From 41af5cbab50d3caa3ccc95f228f93bfcd389a137 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20=C3=81ngel=20San=20Mart=C3=ADn?= Date: Sun, 16 Jun 2013 13:07:38 +0200 Subject: [PATCH] nuevo estilo para windows y linux de la sidebar --- YACReaderLibrary/images.qrc | 4 ++ YACReaderLibrary/library_window.cpp | 32 +++++++++++--- .../yacreader_library_item_widget.cpp | 15 +++++-- custom_widgets/yacreader_sidebar.cpp | 5 ++- custom_widgets/yacreader_table_view.cpp | 3 +- custom_widgets/yacreader_titled_toolbar.cpp | 41 +++++++++++++++++- custom_widgets/yacreader_titled_toolbar.h | 19 ++++++++ images/branch-closed.png | Bin 0 -> 156 bytes images/branch-open.png | Bin 0 -> 145 bytes images/colapse.png | Bin 175 -> 253 bytes images/collapsed_branch_selected.png | Bin 0 -> 139 bytes images/expand.png | Bin 168 -> 158 bytes images/expanded_branch_selected.png | Bin 0 -> 133 bytes images/folder.png | Bin 162 -> 313 bytes images/libraryIcon.png | Bin 164 -> 280 bytes images/setRoot.png | Bin 265 -> 389 bytes 16 files changed, 106 insertions(+), 13 deletions(-) create mode 100644 images/branch-closed.png create mode 100644 images/branch-open.png create mode 100644 images/collapsed_branch_selected.png create mode 100644 images/expanded_branch_selected.png diff --git a/YACReaderLibrary/images.qrc b/YACReaderLibrary/images.qrc index 5bb0e507..4ff01248 100644 --- a/YACReaderLibrary/images.qrc +++ b/YACReaderLibrary/images.qrc @@ -104,5 +104,9 @@ ../images/libraryIcon.png ../images/libraryIconSelected.png ../images/libraryOptions.png + ../images/branch-open.png + ../images/branch-closed.png + ../images/expanded_branch_selected.png + ../images/collapsed_branch_selected.png diff --git a/YACReaderLibrary/library_window.cpp b/YACReaderLibrary/library_window.cpp index 8f405d69..af219caa 100644 --- a/YACReaderLibrary/library_window.cpp +++ b/YACReaderLibrary/library_window.cpp @@ -190,6 +190,31 @@ void LibraryWindow::doLayout() "QTreeView::branch:selected {background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #6BAFE4, stop: 1 #3984D2); border-top: 2px solid qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #5EA3DF, stop: 1 #73B8EA); border-left:none;border-right:none;border-bottom:1px solid #3577C2;}" "QTreeView::branch:open:selected:has-children {image: url(':/images/expanded_branch_osx.png');}" "QTreeView::branch:closed:selected:has-children {image: url(':/images/collapsed_branch_osx.png');}"); +#else + foldersView->setStyleSheet("QTreeView {background-color:transparent; border: none; color:#DDDFDF; outline:0;}" + "QTreeView::item:selected {background-color: #2E2E2E; color:white; font:bold;}" + "QTreeView::item:hover {background-color:#2E2E2E; color:white; font:bold;}" + "QTreeView::branch:selected {background-color:#2E2E2E;}" + + + "QScrollBar:vertical { border: none; background: #222222; width: 7px; margin: 0 3px 0 0; }" + "QScrollBar::handle:vertical { background: #DDDDDD; width: 7px; min-height: 20px; }" + "QScrollBar::add-line:vertical { border: none; background: #222222; height: 10px; subcontrol-position: bottom; subcontrol-origin: margin; margin: 0 3px 0 0;}" + + "QScrollBar::sub-line:vertical { border: none; background: #222222; height: 10px; subcontrol-position: top; subcontrol-origin: margin; margin: 0 3px 0 0;}" + "QScrollBar::up-arrow:vertical {border:none;width: 9px;height: 6px;background: url(':/images/folders_view/line-up.png') center top no-repeat;}" + "QScrollBar::down-arrow:vertical {border:none;width: 9px;height: 6px;background: url(':/images/folders_view/line-down.png') center top no-repeat;}" + + "QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical {background: none; }" + + "QTreeView::branch:has-children:!has-siblings:closed,QTreeView::branch:closed:has-children:has-siblings {border-image: none;image: url(':/images/branch-closed.png');}" + "QTreeView::branch:has-children:selected:!has-siblings:closed,QTreeView::branch:closed:selected:has-children:has-siblings {border-image: none;image: url(':/images/collapsed_branch_selected.png');}" + + "QTreeView::branch:open:has-children:!has-siblings,QTreeView::branch:open:has-children:has-siblings {border-image: none;image: url(':/images/branch-open.png');}" + "QTreeView::branch:open:has-children:selected:!has-siblings,QTreeView::branch:open:has-children:selected:has-siblings {border-image: none;image: url(':/images/expanded_branch_selected.png');}" + + + ); #endif sideBar = new YACReaderSideBar; QVBoxLayout * l = new QVBoxLayout; @@ -197,11 +222,8 @@ void LibraryWindow::doLayout() selectedLibrary->setContextMenuPolicy(Qt::ActionsContextMenu); selectedLibrary->setAttribute(Qt::WA_MacShowFocusRect,false); selectedLibrary->setFocusPolicy(Qt::NoFocus); -#ifdef Q_OS_MAC + l->setContentsMargins(0,0,0,0); -#else - l->setContentsMargins(sHorizontal->handleWidth(),0,0,0); -#endif YACReaderTitledToolBar * librariesTitle = new YACReaderTitledToolBar(tr("LIBRARIES")); @@ -228,7 +250,7 @@ void LibraryWindow::doLayout() searchLayout->addLayout(filter); l->addLayout(searchLayout); - l->setSpacing(1); + l->setSpacing(0); sideBar->setLayout(l); //FINAL LAYOUT------------------------------------------------------------- diff --git a/custom_widgets/yacreader_library_item_widget.cpp b/custom_widgets/yacreader_library_item_widget.cpp index a4b40407..dbb03044 100644 --- a/custom_widgets/yacreader_library_item_widget.cpp +++ b/custom_widgets/yacreader_library_item_widget.cpp @@ -48,9 +48,10 @@ YACReaderLibraryItemWidget::YACReaderLibraryItemWidget(QString n/*ame*/, QString mainLayout->addWidget(down);*/ setLayout(mainLayout); - - //QString styleSheet = " background-color:#454545; border-top: 1px solid #454545;border-bottom: 1px solid #454545;"; - //setStyleSheet(styleSheet); +#ifndef Q_OS_MAC + QString styleSheet = "background-color:transparent; color:#DDDFDF;"; + setStyleSheet(styleSheet); +#endif QString iconStyleSheet = "QLabel {padding:0 0 0 24px; margin:0px}"; @@ -109,8 +110,14 @@ bool YACReaderLibraryItemWidget::eventFilter(QObject *object, QEvent *event){ void YACReaderLibraryItemWidget::deselect() { + +#ifdef Q_OS_MAC QString styleSheet = "background-color:transparent;"; setStyleSheet(styleSheet); +#else + QString styleSheet = "background-color:transparent; color:#DDDFDF;"; + setStyleSheet(styleSheet); +#endif QPixmap iconPixmap(":/images/libraryIcon.png"); icon->setPixmap(iconPixmap); @@ -129,7 +136,7 @@ void YACReaderLibraryItemWidget::select() #ifdef Q_OS_MAC QString styleSheet ="color: white; background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #6BAFE4, stop: 1 #3984D2); border-top: 2px solid qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #5EA3DF, stop: 1 #73B8EA); border-left:none;border-right:none;border-bottom:1px solid #3577C2;"; #else - QString styleSheet = "color: white; background-color:#BBBBBB; font-weight:bold;"; + QString styleSheet = "color: white; background-color:#2E2E2E; font-weight:bold;"; #endif setStyleSheet(styleSheet); diff --git a/custom_widgets/yacreader_sidebar.cpp b/custom_widgets/yacreader_sidebar.cpp index 1cbc0973..9dfc7fc5 100644 --- a/custom_widgets/yacreader_sidebar.cpp +++ b/custom_widgets/yacreader_sidebar.cpp @@ -24,7 +24,10 @@ void YACReaderSideBar::paintEvent(QPaintEvent * event) painter.fillRect(0,0,width(),height(),lG); #else - QWidget::paintEvent(event); + QPainter painter(this); + + painter.fillRect(0,0,width(),height(),QColor("#454545")); + //QWidget::paintEvent(event); #endif diff --git a/custom_widgets/yacreader_table_view.cpp b/custom_widgets/yacreader_table_view.cpp index bc4a0f98..2f87e657 100644 --- a/custom_widgets/yacreader_table_view.cpp +++ b/custom_widgets/yacreader_table_view.cpp @@ -14,8 +14,9 @@ YACReaderTableView::YACReaderTableView(QWidget *parent) : setStyleSheet("QTableView {alternate-background-color: #F2F2F2;background-color: #FAFAFA; outline: 0px;}"// border: 1px solid #999999; border-right:none; border-bottom:none;}" "QTableCornerButton::section {background-color:#F5F5F5; border:none; border-bottom:1px solid #B8BDC4; border-right:1px solid qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #D1D1D1, stop: 1 #B8BDC4);}" "QTableView::item {outline: 0px; border-bottom: 1px solid #DFDFDF;border-top: 1px solid #FEFEFE; padding-bottom:1px; color:#252626;}" + "QTableView {border-top:1px solid #B8B8B8;border-bottom:none;border-left:none;border-right:none;}" #ifdef Q_OS_MAC - "QTableView {border-top:1px solid #B8B8B8;border-bottom:none;border-left:none;border-right:none;}" + "QTableView::item:selected {outline: 0px; border-bottom: 1px solid #3875D7;border-top: 1px solid #3875D7; padding-bottom:1px; background-color: #3875D7; color: #FFFFFF; }" #else diff --git a/custom_widgets/yacreader_titled_toolbar.cpp b/custom_widgets/yacreader_titled_toolbar.cpp index 1d8e2cf5..ea3b8ad1 100644 --- a/custom_widgets/yacreader_titled_toolbar.cpp +++ b/custom_widgets/yacreader_titled_toolbar.cpp @@ -5,6 +5,40 @@ #include #include #include +#include + + + +DropShadowLabel::DropShadowLabel(QWidget* parent) : + QLabel(parent) +{ } + +void DropShadowLabel::drawTextEffect(QPainter *painter, + QPoint offset) +{ + Q_ASSERT(painter != 0); + + // Draw shadow. + painter->setPen(QPen(dropShadowColor)); + painter->drawText(rect().translated(offset), + alignment(), text()); +} + +void DropShadowLabel::paintEvent(QPaintEvent *event) +{ + QPainter painter(this); + painter.setFont(font()); + //TODO find where is the '3' comming from? + drawTextEffect(&painter, QPoint(contentsMargins().left()+3, 1)); + QLabel::paintEvent(event); +} + +void DropShadowLabel::setDropShadowColor(const QColor & color) +{ + dropShadowColor = color; +} + + YACReaderTitledToolBar::YACReaderTitledToolBar(const QString & title, QWidget *parent) : QWidget(parent) @@ -16,11 +50,14 @@ YACReaderTitledToolBar::YACReaderTitledToolBar(const QString & title, QWidget *p QString styleSheet = "QWidget {border:0px;}"; setStyleSheet(styleSheet); - QLabel * nameLabel = new QLabel(title,this); + DropShadowLabel * nameLabel = new DropShadowLabel(this); + nameLabel->setText(title); #ifdef Q_OS_MAC QString nameLabelStyleSheet = "QLabel {color:#707E8C; padding:0 0 0 7px; margin:0px; font-size:11px; font-weight:bold;}"; + nameLabel->setDropShadowColor(QColor("#F9FAFB")); #else - QString nameLabelStyleSheet = "QLabel {color:#656565; padding:0 0 0 0px; margin:0px; font-size:11px; font-weight:bold;}"; + QString nameLabelStyleSheet = "QLabel {color:#BDBFBF; padding:0 0 0 7px; margin:0px; font-size:11px; font-weight:bold;}"; + nameLabel->setDropShadowColor(QColor("#000000")); #endif nameLabel->setStyleSheet(nameLabelStyleSheet); diff --git a/custom_widgets/yacreader_titled_toolbar.h b/custom_widgets/yacreader_titled_toolbar.h index 848bfa62..35fda80e 100644 --- a/custom_widgets/yacreader_titled_toolbar.h +++ b/custom_widgets/yacreader_titled_toolbar.h @@ -2,9 +2,28 @@ #define YACREADER_TITLED_TOOLBAR_H #include +#include +#include +#include +#include class QIcon; +class DropShadowLabel : public QLabel +{ + Q_OBJECT + +public: + + DropShadowLabel(QWidget* parent = 0); + void paintEvent(QPaintEvent *event); + void setDropShadowColor(const QColor & color); +private: + + QColor dropShadowColor; + void drawTextEffect(QPainter* painter, QPoint offset); +}; + class YACReaderTitledToolBar : public QWidget { Q_OBJECT diff --git a/images/branch-closed.png b/images/branch-closed.png new file mode 100644 index 0000000000000000000000000000000000000000..5903e65b3f2203c8c7be6f7dbbb9aca9fab0d13e GIT binary patch literal 156 zcmeAS@N?(olHy`uVBq!ia0vp^EI`b`!3HGn8ON~#DajJoh?3y^w370~qErUQl>DSr z1<%~X^wgl##FWaylc_d9MRuMpjv*Ddl5Xs-|KIfg|9|5H2ExqD&VTkXvx^xxFbYp; z`DMtZKV(@hJb6Mw<&;$V4 Cqb|Sz literal 0 HcmV?d00001 diff --git a/images/branch-open.png b/images/branch-open.png new file mode 100644 index 0000000000000000000000000000000000000000..4a25b96f78e1e5a7d805d16af4107777d9ca9ade GIT binary patch literal 145 zcmeAS@N?(olHy`uVBq!ia0vp^Y#_`5A|IT2?*XJFOI#yLg7ec#$`gxH85~pclTsBt za}(23gHjVyDhp4h+5i<9d%8G=RNPAX^Z&m+v(9X;@#2Roy^h1;LyOxu)9mlVQIH^E>Jszr>mdKI;Vst03l2&U;qFB literal 0 HcmV?d00001 diff --git a/images/colapse.png b/images/colapse.png index 2f1ce901fe2548b246c4563e85e3c7fbb30dd5e8..b70c8171518a147b32a481af58b874e88c88a7c1 100644 GIT binary patch delta 223 zcmV<503iRb0sR3XiBL{Q4GJ0x0000DNk~Le000070000B2nGNE0JD&nsF5Kkf1gQ2 zK~#9!V%Wcb{{DSr z1<%~X^wgl##FWaylc_d9MY^6Yjv*Ddl79UE|DQ=Atszn1qkN=*8iROBqC-Q4z`-L8 kd>6JRn2H>YYG7by__;jrhF;{UnLv#Up00i_>zopr0PWu@zW@LL literal 0 HcmV?d00001 diff --git a/images/expand.png b/images/expand.png index 84a890607f8a28d4d6b5aaee80469cdbfbd6045e..36a41fba0ce7174e953bf9d219aedf1de0320a38 100644 GIT binary patch delta 127 zcmZ3%IFC`WGr-TCmrII^fq{Y7)59eQNOJ%&CkGplfq_(7*cU7>Bs;7 z_RM;F>i_>^_2IEN(8$a##;~$Nt!9#fnXsKF59^Cb8eAJZ4~agQ#G-vbos(IC^?zYv c0|PU|V?Hy@7~`DHKr+O8wVSZ{Qj=KaiXF|yqBkoV@SoVBp+Yj z*aHU+2%LA2i8x`BeQgbkK(oYAg{?jcVuG{8oUR%e9CZ1R(WLEmvB6omD@h>X&;S4S mZ4)yyGr1@5I509WvN1fKqTnxS8zTiYox#)9&t;ucLK6VjN-G!u diff --git a/images/expanded_branch_selected.png b/images/expanded_branch_selected.png new file mode 100644 index 0000000000000000000000000000000000000000..896697624e2dfd819143bbf9036d3b0fb2506227 GIT binary patch literal 133 zcmeAS@N?(olHy`uVBq!ia0vp^Y#_`5A|IT2?*XJFOI#yLg7ec#$`gxH85~pclTsBt za}(23gHjVyDhp4h+5i=)d%8G=RNPAX^Z&m+v)G0PMwP}k@ju5^f5=aNP#@FuzmT(u d!J&bX!B8hZ?AGtQJAhgkJYD@<);T3K0RXDsD?tDN literal 0 HcmV?d00001 diff --git a/images/folder.png b/images/folder.png index b103e43f28589f52a1608b72f15139d4fa1c09ff..22262293e366c2af5756edafeeb9b0cd8090ac45 100644 GIT binary patch delta 262 zcmV+h0r~!-0l5N@7YYmr1^@s6y+Y^Yks&C5+et)0RCwB)Q9%lWFc93t)m}w<@~RK% z2l{OB174&By|h$ zKbGi}8iv6v%YwrOp^_mRFfLBhv;ro+kuTC(QxrwS%*0*SQJ&|!1`t>SD+J&7J#mt8 zBriD}KtMFl^G57WwtMiRd+MfX9=72H^09Y0=vX4Zi};8q0q!(^GWvGSvh1d-s=8R= z8iF8>;~;Dwck8;oa#0kmgm6aF8ianAn>a!%%d!Q3!sq;f(_4T60OmTU2B*xG#Q*>R M07*qoM6N<$g70-^zs7YYjq1^@s6phwqSks&BqL`g(JRCwBA{Qv(yLt0wee+D!#Yt}4A z1_FQumjpHg(G6z=*-S2AA!GwSz{EfS0BJr*rrv`T+kAjby$6P<%>V%g0AHdM#zoi! Q6aWAK07*qoM6N<$f(&~l6951J diff --git a/images/libraryIcon.png b/images/libraryIcon.png index d2cc7112f4efbf813a1b0b1056a97b474cdd3c27..fdee3b2880785d9cad5ade69d379078c1cc2a746 100644 GIT binary patch delta 229 zcmVg9kN5JyBldT5!y~WwYY8D&bJ9LV$L~HBp=5iBSa9q_o6(I@Qa8X8gg+P(`AdG zaw+8;ohgLi6o*=Cn~PEiD;YVIsdRz_y)nkG>N)4jtezxO)!kvcT{^*mZ%XO3e+vds z6;#qmoD10ZUG5|l f#uFCgzXTWneNCTnb!o|*00000NkvXXu0mjfS`KC| delta 112 zcmV-$0FVEe0;BJPks&940VhdBK~#9!V*LOAKLa{AaNvLdh<0#r z_<%0QghjCd(2z?Y3}U0pGa}mnRFLrR-@nOBOiVl=K9Kzd$j${a=L2nH1c|XADV_kN z@_`B%E?&F{7Sq?)2Wgy-V#EIZ`$6vA0L1nnfwgPbGEA8=rJwg;(YmY0`r{`~o~ zU~_Zx7h_}NnPp{VQH+d?azOPG-rn9S&z?P-HGTSYZ831Bn8V7YYps1^@s6ohgq(ks&940INwvK~#9!V*LOAKLa{QOG^^~(X(dF z`hYISghjCdkh%cEP&Nu+M79B_AOT2C0AhZq&_^IH0OI*T+ZaItEJ%t$3iF}dgHYNY zq!`79)YMdvdpAHOL0}@#v;rK41b}Q<096dL{s2(n1*oC`sDCCv)hqyc`T