on xenial help sign in
Fixes for dash as app

Load i18n catalog Process command line options Add the posibility to have a mouse touch adaptor

commitf60bab34e926fdbd87e6d80be36f1438950e3286 authorAlbert Astals <albert.astals@canonical.com> dateWed 6 Aug 2014, 10:31 (12 years ago) parent8e45b88
3 files changed+31
qml/Dash/DashApplication.qml+6 src/Dash/CMakeLists.txt+1 src/Dash/main.cpp+24
qml/Dash/DashApplication.qml+6
@@ -23,6 +23,12 @@ MainView {
2323
2424 useDeprecatedToolbar: false
2525
26+ Binding {
27+ target: i18n
28+ property: "domain"
29+ value: "unity8"
30+ }
31+
2632 Dash {
2733 anchors.fill: parent
2834 }
src/Dash/CMakeLists.txt+1
@@ -1,5 +1,6 @@
11set(DASH_SRCS
22 main.cpp
3+ ../MouseTouchAdaptor.cpp
34)
45
56add_executable(unity8-dash ${DASH_SRCS})
src/Dash/main.cpp+24
@@ -26,6 +26,7 @@
2626#include <QLibrary>
2727
2828#include <paths.h>
29+#include "../MouseTouchAdaptor.h"
2930
3031int main(int argc, const char *argv[])
3132{
@@ -35,10 +36,23 @@ int main(int argc, const char *argv[])
3536 parser.setApplicationDescription("Description: Unity 8 Shell Dash");
3637 parser.addHelpOption();
3738
39+ QCommandLineOption mousetouchOption("mousetouch",
40+ "Allow the mouse to provide touch input");
41+ parser.addOption(mousetouchOption);
42+
3843 QCommandLineOption testabilityOption("testability",
3944 "Load the testability driver (Alternatively export QT_LOAD_TESTABILITY");
4045 parser.addOption(testabilityOption);
4146
47+ QCommandLineOption desktopFileHintOption("desktop_file_hint",
48+ "The desktop_file_hint option for QtMir", "hint_file");
49+ parser.addOption(desktopFileHintOption);
50+
51+ // Treat args with single dashes the same as arguments with two dashes
52+ // Ex: -fullscreen == --fullscreen
53+ parser.setSingleDashWordOptionMode(QCommandLineParser::ParseAsLongOptions);
54+ parser.process(*application);
55+
4256 if (parser.isSet(testabilityOption) || getenv("QT_LOAD_TESTABILITY")) {
4357 QLibrary testLib(QLatin1String("qttestability"));
4458 if (testLib.load()) {
@@ -54,10 +68,20 @@ int main(int argc, const char *argv[])
5468 }
5569 }
5670
71+ bindtextdomain("unity8", translationDirectory().toUtf8().data());
72+
5773 QQuickView* view = new QQuickView();
5874 view->setResizeMode(QQuickView::SizeRootObjectToView);
5975 view->setTitle("Unity Dash");
6076
77+ // You will need this if you want to interact with touch-only components using a mouse
78+ // Needed only when manually testing on a desktop.
79+ MouseTouchAdaptor *mouseTouchAdaptor = 0;
80+ if (parser.isSet(mousetouchOption)) {
81+ mouseTouchAdaptor = new MouseTouchAdaptor;
82+ application->installNativeEventFilter(mouseTouchAdaptor);
83+ }
84+
6185 QUrl source(::qmlDirectory()+"Dash/DashApplication.qml");
6286 prependImportPaths(view->engine(), ::overrideImportPaths());
6387 appendImportPaths(view->engine(), ::fallbackImportPaths());