1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-07-31 19:30:21 +02:00

* Moved stylesheet methods into TomahawkStyle.

This commit is contained in:
Christian Muehlhaeuser
2013-06-13 09:04:41 +02:00
parent b93532dd64
commit a11c90c66b
5 changed files with 44 additions and 27 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -23,6 +23,8 @@
#include <QPixmapCache>
#include <QApplication>
#include <QStyleOption>
#include <QFrame>
#include <QScrollBar>
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; }" );
}

View File

@@ -26,6 +26,9 @@
#include <QPainter>
#include <QStyle>
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" );

View File

@@ -35,7 +35,6 @@
#include <QBitmap>
#include <QPalette>
#include <QApplication>
#include <QScrollBar>
#include <QWidget>
#include <QStyleOption>
#include <QDesktopServices>
@@ -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 )
{

View File

@@ -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 );