added movable reading lists title tool bar to the sidebar

This commit is contained in:
Luis Ángel San Martín 2014-10-28 15:49:34 +01:00
parent b0d944e6b6
commit 0ecae3b44a
6 changed files with 107 additions and 16 deletions

View File

@ -182,8 +182,8 @@ void LibraryWindow::doLayout()
selectedLibrary = sideBar->selectedLibrary;
YACReaderTitledToolBar * librariesTitle = sideBar->librariesTitle;
YACReaderTitledToolBar * foldersTitle = sideBar->foldersTitle;
YACReaderTitledToolBar * readingListsTitle = sideBar->readingListsTitle;
librariesTitle->addAction(createLibraryAction);
librariesTitle->addAction(openLibraryAction);
@ -196,6 +196,9 @@ void LibraryWindow::doLayout()
foldersTitle->addAction(expandAllNodesAction);
foldersTitle->addAction(colapseAllNodesAction);
readingListsTitle->addAction(addReadingListAction);
readingListsTitle->addAction(deleteReadingListAction);
//FINAL LAYOUT-------------------------------------------------------------
comicsViewStack = new QStackedWidget();
@ -688,6 +691,17 @@ void LibraryWindow::createActions()
updateCurrentFolderAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(UPDATE_CURRENT_FOLDER_ACTION_YL));
updateCurrentFolderAction->setIcon(QIcon(":/images/updateLibraryIcon.png"));
addReadingListAction = new QAction(tr("Add new reading list"), this);
addReadingListAction->setData(ADD_READING_LIST_ACTION_YL);
addReadingListAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(ADD_READING_LIST_ACTION_YL));
addReadingListAction->setToolTip(tr("Add a new reading list to the current library"));
addReadingListAction->setIcon(QIcon(":/images/addNew_sidebar.png"));
deleteReadingListAction = new QAction(tr("Remove reading list"), this);
deleteReadingListAction->setData(REMOVE_READING_LIST_ACTION_YL);
deleteReadingListAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(REMOVE_READING_LIST_ACTION_YL));
deleteReadingListAction->setToolTip(tr("Remove current reading list from the library"));
deleteReadingListAction->setIcon(QIcon(":/images/delete_sidebar.png"));
//disable actions
disableAllActions();

View File

@ -184,6 +184,13 @@ private:
QAction * updateFolderAction;
QAction * updateCurrentFolderAction;
//reading lists actions
QAction * addReadingListAction;
QAction * deleteReadingListAction;
//--
//QAction * expandAllNodesRLAction;
//QAction * colapseAllNodesRLAction;
QList<QAction *> itemActions;
QList<QAction *> viewActions;

View File

