Commit 392c928c authored by Gilles Caulier's avatar Gilles Caulier 🗼
Browse files

Manage FullScreen mode from ImportUI through DXmlGuiWindow

Polish API
CCBUGS: 214107
CCBUGS: 220739
CCBUGS: 289262
CCBUGS: 236234
CCBUGS: 258180
CCBUGS: 293676
parent a1bb7a21
......@@ -306,6 +306,9 @@ DigikamApp::DigikamApp()
DigikamApp::~DigikamApp()
{
KConfigGroup group = AlbumSettings::instance()->defaultConfigGroup();
saveFullScreenSettings(group);
ProgressManager::instance()->slotAbortAll();
ImageAttributesWatch::shutDown();
......@@ -415,6 +418,10 @@ void DigikamApp::show()
}
}
// Restore full screen Mode
KConfigGroup group = AlbumSettings::instance()->defaultConfigGroup();
readFullScreenSettings(group);
// Init album icon view zoom factor.
slotThumbSizeChanged(AlbumSettings::instance()->getDefaultIconSize());
slotZoomSliderChanged(AlbumSettings::instance()->getDefaultIconSize());
......
......@@ -61,7 +61,6 @@
class KToolBarPopupAction;
class KToggleAction;
class KActionMenu;
class KToggleFullScreenAction;
namespace Digikam
{
......@@ -144,7 +143,6 @@ public:
selectAllAction(0),
selectNoneAction(0),
selectInvertAction(0),
fullScreenAction(0),
zoomPlusAction(0),
zoomMinusAction(0),
zoomFitToWindowAction(0),
......@@ -163,7 +161,7 @@ public:
slideShowRecursiveAction(0),
bqmAction(0),
maintenanceAction(0),
slideShowQmlAction(0),
slideShowQmlAction(0),
#ifdef USE_SCRIPT_IFACE
scriptConsoleAction(0),
#endif
......@@ -269,7 +267,6 @@ public:
KAction* selectInvertAction;
// View Actions
KToggleFullScreenAction* fullScreenAction;
KAction* zoomPlusAction;
KAction* zoomMinusAction;
KAction* zoomFitToWindowAction;
......@@ -290,7 +287,7 @@ public:
KAction* slideShowRecursiveAction;
KAction* bqmAction;
KAction* maintenanceAction;
KAction* slideShowQmlAction;
KAction* slideShowQmlAction;
#ifdef USE_SCRIPT_IFACE
KAction* scriptConsoleAction;
......
......@@ -139,9 +139,10 @@ ImportUI* ImportUI::m_instance = 0;
ImportUI::ImportUI(QWidget* const parent, const QString& cameraTitle,
const QString& model, const QString& port,
const QString& path, int startIndex)
: KXmlGuiWindow(parent), d(new Private)
: DXmlGuiWindow(parent), d(new Private)
{
setXMLFile("importui.rc");
setFullScreenOptions(FS_NONE);
// --------------------------------------------------------
......@@ -557,9 +558,7 @@ void ImportUI::setupActions()
// ------------------------------------------------------------------------------------------------
d->fullScreenAction = KStandardAction::fullScreen(0, 0, this, this);
actionCollection()->addAction("importui_fullscreen", d->fullScreenAction);
connect(d->fullScreenAction, SIGNAL(toggled(bool)), this, SLOT(slotToggleFullScreen(bool)));
createFullScreenAction("importui_fullscreen");
d->showLogAction = new KToggleAction(KIcon("view-history"), i18n("Show History"), this);
d->showLogAction->setShortcut(KShortcut(Qt::CTRL + Qt::Key_H));
......@@ -832,6 +831,8 @@ void ImportUI::readSettings()
KSharedConfig::Ptr config = KGlobal::config();
KConfigGroup group = config->group(d->configGroupName);
readFullScreenSettings(group);
d->showBarAction->setChecked(ImportSettings::instance()->getShowThumbbar());
d->showLogAction->setChecked(group.readEntry("ShowLog", false));
d->albumCustomizer->readSettings(group);
......@@ -870,6 +871,8 @@ void ImportUI::saveSettings()
d->rightSideBar->saveState();
d->splitter->saveState(group);
//d->filterComboBox->saveSettings();
saveFullScreenSettings(group);
config->sync();
}
......@@ -1151,7 +1154,7 @@ void ImportUI::slotZoomChanged(double zoom)
double zmax = d->view->zoomMax();
d->zoomBar->setZoom(zoom, zmin, zmax);
if (!d->fullScreenAction->isChecked())
if (!fullScreenIsActive())
{
d->zoomBar->triggerZoomTrackerToolTip();
}
......@@ -1161,7 +1164,7 @@ void ImportUI::slotThumbSizeChanged(int size)
{
d->zoomBar->setThumbsSize(size);
if (!d->fullScreenAction->isChecked())
if (!fullScreenIsActive())
{
d->zoomBar->triggerZoomTrackerToolTip();
}
......@@ -2480,24 +2483,6 @@ void ImportUI::slotSetup()
Setup::exec(this);
}
void ImportUI::showToolBars()
{
QList<KToolBar*> toolbars = toolBars();
foreach(KToolBar* const toolbar, toolbars)
{
toolbar->show();
}
}
void ImportUI::hideToolBars()
{
QList<KToolBar*> toolbars = toolBars();
foreach(KToolBar* const toolbar, toolbars)
{
toolbar->hide();
}
}
void ImportUI::slotCameraFreeSpaceInfo(unsigned long kBSize, unsigned long kBAvail)
{
d->cameraFreeSpace->addInformation(kBSize, kBSize - kBAvail, kBAvail, QString());
......@@ -2555,7 +2540,7 @@ void ImportUI::slotCollectionLocationStatusChanged(const CollectionLocation&, in
void ImportUI::slotToggleShowBar()
{
d->view->toggleShowBar(d->showBarAction->isChecked());
showThumbBar(d->showBarAction->isChecked());
}
void ImportUI::slotShowMenuBar()
......@@ -2591,87 +2576,20 @@ void ImportUI::slotHistoryEntryClicked(const QVariant& metadata)
d->view->scrollTo(folder, file);
}
void ImportUI::slotToggleFullScreen(bool b)
void ImportUI::showSideBar(bool visible)
{
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;
}
}
}
d->rightSideBar->restore();
}
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;
}
}
visible ? d->rightSideBar->restore()
: d->rightSideBar->backup();
}
d->rightSideBar->backup();
}
void ImportUI::showThumbBar(bool visible)
{
d->view->toggleShowBar(visible);
}
void ImportUI::slotEscapePressed()
bool ImportUI::thumbbarVisibility() const
{
if (d->fullScreenAction->isChecked())
{
d->fullScreenAction->activate(QAction::Trigger);
}
return d->view->isThumbBarVisible();
}
} // namespace Digikam
......@@ -38,7 +38,6 @@
// KDE includes
#include <kxmlguiwindow.h>
#include <kurl.h>
// Local includes
......@@ -50,6 +49,7 @@
#include "downloadsettings.h"
#include "importiconview.h"
#include "importview.h"
#include "dxmlguiwindow.h"
namespace Digikam
{
......@@ -59,7 +59,7 @@ class CollectionLocation;
class CameraHistoryUpdater;
class ImportIconView;
class ImportUI : public KXmlGuiWindow
class ImportUI : public DXmlGuiWindow
{
Q_OBJECT
......@@ -123,8 +123,6 @@ private:
bool dialogClosed();
void finishDialog();
void showToolBars();
void hideToolBars();
void refreshFreeSpace();
void refreshCollectionFreeSpace();
void deleteItems(bool onlySelected, bool onlyDownloaded);
......@@ -146,6 +144,10 @@ private:
bool createDateBasedSubAlbum(KUrl &downloadUrl, const CamItemInfo& info);
bool createExtBasedSubAlbum(KUrl &downloadUrl, const CamItemInfo& info);
void showThumbBar(bool visible);
void showSideBar(bool visible);
bool thumbbarVisibility() const;
private Q_SLOTS:
void slotClose();
......@@ -172,9 +174,6 @@ private Q_SLOTS:
void slotZoomChanged(double zoom);
void slotThumbSizeChanged(int size);
void slotToggleFullScreen(bool);
void slotEscapePressed();
void slotUpload();
void slotDownloadNew();
......
......@@ -63,8 +63,6 @@
#include "statusprogressbar.h"
#include "importview.h"
class KToggleFullScreenAction;
using namespace KDcrawIface;
namespace Digikam
......@@ -78,8 +76,6 @@ public:
deleteAfter(false),
busy(false),
closed(false),
removeFullScreenButton(false),
fullScreenHideToolBar(false),
downloadMenu(0),
deleteMenu(0),
imageMenu(0),
......@@ -99,7 +95,6 @@ public:
downloadDelNewAction(0),
downloadDelAllAction(0),
downloadDelSelectedAction(0),
fullScreenAction(0),
libsInfoAction(0),
dbStatAction(0),
lockAction(0),
......@@ -150,8 +145,6 @@ public:
bool deleteAfter;
bool busy;
bool closed;
bool removeFullScreenButton;
bool fullScreenHideToolBar;
QString cameraTitle;
......@@ -182,7 +175,6 @@ public:
KAction* downloadDelNewAction;
KAction* downloadDelAllAction;
KAction* downloadDelSelectedAction;
KToggleFullScreenAction* fullScreenAction;
KAction* libsInfoAction;
KAction* dbStatAction;
KAction* lockAction;
......
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