mirror of
https://github.com/YACReader/yacreader
synced 2025-06-04 01:28:55 -04:00
added movable reading lists title tool bar to the sidebar
This commit is contained in:
parent
b0d944e6b6
commit
0ecae3b44a
@ -182,8 +182,8 @@ void LibraryWindow::doLayout()
|
|||||||
selectedLibrary = sideBar->selectedLibrary;
|
selectedLibrary = sideBar->selectedLibrary;
|
||||||
|
|
||||||
YACReaderTitledToolBar * librariesTitle = sideBar->librariesTitle;
|
YACReaderTitledToolBar * librariesTitle = sideBar->librariesTitle;
|
||||||
|
|
||||||
YACReaderTitledToolBar * foldersTitle = sideBar->foldersTitle;
|
YACReaderTitledToolBar * foldersTitle = sideBar->foldersTitle;
|
||||||
|
YACReaderTitledToolBar * readingListsTitle = sideBar->readingListsTitle;
|
||||||
|
|
||||||
librariesTitle->addAction(createLibraryAction);
|
librariesTitle->addAction(createLibraryAction);
|
||||||
librariesTitle->addAction(openLibraryAction);
|
librariesTitle->addAction(openLibraryAction);
|
||||||
@ -196,6 +196,9 @@ void LibraryWindow::doLayout()
|
|||||||
foldersTitle->addAction(expandAllNodesAction);
|
foldersTitle->addAction(expandAllNodesAction);
|
||||||
foldersTitle->addAction(colapseAllNodesAction);
|
foldersTitle->addAction(colapseAllNodesAction);
|
||||||
|
|
||||||
|
readingListsTitle->addAction(addReadingListAction);
|
||||||
|
readingListsTitle->addAction(deleteReadingListAction);
|
||||||
|
|
||||||
//FINAL LAYOUT-------------------------------------------------------------
|
//FINAL LAYOUT-------------------------------------------------------------
|
||||||
comicsViewStack = new QStackedWidget();
|
comicsViewStack = new QStackedWidget();
|
||||||
|
|
||||||
@ -688,6 +691,17 @@ void LibraryWindow::createActions()
|
|||||||
updateCurrentFolderAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(UPDATE_CURRENT_FOLDER_ACTION_YL));
|
updateCurrentFolderAction->setShortcut(ShortcutsManager::getShortcutsManager().getShortcut(UPDATE_CURRENT_FOLDER_ACTION_YL));
|
||||||
updateCurrentFolderAction->setIcon(QIcon(":/images/updateLibraryIcon.png"));
|
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
|
//disable actions
|
||||||
disableAllActions();
|
disableAllActions();
|
||||||
|
@ -184,6 +184,13 @@ private:
|
|||||||
QAction * updateFolderAction;
|
QAction * updateFolderAction;
|
||||||
QAction * updateCurrentFolderAction;
|
QAction * updateCurrentFolderAction;
|
||||||
|
|
||||||
|
//reading lists actions
|
||||||
|
QAction * addReadingListAction;
|
||||||
|
QAction * deleteReadingListAction;
|
||||||
|
//--
|
||||||
|
//QAction * expandAllNodesRLAction;
|
||||||
|
//QAction * colapseAllNodesRLAction;
|
||||||
|
|
||||||
QList<QAction *> itemActions;
|
QList<QAction *> itemActions;
|
||||||
QList<QAction *> viewActions;
|
QList<QAction *> viewActions;
|
||||||
|
|
||||||
|
@ -18,8 +18,20 @@ YACReaderSideBar::YACReaderSideBar(QWidget *parent) :
|
|||||||
selectedLibrary = new YACReaderLibraryListWidget;
|
selectedLibrary = new YACReaderLibraryListWidget;
|
||||||
|
|
||||||
librariesTitle = new YACReaderTitledToolBar(tr("LIBRARIES"));
|
librariesTitle = new YACReaderTitledToolBar(tr("LIBRARIES"));
|
||||||
|
|
||||||
foldersTitle = new YACReaderTitledToolBar(tr("FOLDERS"));
|
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->setContextMenuPolicy(Qt::ActionsContextMenu);
|
||||||
selectedLibrary->setAttribute(Qt::WA_MacShowFocusRect,false);
|
selectedLibrary->setAttribute(Qt::WA_MacShowFocusRect,false);
|
||||||
@ -29,6 +41,8 @@ YACReaderSideBar::YACReaderSideBar(QWidget *parent) :
|
|||||||
QVBoxLayout * l = new QVBoxLayout;
|
QVBoxLayout * l = new QVBoxLayout;
|
||||||
|
|
||||||
l->setContentsMargins(0,0,0,0);
|
l->setContentsMargins(0,0,0,0);
|
||||||
|
|
||||||
|
//LIBRARIES-------------------------------------------------------
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MAC
|
||||||
l->addSpacing(5);
|
l->addSpacing(5);
|
||||||
#endif
|
#endif
|
||||||
@ -43,27 +57,77 @@ YACReaderSideBar::YACReaderSideBar(QWidget *parent) :
|
|||||||
|
|
||||||
l->addWidget(selectedLibrary);
|
l->addWidget(selectedLibrary);
|
||||||
|
|
||||||
#ifndef Q_OS_MAC
|
//END LIBRARIES---------------------------------------------------
|
||||||
l->addSpacing(6);
|
|
||||||
|
|
||||||
l->addSpacing(5);
|
//FOLDERS---------------------------------------------------------
|
||||||
l->addWidget(new YACReaderSideBarSeparator(this));
|
QWidget * foldersContainer = new QWidget(this);
|
||||||
l->addSpacing(4);
|
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
|
#else
|
||||||
l->addSpacing(6);
|
foldersLayout->addSpacing(6);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
l->addWidget(foldersTitle);
|
foldersLayout->addWidget(foldersTitle);
|
||||||
|
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MAC
|
||||||
{
|
foldersLayout->addSpacing(4);
|
||||||
l->addSpacing(4);
|
foldersLayout->addWidget(new YACReaderSideBarSeparator(this));
|
||||||
l->addWidget(new YACReaderSideBarSeparator(this));}
|
foldersLayout->addSpacing(4);
|
||||||
l->addSpacing(4);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
l->addWidget(foldersView);
|
foldersLayout->addWidget(foldersView);
|
||||||
l->setSpacing(0);
|
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);
|
setLayout(l);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef YACREADER_SIDEBAR_H
|
#ifndef YACREADER_SIDEBAR_H
|
||||||
#define YACREADER_SIDEBAR_H
|
#define YACREADER_SIDEBAR_H
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QtWidgets>
|
||||||
|
|
||||||
class YACReaderTreeView;
|
class YACReaderTreeView;
|
||||||
class YACReaderLibraryListWidget;
|
class YACReaderLibraryListWidget;
|
||||||
@ -28,6 +28,9 @@ public:
|
|||||||
YACReaderLibraryListWidget * selectedLibrary;
|
YACReaderLibraryListWidget * selectedLibrary;
|
||||||
YACReaderTitledToolBar * librariesTitle;
|
YACReaderTitledToolBar * librariesTitle;
|
||||||
YACReaderTitledToolBar * foldersTitle;
|
YACReaderTitledToolBar * foldersTitle;
|
||||||
|
YACReaderTitledToolBar * readingListsTitle;
|
||||||
|
|
||||||
|
QSplitter * splitter;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
|
@ -96,6 +96,7 @@ void YACReaderTitledToolBar::addAction(QAction * action)
|
|||||||
QHBoxLayout * mainLayout = dynamic_cast<QHBoxLayout *>(layout());
|
QHBoxLayout * mainLayout = dynamic_cast<QHBoxLayout *>(layout());
|
||||||
|
|
||||||
QToolButton * tb = new QToolButton(this);
|
QToolButton * tb = new QToolButton(this);
|
||||||
|
tb->setCursor(QCursor(Qt::ArrowCursor));
|
||||||
tb->setDefaultAction(action);
|
tb->setDefaultAction(action);
|
||||||
tb->setIconSize(QSize(16,16));
|
tb->setIconSize(QSize(16,16));
|
||||||
tb->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum);
|
tb->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum);
|
||||||
|
@ -75,6 +75,8 @@ public:
|
|||||||
#define UPDATE_CURRENT_FOLDER_ACTION_YL "UPDATE_CURRENT_FOLDER_ACTION_YL"
|
#define UPDATE_CURRENT_FOLDER_ACTION_YL "UPDATE_CURRENT_FOLDER_ACTION_YL"
|
||||||
#define ADD_FOLDER_ACTION_YL "ADD_FOLDER_ACTION_YL"
|
#define ADD_FOLDER_ACTION_YL "ADD_FOLDER_ACTION_YL"
|
||||||
#define REMOVE_FOLDER_ACTION_YL "REMOVE_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
|
//COMMANDS YACReaderLibrary
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user