From e790334e543cb6674ed46c19e5ed24de457dcf01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20=C3=81ngel=20San=20Mart=C3=ADn?= Date: Mon, 3 Jun 2013 17:37:16 +0200 Subject: [PATCH] a?adida nueva barra de herramientas principal a yacreaderlibrary --- YACReaderLibrary/YACReaderLibrary.pro | 2 + YACReaderLibrary/images.qrc | 12 +- YACReaderLibrary/library_window.cpp | 3 +- YACReaderLibrary/yacreader_main_toolbar.cpp | 128 ++++++++++++++++++++ YACReaderLibrary/yacreader_main_toolbar.h | 43 +++++++ images/main_toolbar/back.png | Bin 0 -> 225 bytes images/main_toolbar/back_disabled.png | Bin 0 -> 225 bytes images/main_toolbar/divider.png | Bin 0 -> 207 bytes images/main_toolbar/forward.png | Bin 0 -> 234 bytes images/main_toolbar/forward_disabled.png | Bin 0 -> 240 bytes images/main_toolbar/fullscreen.png | Bin 0 -> 259 bytes images/main_toolbar/help.png | Bin 0 -> 384 bytes images/main_toolbar/server.png | Bin 0 -> 196 bytes images/main_toolbar/settings.png | Bin 0 -> 369 bytes 14 files changed, 186 insertions(+), 2 deletions(-) create mode 100644 YACReaderLibrary/yacreader_main_toolbar.cpp create mode 100644 YACReaderLibrary/yacreader_main_toolbar.h create mode 100644 images/main_toolbar/back.png create mode 100644 images/main_toolbar/back_disabled.png create mode 100644 images/main_toolbar/divider.png create mode 100644 images/main_toolbar/forward.png create mode 100644 images/main_toolbar/forward_disabled.png create mode 100644 images/main_toolbar/fullscreen.png create mode 100644 images/main_toolbar/help.png create mode 100644 images/main_toolbar/server.png create mode 100644 images/main_toolbar/settings.png diff --git a/YACReaderLibrary/YACReaderLibrary.pro b/YACReaderLibrary/YACReaderLibrary.pro index 26c81796..476b76c6 100644 --- a/YACReaderLibrary/YACReaderLibrary.pro +++ b/YACReaderLibrary/YACReaderLibrary.pro @@ -75,6 +75,7 @@ HEADERS += comic_flow.h \ no_libraries_widget.h \ import_widget.h \ yacreader_local_server.h \ + yacreader_main_toolbar.h SOURCES += comic_flow.cpp \ create_library_dialog.cpp \ @@ -112,6 +113,7 @@ SOURCES += comic_flow.cpp \ no_libraries_widget.cpp \ import_widget.cpp \ yacreader_local_server.cpp \ + yacreader_main_toolbar.cpp include(./server/server.pri) diff --git a/YACReaderLibrary/images.qrc b/YACReaderLibrary/images.qrc index 5e10e765..842d3236 100644 --- a/YACReaderLibrary/images.qrc +++ b/YACReaderLibrary/images.qrc @@ -89,5 +89,15 @@ ../images/social_dialog/shadow.png ../images/social_dialog/twitter.png ../images/social_dialog/separator.png + ../images/main_toolbar/back.png + ../images/main_toolbar/back_disabled.png + ../images/main_toolbar/forward.png + ../images/main_toolbar/forward_disabled.png + ../images/main_toolbar/divider.png + ../images/main_toolbar/settings.png + ../images/main_toolbar/server.png + ../images/main_toolbar/help.png + ../images/main_toolbar/fullscreen.png + - \ No newline at end of file + diff --git a/YACReaderLibrary/library_window.cpp b/YACReaderLibrary/library_window.cpp index 1c9ba6ba..cc2dea09 100644 --- a/YACReaderLibrary/library_window.cpp +++ b/YACReaderLibrary/library_window.cpp @@ -48,6 +48,7 @@ #include "yacreader_dark_menu.h" #include "yacreader_titled_toolbar.h" +#include "yacreader_main_toolbar.h" //#include "yacreader_social_dialog.h" // @@ -223,7 +224,7 @@ void LibraryWindow::doLayout() sHorizontal->addWidget(sideBar); #ifdef NEW_LAYOUT QVBoxLayout * rightLayout = new QVBoxLayout; - rightLayout->addWidget(libraryToolBar); + rightLayout->addWidget(new YACReaderMainToolBar); rightLayout->addWidget(sVertical); rightLayout->setMargin(0); diff --git a/YACReaderLibrary/yacreader_main_toolbar.cpp b/YACReaderLibrary/yacreader_main_toolbar.cpp new file mode 100644 index 00000000..c9bbdc3a --- /dev/null +++ b/YACReaderLibrary/yacreader_main_toolbar.cpp @@ -0,0 +1,128 @@ +#include "yacreader_main_toolbar.h" + +#include +#include +#include +#include +#include +#include + +YACReaderMainToolBar::YACReaderMainToolBar(QWidget *parent) : + QWidget(parent) +{ + mainLayout = new QHBoxLayout; + + currentFolder = new QLabel(tr("Root"),this); + currentFolder->setAlignment(Qt::AlignCenter); + currentFolder->setStyleSheet(" QLabel {color:#404040; font-size:22px; font-weight:bold;}"); + + QFont f=currentFolder->font(); + f.setStyleStrategy(QFont::PreferAntialias); + currentFolder->setFont(f); + + QString qToolButtonStyleSheet = "QToolButton {border:none;}"; + + backButton = new QToolButton(); + backButton->setStyleSheet(qToolButtonStyleSheet); + QIcon icoBackButton; + icoBackButton.addPixmap(QPixmap(":/images/main_toolbar/back.png"), QIcon::Normal); + icoBackButton.addPixmap(QPixmap(":/images/main_toolbar/back_disabled.png"), QIcon::Disabled); + backButton->setIcon(icoBackButton); + + forwardButton = new QToolButton(); + forwardButton->setStyleSheet(qToolButtonStyleSheet); + forwardButton->setDisabled(true); + QIcon icoFordwardButton; + icoFordwardButton.addPixmap(QPixmap(":/images/main_toolbar/forward.png"), QIcon::Normal); + icoFordwardButton.addPixmap(QPixmap(":/images/main_toolbar/forward_disabled.png"), QIcon::Disabled); + forwardButton->setIcon(icoFordwardButton); + + settingsButton = new QToolButton(); + settingsButton->setStyleSheet(qToolButtonStyleSheet); + QIcon icoSettingsButton; + settingsButton->setIconSize(QSize(24,24)); + icoSettingsButton.addPixmap(QPixmap(":/images/main_toolbar/settings.png"), QIcon::Normal); + settingsButton->setIcon(icoSettingsButton); + + serverButton = new QToolButton(); + serverButton->setStyleSheet(qToolButtonStyleSheet); + QIcon icoServerButton; + serverButton->setIconSize(QSize(17,24)); + icoServerButton.addPixmap(QPixmap(":/images/main_toolbar/server.png"), QIcon::Normal); + serverButton->setIcon(icoServerButton); + + helpButton = new QToolButton(); + helpButton->setStyleSheet(qToolButtonStyleSheet); + QIcon icoHelpButton; + helpButton->setIconSize(QSize(14,25)); + icoHelpButton.addPixmap(QPixmap(":/images/main_toolbar/help.png"), QIcon::Normal); + helpButton->setIcon(icoHelpButton); + + fullscreenButton = new QToolButton(); + fullscreenButton->setStyleSheet(qToolButtonStyleSheet); + QIcon icoFullscreenButton; + fullscreenButton->setIconSize(QSize(24,24)); + icoFullscreenButton.addPixmap(QPixmap(":/images/main_toolbar/fullscreen.png"), QIcon::Normal); + fullscreenButton->setIcon(icoFullscreenButton); + + mainLayout->setMargin(0); + mainLayout->setSpacing(0); + + mainLayout->addSpacing(12); + mainLayout->addWidget(backButton); + addDivider(); + mainLayout->addWidget(forwardButton); + + mainLayout->addSpacing(34); + mainLayout->addWidget(settingsButton); + addWideDivider(); + mainLayout->addWidget(serverButton); + addWideDivider(); + mainLayout->addWidget(helpButton); + + mainLayout->addStretch(); + + mainLayout->addWidget(fullscreenButton); + mainLayout->addSpacing(10); + + setLayout(mainLayout); + + setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed); +} + + +QSize YACReaderMainToolBar::sizeHint() const +{ + return QSize(200,40); +} + +void YACReaderMainToolBar::paintEvent(QPaintEvent * event) +{ + Q_UNUSED(event); + + QPainter painter (this); + painter.fillRect(0,0,width(),height(),QColor("#F0F0F0")); +} + +void YACReaderMainToolBar::resizeEvent(QResizeEvent * event) +{ + currentFolder->move((event->size().width()-currentFolder->width())/2,(event->size().height()-currentFolder->height())/2); +} + +void YACReaderMainToolBar::addDivider() +{ + QPixmap img(":/images/main_toolbar/divider.png"); + QLabel * divider = new QLabel(); + divider->setPixmap(img); + + mainLayout->addSpacing(5); + mainLayout->addWidget(divider); + mainLayout->addSpacing(5); +} + +void YACReaderMainToolBar::addWideDivider() +{ + mainLayout->addSpacing(3); + addDivider(); + mainLayout->addSpacing(3); +} diff --git a/YACReaderLibrary/yacreader_main_toolbar.h b/YACReaderLibrary/yacreader_main_toolbar.h new file mode 100644 index 00000000..f8a1a778 --- /dev/null +++ b/YACReaderLibrary/yacreader_main_toolbar.h @@ -0,0 +1,43 @@ +#ifndef YACREADER_MAIN_TOOLBAR_H +#define YACREADER_MAIN_TOOLBAR_H + +#include + +class QToolButton; +class QLabel; +class QResizeEvent; +class QPaintEvent; +class QHBoxLayout; + +class YACReaderMainToolBar : public QWidget +{ + Q_OBJECT +public: + explicit YACReaderMainToolBar(QWidget *parent = 0); + QSize sizeHint() const; +signals: + +public slots: + +private: + void paintEvent(QPaintEvent *); + void resizeEvent(QResizeEvent *); + + QToolButton * backButton; + QToolButton * forwardButton; + QToolButton * settingsButton; + QToolButton * serverButton; + QToolButton * helpButton; + QToolButton * fullscreenButton; + + QHBoxLayout * mainLayout; + + QLabel * currentFolder; + + void addDivider(); + void addWideDivider(); + + +}; + +#endif // YACREADER_MAIN_TOOLBAR_H diff --git a/images/main_toolbar/back.png b/images/main_toolbar/back.png new file mode 100644 index 0000000000000000000000000000000000000000..2677d99e7e13046e5ba9d73c7df3abed71035426 GIT binary patch literal 225 zcmeAS@N?(olHy`uVBq!ia0vp^{6H+g!3HExhN-duDajJoh?3y^w370~qErUQl>DSr z1<%~X^wgl##FWaylc_d9Ma`Zrjv*DdlK%YvZ_m8)z{QJ!j2@C3CM;aZ*zwr0My$x> zAOkm}FH?Z;&l^u7KV)b%B-O>VZJw~0)75z8tOv6irFa{@Fa`lt2{W@cWd8s6SG>VQ zLrbdhhqC4@$%(-dE9=saOta}UZ4r#Wr8dPwqVuH0j!Ejunmf7f3b=V~QgLWtWYGR< V@Zo6aQIMM%JYD@<);T3K0RZCjPelL# literal 0 HcmV?d00001 diff --git a/images/main_toolbar/back_disabled.png b/images/main_toolbar/back_disabled.png new file mode 100644 index 0000000000000000000000000000000000000000..9e09b69aa152d3fd9e5230a66baf0d74acdbf1cc GIT binary patch literal 225 zcmeAS@N?(olHy`uVBq!ia0vp^{6H+g!3HExhN-duDajJoh?3y^w370~qErUQl>DSr z1<%~X^wgl##FWaylc_d9Ma`Zrjv*DdlK%YvZ_m6k;q)|JE{9VMtvtTG4l?|YHcwd0 z$rizpA=Hp{>bTnZCih@Qk&?*O)3rzj105q WJC#~*7nTA#hr!d;&t;ucLK6V-!AULv literal 0 HcmV?d00001 diff --git a/images/main_toolbar/divider.png b/images/main_toolbar/divider.png new file mode 100644 index 0000000000000000000000000000000000000000..ed245eebcaf0ec756486c35626da3a705088212f GIT binary patch literal 207 zcmeAS@N?(olHy`uVBq!ia0vp^j6kf!!3HGf>24MTQj#UE5hcO-X(i=}MX3yqDfvmM z3ZA)%>8U}fi7AzZCsS>JiV8hl978H@iJZ#jIusz_{LrUs!Inq6Oa5zTZ4bP^Lc=59 z>SytT(>yATwe}@*x}wA^m(DS=n#KO?_`N$bZ!a-BcdPwav@eG?S5#HBfWuRto&)n6 ze+V|}UzX2*@3Uvl^6l)K%jNT)UEPyXVdfszQz(|e&>v`XvX-GI8fZC#r>mdKI;Vst E0K$|_hX4Qo literal 0 HcmV?d00001 diff --git a/images/main_toolbar/forward.png b/images/main_toolbar/forward.png new file mode 100644 index 0000000000000000000000000000000000000000..b6473ae8cb05466d7eac75e8e0a8f00556ecfbae GIT binary patch literal 234 zcmeAS@N?(olHy`uVBq!ia0vp^{6H+g!3HExhN-duDajJoh?3y^w370~qErUQl>DSr z1<%~X^wgl##FWaylc_d9MLnJ_jv*Ddk_rk6I2e*z|NsAQJfUl*goMO3=8v`R?#Edj z)*NtPN?^J5OWrp}QNaAo{r&$LEoUVrC|#Mr|0IL0vERXlv1OyAlZSDfbH~-5s{%o$ z%F>e#9C2V&a4%LC&}Nvsx3QJQSK{M&r#`hL6JeiBohKQGmi<%+xy+cv%(%o-utR>r fB2G32CLRWlIk`ta9G-Iw=q?6NS3j3^P6DSr z1<%~X^wgl##FWaylc_d9MUy;T978H@ExGWJ*TF!b?crsK101p|>~k7?dk(PqI9%d8 zpwe@I<*TR3$Hl9TtL7_BeIDeIJy$t%t!iFV2iq2jWGj_U!$;p@3Z`?MpBa5=fliBX z&3fKF_XCTUO}VwhVuy-Y_4I;|wVs+Uj@KO2owVcI45NVltOZwPm&6C~)VV1B>8h#N ncR}R0uwTr=sm*s}n0Oc%3bMLnSQz*uM3X~SMrWsIF+c8bUsu5>wUYJNipx*$dn!C(c{fMFWL*}6 zIeU&~9P5ORZpNUGVT$dKMUPE?U+-aj+_I+dv}i^^VLywA8wEH_?h9rOJQ4e_iJ424fz+AD5q`2!uy;OXk;vd$@? F2>>+&USR+L literal 0 HcmV?d00001 diff --git a/images/main_toolbar/help.png b/images/main_toolbar/help.png new file mode 100644 index 0000000000000000000000000000000000000000..b3ab99149087fd83470eeef4a87e0550fca6ab64 GIT binary patch literal 384 zcmV-`0e}99P)X1^@s60h=H40000PbVXQnQ*UN; zcVTj606}DLVr3vnZDD6+Qe|Oed2z{QJOBUzB1uF+RCwB)RPAlTFc3Yg{3o3tY*03+ zvq6{u*q|GfZjf$3Cm@|5VS|idHh>Az=jbB2?p;1O=_!_-=X>|g_NwbT%JY0fL!zdyhyu=BD; zh}(n*B^U34#fp`DNX(uX5yEIRqM4}WpvPNcTs7{-6*7#Ws-0hPGeF%X)Q?~ z{4hc`U)QTZI)YSn?RX{< z!JIO91#Uor8r!KF&(YJ7X;Mv;O=|oaYj!MSx}-)E+5S-eb1IRW{H`1~H`xxZwHSIB ezNKOO3NQdLsbY$Nujmv20000F!NhJjZ0tpETHyDn5<5|+&>>zW%rIC>*pjLW@ zh5%ps?)BzO1Y|4q1s#ZvxHS|$0+NX*Gkwv_Xy r<~M~_!y17U4+d7Y#??Fx49pCr3<{HY&-ncY+Q{JP>gTe~DWM4fYiK>W literal 0 HcmV?d00001 diff --git a/images/main_toolbar/settings.png b/images/main_toolbar/settings.png new file mode 100644 index 0000000000000000000000000000000000000000..02e7df24067db92ed68a97adf30b2e87985d3e5e GIT binary patch literal 369 zcmV-%0gnEOP)n%ga2I=Mj|3?-cM(LAkmN}$)^!yzq_rMlsPWZUYnvFkGE#Z#DR)%k z8cW5|0}xa=opE$0?E~^1@QCxuJ;1YP(7+)Ksk95<#{iz(iaew@PfGD;@(s)x_0FeI ze57Bz|*AZv0X~A_=(N@_{EGI0PMQ5r+ujB~&u| zKFGVB%$fY97F8L+Q>E6T^lFOr+hovb{H}Iw%Ve5