Commit 4b034a23 authored by Gilles Caulier's avatar Gilles Caulier 🗼
Browse files

Port fullscreen mode from Batch Queue Manager to FullScreenMngr.

CCBUGS: 214107
CCBUGS: 220739
CCBUGS: 289262
CCBUGS: 236234
CCBUGS: 258180
CCBUGS: 293676
parent cde52bd9
......@@ -44,10 +44,13 @@ class KToggleFullScreenAction;
namespace Digikam
{
/** Optional parts which can be hiddedn or not from managed window configuration panel
*/
enum FullScreenOptions
{
FS_TOOLBAR = 0x00000001,
FS_THUMBBAR = 0x00000002,
FS_NONE = 0x00000004,
FS_DEFAULT = FS_TOOLBAR | FS_THUMBBAR // Image Editor config.
};
......
......@@ -141,6 +141,11 @@ QueueMgrWindow::QueueMgrWindow()
// We don't want to be deleted on close
setAttribute(Qt::WA_DeleteOnClose, false);
// --------------------------------------------------------
d->fullScreenMngr = new FullScreenMngr(FS_NONE);
d->fullScreenMngr->setManagedWindow(this);
// -- Build the GUI -------------------------------
setupUserArea();
......@@ -165,6 +170,7 @@ QueueMgrWindow::QueueMgrWindow()
QueueMgrWindow::~QueueMgrWindow()
{
m_instance = 0;
delete d->fullScreenMngr;
delete d;
}
......@@ -412,9 +418,8 @@ void QueueMgrWindow::setupActions()
// -- Standard 'View' menu actions ---------------------------------------------
d->fullScreenAction = KStandardAction::fullScreen(0, 0, this, this);
actionCollection()->addAction("queuemgr_fullscreen", d->fullScreenAction);
connect(d->fullScreenAction, SIGNAL(toggled(bool)), this, SLOT(slotToggleFullScreen(bool)));
QAction* const fullScreenAction = d->fullScreenMngr->createFullScreenAction("queuemgr_fullscreen");
connect(fullScreenAction, SIGNAL(toggled(bool)), this, SLOT(slotToggleFullScreen(bool)));
// -- Standard 'Configure' menu actions ----------------------------------------
......@@ -470,10 +475,10 @@ void QueueMgrWindow::readSettings()
KConfigGroup group = config->group("Batch Queue Manager Settings");
d->verticalSplitter->restoreState(group, d->VERTICAL_SPLITTER_CONFIG_KEY);
d->bottomSplitter->restoreState(group, d->BOTTOM_SPLITTER_CONFIG_KEY);
d->topSplitter->restoreState(group, d->TOP_SPLITTER_CONFIG_KEY);
d->bottomSplitter->restoreState(group, d->BOTTOM_SPLITTER_CONFIG_KEY);
d->topSplitter->restoreState(group, d->TOP_SPLITTER_CONFIG_KEY);
// TODO
d->fullScreenMngr->readSettings(group);
}
void QueueMgrWindow::writeSettings()
......@@ -481,11 +486,12 @@ void QueueMgrWindow::writeSettings()
KSharedConfig::Ptr config = KGlobal::config();
KConfigGroup group = config->group("Batch Queue Manager Settings");
d->topSplitter->saveState(group, d->TOP_SPLITTER_CONFIG_KEY);
d->bottomSplitter->saveState(group, d->BOTTOM_SPLITTER_CONFIG_KEY);
d->topSplitter->saveState(group, d->TOP_SPLITTER_CONFIG_KEY);
d->bottomSplitter->saveState(group, d->BOTTOM_SPLITTER_CONFIG_KEY);
d->verticalSplitter->saveState(group, d->VERTICAL_SPLITTER_CONFIG_KEY);
// TODO
d->fullScreenMngr->saveSettings(group);
config->sync();
}
......@@ -498,6 +504,10 @@ void QueueMgrWindow::applySettings()
}
d->queuePool->applySettings();
KSharedConfig::Ptr config = KGlobal::config();
KConfigGroup group = config->group("Batch Queue Manager Settings");
d->fullScreenMngr->readSettings(group);
}
void QueueMgrWindow::refreshStatusBar()
......@@ -1082,80 +1092,14 @@ void QueueMgrWindow::slotSaveWorkflow()
void QueueMgrWindow::slotToggleFullScreen(bool b)
{
KToggleFullScreenAction::setFullScreen(this, b);
if (!b)
{
// Switch off fullscreen
slotShowMenuBar();
statusBar()->show();
showToolBars();
if (d->removeFullScreenButton)
{
QList<KToolBar*> toolbars = toolBars();
foreach(KToolBar* const toolbar, toolbars)
{
// name is set in ui.rc XML file
if (toolbar->objectName() == "ToolBar")
{
toolbar->removeAction(d->fullScreenAction);
break;
}
}
}
}
else
{
// Switch on fullscreen
// hide the menubar and the statusbar
menuBar()->hide();
statusBar()->hide();
if (d->fullScreenHideToolBar)
{
hideToolBars();
}
else
{
showToolBars();
QList<KToolBar*> toolbars = toolBars();
KToolBar* mainToolbar = 0;
foreach(KToolBar* const toolbar, toolbars)
{
if (toolbar->objectName() == "ToolBar")
{
mainToolbar = toolbar;
break;
}
}
// add fullscreen action if necessary
if (mainToolbar && !mainToolbar->actions().contains(d->fullScreenAction))
{
mainToolbar->addAction(d->fullScreenAction);
d->removeFullScreenButton = true;
}
else
{
// If FullScreen button is enabled in toolbar settings,
// we shall not remove it when leaving of fullscreen mode.
d->removeFullScreenButton = false;
}
}
}
d->fullScreenMngr->switchWindowToFullScreen(b);
}
void QueueMgrWindow::slotEscapePressed()
void QueueMgrWindow::keyPressEvent(QKeyEvent* e)
{
if (d->fullScreenAction->isChecked())
if (e->key() == Qt::Key_Escape)
{
d->fullScreenAction->activate(QAction::Trigger);
d->fullScreenMngr->escapePressed();
}
}
......
......@@ -86,6 +86,7 @@ Q_SIGNALS:
protected:
void moveEvent(QMoveEvent* e);
void keyPressEvent(QKeyEvent* e);
public Q_SLOTS:
......@@ -119,7 +120,6 @@ private:
private Q_SLOTS:
void slotToggleFullScreen(bool);
void slotEscapePressed();
void slotEditKeys();
void slotShowMenuBar();
void slotConfToolbars();
......
......@@ -49,8 +49,7 @@
#include "sidebar.h"
#include "toolsettingsview.h"
#include "toolsview.h"
class KToggleFullScreenAction;
#include "fullscreenmngr.h"
namespace Digikam
{
......@@ -67,8 +66,6 @@ public:
BOTTOM_SPLITTER_CONFIG_KEY("BqmBottomSplitter"),
VERTICAL_SPLITTER_CONFIG_KEY("BqmVerticalSplitter")
{
fullScreenHideToolBar = false;
removeFullScreenButton = false;
busy = false;
clearQueueAction = 0;
moveUpToolAction = 0;
......@@ -77,7 +74,6 @@ public:
removeItemsSelAction = 0;
removeItemsDoneAction = 0;
clearToolsAction = 0;
fullScreenAction = 0;
donateMoneyAction = 0;
statusProgressBar = 0;
statusLabel = 0;
......@@ -103,11 +99,10 @@ public:
thread = 0;
animLogo = 0;
about = 0;
fullScreenMngr = 0;
currentQueueToProcess = 0;
}
bool fullScreenHideToolBar;
bool removeFullScreenButton;
bool busy;
int currentQueueToProcess;
......@@ -122,7 +117,6 @@ public:
QAction* removeToolAction;
QAction* clearToolsAction;
KToggleFullScreenAction* fullScreenAction;
KAction* runAction;
KAction* stopAction;
KAction* removeQueueAction;
......@@ -156,6 +150,8 @@ public:
DAboutData* about;
FullScreenMngr* fullScreenMngr;
const QString TOP_SPLITTER_CONFIG_KEY;
const QString BOTTOM_SPLITTER_CONFIG_KEY;
const QString VERTICAL_SPLITTER_CONFIG_KEY;
......
Markdown is supported
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