@ -18,8 +18,20 @@ YACReaderSideBar::YACReaderSideBar(QWidget *parent) :
selectedLibrary = new YACReaderLibraryListWidget;
librariesTitle = new YACReaderTitledToolBar(tr("LIBRARIES"));
foldersTitle = new YACReaderTitledToolBar(tr("FOLDERS"));
readingListsTitle = new YACReaderTitledToolBar(tr("READING LISTS"));
splitter = new QSplitter(this);
splitter->setOrientation(Qt::Vertical);
#ifndef Q_OS_MAC
splitter->setStyleSheet("QSplitter::handle { "
" image: none; background-color = black; "
" }"
"QSplitter::handle:vertical { height: 50px;}");
#else
#endif
selectedLibrary->setContextMenuPolicy(Qt::ActionsContextMenu);
selectedLibrary->setAttribute(Qt::WA_MacShowFocusRect,false);
@ -29,6 +41,8 @@ YACReaderSideBar::YACReaderSideBar(QWidget *parent) :
QVBoxLayout * l = new QVBoxLayout;
l->setContentsMargins(0,0,0,0);
//LIBRARIES-------------------------------------------------------
#ifndef Q_OS_MAC
l->addSpacing(5);
#endif
@ -43,27 +57,77 @@ YACReaderSideBar::YACReaderSideBar(QWidget *parent) :
l->addWidget(selectedLibrary);
#ifndef Q_OS_MAC
l->addSpacing(6);
//END LIBRARIES---------------------------------------------------
l->addSpacing(5);
l->addWidget(new YACReaderSideBarSeparator(this));
l->addSpacing(4);
//FOLDERS---------------------------------------------------------
QWidget * foldersContainer = new QWidget(this);
QVBoxLayout * foldersLayout = new QVBoxLayout;
foldersLayout->setContentsMargins(0,0,0,0);
foldersLayout->setSpacing(0);
#ifndef Q_OS_MAC
foldersLayout->addSpacing(6);
foldersLayout->addSpacing(5);
foldersLayout->addWidget(new YACReaderSideBarSeparator(this));
foldersLayout->addSpacing(4);
#else
l->addSpacing(6);
foldersLayout->addSpacing(6);
#endif
l->addWidget(foldersTitle);
foldersLayout->addWidget(foldersTitle);
#ifndef Q_OS_MAC
{
l->addSpacing(4);
l->addWidget(new YACReaderSideBarSeparator(this));}
l->addSpacing(4);
foldersLayout->addSpacing(4);
foldersLayout->addWidget(new YACReaderSideBarSeparator(this));
foldersLayout->addSpacing(4);
#endif
l->addWidget(foldersView);
l->setSpacing(0);
foldersLayout->addWidget(foldersView);
foldersLayout->addSpacing(6);
foldersContainer->setLayout(foldersLayout);
splitter->addWidget(foldersContainer);
//END FOLDERS------------------------------------------------------
//READING LISTS----------------------------------------------------
QWidget * readingLists = new QWidget(this);
splitter->addWidget(readingLists);
QVBoxLayout * readingListsHeaderLayout = new QVBoxLayout;
readingListsHeaderLayout->setContentsMargins(0,0,0,0);
readingListsHeaderLayout->setSpacing(0);
#ifndef Q_OS_MAC
//readingListsLayout->addSpacing(6);
readingListsHeaderLayout->addSpacing(5);
readingListsHeaderLayout->addWidget(new YACReaderSideBarSeparator(this));
readingListsHeaderLayout->addSpacing(4);
#else
//readingListsHeaderLayout->addSpacing(6);
#endif
readingListsHeaderLayout->addWidget(readingListsTitle);
#ifndef Q_OS_MAC
readingListsHeaderLayout->addSpacing(4);
readingListsHeaderLayout->addWidget(new YACReaderSideBarSeparator(this));
readingListsHeaderLayout->addSpacing(4);
#endif
//readingListsLayout->addWidget(readingListsView);
readingListsHeaderLayout->addStretch();
QSplitterHandle * handle = splitter->handle(1);
//handle->setCursor(QCursor(Qt::ArrowCursor));
handle->setLayout(readingListsHeaderLayout);
//END READING LISTS------------------------------------------------
l->addWidget(splitter);
l->setSpacing(0);
setLayout(l);
}

View File

@ -1,7 +1,7 @@
#ifndef YACREADER_SIDEBAR_H
#define YACREADER_SIDEBAR_H
#include <QWidget>
#include <QtWidgets>
class YACReaderTreeView;
class YACReaderLibraryListWidget;
@ -28,6 +28,9 @@ public:
YACReaderLibraryListWidget * selectedLibrary;
YACReaderTitledToolBar * librariesTitle;
YACReaderTitledToolBar * foldersTitle;
YACReaderTitledToolBar * readingListsTitle;
QSplitter * splitter;
signals:

View File

@ -96,6 +96,7 @@ void YACReaderTitledToolBar::addAction(QAction * action)
QHBoxLayout * mainLayout = dynamic_cast<QHBoxLayout *>(layout());
QToolButton * tb = new QToolButton(this);
tb->setCursor(QCursor(Qt::ArrowCursor));
tb->setDefaultAction(action);
tb->setIconSize(QSize(16,16));
tb->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum);

View File

@ -75,6 +75,8 @@ public:
#define UPDATE_CURRENT_FOLDER_ACTION_YL "UPDATE_CURRENT_FOLDER_ACTION_YL"
#define ADD_FOLDER_ACTION_YL "ADD_FOLDER_ACTION_YL"
#define REMOVE_FOLDER_ACTION_YL "REMOVE_FOLDER_ACTION_YL"
#define ADD_READING_LIST_ACTION_YL "ADD_READING_LIST_ACTION_YL"
#define REMOVE_READING_LIST_ACTION_YL "REMOVE_READING_LIST_ACTION_YL"
//COMMANDS YACReaderLibrary