Commit a1bb7a21 authored by Gilles Caulier's avatar Gilles Caulier 🗼
Browse files

Manage FullScreen mode from AlbumGUI through DXmlGuiWindow

Polish API
CCBUGS: 214107
CCBUGS: 220739
CCBUGS: 289262
CCBUGS: 236234
CCBUGS: 258180
CCBUGS: 293676
parent a2c30eef
......@@ -10,7 +10,7 @@
* Copyright (C) 2006 by Tom Albers <tomalbers at kde dot nl>
* Copyright (C) 2002-2013 by Gilles Caulier <caulier dot gilles at gmail dot com>
* Copyright (C) 2009-2012 by Andi Clemens <andi dot clemens at gmail dot com>
* Copyright (C) 2013 by Michael G. Hansen <mike at mghansen dot de>
* Copyright (C) 2013 by Michael G. Hansen <mike at mghansen dot de>
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
......@@ -165,10 +165,11 @@ namespace Digikam
DigikamApp* DigikamApp::m_instance = 0;
DigikamApp::DigikamApp()
: KXmlGuiWindow(0), d(new Private)
: DXmlGuiWindow(0), d(new Private)
{
// --------------------------------------------------------
setFullScreenOptions(FS_NONE);
setXMLFile("digikamui.rc");
// --------------------------------------------------------
......@@ -1188,9 +1189,7 @@ void DigikamApp::setupActions()
// -----------------------------------------------------------
d->fullScreenAction = KStandardAction::fullScreen(0, 0, this, this);
actionCollection()->addAction("full_screen", d->fullScreenAction);
connect(d->fullScreenAction, SIGNAL(toggled(bool)), this, SLOT(slotToggleFullScreen(bool)));
createFullScreenAction("full_screen");
// -----------------------------------------------------------
......@@ -2592,7 +2591,7 @@ void DigikamApp::slotThumbSizeChanged(int size)
{
d->zoomBar->setThumbsSize(size);
if (!d->fullScreenAction->isChecked() && d->autoShowZoomToolTip)
if (!fullScreenIsActive() && d->autoShowZoomToolTip)
{
d->zoomBar->triggerZoomTrackerToolTip();
}
......@@ -2604,7 +2603,7 @@ void DigikamApp::slotZoomChanged(double zoom)
double zmax = d->view->zoomMax();
d->zoomBar->setZoom(zoom, zmin, zmax);
if (!d->fullScreenAction->isChecked() && d->autoShowZoomToolTip)
if (!fullScreenIsActive() && d->autoShowZoomToolTip)
{
d->zoomBar->triggerZoomTrackerToolTip();
}
......@@ -2914,20 +2913,6 @@ void DigikamApp::slotComponentsInfo()
showDigikamComponentsInfo();
}
void DigikamApp::showToolBars(bool show)
{
QList<KToolBar*> toolbars = toolBars();
foreach(KToolBar* toolbar, toolbars)
{
show ? toolbar->show() : toolbar->hide();
}
}
void DigikamApp::showThumbBar(bool show)
{
d->view->toggleShowBar(show);
}
void DigikamApp::setupImageTransformActions()
{
d->imageRotateActionMenu = new KActionMenu(KIcon("object-rotate-right"), i18n("Rotate"), actionCollection());
......@@ -3028,71 +3013,20 @@ void DigikamApp::rebuild()
}
}
void DigikamApp::slotToggleFullScreen(bool b)
void DigikamApp::showSideBar(bool visible)
{
KToggleFullScreenAction::setFullScreen(this, b);
static bool wasThumbBarVisible = true;
static bool wasToolbBarVisible = true;
if (!b)
{
// Switch off fullscreen
slotShowMenuBar();
statusBar()->show();
showToolBars();
KToolBar* const mainToolBar = toolBar("mainToolBar");
if (mainToolBar)
{
if (wasToolbBarVisible)
{
mainToolBar->show();
}
else
{
mainToolBar->hide();
}
}
showThumbBar(wasThumbBarVisible);
d->view->showSideBars();
}
else
{
// Switch on fullscreen
wasThumbBarVisible = d->view->isThumbBarVisible();
wasToolbBarVisible = true;
KToolBar* const mainToolBar = toolBar("mainToolBar");
if (mainToolBar)
{
wasToolbBarVisible = mainToolBar->isVisible();
}
KConfigGroup group = d->config->group("ImageViewer Settings");
bool fullScreenHideToolBar = group.readEntry("FullScreen Hide ToolBar", false);
bool fullScreenHideThumbBar = group.readEntry("FullScreenHideThumbBar", true);
menuBar()->hide();
statusBar()->hide();
if (fullScreenHideToolBar)
{
showToolBars(false);
}
visible ? d->view->showSideBars()
: d->view->hideSideBars();
}
if (fullScreenHideThumbBar)
{
showThumbBar(false);
}
void DigikamApp::showThumbBar(bool visible)
{
d->view->toggleShowBar(visible);
}
d->view->hideSideBars();
}
bool DigikamApp::thumbbarVisibility() const
{
return d->view->isThumbBarVisible();
}
} // namespace Digikam
......@@ -10,7 +10,7 @@
* Copyright (C) 2006 by Tom Albers <tomalbers at kde dot nl>
* Copyright (C) 2002-2012 by Gilles Caulier <caulier dot gilles at gmail dot com>
* Copyright (C) 2009-2011 by Andi Clemens <andi dot clemens at gmail dot com>
* Copyright (C) 2013 by Michael G. Hansen <mike at mghansen dot de>
* Copyright (C) 2013 by Michael G. Hansen <mike at mghansen dot de>
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
......@@ -37,7 +37,6 @@
// KDE includes
#include <kurl.h>
#include <kxmlguiwindow.h>
#include <kio/global.h>
#include <kio/netaccess.h>
#include <solid/solidnamespace.h>
......@@ -46,6 +45,7 @@
#include "config-digikam.h"
#include "digikam_export.h"
#include "dxmlguiwindow.h"
class KAction;
class KActionMenu;
......@@ -65,7 +65,7 @@ class ImageInfo;
class ImageInfoList;
class CameraType;
class DigikamApp : public KXmlGuiWindow
class DigikamApp : public DXmlGuiWindow
{
Q_OBJECT
......@@ -142,8 +142,9 @@ private:
void updateCameraMenu();
void updateQuickImportAction();
void initGui();
void showToolBars(bool show=true);
void showThumbBar(bool show=true);
void showThumbBar(bool visible);
void showSideBar(bool visible);
bool thumbbarVisibility() const;
private Q_SLOTS:
......@@ -189,7 +190,6 @@ private Q_SLOTS:
void slotConfToolbars();
void slotNewToolbarConfig();
void slotConfNotifications();
void slotToggleFullScreen(bool);
void slotMaintenance();
void slotMaintenanceDone();
......
......@@ -166,6 +166,8 @@ void DXmlGuiWindow::slotToggleFullScreen(bool set)
{
KToggleFullScreenAction::setFullScreen(this, set);
showCustomizedView(!set);
if (!set)
{
kDebug() << "TURN OFF fullscreen";
......@@ -418,6 +420,11 @@ void DXmlGuiWindow::showThumbBar(bool visible)
Q_UNUSED(visible);
}
void DXmlGuiWindow::showCustomizedView(bool visible)
{
Q_UNUSED(visible);
}
bool DXmlGuiWindow::thumbbarVisibility() const
{
return true;
......
......@@ -99,23 +99,28 @@ protected:
bool eventFilter(QObject* obj, QEvent* ev);
void keyPressEvent(QKeyEvent* e);
/** Re-implement this method if you want to manage sidebar visibility.in managed window
/** Re-implement this method if you want to manage sidebar visibility in full-screen mode.
* By default this method do nothing.
*/
virtual void showSideBar(bool visible);
/** Re-implement this method if you want to manage thumbbar visibility.in managed window
/** Re-implement this method if you want to manage thumbbar visibility in full-screen mode.
* By default this method do nothing.
*/
virtual void showThumbBar(bool visible);
/** Re-implement this method if you want to manage customized view visibility in full-screen mode.
* By default this method do nothing.
*/
virtual void showCustomizedView(bool visible);
/** Re-implement this method if managed window has a thumbbar. This must return visibility state of it.
*/
virtual bool thumbbarVisibility() const;
protected Q_SLOTS:
private Q_SLOTS:
virtual void slotToggleFullScreen(bool);
void slotToggleFullScreen(bool);
private:
......
......@@ -2952,33 +2952,19 @@ void EditorWindow::showSideBar(bool visible)
void EditorWindow::showThumbBar(bool visible)
{
if (visible)
{
thumbBar()->restoreVisibility();
}
else
{
thumbBar()->hide();
}
visible ? thumbBar()->restoreVisibility()
: thumbBar()->hide();
}
void EditorWindow::slotToggleFullScreen(bool b)
bool EditorWindow::thumbbarVisibility() const
{
DXmlGuiWindow::slotToggleFullScreen(b);
if (!b)
{
m_canvas->setBackgroundColor(m_bgColor);
}
else
{
m_canvas->setBackgroundColor(QColor(Qt::black));
}
return thumbBar()->isVisible();
}
bool EditorWindow::thumbbarVisibility() const
void EditorWindow::showCustomizedView(bool visible)
{
return thumbBar()->isVisible();
visible ? m_canvas->setBackgroundColor(QColor(Qt::black))
: m_canvas->setBackgroundColor(m_bgColor);
}
} // namespace Digikam
......@@ -262,8 +262,6 @@ protected Q_SLOTS:
void slotConfNotifications();
void slotNewToolbarConfig();
void slotToggleFullScreen(bool b);
void slotSelected(bool);
void slotLoadingProgress(const QString& filePath, float progress);
......@@ -331,6 +329,7 @@ private:
void quitWaitingLoop();
void showSideBar(bool visible);
void showThumbBar(bool visible);
void showCustomizedView(bool visible);
bool thumbbarVisibility() const;
void setColorManagedViewIndicatorToolTip(bool available, bool cmv);
void setUnderExposureToolTip(bool uei);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment