Allow passing default main views via cmdline
This commit is contained in:
parent
66cee1eb09
commit
cf45517adb
@ -100,6 +100,8 @@ int main(int argc, char *argv[])
|
|||||||
defaultStyleOption.setDefaultValue("light");
|
defaultStyleOption.setDefaultValue("light");
|
||||||
parser.addOption(defaultStyleOption);
|
parser.addOption(defaultStyleOption);
|
||||||
#endif
|
#endif
|
||||||
|
QCommandLineOption defaultViewsOption = QCommandLineOption({"v", "default-views"}, "The main views enabled by default if there is no configuration done by the user and the style doesn't dictate them, comma separated.", "mainviews");
|
||||||
|
parser.addOption(defaultViewsOption);
|
||||||
QCommandLineOption kioskOption = QCommandLineOption({"k", "kiosk"}, "Start the application in kiosk mode.");
|
QCommandLineOption kioskOption = QCommandLineOption({"k", "kiosk"}, "Start the application in kiosk mode.");
|
||||||
parser.addOption(kioskOption);
|
parser.addOption(kioskOption);
|
||||||
parser.process(application);
|
parser.process(application);
|
||||||
@ -165,6 +167,7 @@ int main(int argc, char *argv[])
|
|||||||
engine->rootContext()->setContextProperty("qtBuildVersion", QT_VERSION_STR);
|
engine->rootContext()->setContextProperty("qtBuildVersion", QT_VERSION_STR);
|
||||||
engine->rootContext()->setContextProperty("qtVersion", qVersion());
|
engine->rootContext()->setContextProperty("qtVersion", qVersion());
|
||||||
|
|
||||||
|
engine->rootContext()->setContextProperty("defaultMainViewFilter", parser.value(defaultViewsOption));
|
||||||
engine->rootContext()->setContextProperty("kioskMode", parser.isSet(kioskOption));
|
engine->rootContext()->setContextProperty("kioskMode", parser.isSet(kioskOption));
|
||||||
engine->rootContext()->setContextProperty("autoConnectHost", parser.value(connectOption));
|
engine->rootContext()->setContextProperty("autoConnectHost", parser.value(connectOption));
|
||||||
|
|
||||||
|
|||||||
@ -94,7 +94,16 @@ Page {
|
|||||||
category: engine.jsonRpcClient.currentHost.uuid
|
category: engine.jsonRpcClient.currentHost.uuid
|
||||||
property string mainMenuContent: ""
|
property string mainMenuContent: ""
|
||||||
property var sortOrder: []
|
property var sortOrder: []
|
||||||
property var filterList: app.hasOwnProperty("mainViewsFilter") ? app.mainViewsFilter : ["things"]
|
// Priority for main view config:
|
||||||
|
// 1. Settings made by the user
|
||||||
|
// 2. Style mainViewsFilter as that comes with branding (for now, if a style defines main views, all of them are active by default)
|
||||||
|
// 3. Command line args
|
||||||
|
// 4. Just show "things" alone by default
|
||||||
|
property var filterList: app.hasOwnProperty("mainViewsFilter") ?
|
||||||
|
app.mainViewsFilter
|
||||||
|
: defaultMainViewFilter.length > 0 ?
|
||||||
|
defaultMainViewFilter.split(',')
|
||||||
|
: ["things"]
|
||||||
property int currentIndex: 0
|
property int currentIndex: 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user