From a11c90c66b32c7138ea1f84292a1ff0a21243232 Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Thu, 13 Jun 2013 09:04:41 +0200 Subject: [PATCH] * Moved stylesheet methods into TomahawkStyle. --- data/images/widget-border.png | Bin 1092 -> 0 bytes src/libtomahawk/utils/TomahawkStyle.cpp | 35 +++++++++++++++++++++ src/libtomahawk/utils/TomahawkStyle.h | 9 ++++++ src/libtomahawk/utils/TomahawkUtilsGui.cpp | 25 --------------- src/libtomahawk/utils/TomahawkUtilsGui.h | 2 -- 5 files changed, 44 insertions(+), 27 deletions(-) delete mode 100644 data/images/widget-border.png diff --git a/data/images/widget-border.png b/data/images/widget-border.png deleted file mode 100644 index 227e0f70a1baaff725aca070491a766a1d257107..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1092 zcmeAS@N?(olHy`uVBq!ia0vp^4}jQ#gAGVB8&>l(FtBiYx;TbZFutAMop;57$8~oA zSC(qP&+dQ!mn$j;$S2;pHa)@DXm&~URw4CC*XM0KK2NUb<~IZ1%ip`ZyLYGUpJi(@ zd)Cq7io#!OUdQ!zMGJi0YrHjW-?<(0R=-}+z4u;h_12r)pSyoGl{bDJ7yJF$oTB{m zds0eIRqK3RwOMQPto5~SKezs}k?t{?cm4X_U46Ii#eF*w^Xra({P*hD{A+(~x>;IN zllg6JWXJn`H-k4pGSe$A;-hP(+M^DN>=fl~LJx%-^KRA{!)C$jJVdUsw zU=rbC;`qU-;9y^@=H$R4upmId;ebB_Ne}IO}w-i=XVB!eS;81v=-oWtp z%uEhOL5Bt>M+QcFMwS=p=Uhgu#v9<82b`tnKHJYKtoWf`aKbgc+vjDwKZKu^n^l`* zW_tTm&RY4ecBT6-?pgb@c>n!t^PgY&`q6Lh=i*ntb6<*YUAWQztX^<~dG5#GrJpzc z{H3$E!29>{dHuTr`vd>Yko#)4_^Y9@yX^^m;TxY0>6QPSZMp3JiZtE*(@sb0T>bLR zx%_&fV2f1#>{g}svu#aJFW=Wux;I4pxA)fS^J~6FpMJXMOLW#}pRdm^Exz}9?dyA| zH!WYj`~0mvYj}$q5 z*QFQl|FvfJ`}2=aoX>u?v*Yv0Szk))x2$`<$?i{7-W2({XDzc!@7795zUwmW~c?(9>m>Lus@zEYka?`3*D`uumLdFzYAemsB9 Zudh}rJ}GFqGq7}E@O1TaS?83{1OQWU #include #include +#include +#include void @@ -157,3 +159,36 @@ TomahawkStyle::drawArrow( QStyle::PrimitiveElement element, QPainter* p, const Q int yOffset = r.y() + ( r.height() - size ) / 2; p->drawPixmap( xOffset, yOffset, pixmap ); } + + +void +TomahawkStyle::stylePageFrame( QFrame* frame ) +{ + frame->setStyleSheet( QString( "QFrame#%1 { background-color: %2; border: 1px solid white; border-radius: 3px; }" ) + .arg( frame->objectName() ) + .arg( TomahawkStyle::PAGE_ITEM_BACKGROUND.name() ) ); +} + + +void +TomahawkStyle::styleScrollBar( QScrollBar* scrollBar ) +{ + scrollBar->setStyleSheet( + "QScrollBar:horizontal { background-color: transparent; }" + "QScrollBar::handle:horizontal { border-height: 9px; margin-bottom: 6px;" + "border-image: url(" RESPATH "images/scrollbar-horizontal-handle.png) 3 3 3 3 stretch stretch;" + "border-top: 3px transparent; border-bottom: 3px transparent; border-right: 3px transparent; border-left: 3px transparent; }" + "QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal { width: 0px; height: 0px; background: none; }" + "QScrollBar::add-line:horizontal, QScrollBar::sub-line:horizontal { width: 0px; height: 0px; background: none; }" + "QScrollBar:left-arrow:horizontal, QScrollBar::right-arrow:horizontal {" + "border: 0px; width: 0px; height: 0px; background: none; background-color: transparent; }" + + "QScrollBar:vertical { background-color: transparent; }" + "QScrollBar::handle:vertical { border-width: 9px; margin-right: 6px;" + "border-image: url(" RESPATH "images/scrollbar-vertical-handle.png) 3 3 3 3 stretch stretch;" + "border-top: 3px transparent; border-bottom: 3px transparent; border-right: 3px transparent; border-left: 3px transparent; }" + "QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical { width: 0px; height: 0px; background: none; }" + "QScrollBar::add-line:vertical, QScrollBar::sub-line:vertical { width: 0px; height: 0px; background: none; }" + "QScrollBar:up-arrow:vertical, QScrollBar::down-arrow:vertical {" + "border: 0px; width: 0px; height: 0px; background: none; background-color: transparent; }" ); +} diff --git a/src/libtomahawk/utils/TomahawkStyle.h b/src/libtomahawk/utils/TomahawkStyle.h index f159d5365..6016a6e97 100644 --- a/src/libtomahawk/utils/TomahawkStyle.h +++ b/src/libtomahawk/utils/TomahawkStyle.h @@ -26,6 +26,9 @@ #include #include +class QFrame; +class QScrollBar; + namespace TomahawkStyle { /** @@ -41,6 +44,9 @@ namespace TomahawkStyle */ DLLEXPORT void drawArrow( QStyle::PrimitiveElement, QPainter* painter, const QStyleOption* opt ); + DLLEXPORT void stylePageFrame( QFrame* frame ); + DLLEXPORT void styleScrollBar( QScrollBar* scrollBar ); + static const QColor BORDER_LINE = QColor( "#8c8c8c" ); static const QColor POPUP_BACKGROUND = QColor( "#ffffff" ); static const QColor POPUP_OSX_BACKGROUND = QColor( "#D6E3F1" ); @@ -58,6 +64,9 @@ namespace TomahawkStyle static const QColor HEADER_TEXT = QColor( "#eaeaea" ); static const QColor HEADER_HIGHLIGHT = QColor( "#333" ); + static const QColor PAGE_TEXT = Qt::gray; + static const QColor PAGE_ITEM_BACKGROUND = QColor( "#1e1e1e" ).lighter( 290 ); + static const QColor PAGE_FOREGROUND = QColor( "#ffffff" ); static const QColor PAGE_BACKGROUND = QColor( "#1e1e1e" ).lighter(); static const QColor FOOTNOTES_BACKGROUND = QColor( "#272b2e" ); static const QColor DASHBOARD_ROUNDFIGURE_BACKGROUND = QColor( "#454e59" ); diff --git a/src/libtomahawk/utils/TomahawkUtilsGui.cpp b/src/libtomahawk/utils/TomahawkUtilsGui.cpp index f09970ad2..708479940 100644 --- a/src/libtomahawk/utils/TomahawkUtilsGui.cpp +++ b/src/libtomahawk/utils/TomahawkUtilsGui.cpp @@ -35,7 +35,6 @@ #include #include #include -#include #include #include #include @@ -818,30 +817,6 @@ drawRoundedButton( QPainter* painter, const QRect& btnRect, const QColor& color, } -void -styleScrollBar( QScrollBar* scrollBar ) -{ - scrollBar->setStyleSheet( - "QScrollBar:horizontal { background-color: transparent; }" - "QScrollBar::handle:horizontal { border-height: 9px; margin-bottom: 6px;" - "border-image: url(" RESPATH "images/scrollbar-horizontal-handle.png) 3 3 3 3 stretch stretch;" - "border-top: 3px transparent; border-bottom: 3px transparent; border-right: 3px transparent; border-left: 3px transparent; }" - "QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal { width: 0px; height: 0px; background: none; }" - "QScrollBar::add-line:horizontal, QScrollBar::sub-line:horizontal { width: 0px; height: 0px; background: none; }" - "QScrollBar:left-arrow:horizontal, QScrollBar::right-arrow:horizontal {" - "border: 0px; width: 0px; height: 0px; background: none; background-color: transparent; }" - - "QScrollBar:vertical { background-color: transparent; }" - "QScrollBar::handle:vertical { border-width: 9px; margin-right: 6px;" - "border-image: url(" RESPATH "images/scrollbar-vertical-handle.png) 3 3 3 3 stretch stretch;" - "border-top: 3px transparent; border-bottom: 3px transparent; border-right: 3px transparent; border-left: 3px transparent; }" - "QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical { width: 0px; height: 0px; background: none; }" - "QScrollBar::add-line:vertical, QScrollBar::sub-line:vertical { width: 0px; height: 0px; background: none; }" - "QScrollBar:up-arrow:vertical, QScrollBar::down-arrow:vertical {" - "border: 0px; width: 0px; height: 0px; background: none; background-color: transparent; }" ); -} - - QPixmap createTiledPixmap( int width, int height, const QImage& inputTile ) { diff --git a/src/libtomahawk/utils/TomahawkUtilsGui.h b/src/libtomahawk/utils/TomahawkUtilsGui.h index 1c3d872da..109edc67d 100644 --- a/src/libtomahawk/utils/TomahawkUtilsGui.h +++ b/src/libtomahawk/utils/TomahawkUtilsGui.h @@ -39,7 +39,6 @@ class QPixmap; class QLayout; class QPalette; class QRect; -class QScrollBar; namespace TomahawkUtils { @@ -68,7 +67,6 @@ namespace TomahawkUtils DLLEXPORT void prepareStyleOption( QStyleOptionViewItemV4* option, const QModelIndex& index, PlayableItem* item ); DLLEXPORT void drawRoundedButton( QPainter* painter, const QRect& btnRect, const QColor& color, const QColor &gradient1bottom = QColor(), const QColor& gradient2top = QColor(), const QColor& gradient2bottom = QColor() ); - DLLEXPORT void styleScrollBar( QScrollBar* scrollBar ); DLLEXPORT QPixmap defaultPixmap( ImageType type, ImageMode mode = TomahawkUtils::Original, const QSize& size = QSize( 0, 0 ) ); DLLEXPORT QPixmap createTiledPixmap( int width, int height, const QImage& src );