diff --git a/app/fullscreencontent.cpp b/app/fullscreencontent.cpp index 1339b0c2..0138b8eb 100644 --- a/app/fullscreencontent.cpp +++ b/app/fullscreencontent.cpp @@ -1,525 +1,525 @@ // vim: set tabstop=4 shiftwidth=4 expandtab: /* Gwenview: an image viewer Copyright 2008 Aurélien Gâteau 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. */ // Self #include "fullscreencontent.h" // Qt #include #include #include #include #include #include #include #include #include // KDE #include #include #include #include // Local #include #include #include #include #include #include #include #include #include #include namespace Gwenview { /** * A widget which behaves more or less like a QToolBar, but which uses real * widgets for the toolbar items. We need a real widget to be able to position * the option menu. */ class FullScreenToolBar : public QWidget { public: FullScreenToolBar(QWidget* parent = 0) : QWidget(parent) , mLayout(new QHBoxLayout(this)) { setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); mLayout->setSpacing(0); mLayout->setMargin(0); } void addAction(QAction* action) { QToolButton* button = new QToolButton; button->setDefaultAction(action); button->setToolButtonStyle(Qt::ToolButtonIconOnly); button->setAutoRaise(true); const int extent = KIconLoader::SizeMedium; button->setIconSize(QSize(extent, extent)); mLayout->addWidget(button); } void addSeparator() { mLayout->addSpacing(QApplication::style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing)); } void addStretch() { mLayout->addStretch(); } void setDirection(QBoxLayout::Direction direction) { mLayout->setDirection(direction); } private: QBoxLayout* mLayout; }; FullScreenContent::FullScreenContent(QObject* parent, GvCore* gvCore) : QObject(parent) { mGvCore = gvCore; mViewPageVisible = false; } void FullScreenContent::init(KActionCollection* actionCollection, QWidget* autoHideParentWidget, SlideShow* slideShow) { mSlideShow = slideShow; mActionCollection = actionCollection; connect(actionCollection->action("view"), SIGNAL(toggled(bool)), SLOT(slotViewModeActionToggled(bool))); // mAutoHideContainer mAutoHideContainer = new FullScreenBar(autoHideParentWidget); mAutoHideContainer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); QVBoxLayout* layout = new QVBoxLayout(mAutoHideContainer); layout->setMargin(0); layout->setSpacing(0); EventWatcher::install(autoHideParentWidget, QEvent::Resize, this, SLOT(adjustSize())); // mContent mContent = new QWidget; mContent->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); mContent->setAutoFillBackground(true); EventWatcher::install(mContent, QEvent::Show, this, SLOT(updateCurrentUrlWidgets())); layout->addWidget(mContent); createOptionsAction(); // mToolBar mToolBar = new FullScreenToolBar(mContent); #define addAction(name) mToolBar->addAction(actionCollection->action(name)) addAction("browse"); addAction("view"); mToolBar->addSeparator(); addAction("go_previous"); addAction("toggle_slideshow"); addAction("go_next"); mToolBar->addSeparator(); addAction("rotate_left"); addAction("rotate_right"); #undef addAction mToolBarShadow = new ShadowFilter(mToolBar); // mInformationLabel mInformationLabel = new QLabel; mInformationLabel->setWordWrap(true); mInformationLabel->setContentsMargins(6, 0, 6, 0); mInformationLabel->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored); mInformationLabel->setAutoFillBackground(true); mInformationLabel->setBackgroundRole(QPalette::Mid); mInformationLabelShadow = new ShadowFilter(mInformationLabel); // Thumbnail bar mThumbnailBar = new ThumbnailBarView(mContent); mThumbnailBar->setThumbnailScaleMode(ThumbnailView::ScaleToSquare); ThumbnailBarItemDelegate* delegate = new ThumbnailBarItemDelegate(mThumbnailBar); mThumbnailBar->setItemDelegate(delegate); mThumbnailBar->setSelectionMode(QAbstractItemView::ExtendedSelection); // Right bar mRightToolBar = new FullScreenToolBar(mContent); mRightToolBar->addAction(mActionCollection->action("leave_fullscreen")); mRightToolBar->addAction(mOptionsAction); mRightToolBar->addStretch(); mRightToolBar->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding); mRightToolBarShadow = new ShadowFilter(mRightToolBar); updateLayout(); updateContainerAppearance(); } ThumbnailBarView* FullScreenContent::thumbnailBar() const { return mThumbnailBar; } void FullScreenContent::setCurrentUrl(const QUrl &url) { if (url.isEmpty()) { mCurrentDocument = Document::Ptr(); } else { mCurrentDocument = DocumentFactory::instance()->load(url); connect(mCurrentDocument.data(), SIGNAL(metaInfoUpdated()), SLOT(updateCurrentUrlWidgets())); } updateCurrentUrlWidgets(); } void FullScreenContent::updateInformationLabel() { if (!mCurrentDocument) { return; } if (!mInformationLabel->isVisible()) { return; } ImageMetaInfoModel* model = mCurrentDocument->metaInfo(); QStringList valueList; Q_FOREACH(const QString & key, GwenviewConfig::fullScreenPreferredMetaInfoKeyList()) { const QString value = model->getValueForKey(key); if (value.length() > 0) { valueList << value; } } QString text = valueList.join(i18nc("@item:intext fullscreen meta info separator", ", ")); mInformationLabel->setText(text); } void FullScreenContent::updateCurrentUrlWidgets() { updateInformationLabel(); updateMetaInfoDialog(); } void FullScreenContent::showImageMetaInfoDialog() { if (!mImageMetaInfoDialog) { mImageMetaInfoDialog = new ImageMetaInfoDialog(mInformationLabel); // Do not let the fullscreen theme propagate to this dialog for now, // it's already quite complicated to create a theme mImageMetaInfoDialog->setStyle(QApplication::style()); mImageMetaInfoDialog->setAttribute(Qt::WA_DeleteOnClose, true); connect(mImageMetaInfoDialog, SIGNAL(preferredMetaInfoKeyListChanged(QStringList)), SLOT(slotPreferredMetaInfoKeyListChanged(QStringList))); connect(mImageMetaInfoDialog, SIGNAL(destroyed()), SLOT(slotImageMetaInfoDialogClosed())); } if (mCurrentDocument) { mImageMetaInfoDialog->setMetaInfo(mCurrentDocument->metaInfo(), GwenviewConfig::fullScreenPreferredMetaInfoKeyList()); } mAutoHideContainer->setAutoHidingEnabled(false); mImageMetaInfoDialog->show(); } void FullScreenContent::slotPreferredMetaInfoKeyListChanged(const QStringList& list) { GwenviewConfig::setFullScreenPreferredMetaInfoKeyList(list); GwenviewConfig::self()->save(); updateInformationLabel(); } void FullScreenContent::updateMetaInfoDialog() { if (!mImageMetaInfoDialog) { return; } ImageMetaInfoModel* model = mCurrentDocument ? mCurrentDocument->metaInfo() : 0; mImageMetaInfoDialog->setMetaInfo(model, GwenviewConfig::fullScreenPreferredMetaInfoKeyList()); } static QString formatSlideShowIntervalText(int value) { return i18ncp("Slideshow interval in seconds", "%1 sec", "%1 secs", value); } void FullScreenContent::updateLayout() { delete mContent->layout(); if (GwenviewConfig::showFullScreenThumbnails()) { mRightToolBar->setDirection(QBoxLayout::TopToBottom); QHBoxLayout* layout = new QHBoxLayout(mContent); layout->setMargin(0); layout->setSpacing(0); QVBoxLayout* vLayout; // First column vLayout = new QVBoxLayout; vLayout->addWidget(mToolBar); vLayout->addWidget(mInformationLabel); layout->addLayout(vLayout); // Second column layout->addSpacing(2); layout->addWidget(mThumbnailBar); layout->addSpacing(2); // Third column vLayout = new QVBoxLayout; vLayout->addWidget(mRightToolBar); layout->addLayout(vLayout); mThumbnailBar->setFixedHeight(GwenviewConfig::fullScreenBarHeight()); mAutoHideContainer->setFixedHeight(GwenviewConfig::fullScreenBarHeight()); // Shadows mToolBarShadow->reset(); mToolBarShadow->setShadow(ShadowFilter::RightEdge, QColor(0, 0, 0, 64)); mToolBarShadow->setShadow(ShadowFilter::BottomEdge, QColor(255, 255, 255, 8)); mInformationLabelShadow->reset(); mInformationLabelShadow->setShadow(ShadowFilter::LeftEdge, QColor(0, 0, 0, 64)); mInformationLabelShadow->setShadow(ShadowFilter::TopEdge, QColor(0, 0, 0, 64)); mInformationLabelShadow->setShadow(ShadowFilter::RightEdge, QColor(0, 0, 0, 128)); mInformationLabelShadow->setShadow(ShadowFilter::BottomEdge, QColor(255, 255, 255, 8)); mRightToolBarShadow->reset(); mRightToolBarShadow->setShadow(ShadowFilter::LeftEdge, QColor(0, 0, 0, 64)); mRightToolBarShadow->setShadow(ShadowFilter::BottomEdge, QColor(255, 255, 255, 8)); } else { mRightToolBar->setDirection(QBoxLayout::RightToLeft); QHBoxLayout* layout = new QHBoxLayout(mContent); layout->setMargin(0); layout->setSpacing(0); layout->addWidget(mToolBar); layout->addWidget(mInformationLabel); layout->addWidget(mRightToolBar); mAutoHideContainer->setFixedHeight(mToolBar->sizeHint().height()); // Shadows mToolBarShadow->reset(); mInformationLabelShadow->reset(); mInformationLabelShadow->setShadow(ShadowFilter::LeftEdge, QColor(0, 0, 0, 64)); mInformationLabelShadow->setShadow(ShadowFilter::RightEdge, QColor(0, 0, 0, 32)); mRightToolBarShadow->reset(); mRightToolBarShadow->setShadow(ShadowFilter::LeftEdge, QColor(255, 255, 255, 8)); } } void FullScreenContent::updateContainerAppearance() { if (!mContent->window()->isFullScreen() || !mViewPageVisible) { mAutoHideContainer->setActivated(false); return; } mThumbnailBar->setVisible(GwenviewConfig::showFullScreenThumbnails()); mAutoHideContainer->adjustSize(); mAutoHideContainer->setActivated(true); } void FullScreenContent::adjustSize() { if (mContent->window()->isFullScreen() && mViewPageVisible) { mAutoHideContainer->adjustSize(); } } void FullScreenContent::createOptionsAction() { // We do not use a KActionMenu because: // // - It causes the button to show a small down arrow on its right, // which makes it wider // // - We can't control where the menu shows: in no-thumbnail-mode, the // menu should not be aligned to the right edge of the screen because // if the mode is changed to thumbnail-mode, we want the option button // to remain visible mOptionsAction = new QAction(this); mOptionsAction->setPriority(QAction::LowPriority); mOptionsAction->setIcon(QIcon::fromTheme("configure")); mOptionsAction->setToolTip(i18nc("@info:tooltip", "Configure full screen mode")); QObject::connect(mOptionsAction, SIGNAL(triggered()), this, SLOT(showOptionsMenu())); } void FullScreenContent::updateSlideShowIntervalLabel() { Q_ASSERT(mConfigWidget); int value = mConfigWidget->mSlideShowIntervalSlider->value(); QString text = formatSlideShowIntervalText(value); mConfigWidget->mSlideShowIntervalLabel->setText(text); } void FullScreenContent::setFullScreenBarHeight(int value) { mThumbnailBar->setFixedHeight(value); mAutoHideContainer->setFixedHeight(value); GwenviewConfig::setFullScreenBarHeight(value); } void FullScreenContent::showOptionsMenu() { Q_ASSERT(!mConfigWidget); mConfigWidget = new FullScreenConfigWidget; FullScreenConfigWidget* widget = mConfigWidget; // Put widget in a menu QMenu menu; QWidgetAction* action = new QWidgetAction(&menu); action->setDefaultWidget(widget); menu.addAction(action); // Slideshow checkboxes widget->mSlideShowLoopCheckBox->setChecked(mSlideShow->loopAction()->isChecked()); connect(widget->mSlideShowLoopCheckBox, SIGNAL(toggled(bool)), mSlideShow->loopAction(), SLOT(trigger())); widget->mSlideShowRandomCheckBox->setChecked(mSlideShow->randomAction()->isChecked()); connect(widget->mSlideShowRandomCheckBox, SIGNAL(toggled(bool)), mSlideShow->randomAction(), SLOT(trigger())); // Interval slider widget->mSlideShowIntervalSlider->setValue(int(GwenviewConfig::interval())); connect(widget->mSlideShowIntervalSlider, SIGNAL(valueChanged(int)), mSlideShow, SLOT(setInterval(int))); connect(widget->mSlideShowIntervalSlider, SIGNAL(valueChanged(int)), SLOT(updateSlideShowIntervalLabel())); // Interval label QString text = formatSlideShowIntervalText(88); int width = widget->mSlideShowIntervalLabel->fontMetrics().width(text); widget->mSlideShowIntervalLabel->setFixedWidth(width); updateSlideShowIntervalLabel(); // Image information connect(widget->mConfigureDisplayedInformationButton, SIGNAL(clicked()), SLOT(showImageMetaInfoDialog())); // Thumbnails widget->mThumbnailGroupBox->setVisible(mViewPageVisible); if (mViewPageVisible) { widget->mShowThumbnailsCheckBox->setChecked(GwenviewConfig::showFullScreenThumbnails()); widget->mHeightSlider->setMinimum(mRightToolBar->sizeHint().height()); widget->mHeightSlider->setValue(mThumbnailBar->height()); connect(widget->mShowThumbnailsCheckBox, SIGNAL(toggled(bool)), SLOT(slotShowThumbnailsToggled(bool))); connect(widget->mHeightSlider, SIGNAL(valueChanged(int)), SLOT(setFullScreenBarHeight(int))); } // Show menu below its button QPoint pos; QWidget* button = mOptionsAction->associatedWidgets().first(); Q_ASSERT(button); qWarning() << button << button->geometry(); if (QApplication::isRightToLeft()) { pos = button->mapToGlobal(button->rect().bottomLeft()); } else { pos = button->mapToGlobal(button->rect().bottomRight()); pos.rx() -= menu.sizeHint().width(); } qWarning() << pos; menu.exec(pos); } void FullScreenContent::setFullScreenMode(bool fullScreenMode) { Q_UNUSED(fullScreenMode); updateContainerAppearance(); setupThumbnailBarStyleSheet(); } void FullScreenContent::setDistractionFreeMode(bool distractionFreeMode) { - mAutoHideContainer->setAutoHidingEnabled(!distractionFreeMode); + mAutoHideContainer->setEdgeTriggerEnabled(!distractionFreeMode); } void FullScreenContent::slotImageMetaInfoDialogClosed() { mAutoHideContainer->setAutoHidingEnabled(true); } void FullScreenContent::slotShowThumbnailsToggled(bool value) { GwenviewConfig::setShowFullScreenThumbnails(value); GwenviewConfig::self()->save(); mThumbnailBar->setVisible(value); updateLayout(); mContent->adjustSize(); mAutoHideContainer->adjustSize(); } void FullScreenContent::slotViewModeActionToggled(bool value) { mViewPageVisible = value; updateContainerAppearance(); } void FullScreenContent::setupThumbnailBarStyleSheet() { const QPalette pal = mGvCore->palette(GvCore::NormalPalette); const QPalette fsPal = mGvCore->palette(GvCore::FullScreenPalette); QColor bgColor = fsPal.color(QPalette::Normal, QPalette::Base); QColor bgSelColor = pal.color(QPalette::Normal, QPalette::Highlight); QColor bgHovColor = pal.color(QPalette::Normal, QPalette::Highlight); // Darken the select color a little to suit dark theme of fullscreen mode bgSelColor.setHsv(bgSelColor.hue(), bgSelColor.saturation(), (bgSelColor.value() * 0.8)); // Calculate hover color based on background color in case it changes (matches ViewMainPage thumbnail bar) bgHovColor.setHsv(bgHovColor.hue(), (bgHovColor.saturation() / 2), ((bgHovColor.value() + bgColor.value()) / 2)); QString genCss = "QListView {" " background-color: %1;" "}"; genCss = genCss.arg(StyleSheetUtils::rgba(bgColor)); QString itemSelCss = "QListView::item:selected {" " background-color: %1;" "}"; itemSelCss = itemSelCss.arg(StyleSheetUtils::rgba(bgSelColor)); QString itemHovCss = "QListView::item:hover:!selected {" " background-color: %1;" "}"; itemHovCss = itemHovCss.arg(StyleSheetUtils::rgba(bgHovColor)); QString css = genCss + itemSelCss + itemHovCss; mThumbnailBar->setStyleSheet(css); } } // namespace diff --git a/lib/fullscreenbar.cpp b/lib/fullscreenbar.cpp index 69e7bc96..75b915be 100644 --- a/lib/fullscreenbar.cpp +++ b/lib/fullscreenbar.cpp @@ -1,272 +1,279 @@ // vim: set tabstop=4 shiftwidth=4 expandtab: /* Gwenview: an image viewer Copyright 2007 Aurélien Gâteau 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, Boston, MA 02110-1301, USA. */ // Self #include "fullscreenbar.h" // Qt #include #include #include #include #include #include #include #include #include #include // KDE #include // Local namespace Gwenview { static const int SLIDE_DURATION = 150; static const int AUTO_HIDE_CURSOR_TIMEOUT = 1000; // How long before the bar slide out after switching to fullscreen static const int INITIAL_HIDE_TIMEOUT = 2000; // Do not slide bar out if mouse is less than this amount of pixels below bar, to // prevent accidental slide outs static const int EXTRA_BAR_HEIGHT = 20; struct FullScreenBarPrivate { FullScreenBar* q; QTimeLine* mTimeLine; QTimer* mAutoHideCursorTimer; bool mAutoHidingEnabled; + bool mEdgeTriggerEnabled; QTimer* mInitialHideTimer; void startTimeLine() { if (mTimeLine->state() != QTimeLine::Running) { mTimeLine->start(); } } void hideCursor() { QBitmap empty(32, 32); empty.clear(); QCursor blankCursor(empty, empty); QApplication::setOverrideCursor(blankCursor); } /** * Returns the rectangle in which the mouse must enter to trigger bar * sliding. The rectangle is in global coords. */ QRect slideInTriggerRect() const { QRect rect = QApplication::desktop()->screenGeometry(QApplication::desktop()->screenNumber(q->parentWidget())); // Take parent widget position into account because it may not be at // the top of the screen, for example when the save bar warning is // shown. rect.setHeight(q->parentWidget()->y() + q->height() + EXTRA_BAR_HEIGHT); return rect; } bool shouldHide() const { Q_ASSERT(q->parentWidget()); if (!mAutoHidingEnabled) { return false; } if (slideInTriggerRect().contains(QCursor::pos())) { return false; } if (QApplication::activePopupWidget()) { return false; } // Do not hide if a button is down, which can happen when we are // using a scroll bar. if (QApplication::mouseButtons() != Qt::NoButton) { return false; } return true; } }; FullScreenBar::FullScreenBar(QWidget* parent) : QFrame(parent) , d(new FullScreenBarPrivate) { d->q = this; d->mAutoHidingEnabled = true; + d->mEdgeTriggerEnabled = true; setObjectName(QLatin1String("fullScreenBar")); d->mTimeLine = new QTimeLine(SLIDE_DURATION, this); connect(d->mTimeLine, &QTimeLine::valueChanged, this, &FullScreenBar::moveBar); d->mAutoHideCursorTimer = new QTimer(this); d->mAutoHideCursorTimer->setInterval(AUTO_HIDE_CURSOR_TIMEOUT); d->mAutoHideCursorTimer->setSingleShot(true); connect(d->mAutoHideCursorTimer, &QTimer::timeout, this, &FullScreenBar::slotAutoHideCursorTimeout); d->mInitialHideTimer = new QTimer(this); d->mInitialHideTimer->setInterval(INITIAL_HIDE_TIMEOUT); d->mInitialHideTimer->setSingleShot(true); connect(d->mInitialHideTimer, &QTimer::timeout, this, &FullScreenBar::slideOut); hide(); } FullScreenBar::~FullScreenBar() { delete d; } QSize FullScreenBar::sizeHint() const { QSize sh = QFrame::sizeHint(); if (!layout()) { return sh; } if (layout()->expandingDirections() & Qt::Horizontal) { sh.setWidth(parentWidget()->width()); } return sh; } void FullScreenBar::moveBar(qreal value) { move(0, -height() + int(value * height())); // For some reason, if Gwenview is started with command line options to // start a slideshow, the bar might end up below the view. Calling raise() // here fixes it. raise(); } void FullScreenBar::setActivated(bool activated) { if (activated) { // Delay installation of event filter because switching to fullscreen // cause a few window adjustments, which seems to generate unwanted // mouse events, which cause the bar to slide in. QTimer::singleShot(500, this, SLOT(delayedInstallEventFilter())); adjustSize(); // Make sure the widget is visible on start move(0, 0); raise(); show(); } else { qApp->removeEventFilter(this); hide(); d->mAutoHideCursorTimer->stop(); QApplication::restoreOverrideCursor(); } } void FullScreenBar::delayedInstallEventFilter() { qApp->installEventFilter(this); if (d->shouldHide()) { d->mInitialHideTimer->start(); d->hideCursor(); } } void FullScreenBar::slotAutoHideCursorTimeout() { if (d->shouldHide()) { d->hideCursor(); } else { d->mAutoHideCursorTimer->start(); } } void FullScreenBar::slideOut() { d->mInitialHideTimer->stop(); d->mTimeLine->setDirection(QTimeLine::Backward); d->startTimeLine(); } void FullScreenBar::slideIn() { d->mInitialHideTimer->stop(); d->mTimeLine->setDirection(QTimeLine::Forward); d->startTimeLine(); } bool FullScreenBar::eventFilter(QObject* object, QEvent* event) { if (event->type() == QEvent::MouseMove) { QApplication::restoreOverrideCursor(); d->mAutoHideCursorTimer->start(); if (y() == 0) { if (d->shouldHide()) { slideOut(); } } else { QMouseEvent* mouseEvent = static_cast(event); - if (mouseEvent->buttons() == 0 && d->slideInTriggerRect().contains(QCursor::pos())) { + if (d->mEdgeTriggerEnabled && mouseEvent->buttons() == 0 && d->slideInTriggerRect().contains(QCursor::pos())) { slideIn(); } } return false; } if (event->type() == QEvent::MouseButtonRelease) { // This can happen if user released the mouse after using a scrollbar // in the content (the bar does not hide while a button is down) if (y() == 0 && d->shouldHide()) { slideOut(); } return false; } // Filtering message on tooltip text for CJK to remove accelerators. // Quoting ktoolbar.cpp: // """ // CJK languages use more verbose accelerator marker: they add a Latin // letter in parenthesis, and put accelerator on that. Hence, the default // removal of ampersand only may not be enough there, instead the whole // parenthesis construct should be removed. Use KLocale's method to do this. // """ if (event->type() == QEvent::Show || event->type() == QEvent::Paint) { QToolButton* button = qobject_cast(object); if (button && !button->actions().isEmpty()) { QAction* action = button->actions().first(); QString toolTip = KLocalizedString::removeAcceleratorMarker(action->toolTip()); // Filtering message requested by translators (scripting). button->setToolTip(i18nc("@info:tooltip of custom toolbar button", "%1", toolTip)); } } return false; } void FullScreenBar::setAutoHidingEnabled(bool value) { d->mAutoHidingEnabled = value; } +void FullScreenBar::setEdgeTriggerEnabled(bool value) +{ + d->mEdgeTriggerEnabled = value; +} + } // namespace diff --git a/lib/fullscreenbar.h b/lib/fullscreenbar.h index 0ecaded3..721ee02b 100644 --- a/lib/fullscreenbar.h +++ b/lib/fullscreenbar.h @@ -1,70 +1,71 @@ // vim: set tabstop=4 shiftwidth=4 expandtab: /* Gwenview: an image viewer Copyright 2007 Aurélien Gâteau 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, Boston, MA 02110-1301, USA. */ #ifndef FULLSCREENBAR_H #define FULLSCREENBAR_H #include // Qt #include // KDE // Local class QEvent; namespace Gwenview { struct FullScreenBarPrivate; class GWENVIEWLIB_EXPORT FullScreenBar : public QFrame { Q_OBJECT public: FullScreenBar(QWidget* parent); ~FullScreenBar(); void setActivated(bool); void setAutoHidingEnabled(bool); + void setEdgeTriggerEnabled(bool); QSize sizeHint() const Q_DECL_OVERRIDE; public Q_SLOTS: void slideIn(); void slideOut(); private Q_SLOTS: void slotAutoHideCursorTimeout(); void moveBar(qreal); void delayedInstallEventFilter(); protected: bool eventFilter(QObject*, QEvent*) Q_DECL_OVERRIDE; private: FullScreenBarPrivate* const d; }; } // namespace #endif /* FULLSCREENBAR_H */