Changeset View
Changeset View
Standalone View
Standalone View
kstyle/breezehelper.h
Show All 17 Lines | |||||
18 | * along with this program; if not, write to the * | 18 | * along with this program; if not, write to the * | ||
19 | * Free Software Foundation, Inc., * | 19 | * Free Software Foundation, Inc., * | ||
20 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * | 20 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * | ||
21 | *************************************************************************/ | 21 | *************************************************************************/ | ||
22 | 22 | | |||
23 | 23 | | |||
24 | #include "breeze.h" | 24 | #include "breeze.h" | ||
25 | #include "breezeanimationdata.h" | 25 | #include "breezeanimationdata.h" | ||
26 | #include "breezesettings.h" | ||||
26 | #include "config-breeze.h" | 27 | #include "config-breeze.h" | ||
27 | 28 | | |||
28 | #include <KColorScheme> | 29 | #include <KColorScheme> | ||
29 | #include <KSharedConfig> | 30 | #include <KSharedConfig> | ||
31 | #include <KConfigWatcher> | ||||
30 | 32 | | |||
33 | #include <QToolBar> | ||||
hpereiradacosta: Not needed as far as I can tell (none of your changes in this file require QToolbar) | |||||
cblack: This is necessary to compile. | |||||
31 | #include <QPainterPath> | 34 | #include <QPainterPath> | ||
32 | #include <QIcon> | 35 | #include <QIcon> | ||
33 | #include <QWidget> | 36 | #include <QWidget> | ||
34 | 37 | | |||
35 | namespace Breeze | 38 | namespace Breeze | ||
36 | { | 39 | { | ||
37 | 40 | | |||
38 | //* breeze style helper class. | 41 | //* breeze style helper class. | ||
39 | /** contains utility functions used at multiple places in both breeze style and breeze window decoration */ | 42 | /** contains utility functions used at multiple places in both breeze style and breeze window decoration */ | ||
40 | class Helper | 43 | class Helper : public QObject | ||
41 | { | 44 | { | ||
45 | Q_OBJECT | ||||
46 | | ||||
42 | public: | 47 | public: | ||
43 | 48 | | |||
44 | //* constructor | 49 | //* constructor | ||
45 | explicit Helper( KSharedConfig::Ptr ); | 50 | explicit Helper( KSharedConfig::Ptr, QObject *parent = nullptr ); | ||
46 | 51 | | |||
47 | //* destructor | 52 | //* destructor | ||
48 | virtual ~Helper() | 53 | virtual ~Helper() | ||
49 | {} | 54 | {} | ||
50 | 55 | | |||
51 | //* load configuration | 56 | //* load configuration | ||
52 | virtual void loadConfig(); | 57 | virtual void loadConfig(); | ||
53 | 58 | | |||
54 | //* pointer to shared config | 59 | //* pointer to shared config | ||
55 | KSharedConfig::Ptr config() const; | 60 | KSharedConfig::Ptr config() const; | ||
56 | 61 | | |||
62 | //* pointer to kdecoration config | ||||
63 | QSharedPointer<InternalSettings> decorationConfig() const; | ||||
64 | | ||||
57 | //*@name color utilities | 65 | //*@name color utilities | ||
58 | //@{ | 66 | //@{ | ||
59 | 67 | | |||
60 | //* add alpha channel multiplier to color | 68 | //* add alpha channel multiplier to color | ||
61 | QColor alphaColor( QColor color, qreal alpha ) const; | 69 | QColor alphaColor( QColor color, qreal alpha ) const; | ||
62 | 70 | | |||
63 | //* mouse over color | 71 | //* mouse over color | ||
64 | QColor hoverColor( const QPalette& palette ) const | 72 | QColor hoverColor( const QPalette& palette ) const | ||
▲ Show 20 Lines • Show All 194 Lines • ▼ Show 20 Line(s) | |||||
259 | static bool isWayland(); | 267 | static bool isWayland(); | ||
260 | 268 | | |||
261 | //* returns true if compositing is active | 269 | //* returns true if compositing is active | ||
262 | bool compositingActive() const; | 270 | bool compositingActive() const; | ||
263 | 271 | | |||
264 | //* returns true if a given widget supports alpha channel | 272 | //* returns true if a given widget supports alpha channel | ||
265 | bool hasAlphaChannel( const QWidget* ) const; | 273 | bool hasAlphaChannel( const QWidget* ) const; | ||
266 | 274 | | |||
275 | //* returns true if widget is in the tools area | ||||
276 | bool isInToolsArea( const QWidget* ) const; | ||||
277 | | ||||
278 | //* returns false if tools area is empty | ||||
279 | bool toolsAreaHasContents ( const QWidget* ) const; | ||||
280 | | ||||
281 | //* returns true if tools area has a toolbar | ||||
282 | bool toolsAreaHasToolBar ( const QWidget* ) const; | ||||
283 | | ||||
284 | //* returns true if the tools area should be drawn | ||||
285 | bool shouldDrawToolsArea ( const QWidget* ) const; | ||||
286 | | ||||
287 | //* returns the tools area border color | ||||
288 | QColor toolsAreaBorderColor ( const QWidget* ) const; | ||||
289 | | ||||
290 | //* returns the united rectangle of all toolbars in the tools area | ||||
291 | QRect toolsAreaToolbarsRect (const QWidget* widget) const; | ||||
292 | | ||||
293 | QToolBar* grabToolBarForToolsArea ( const QWidget* ) const; | ||||
294 | | ||||
295 | void setToolsAreaEnabled(bool enabled) | ||||
296 | { _toolsAreaEnabled = enabled; }; | ||||
297 | | ||||
267 | //@} | 298 | //@} | ||
268 | 299 | | |||
269 | //* return device pixel ratio for a given pixmap | 300 | //* return device pixel ratio for a given pixmap | ||
270 | virtual qreal devicePixelRatio( const QPixmap& ) const; | 301 | virtual qreal devicePixelRatio( const QPixmap& ) const; | ||
271 | 302 | | |||
272 | //* frame radius | 303 | //* frame radius | ||
273 | constexpr qreal frameRadius( const int penWidth = PenWidth::NoPen, const qreal bias = 0 ) const | 304 | constexpr qreal frameRadius( const int penWidth = PenWidth::NoPen, const qreal bias = 0 ) const | ||
274 | { return qMax( Metrics::Frame_FrameRadius - (0.5 * penWidth) + bias, 0.0 ); } | 305 | { return qMax( Metrics::Frame_FrameRadius - (0.5 * penWidth) + bias, 0.0 ); } | ||
Show All 16 Lines | |||||
291 | //* return rounded path in a given rect, with only selected corners rounded, and for a given radius | 322 | //* return rounded path in a given rect, with only selected corners rounded, and for a given radius | ||
292 | QPainterPath roundedPath( const QRectF&, Corners, qreal ) const; | 323 | QPainterPath roundedPath( const QRectF&, Corners, qreal ) const; | ||
293 | 324 | | |||
294 | private: | 325 | private: | ||
295 | 326 | | |||
296 | //* configuration | 327 | //* configuration | ||
297 | KSharedConfig::Ptr _config; | 328 | KSharedConfig::Ptr _config; | ||
298 | 329 | | |||
330 | //* KWin configuration | ||||
331 | KSharedConfig::Ptr _kwinConfig; | ||||
332 | | ||||
333 | //* decoration configuration | ||||
334 | QSharedPointer<InternalSettings> _decorationConfig; | ||||
335 | | ||||
299 | //*@name brushes | 336 | //*@name brushes | ||
300 | //@{ | 337 | //@{ | ||
301 | KStatefulBrush _viewFocusBrush; | 338 | KStatefulBrush _viewFocusBrush; | ||
302 | KStatefulBrush _viewHoverBrush; | 339 | KStatefulBrush _viewHoverBrush; | ||
303 | KStatefulBrush _viewNegativeTextBrush; | 340 | KStatefulBrush _viewNegativeTextBrush; | ||
304 | //@} | 341 | //@} | ||
305 | 342 | | |||
306 | //*@name windeco colors | 343 | //*@name windeco colors | ||
307 | //@{ | 344 | //@{ | ||
308 | QColor _activeTitleBarColor; | 345 | QColor _activeTitleBarColor; | ||
309 | QColor _activeTitleBarTextColor; | 346 | QColor _activeTitleBarTextColor; | ||
310 | QColor _inactiveTitleBarColor; | 347 | QColor _inactiveTitleBarColor; | ||
311 | QColor _inactiveTitleBarTextColor; | 348 | QColor _inactiveTitleBarTextColor; | ||
312 | //@} | 349 | //@} | ||
313 | 350 | | |||
351 | bool _toolsAreaEnabled; | ||||
352 | | ||||
353 | mutable QHash<QWindow*,QRect> _cachedRects; | ||||
354 | mutable bool _invalidateCachedRects; | ||||
355 | mutable bool _cachedAutoValid = false; | ||||
356 | | ||||
357 | friend class ToolsAreaManager; | ||||
358 | | ||||
314 | }; | 359 | }; | ||
315 | 360 | | |||
316 | } | 361 | } | ||
317 | 362 | | |||
318 | #endif | 363 | #endif |
Not needed as far as I can tell (none of your changes in this file require QToolbar)