cambio en la toolbar

This commit is contained in:
Luis Ángel San Martín
2013-06-17 12:10:59 +02:00
parent 288aec8c53
commit bbf4d09855
4 changed files with 67 additions and 70 deletions

View File

@ -115,8 +115,6 @@ void LibraryWindow::setupUI()
socialDialog->setHidden(true);*/ socialDialog->setHidden(true);*/
} }
//#define NEW_LAYOUT
void LibraryWindow::doLayout() void LibraryWindow::doLayout()
{ {
//LAYOUT ELEMENTS------------------------------------------------------------ //LAYOUT ELEMENTS------------------------------------------------------------
@ -132,10 +130,10 @@ void LibraryWindow::doLayout()
//TOOLBARS------------------------------------------------------------------- //TOOLBARS-------------------------------------------------------------------
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
editInfoToolBar = new QToolBar(); editInfoToolBar = new QToolBar();
#ifdef NEW_LAYOUT #ifdef Q_OS_MAC
libraryToolBar = new QToolBar();
#else
libraryToolBar = addToolBar(tr("Library")); libraryToolBar = addToolBar(tr("Library"));
#else
libraryToolBar = new YACReaderMainToolBar;
#endif #endif
//FLOW----------------------------------------------------------------------- //FLOW-----------------------------------------------------------------------
@ -211,9 +209,9 @@ void LibraryWindow::doLayout()
comics->setLayout(comicsLayout); comics->setLayout(comicsLayout);
sVertical->addWidget(comics); sVertical->addWidget(comics);
sHorizontal->addWidget(sideBar); sHorizontal->addWidget(sideBar);
#ifdef NEW_LAYOUT #ifndef Q_OS_MAC
QVBoxLayout * rightLayout = new QVBoxLayout; QVBoxLayout * rightLayout = new QVBoxLayout;
rightLayout->addWidget(new YACReaderMainToolBar); rightLayout->addWidget(libraryToolBar);
rightLayout->addWidget(sVertical); rightLayout->addWidget(sVertical);
rightLayout->setMargin(0); rightLayout->setMargin(0);
@ -299,6 +297,18 @@ void LibraryWindow::doModels()
void LibraryWindow::createActions() void LibraryWindow::createActions()
{ {
backAction = new QAction(this);
QIcon icoBackButton;
icoBackButton.addPixmap(QPixmap(":/images/main_toolbar/back.png"), QIcon::Normal);
icoBackButton.addPixmap(QPixmap(":/images/main_toolbar/back_disabled.png"), QIcon::Disabled);
backAction->setIcon(icoBackButton);
fordwardAction = new QAction(this);
QIcon icoFordwardButton;
icoFordwardButton.addPixmap(QPixmap(":/images/main_toolbar/forward.png"), QIcon::Normal);
icoFordwardButton.addPixmap(QPixmap(":/images/main_toolbar/forward_disabled.png"), QIcon::Disabled);
fordwardAction->setIcon(icoFordwardButton);
createLibraryAction = new QAction(this); createLibraryAction = new QAction(this);
createLibraryAction->setToolTip(tr("Create a new library")); createLibraryAction->setToolTip(tr("Create a new library"));
createLibraryAction->setShortcut(Qt::Key_A); createLibraryAction->setShortcut(Qt::Key_A);
@ -376,12 +386,16 @@ void LibraryWindow::createActions()
toggleFullScreenAction = new QAction(tr("Fullscreen mode on/off"),this); toggleFullScreenAction = new QAction(tr("Fullscreen mode on/off"),this);
toggleFullScreenAction->setToolTip(tr("Fullscreen mode on/off (F)")); toggleFullScreenAction->setToolTip(tr("Fullscreen mode on/off (F)"));
toggleFullScreenAction->setShortcut(Qt::Key_F); toggleFullScreenAction->setShortcut(Qt::Key_F);
toggleFullScreenAction->setIcon(QIcon(":/images/fit.png")); QIcon icoFullscreenButton;
icoFullscreenButton.addPixmap(QPixmap(":/images/main_toolbar/fullscreen.png"), QIcon::Normal);
toggleFullScreenAction->setIcon(icoFullscreenButton);
helpAboutAction = new QAction(this); helpAboutAction = new QAction(this);
helpAboutAction->setToolTip(tr("Help, About YACReader")); helpAboutAction->setToolTip(tr("Help, About YACReader"));
helpAboutAction->setShortcut(Qt::Key_F1); helpAboutAction->setShortcut(Qt::Key_F1);
helpAboutAction->setIcon(QIcon(":/images/help.png")); QIcon icoHelpButton;
icoHelpButton.addPixmap(QPixmap(":/images/main_toolbar/help.png"), QIcon::Normal);
helpAboutAction->setIcon(icoHelpButton);
setRootIndexAction = new QAction(this); setRootIndexAction = new QAction(this);
setRootIndexAction->setShortcut(Qt::Key_0); setRootIndexAction->setShortcut(Qt::Key_0);
@ -401,12 +415,16 @@ void LibraryWindow::createActions()
optionsAction = new QAction(this); optionsAction = new QAction(this);
optionsAction->setShortcut(Qt::Key_C); optionsAction->setShortcut(Qt::Key_C);
optionsAction->setToolTip(tr("Show options dialog")); optionsAction->setToolTip(tr("Show options dialog"));
optionsAction->setIcon(QIcon(":/images/options.png")); QIcon icoSettingsButton;
icoSettingsButton.addPixmap(QPixmap(":/images/main_toolbar/settings.png"), QIcon::Normal);
optionsAction->setIcon(icoSettingsButton);
serverConfigAction = new QAction(this); serverConfigAction = new QAction(this);
serverConfigAction->setShortcut(Qt::Key_S); serverConfigAction->setShortcut(Qt::Key_S);
serverConfigAction->setToolTip(tr("Show comics server options dialog")); serverConfigAction->setToolTip(tr("Show comics server options dialog"));
serverConfigAction->setIcon(QIcon(":/images/server.png")); QIcon icoServerButton;
icoServerButton.addPixmap(QPixmap(":/images/main_toolbar/server.png"), QIcon::Normal);
serverConfigAction->setIcon(icoServerButton);
//socialAction = new QAction(this); //socialAction = new QAction(this);
@ -517,50 +535,36 @@ void LibraryWindow::enableLibraryActions()
void LibraryWindow::createToolBars() void LibraryWindow::createToolBars()
{ {
libraryToolBar->setIconSize(QSize(32,32)); //TODO make icon size dynamic
libraryToolBar->addAction(createLibraryAction);
libraryToolBar->addAction(openLibraryAction);
libraryToolBar->addSeparator();
libraryToolBar->addAction(exportComicsInfo);
libraryToolBar->addAction(importComicsInfo);
libraryToolBar->addSeparator();
libraryToolBar->addAction(exportLibraryAction);
libraryToolBar->addAction(importLibraryAction);
libraryToolBar->addSeparator();
libraryToolBar->addAction(updateLibraryAction);
libraryToolBar->addAction(renameLibraryAction);
libraryToolBar->addAction(removeLibraryAction);
//libraryToolBar->addAction(deleteLibraryAction);
libraryToolBar->addSeparator();
libraryToolBar->addAction(toggleFullScreenAction);
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
libraryToolBar->addSeparator(); libraryToolBar->setIconSize(QSize(16,16)); //TODO make icon size dynamic
#else
libraryToolBar->addWidget(new QToolBarStretch());
#endif
#ifdef SERVER_RELEASE #ifdef SERVER_RELEASE
libraryToolBar->addAction(serverConfigAction); libraryToolBar->addAction(serverConfigAction);
#endif #endif
libraryToolBar->addAction(optionsAction); libraryToolBar->addAction(optionsAction);
libraryToolBar->addAction(helpAboutAction); libraryToolBar->addAction(helpAboutAction);
//libraryToolBar->addAction(socialAction);
#ifdef Q_OS_MAC libraryToolBar->addSeparator();
libraryToolBar->addAction(toggleFullScreenAction);
libraryToolBar->addSeparator();
libraryToolBar->addWidget(new QToolBarStretch()); libraryToolBar->addWidget(new QToolBarStretch());
libraryToolBar->addWidget(foldersFilter); libraryToolBar->addWidget(foldersFilter);
#endif
libraryToolBar->setMovable(false); libraryToolBar->setMovable(false);
#else
libraryToolBar->backButton->setDefaultAction(backAction);
libraryToolBar->forwardButton->setDefaultAction(fordwardAction);
libraryToolBar->settingsButton->setDefaultAction(optionsAction);
libraryToolBar->serverButton->setDefaultAction(serverConfigAction);
libraryToolBar->helpButton->setDefaultAction(helpAboutAction);
libraryToolBar->fullscreenButton->setDefaultAction(toggleFullScreenAction);
#endif
editInfoToolBar->setIconSize(QSize(18,18)); editInfoToolBar->setIconSize(QSize(18,18));
editInfoToolBar->addAction(openComicAction); editInfoToolBar->addAction(openComicAction);
editInfoToolBar->addSeparator(); editInfoToolBar->addSeparator();

View File

@ -47,6 +47,7 @@ class YACReaderTableView;
class YACReaderSideBar; class YACReaderSideBar;
class YACReaderLibraryListWidget; class YACReaderLibraryListWidget;
class YACReaderTreeView; class YACReaderTreeView;
class YACReaderMainToolBar;
#include "comic_db.h" #include "comic_db.h"
class LibraryWindow : public QMainWindow class LibraryWindow : public QMainWindow
@ -105,6 +106,9 @@ private:
int i; int i;
QAction * backAction;
QAction * fordwardAction;
QAction * openComicAction; QAction * openComicAction;
QAction * showPropertiesAction; QAction * showPropertiesAction;
QAction * createLibraryAction; QAction * createLibraryAction;
@ -146,8 +150,11 @@ private:
QAction * deleteComicsAction; QAction * deleteComicsAction;
QAction * hideComicViewAction; QAction * hideComicViewAction;
#ifdef Q_OS_MAC
QToolBar * libraryToolBar; QToolBar * libraryToolBar;
#else
YACReaderMainToolBar * libraryToolBar;
#endif
QToolBar * treeActions; QToolBar * treeActions;
QToolBar * comicsToolBar; QToolBar * comicsToolBar;
QToolBar * editInfoToolBar; QToolBar * editInfoToolBar;

View File

@ -6,6 +6,7 @@
#include <QLabel> #include <QLabel>
#include <QResizeEvent> #include <QResizeEvent>
#include <QPaintEvent> #include <QPaintEvent>
#include <QAction>
YACReaderMainToolBar::YACReaderMainToolBar(QWidget *parent) : YACReaderMainToolBar::YACReaderMainToolBar(QWidget *parent) :
QWidget(parent) QWidget(parent)
@ -24,46 +25,29 @@ YACReaderMainToolBar::YACReaderMainToolBar(QWidget *parent) :
backButton = new QToolButton(); backButton = new QToolButton();
backButton->setStyleSheet(qToolButtonStyleSheet); 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 = new QToolButton();
forwardButton->setStyleSheet(qToolButtonStyleSheet); forwardButton->setStyleSheet(qToolButtonStyleSheet);
forwardButton->setDisabled(true); 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 = new QToolButton();
settingsButton->setStyleSheet(qToolButtonStyleSheet); settingsButton->setStyleSheet(qToolButtonStyleSheet);
QIcon icoSettingsButton;
settingsButton->setIconSize(QSize(24,24)); settingsButton->setIconSize(QSize(24,24));
icoSettingsButton.addPixmap(QPixmap(":/images/main_toolbar/settings.png"), QIcon::Normal);
settingsButton->setIcon(icoSettingsButton);
serverButton = new QToolButton(); serverButton = new QToolButton();
serverButton->setStyleSheet(qToolButtonStyleSheet); serverButton->setStyleSheet(qToolButtonStyleSheet);
QIcon icoServerButton;
serverButton->setIconSize(QSize(17,24)); serverButton->setIconSize(QSize(17,24));
icoServerButton.addPixmap(QPixmap(":/images/main_toolbar/server.png"), QIcon::Normal);
serverButton->setIcon(icoServerButton);
helpButton = new QToolButton(); helpButton = new QToolButton();
helpButton->setStyleSheet(qToolButtonStyleSheet); helpButton->setStyleSheet(qToolButtonStyleSheet);
QIcon icoHelpButton;
helpButton->setIconSize(QSize(14,25)); helpButton->setIconSize(QSize(14,25));
icoHelpButton.addPixmap(QPixmap(":/images/main_toolbar/help.png"), QIcon::Normal);
helpButton->setIcon(icoHelpButton);
fullscreenButton = new QToolButton(); fullscreenButton = new QToolButton();
fullscreenButton->setStyleSheet(qToolButtonStyleSheet); fullscreenButton->setStyleSheet(qToolButtonStyleSheet);
QIcon icoFullscreenButton;
fullscreenButton->setIconSize(QSize(24,24)); fullscreenButton->setIconSize(QSize(24,24));
icoFullscreenButton.addPixmap(QPixmap(":/images/main_toolbar/fullscreen.png"), QIcon::Normal);
fullscreenButton->setIcon(icoFullscreenButton);
mainLayout->setMargin(0); mainLayout->setMargin(0);
mainLayout->setSpacing(0); mainLayout->setSpacing(0);

View File

@ -15,6 +15,13 @@ class YACReaderMainToolBar : public QWidget
public: public:
explicit YACReaderMainToolBar(QWidget *parent = 0); explicit YACReaderMainToolBar(QWidget *parent = 0);
QSize sizeHint() const; QSize sizeHint() const;
QToolButton * backButton;
QToolButton * forwardButton;
QToolButton * settingsButton;
QToolButton * serverButton;
QToolButton * helpButton;
QToolButton * fullscreenButton;
signals: signals:
public slots: public slots:
@ -23,12 +30,7 @@ private:
void paintEvent(QPaintEvent *); void paintEvent(QPaintEvent *);
void resizeEvent(QResizeEvent *); void resizeEvent(QResizeEvent *);
QToolButton * backButton;
QToolButton * forwardButton;
QToolButton * settingsButton;
QToolButton * serverButton;
QToolButton * helpButton;
QToolButton * fullscreenButton;
QHBoxLayout * mainLayout; QHBoxLayout * mainLayout;