on b9739cb help sign in
81 lines 2.1 kB history raw
1#ifndef SCREEN_H
2#define SCREEN_H
4#include <qtmir/screen.h>
5#include <QScopedPointer>
6#include <QPointer>
8#include "WorkspaceModel.h"
10class ScreenProxy;
12class Screen : public qtmir::Screen
14 Q_OBJECT
15 Q_PROPERTY(WorkspaceModel* workspaces READ workspaces CONSTANT)
16 Q_PROPERTY(Workspace* currentWorkspace READ currentWorkspace WRITE setCurrentWorkspace NOTIFY currentWorkspaceChanged)
18public:
19 explicit Screen(qtmir::Screen*const wrapped);
21 qtmir::OutputId outputId() const override;
22 bool used() const override;
23 QString name() const override;
24 float scale() const override;
25 QSizeF physicalSize() const override;
26 qtmir::FormFactor formFactor() const override;
27 qtmir::OutputTypes outputType() const override;
28 MirPowerMode powerMode() const override;
29 Qt::ScreenOrientation orientation() const override;
30 QPoint position() const override;
31 QQmlListProperty<qtmir::ScreenMode> availableModes() override;
32 uint currentModeIndex() const override;
33 bool isActive() const override;
34 void setActive(bool active) override;
36 QScreen* qscreen() const override;
38 qtmir::ScreenConfiguration *beginConfiguration() const override;
39 bool applyConfiguration(qtmir::ScreenConfiguration *configuration) override;
41 qtmir::Screen* wrapped() const { return m_wrapped; }
43 WorkspaceModel* workspaces() const;
45 Workspace *currentWorkspace() const;
46 void setCurrentWorkspace(Workspace* workspace);
48 void sync(Screen* proxy);
50public Q_SLOTS:
51 void activate();
53Q_SIGNALS:
54 void currentWorkspaceChanged(Workspace*);
56protected:
57 Screen(Screen const& other);
59 void resetCurrentWorkspace();
61 qtmir::Screen*const m_wrapped;
62 const QScopedPointer<WorkspaceModel> m_workspaces;
63 QPointer<Workspace> m_currentWorspace;
64};
66class ScreenProxy : public Screen
68 Q_OBJECT
69public:
70 explicit ScreenProxy(Screen*const screen);
72 Screen* proxyObject() const { return m_original.data(); }
74public Q_SLOTS:
75 void addWorkspace();
77private:
78 const QPointer<Screen> m_original;
79};
81#endif // SCREEN_H