Added an icon for the show info toolbar action and a setting for remembering its configuration.

This commit is contained in:
Luis Ángel San Martín 2016-04-19 10:48:48 +02:00
parent 64b77586fc
commit 0486e5eb5f
7 changed files with 14 additions and 4 deletions

View File

@ -100,12 +100,15 @@ GridComicsView::GridComicsView(QWidget *parent) :
ctxt->setContextProperty("dragManager", this);
ctxt->setContextProperty("dropManager", this);
ctxt->setContextProperty("showInfo", false);
bool showInfo = settings->value(COMICS_GRID_SHOW_INFO, false).toBool();
ctxt->setContextProperty("showInfo", showInfo);
view->setSource(QUrl("qrc:/qml/GridComicsView.qml"));
showInfoAction = new QAction("Show info",this);
showInfoAction = new QAction(tr("Show info"),this);
showInfoAction->setIcon(QIcon(":/images/comics_view_toolbar/show_comic_info.png"));
showInfoAction->setCheckable(true);
showInfoAction->setChecked(showInfo);
connect(showInfoAction, &QAction::toggled, this, &GridComicsView::showInfo);
setShowMarks(true);//TODO save this in settings
@ -166,6 +169,7 @@ void GridComicsView::setToolBar(QToolBar *toolBar)
toolBarStretchAction = toolBar->addWidget(toolBarStretch);
toolBar->addAction(showInfoAction);
showInfoSeparatorAction = toolBar->addSeparator();
coverSizeSliderAction = toolBar->addWidget(coverSizeSliderWidget);
}
@ -433,6 +437,7 @@ void GridComicsView::closeEvent(QCloseEvent *event)
{
toolbar->removeAction(toolBarStretchAction);
toolbar->removeAction(showInfoAction);
toolbar->removeAction(showInfoSeparatorAction);
toolbar->removeAction(coverSizeSliderAction);
/*QObject *object = view->rootObject();
@ -445,4 +450,5 @@ void GridComicsView::closeEvent(QCloseEvent *event)
//save settings
settings->setValue(COMICS_GRID_COVER_SIZES, coverSizeSlider->value());
settings->setValue(COMICS_GRID_SHOW_INFO, showInfoAction->isChecked());
}

View File

@ -77,6 +77,7 @@ private:
QSlider * coverSizeSlider;
QAction * coverSizeSliderAction;
QAction * showInfoAction;
QAction * showInfoSeparatorAction;
YACReaderComicsSelectionHelper * selectionHelper;
YACReaderComicInfoHelper * comicInfoHelper;

View File

@ -35,7 +35,9 @@
<file>../images/comics_view_toolbar/small_size_grid_zoom.png</file>
<file>../images/comics_view_toolbar/small_size_grid_zoom@2x.png</file>
<file>../images/comics_view_toolbar/trash.png</file>
<file>../images/comics_view_toolbar/trash.png</file>
<file>../images/comics_view_toolbar/trash@2x.png</file>
<file>../images/comics_view_toolbar/show_comic_info.png</file>
<file>../images/comics_view_toolbar/show_comic_info@2x.png</file>
<file>../images/coversPackage.png</file>
<file>../images/db.png</file>
<file>../images/defaultCover.png</file>

View File

@ -471,7 +471,7 @@ Rectangle {
anchors.rightMargin: 10
pixelAligned: true
//flickDeceleration: -2000
snapMode: GridView.SnapToRow
currentIndex: 0
cacheBuffer: 0

View File

@ -53,6 +53,7 @@
#define COMICS_VIEW_FLOW_SPLITTER_STATUS "COMICS_VIEW_FLOW_SPLITTER_STATUS"
#define SIDEBAR_SPLITTER_STATUS "SIDEBAR_SPLITTER_STATUS"
#define COMICS_GRID_COVER_SIZES "COMICS_GRID_COVER_SIZES"
#define COMICS_GRID_SHOW_INFO "COMICS_GRID_SHOW_INFO"
#define COMIC_VINE_API_KEY "COMIC_VINE_API_KEY"
#define COMIC_VINE_BASE_URL "COMIC_VINE_BASE_URL"

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 B