Changeset View
Changeset View
Standalone View
Standalone View
containments/desktop/plugins/folder/screenmapper.h
Show First 20 Lines • Show All 44 Lines • ▼ Show 20 Line(s) | 41 | public: | |||
---|---|---|---|---|---|
45 | }; | 45 | }; | ||
46 | 46 | | |||
47 | static ScreenMapper *instance(); | 47 | static ScreenMapper *instance(); | ||
48 | ~ScreenMapper() override = default; | 48 | ~ScreenMapper() override = default; | ||
49 | 49 | | |||
50 | QStringList screenMapping() const; | 50 | QStringList screenMapping() const; | ||
51 | void setScreenMapping(const QStringList &mapping); | 51 | void setScreenMapping(const QStringList &mapping); | ||
52 | 52 | | |||
53 | int screenForItem(const QString &name) const; | 53 | int screenForItem(const QUrl &url) const; | ||
54 | void addMapping(const QString &name, int screen, MappingSignalBehavior behavior = ImmediateSignal); | 54 | void addMapping(const QUrl &url, int screen, MappingSignalBehavior behavior = ImmediateSignal); | ||
55 | void removeFromMap(const QString &name); | 55 | void removeFromMap(const QUrl &url); | ||
56 | void setCorona(Plasma::Corona *corona); | 56 | void setCorona(Plasma::Corona *corona); | ||
57 | 57 | | |||
58 | void addScreen(int screenId, const QString &path); | 58 | void addScreen(int screenId, const QUrl &screenUrl); | ||
59 | void removeScreen(int screenId, const QString &path); | 59 | void removeScreen(int screenId, const QUrl &screenUrl); | ||
60 | int firstAvailableScreen(const QString &path) const; | 60 | int firstAvailableScreen(const QUrl &screenUrl) const; | ||
61 | void removeItemFromDisabledScreen(const QString &name); | 61 | void removeItemFromDisabledScreen(const QUrl &url); | ||
62 | 62 | | |||
63 | #ifdef BUILD_TESTING | 63 | #ifdef BUILD_TESTING | ||
64 | void cleanup(); | 64 | void cleanup(); | ||
65 | #endif | 65 | #endif | ||
66 | 66 | | |||
67 | static QUrl stringToUrl(const QString &path); | ||||
68 | | ||||
67 | Q_SIGNALS: | 69 | Q_SIGNALS: | ||
68 | void screenMappingChanged() const; | 70 | void screenMappingChanged() const; | ||
69 | void screensChanged() const; | 71 | void screensChanged() const; | ||
70 | 72 | | |||
71 | private: | 73 | private: | ||
72 | ScreenMapper(QObject *parent = nullptr); | 74 | ScreenMapper(QObject *parent = nullptr); | ||
73 | 75 | | |||
74 | QHash<QString, int> m_screenItemMap; | 76 | QHash<QUrl, int> m_screenItemMap; | ||
75 | QHash<int, QStringList> m_itemsOnDisabledScreensMap; | 77 | QHash<int, QVector<QUrl> > m_itemsOnDisabledScreensMap; | ||
76 | QHash<QString, int> m_firstScreenForPath; // first available screen for a path | 78 | QHash<QUrl, int> m_firstScreenForPath; // first available screen for a path | ||
77 | QHash<QString, int> m_screensPerPath; // screen per registered path | 79 | QHash<QUrl, int> m_screensPerPath; // screen per registered path | ||
78 | QVector<int> m_availableScreens; | 80 | QVector<int> m_availableScreens; | ||
79 | Plasma::Corona *m_corona = nullptr; | 81 | Plasma::Corona *m_corona = nullptr; | ||
80 | QTimer *m_screenMappingChangedTimer = nullptr; | 82 | QTimer *m_screenMappingChangedTimer = nullptr; | ||
81 | }; | 83 | }; | ||
82 | 84 | | |||
83 | #endif // SCREENMAPPER_H | 85 | #endif // SCREENMAPPER_H |