Changeset View
Changeset View
Standalone View
Standalone View
rules.h
Show All 34 Lines | |||||
35 | class KConfig; | 35 | class KConfig; | ||
36 | class KXMessages; | 36 | class KXMessages; | ||
37 | 37 | | |||
38 | namespace KWin | 38 | namespace KWin | ||
39 | { | 39 | { | ||
40 | 40 | | |||
41 | class AbstractClient; | 41 | class AbstractClient; | ||
42 | class Rules; | 42 | class Rules; | ||
43 | class RuleSettings; | ||||
43 | 44 | | |||
44 | #ifndef KCMRULES // only for kwin core | 45 | #ifndef KCMRULES // only for kwin core | ||
45 | 46 | | |||
46 | class WindowRules | 47 | class WindowRules | ||
47 | { | 48 | { | ||
48 | public: | 49 | public: | ||
49 | explicit WindowRules(const QVector< Rules* >& rules); | 50 | explicit WindowRules(const QVector< Rules* >& rules); | ||
50 | WindowRules(); | 51 | WindowRules(); | ||
▲ Show 20 Lines • Show All 45 Lines • ▼ Show 20 Line(s) | |||||
96 | }; | 97 | }; | ||
97 | 98 | | |||
98 | #endif | 99 | #endif | ||
99 | 100 | | |||
100 | class Rules | 101 | class Rules | ||
101 | { | 102 | { | ||
102 | public: | 103 | public: | ||
103 | Rules(); | 104 | Rules(); | ||
104 | explicit Rules(const KConfigGroup&); | 105 | explicit Rules(const RuleSettings&); | ||
ervin: I'd expect it via pointer since RuleSettings isn't a data type. | |||||
ervin: Can drop the const now | |||||
hchain: const does make sense here I think | |||||
105 | Rules(const QString&, bool temporary); | 106 | Rules(const QString&, bool temporary); | ||
106 | enum Type { | 107 | enum Type { | ||
107 | Position = 1<<0, Size = 1<<1, Desktop = 1<<2, | 108 | Position = 1<<0, Size = 1<<1, Desktop = 1<<2, | ||
108 | MaximizeVert = 1<<3, MaximizeHoriz = 1<<4, Minimize = 1<<5, | 109 | MaximizeVert = 1<<3, MaximizeHoriz = 1<<4, Minimize = 1<<5, | ||
109 | Shade = 1<<6, SkipTaskbar = 1<<7, SkipPager = 1<<8, | 110 | Shade = 1<<6, SkipTaskbar = 1<<7, SkipPager = 1<<8, | ||
110 | SkipSwitcher = 1<<9, Above = 1<<10, Below = 1<<11, Fullscreen = 1<<12, | 111 | SkipSwitcher = 1<<9, Above = 1<<10, Below = 1<<11, Fullscreen = 1<<12, | ||
111 | NoBorder = 1<<13, OpacityActive = 1<<14, OpacityInactive = 1<<15, | 112 | NoBorder = 1<<13, OpacityActive = 1<<14, OpacityInactive = 1<<15, | ||
112 | Activity = 1<<16, Screen = 1<<17, DesktopFile = 1 << 18, All = 0xffffffff | 113 | Activity = 1<<16, Screen = 1<<17, DesktopFile = 1 << 18, All = 0xffffffff | ||
Show All 12 Lines | |||||
125 | enum StringMatch { | 126 | enum StringMatch { | ||
126 | FirstStringMatch, | 127 | FirstStringMatch, | ||
127 | UnimportantMatch = FirstStringMatch, | 128 | UnimportantMatch = FirstStringMatch, | ||
128 | ExactMatch, | 129 | ExactMatch, | ||
129 | SubstringMatch, | 130 | SubstringMatch, | ||
130 | RegExpMatch, | 131 | RegExpMatch, | ||
131 | LastStringMatch = RegExpMatch | 132 | LastStringMatch = RegExpMatch | ||
132 | }; | 133 | }; | ||
133 | void write(KConfigGroup&) const; | 134 | enum SetRule { | ||
135 | UnusedSetRule = Unused, | ||||
136 | SetRuleDummy = 256 // so that it's at least short int | ||||
Might be worth testing without it, since C++11 this should be guaranteed to be an int anyway. ervin: Might be worth testing without it, since C++11 this should be guaranteed to be an int anyway. | |||||
137 | }; | ||||
138 | enum ForceRule { | ||||
139 | UnusedForceRule = Unused, | ||||
140 | ForceRuleDummy = 256 // so that it's at least short int | ||||
141 | }; | ||||
142 | void write(RuleSettings&) const; | ||||
ervin: Same thing, I'd expect a pointer not a reference. | |||||
134 | bool isEmpty() const; | 143 | bool isEmpty() const; | ||
135 | #ifndef KCMRULES | 144 | #ifndef KCMRULES | ||
136 | bool discardUsed(bool withdrawn); | 145 | bool discardUsed(bool withdrawn); | ||
137 | bool match(const AbstractClient* c) const; | 146 | bool match(const AbstractClient* c) const; | ||
138 | bool update(AbstractClient*, int selection); | 147 | bool update(AbstractClient*, int selection); | ||
139 | bool isTemporary() const; | 148 | bool isTemporary() const; | ||
140 | bool discardTemporary(bool force); // removes if temporary and forced or too old | 149 | bool discardTemporary(bool force); // removes if temporary and forced or too old | ||
141 | bool applyPlacement(Placement::Policy& placement) const; | 150 | bool applyPlacement(Placement::Policy& placement) const; | ||
Show All 36 Lines | |||||
178 | bool applyDesktopFile(QString &desktopFile, bool init) const; | 187 | bool applyDesktopFile(QString &desktopFile, bool init) const; | ||
179 | private: | 188 | private: | ||
180 | #endif | 189 | #endif | ||
181 | bool matchType(NET::WindowType match_type) const; | 190 | bool matchType(NET::WindowType match_type) const; | ||
182 | bool matchWMClass(const QByteArray& match_class, const QByteArray& match_name) const; | 191 | bool matchWMClass(const QByteArray& match_class, const QByteArray& match_name) const; | ||
183 | bool matchRole(const QByteArray& match_role) const; | 192 | bool matchRole(const QByteArray& match_role) const; | ||
184 | bool matchTitle(const QString& match_title) const; | 193 | bool matchTitle(const QString& match_title) const; | ||
185 | bool matchClientMachine(const QByteArray& match_machine, bool local) const; | 194 | bool matchClientMachine(const QByteArray& match_machine, bool local) const; | ||
186 | enum SetRule { | 195 | void readFromSettings(const RuleSettings& settings); | ||
187 | UnusedSetRule = Unused, | | |||
188 | SetRuleDummy = 256 // so that it's at least short int | | |||
189 | }; | | |||
190 | enum ForceRule { | | |||
191 | UnusedForceRule = Unused, | | |||
192 | ForceRuleDummy = 256 // so that it's at least short int | | |||
193 | }; | | |||
194 | void readFromCfg(const KConfigGroup& cfg); | | |||
195 | static SetRule readSetRule(const KConfigGroup&, const QString& key); | 196 | static SetRule readSetRule(const KConfigGroup&, const QString& key); | ||
196 | static ForceRule readForceRule(const KConfigGroup&, const QString& key); | 197 | static ForceRule readForceRule(const int v); | ||
197 | static NET::WindowType readType(const KConfigGroup&, const QString& key); | 198 | static NET::WindowType readType(const KConfigGroup&, const QString& key); | ||
198 | static QString readDecoColor(const KConfigGroup &cfg); | 199 | static QString readDecoColor(const QString &themeName); | ||
ervin: And here as well. | |||||
199 | #ifndef KCMRULES | 200 | #ifndef KCMRULES | ||
200 | static bool checkSetRule(SetRule rule, bool init); | 201 | static bool checkSetRule(SetRule rule, bool init); | ||
201 | static bool checkForceRule(ForceRule rule); | 202 | static bool checkForceRule(ForceRule rule); | ||
202 | static bool checkSetStop(SetRule rule); | 203 | static bool checkSetStop(SetRule rule); | ||
203 | static bool checkForceStop(ForceRule rule); | 204 | static bool checkForceStop(ForceRule rule); | ||
204 | #endif | 205 | #endif | ||
205 | int temporary_state; // e.g. for kstart | 206 | int temporary_state; // e.g. for kstart | ||
206 | QString description; | 207 | QString description; | ||
▲ Show 20 Lines • Show All 176 Lines • ▼ Show 20 Line(s) | |||||
383 | } | 384 | } | ||
384 | 385 | | |||
385 | #endif | 386 | #endif | ||
386 | 387 | | |||
387 | QDebug& operator<<(QDebug& stream, const Rules*); | 388 | QDebug& operator<<(QDebug& stream, const Rules*); | ||
388 | 389 | | |||
389 | } // namespace | 390 | } // namespace | ||
390 | 391 | | |||
391 | Q_DECLARE_OPERATORS_FOR_FLAGS(KWin::Rules::Types) | 392 | Q_DECLARE_OPERATORS_FOR_FLAGS(KWin::Rules::Types); | ||
zzag: Unrelated change. Please revert it. | |||||
392 | 393 | | |||
393 | #endif | 394 | #endif |
I'd expect it via pointer since RuleSettings isn't a data type.