Commit 3f162a3c authored by Stuart Dickson's avatar Stuart Dickson

gemini: Add "fullscreen" option

Conflicts:

	krita/gemini/MainWindow.cpp
	krita/gemini/desktopviewproxy.cpp
	krita/gemini/desktopviewproxy.h
	krita/gemini/main.cpp
parent f42c8fa5
......@@ -98,6 +98,7 @@ public:
, sketchKisView(0)
, desktopKisView(0)
, desktopViewProxy(0)
, forceFullScreen(false)
, forceDesktop(false)
, forceSketch(false)
, temporaryFile(false)
......@@ -129,6 +130,7 @@ public:
KisView2* desktopKisView;
DesktopViewProxy* desktopViewProxy;
bool forceFullScreen;
bool forceDesktop;
bool forceSketch;
bool temporaryFile;
......@@ -393,7 +395,9 @@ void MainWindow::switchToDesktop(bool justLoaded)
setCentralWidget(d->desktopView);
}
setWindowState(windowState() & ~Qt::WindowFullScreen);
if (!d->forceFullScreen) {
setWindowState(windowState() & ~Qt::WindowFullScreen);
}
if (view) {
//Notify the new view that we just switched to it, passing our synchronisation object
......@@ -462,6 +466,7 @@ void MainWindow::documentChanged()
factory->removeClient(d->desktopKisView);
factory->addClient(d->desktopKisView);
d->desktopViewProxy->documentChanged();
connect(d->desktopKisView, SIGNAL(sigLoadingFinished()), d->centerer, SLOT(start()));
connect(d->desktopKisView, SIGNAL(sigSavingFinished()), this, SLOT(resetWindowTitle()));
connect(d->desktopKisView->canvasBase()->resourceManager(), SIGNAL(canvasResourceChanged(int, const QVariant&)),
......@@ -730,4 +735,13 @@ void MainWindow::cloneResources(KisCanvasResourceProvider *from, KisCanvasResour
}
bool MainWindow::forceFullScreen() {
return d->forceFullScreen;
}
void MainWindow::forceFullScreen(bool newValue)
{
d->forceFullScreen = newValue;
}
#include "MainWindow.moc"
......@@ -59,6 +59,8 @@ public:
virtual void closeEvent(QCloseEvent* event);
bool forceFullScreen();
void forceFullScreen(bool newValue);
public Q_SLOTS:
void minimize();
void closeWindow();
......
......@@ -42,6 +42,7 @@
#include <sketch/DocumentManager.h>
#include <sketch/RecentFileManager.h>
#include <sketch/Settings.h>
#include <kis_config.h>
#include <kis_doc2.h>
#include <kis_view2.h>
......@@ -177,4 +178,47 @@ void DesktopViewProxy::slotFileOpenRecent(const KUrl& url)
QProcess::startDetached(qApp->applicationFilePath(), QStringList() << url.toLocalFile(), QDir::currentPath());
}
/**
* @brief Override to allow for full-screen support with Canvas-mode
*
* The basic behaviour of the KisView2 is to check the KoConfig and
* to adjust the main window appropriately. If "hideTitlebar" is set
* true, then it switches the window between windowed and full-screen.
* To prevent it leaving the full-screen mode, we set the mode to false
*
* @param toggled
*/
void DesktopViewProxy::toggleShowJustTheCanvas(bool toggled)
{
KisView2* kisView = qobject_cast<KisView2*>(d->desktopView->rootView());
if(toggled) {
kisView->showJustTheCanvas(toggled);
}
else {
KisConfig cfg;
bool fullScreen = d->mainWindow->forceFullScreen();
bool hideTitlebar = cfg.hideTitlebarFullscreen();
if (fullScreen) {
cfg.setHideTitlebarFullscreen(false);
}
kisView->showJustTheCanvas(toggled);
if (fullScreen) {
cfg.setHideTitlebarFullscreen(hideTitlebar);
}
}
}
void DesktopViewProxy::documentChanged()
{
// Remove existing linking for toggling canvas, in order
// to over-ride the window state behaviour
KisView2* view = qobject_cast<KisView2*>(d->desktopView->rootView());
QAction* toggleJustTheCanvasAction = view->actionCollection()->action("view_show_just_the_canvas");
toggleJustTheCanvasAction->disconnect(view);
connect(toggleJustTheCanvasAction, SIGNAL(toggled(bool)), this, SLOT(toggleShowJustTheCanvas(bool)));
}
#include "desktopviewproxy.moc"
......@@ -36,6 +36,8 @@ public:
virtual ~DesktopViewProxy();
public Q_SLOTS:
void documentChanged();
void fileNew();
void fileOpen();
void fileSave();
......@@ -44,6 +46,8 @@ public Q_SLOTS:
void loadExistingAsNew();
void slotFileOpenRecent(const KUrl &url);
void toggleShowJustTheCanvas(bool toggled);
Q_SIGNALS:
void documentSaved();
......
......@@ -81,6 +81,7 @@ int main( int argc, char** argv )
KCmdLineOptions options;
options.add( "+[files]", ki18n( "Images to open" ) );
options.add( "vkb", ki18n( "Use the virtual keyboard" ) );
options.add( "fullscreen", ki18n( "Use full-screen display" ) );
KCmdLineArgs::addCmdLineOptions( options );
KCmdLineArgs* args = KCmdLineArgs::parsedArgs();
......@@ -146,14 +147,22 @@ int main( int argc, char** argv )
qobject_cast<QApplication*>(QApplication::instance())->setStyle("Oxygen");
}
bool showFullscreen = false;
if (args->isSet("fullscreen")) {
showFullscreen = true;
}
// then create the pixmap from an xpm: we cannot get the
// location of our datadir before we've started our components,
// so use an xpm.
// If fullscreen, hide splash screen
QPixmap pm(splash_screen_xpm);
QSplashScreen splash(pm);
splash.show();
splash.showMessage(".");
app.processEvents();
if (!showFullscreen) {
splash.show();
splash.showMessage(".");
app.processEvents();
}
#if defined Q_WS_X11 && QT_VERSION >= 0x040800
QApplication::setAttribute(Qt::AA_X11InitThreads);
......@@ -165,11 +174,15 @@ int main( int argc, char** argv )
app.setInputContext(new SketchInputContext(&app));
}
if (showFullscreen) {
window.showFullScreen();
} else {
#ifdef Q_OS_WIN
window.showMaximized();
window.showMaximized();
#else
window.show();
window.show();
#endif
}
splash.finish(&window);
return app.exec();
......
......@@ -198,6 +198,7 @@ public slots:
void slotLoadingFinished();
void slotSavingFinished();
void showJustTheCanvas(bool toggled);
signals:
......@@ -217,7 +218,6 @@ private slots:
void slotSaveIncremental();
void slotSaveIncrementalBackup();
void showStatusBar(bool toggled);
void showJustTheCanvas(bool toggled);
void showHideScrollbars();
void toggleTabletLogger();
void openResourcesDirectory();
......
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