diff --git a/app/browsemainpage.cpp b/app/browsemainpage.cpp --- a/app/browsemainpage.cpp +++ b/app/browsemainpage.cpp @@ -215,6 +215,28 @@ pal.setColor(QPalette::Window, pal.color(QPalette::Window).dark(110)); mUrlNavigatorContainer->setPalette(pal); } + + void updateContextBarActions() + { + PreviewItemDelegate::ContextBarActions actions; + switch (GwenviewConfig::thumbnailActions()) + { + case ThumbnailActions::None: + actions = PreviewItemDelegate::NoAction; + break; + case ThumbnailActions::ShowSelectionButtonOnly: + actions = PreviewItemDelegate::SelectionAction; + break; + case ThumbnailActions::AllButtons: + default: + actions = PreviewItemDelegate::SelectionAction | PreviewItemDelegate::RotateAction; + if (!q->window()->isFullScreen()) { + actions |= PreviewItemDelegate::FullScreenAction; + } + break; + } + mDelegate->setContextBarActions(actions); + } }; BrowseMainPage::BrowseMainPage(QWidget* parent, KActionCollection* actionCollection, GvCore* gvCore) @@ -245,7 +267,9 @@ void BrowseMainPage::loadConfig() { setPalette(d->mGvCore->palette(GvCore::NormalPalette)); - d->mThumbnailView->setPalette(d->mGvCore->palette(GvCore::NormalViewPalette)); + d->mThumbnailView->setPalette(d->mGvCore->palette(window()->isFullScreen() + ? GvCore::FullScreenViewPalette + : GvCore::NormalViewPalette)); d->mUrlNavigator->setUrlEditable(GwenviewConfig::urlNavigatorIsEditable()); d->mUrlNavigator->setShowFullPath(GwenviewConfig::urlNavigatorShowFullPath()); @@ -263,6 +287,8 @@ break; } } + + d->updateContextBarActions(); } void BrowseMainPage::saveConfig() const @@ -374,11 +400,7 @@ d->mUrlNavigatorContainer->setContentsMargins( fullScreen ? 6 : 0, 0, 0, 0); - PreviewItemDelegate::ContextBarActions actions = PreviewItemDelegate::SelectionAction | PreviewItemDelegate::RotateAction; - if (!fullScreen) { - actions |= PreviewItemDelegate::FullScreenAction; - } - d->mDelegate->setContextBarActions(actions); + d->updateContextBarActions(); d->mFullScreenToolBar->setVisible(fullScreen); d->mFullScreenToolBar2->setVisible(fullScreen); diff --git a/app/configdialog.h b/app/configdialog.h --- a/app/configdialog.h +++ b/app/configdialog.h @@ -48,6 +48,7 @@ InvisibleButtonGroup* mAlphaBackgroundModeGroup; InvisibleButtonGroup* mWheelBehaviorGroup; InvisibleButtonGroup* mAnimationMethodGroup; + InvisibleButtonGroup* mThumbnailActionsGroup; InvisibleButtonGroup* mZoomModeGroup; InvisibleButtonGroup* mThumbnailBarOrientationGroup; InvisibleButtonGroup* mRenderingIntentGroup; diff --git a/app/configdialog.cpp b/app/configdialog.cpp --- a/app/configdialog.cpp +++ b/app/configdialog.cpp @@ -52,6 +52,13 @@ // General widget = setupPage(mGeneralConfigPage); + + mThumbnailActionsGroup = new InvisibleButtonGroup(widget); + mThumbnailActionsGroup->setObjectName(QLatin1String("kcfg_ThumbnailActions")); + mThumbnailActionsGroup->addButton(mGeneralConfigPage.allButtonsThumbnailActionsRadioButton, int(ThumbnailActions::AllButtons)); + mThumbnailActionsGroup->addButton(mGeneralConfigPage.selectionOnlyThumbnailActionsRadioButton, int(ThumbnailActions::ShowSelectionButtonOnly)); + mThumbnailActionsGroup->addButton(mGeneralConfigPage.noneThumbnailActionsRadioButton, int(ThumbnailActions::None)); + pageItem = addPage(widget, i18n("General")); pageItem->setIcon(QIcon::fromTheme("gwenview")); connect(mGeneralConfigPage.kcfg_ViewBackgroundValue, SIGNAL(valueChanged(int)), SLOT(updateViewBackgroundFrame())); diff --git a/app/generalconfigpage.ui b/app/generalconfigpage.ui --- a/app/generalconfigpage.ui +++ b/app/generalconfigpage.ui @@ -11,6 +11,36 @@ + + + + Videos: + + + + + + + Show videos + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + @@ -76,22 +106,8 @@ - - - - Videos: - - - - - - - Show videos - - - - - + + Qt::Vertical @@ -106,6 +122,34 @@ + + + + Thumbnail actions: + + + + + + + All buttons + + + + + + + Show selection button onl&y + + + + + + + None + + + diff --git a/app/viewmainpage.cpp b/app/viewmainpage.cpp --- a/app/viewmainpage.cpp +++ b/app/viewmainpage.cpp @@ -189,7 +189,7 @@ QColor borderSelColor = PaintUtils::adjustedHsv(bgSelColor, 0, 0, -qMin(60, bgSelColor.value())); QString itemCss = - "QListView::item {" + "QListView::item:!hover {" " background-color: %1;" " border-left: 1px solid %2;" " border-right: 1px solid %3;" diff --git a/importer/thumbnailpage.cpp b/importer/thumbnailpage.cpp --- a/importer/thumbnailpage.cpp +++ b/importer/thumbnailpage.cpp @@ -162,7 +162,18 @@ PreviewItemDelegate* delegate = new PreviewItemDelegate(mThumbnailView); delegate->setThumbnailDetails(PreviewItemDelegate::FileNameDetail); - delegate->setContextBarActions(PreviewItemDelegate::SelectionAction); + PreviewItemDelegate::ContextBarActions actions; + switch (GwenviewConfig::thumbnailActions()) + { + case ThumbnailActions::None: + actions = PreviewItemDelegate::NoAction; + break; + case ThumbnailActions::ShowSelectionButtonOnly: + case ThumbnailActions::AllButtons: + actions = PreviewItemDelegate::SelectionAction; + break; + } + delegate->setContextBarActions(actions); mThumbnailView->setItemDelegate(delegate); // Colors diff --git a/lib/gwenviewconfig.kcfg b/lib/gwenviewconfig.kcfg --- a/lib/gwenviewconfig.kcfg +++ b/lib/gwenviewconfig.kcfg @@ -7,6 +7,7 @@ lib/sorting.h lib/zoommode.h + lib/thumbnailactions.h lib/mousewheelbehavior.h lib/documentview/documentview.h lib/documentview/rasterimageview.h @@ -82,6 +83,15 @@ information + + + + + + + + ThumbnailActions::AllButtons + diff --git a/lib/thumbnailactions.h b/lib/thumbnailactions.h new file mode 100644 --- /dev/null +++ b/lib/thumbnailactions.h @@ -0,0 +1,48 @@ +// vim: set tabstop=4 shiftwidth=4 expandtab: +/* +Gwenview: an image viewer +Copyright 2018 Huon Imberger + +This program is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 2 of the License, or (at your +option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Cambridge, MA 02110-1301, USA. + +*/ +#ifndef THUMBNAILACTIONS_H +#define THUMBNAILACTIONS_H + +// Qt + +// KDE + +// Local + +namespace Gwenview +{ + +namespace ThumbnailActions +{ +/** + * This enum represents the different thumbnail actions display modes. + */ +enum Enum { + AllButtons, + ShowSelectionButtonOnly, + None +}; + +} // namespace ThumbnailActions + +} // namespace Gwenview + +#endif /* THUMBNAILACTIONS_H */ diff --git a/lib/thumbnailview/thumbnailbarview.cpp b/lib/thumbnailview/thumbnailbarview.cpp --- a/lib/thumbnailview/thumbnailbarview.cpp +++ b/lib/thumbnailview/thumbnailbarview.cpp @@ -44,6 +44,7 @@ #include "lib/hud/hudtheme.h" #include "lib/paintutils.h" #include "lib/thumbnailview/abstractthumbnailviewhelper.h" +#include "gwenviewconfig.h" namespace Gwenview { @@ -126,7 +127,7 @@ { mIndexUnderCursor = index; - if (mIndexUnderCursor.isValid()) { + if (mIndexUnderCursor.isValid() && GwenviewConfig::thumbnailActions() != ThumbnailActions::None) { updateToggleSelectionButton(); const QRect rect = mView->visualRect(mIndexUnderCursor);