on xenial help sign in
Added geometry to indicators client setup
d147b7fNick Dedekind
src/Panel/Indicators/client/indicatorsclient.cpp+20−10
@@ -56,6 +56,26 @@ IndicatorsClient::IndicatorsClient(int &argc, char **argv)
56 m_view(0)
56 m_view(0)
57{
57{
58 m_application = new QApplication(argc, argv);
58 m_application = new QApplication(argc, argv);
59+ QStringList args = m_application->arguments();
60+
61+ m_view = new QQuickView;
62+ m_view->engine()->setBaseUrl(QUrl::fromLocalFile(::shellAppDirectory()+"Panel/Indicators/client/"));
63+ prependImportPaths(m_view->engine(), ::overrideImportPaths());
64+ appendImportPaths(m_view->engine(), ::fallbackImportPaths());
65+
66+ m_view->setSource(QUrl("IndicatorsClient.qml"));
67+ m_view->setResizeMode(QQuickView::SizeRootObjectToView);
68+
69+ if (args.contains(QLatin1String("-geometry")) && args.size() > args.indexOf(QLatin1String("-geometry")) + 1) {
70+ QStringList geometryArg = args.at(args.indexOf(QLatin1String("-geometry")) + 1).split('x');
71+ if (geometryArg.size() == 2) {
72+ m_view->resize(geometryArg.at(0).toInt(), geometryArg.at(1).toInt());
73+ }
74+ }
75+ else {
76+ //Usable size on desktop
77+ m_view->setMinimumSize(QSize(480, 720));
78+ }
59}
79}
60
80
61IndicatorsClient::~IndicatorsClient()
81IndicatorsClient::~IndicatorsClient()
@@ -69,21 +89,11 @@ IndicatorsClient::~IndicatorsClient()
69
89
70void IndicatorsClient::setupUI()
90void IndicatorsClient::setupUI()
71{
91{
72− m_view = new QQuickView;
73− m_view->engine()->setBaseUrl(QUrl::fromLocalFile(::shellAppDirectory()+"Panel/Indicators/client/"));
74− prependImportPaths(m_view->engine(), ::overrideImportPaths());
75− appendImportPaths(m_view->engine(), ::fallbackImportPaths());
76−
77− m_view->setSource(QUrl("IndicatorsClient.qml"));
78− m_view->setResizeMode(QQuickView::SizeRootObjectToView);
79
92
80− //Usable size on desktop
81− m_view->setMinimumSize(QSize(480, 720));
82}
93}
83
94
84int IndicatorsClient::run()
95int IndicatorsClient::run()
85{
96{
86− setupUI();
87 m_view->show();
97 m_view->show();
88 return m_application->exec();
98 return m_application->exec();
89}
99}
tests/autopilot/indicators_client/tests/__init__.py+15−7
@@ -38,19 +38,27 @@ class IndicatorsTestCase(AutopilotTestCase):
38 ('with touch', dict(input_device_class=Touch)),
38 ('with touch', dict(input_device_class=Touch)),
39 ]
39 ]
40
40
41− def setUp(self):
41+ def setUp(self, geometry):
42 self.pointing_device = Pointer(self.input_device_class.create())
42 self.pointing_device = Pointer(self.input_device_class.create())
43 super(IndicatorsTestCase, self).setUp()
43 super(IndicatorsTestCase, self).setUp()
44 if os.path.realpath(__file__).startswith("/usr/"):
44 if os.path.realpath(__file__).startswith("/usr/"):
45− self.launch_test_installed()
45+ self.launch_test_installed(geometry)
46 else:
46 else:
47− self.launch_test_local()
47+ self.launch_test_local(geometry)
48
48
49− def launch_test_local(self):
49+ def launch_test_local(self,geometry):
50+ if geometry != "0x0":
50− self.app = self.launch_test_application("../../builddir/src/Panel/Indicators/client/indicators-client", app_type='qt')
51+ self.app = self.launch_test_application("../../builddir/src/Panel/Indicators/client/indicators-client",
52+ "-geometry", geometry, app_type='qt')
53+ else:
54+ self.app = self.launch_test_application("../../builddir/src/Panel/Indicators/client/indicators-client",
55+ app_type='qt')
51
56
52− def launch_test_installed(self):
57+ def launch_test_installed(self, geometry):
58+ if geometry != "0x0":
59+ self.app = self.launch_test_application("indicators-client", "-geometry", geometry, app_type='qt')
60+ else:
53− self.app = self.launch_test_application("indicators-client", app_type='qt')
61+ self.app = self.launch_test_application("indicators-client", app_type='qt')
54
62
55 def skipWrapper(*args, **kwargs):
63 def skipWrapper(*args, **kwargs):
56 pass
64 pass
tests/autopilot/indicators_client/tests/test_battery.py+1−1
@@ -17,7 +17,7 @@ import math
17
17
18class TestDisplayMenus(IndicatorsTestCase):
18class TestDisplayMenus(IndicatorsTestCase):
19 def setUp(self):
19 def setUp(self):
20− super(TestDisplayMenus, self).setUp()
20+ super(TestDisplayMenus, self).setUp("384x640")
21
21
22 # This opens the messaging menu so you don't have to do that in
22 # This opens the messaging menu so you don't have to do that in
23 # every test case
23 # every test case