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 00000000..2677d99e Binary files /dev/null and b/images/main_toolbar/back.png differ diff --git a/images/main_toolbar/back_disabled.png b/images/main_toolbar/back_disabled.png new file mode 100644 index 00000000..9e09b69a Binary files /dev/null and b/images/main_toolbar/back_disabled.png differ diff --git a/images/main_toolbar/divider.png b/images/main_toolbar/divider.png new file mode 100644 index 00000000..ed245eeb Binary files /dev/null and b/images/main_toolbar/divider.png differ diff --git a/images/main_toolbar/forward.png b/images/main_toolbar/forward.png new file mode 100644 index 00000000..b6473ae8 Binary files /dev/null and b/images/main_toolbar/forward.png differ diff --git a/images/main_toolbar/forward_disabled.png b/images/main_toolbar/forward_disabled.png new file mode 100644 index 00000000..1e4b070a Binary files /dev/null and b/images/main_toolbar/forward_disabled.png differ diff --git a/images/main_toolbar/fullscreen.png b/images/main_toolbar/fullscreen.png new file mode 100644 index 00000000..4235184f Binary files /dev/null and b/images/main_toolbar/fullscreen.png differ diff --git a/images/main_toolbar/help.png b/images/main_toolbar/help.png new file mode 100644 index 00000000..b3ab9914 Binary files /dev/null and b/images/main_toolbar/help.png differ diff --git a/images/main_toolbar/server.png b/images/main_toolbar/server.png new file mode 100644 index 00000000..98b66e5a Binary files /dev/null and b/images/main_toolbar/server.png differ diff --git a/images/main_toolbar/settings.png b/images/main_toolbar/settings.png new file mode 100644 index 00000000..02e7df24 Binary files /dev/null and b/images/main_toolbar/settings.png differ