add --windowed option

if passed the destop view is windowed no matter what. probably useful
only in the early stages of development
This commit is contained in:
Marco Martin 2013-09-13 18:34:21 +02:00
parent cb1064fd32
commit ee510e5fca
4 changed files with 16 additions and 2 deletions

View File

@ -18,6 +18,7 @@
#include "desktopview.h"
#include "shellcorona.h"
#include "shellmanager.h"
#include <QQmlEngine>
#include <QQmlContext>
@ -48,7 +49,7 @@ bool DesktopView::stayBehind() const
void DesktopView::setStayBehind(bool stayBehind)
{
if (stayBehind == m_stayBehind) {
if (ShellManager::s_forceWindowed || stayBehind == m_stayBehind) {
return;
}
@ -69,7 +70,7 @@ bool DesktopView::fillScreen() const
void DesktopView::setFillScreen(bool fillScreen)
{
if (fillScreen == m_fillScreen) {
if (ShellManager::s_forceWindowed || fillScreen == m_fillScreen) {
return;
}

View File

@ -24,6 +24,7 @@
#include "shellmanager.h"
#include <QtQml/QQmlDebuggingEnabler>
#include <QDebug>
static const char description[] = "Plasma Shell";
static const char version[] = "2.0";
@ -38,9 +39,13 @@ int main(int argc, char** argv)
QCommandLineOption dbg = QCommandLineOption(QStringList() << QStringLiteral("d") << QStringLiteral("qmljsdebugger"),
QStringLiteral("Enable QML Javascript debugger"));
QCommandLineOption windowed = QCommandLineOption(QStringList() << QStringLiteral("w") << QStringLiteral("windowed"),
QStringLiteral("force a windowed view for desktop purposes"));
parser.addVersionOption();
parser.setApplicationDescription(description);
parser.addOption(dbg);
parser.addOption(windowed);
parser.process(app);
//enable the QML debugger only if --qmljsdebugger (or -d) is passed as a command line arg
@ -58,6 +63,8 @@ int main(int argc, char** argv)
// corona->processUpdateScripts();
// corona->checkScreens();
ShellManager::s_forceWindowed = parser.isSet(windowed);
ShellManager::instance();
return app.exec();

View File

@ -36,6 +36,8 @@ static const QString s_shellsDir(
QString(CMAKE_INSTALL_PREFIX) + "/" + DATA_INSTALL_DIR + "/" + "plasma/shells/");
static const QString s_shellLoaderPath = QString("/contents/loader.qml");
bool ShellManager::s_forceWindowed = false;
//
// ShellManager
//

View File

@ -22,6 +22,8 @@
#include <QObject>
class ShellManager: public QObject {
Q_OBJECT
public:
@ -30,6 +32,8 @@ public:
void loadHandlers();
static bool s_forceWindowed;
protected Q_SLOTS:
void registerHandler(QObject * handler);
void deregisterHandler(QObject * handler);