aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzheng_wenlong <wenlong_zheng@nexty-ele.com>2018-11-22 14:16:08 +0900
committerzheng_wenlong <wenlong_zheng@nexty-ele.com>2018-11-22 14:16:08 +0900
commitfabcb8148b8032f4f8d04523e2f24cf8debe477f (patch)
treea6c6348c5689df0517e17e6f292b955d6823e58e
parent6525fcc7cbf779d881197e070d61c1e2400946f8 (diff)
change fullscreen button size.
-rw-r--r--homescreen/qml/images/menubar_full_background.pngbin5692 -> 6608 bytes
-rw-r--r--homescreen/qml/images/menubar_normal_background.pngbin68924 -> 68858 bytes
-rw-r--r--homescreen/qml/main.qml48
-rw-r--r--homescreen/src/main.cpp46
4 files changed, 54 insertions, 40 deletions
diff --git a/homescreen/qml/images/menubar_full_background.png b/homescreen/qml/images/menubar_full_background.png
index 39e12b9..16a7e77 100644
--- a/homescreen/qml/images/menubar_full_background.png
+++ b/homescreen/qml/images/menubar_full_background.png
Binary files differ
diff --git a/homescreen/qml/images/menubar_normal_background.png b/homescreen/qml/images/menubar_normal_background.png
index ceb3684..bfffc55 100644
--- a/homescreen/qml/images/menubar_normal_background.png
+++ b/homescreen/qml/images/menubar_normal_background.png
Binary files differ
diff --git a/homescreen/qml/main.qml b/homescreen/qml/main.qml
index 13500bd..10509fd 100644
--- a/homescreen/qml/main.qml
+++ b/homescreen/qml/main.qml
@@ -134,38 +134,44 @@ Window {
Item {
id: switchBtn
+ width: 110
+ height: 110
anchors.right: parent.right
- anchors.rightMargin: 20
anchors.top: parent.top
- anchors.topMargin: 5
- width: 55
- height: 55
z: 1
+ Image {
+ id: image
+ width: 55
+ height: 55
+ anchors.right: parent.right
+ anchors.rightMargin: 20
+ anchors.top: parent.top
+ anchors.topMargin: 5
+ source: './images/normal.png'
+ }
MouseArea {
anchors.fill: parent
property string btnState: 'normal'
- Image {
- id: image
- anchors.fill: parent
- source: './images/normal.png'
- }
onClicked: {
- if (btnState === 'normal') {
- image.source = './images/fullscreen.png'
- btnState = 'fullscreen'
- container.state = 'fullscreen'
- container.opacity = 0.0
- touchArea.switchArea(1)
-
+ if (container.state === 'normal') {
+ turnToFullscreen()
} else {
- image.source = './images/normal.png'
- btnState = 'normal'
- container.state = 'normal'
- container.opacity = 1.0
- touchArea.switchArea(0)
+ turnToNormal()
}
}
}
}
+ function turnToFullscreen() {
+ image.source = './images/fullscreen.png'
+ container.state = 'fullscreen'
+ container.opacity = 0.0
+ touchArea.switchArea(1)
+ }
+ function turnToNormal() {
+ image.source = './images/normal.png'
+ container.state = 'normal'
+ container.opacity = 1.0
+ touchArea.switchArea(0)
+ }
}
diff --git a/homescreen/src/main.cpp b/homescreen/src/main.cpp
index a80dd04..08f83a8 100644
--- a/homescreen/src/main.cpp
+++ b/homescreen/src/main.cpp
@@ -93,6 +93,9 @@ int main(int argc, char *argv[])
qmlRegisterType<StatusBarModel>("HomeScreen", 1, 0, "StatusBarModel");
ApplicationLauncher *launcher = new ApplicationLauncher();
+ HomescreenHandler* homescreenHandler = new HomescreenHandler();
+ homescreenHandler->init(port, token.toStdString().c_str());
+
QLibWindowmanager* layoutHandler = new QLibWindowmanager();
if(layoutHandler->init(port,token) != 0){
exit(EXIT_FAILURE);
@@ -102,24 +105,6 @@ int main(int argc, char *argv[])
exit(EXIT_FAILURE);
}
- layoutHandler->set_event_handler(QLibWindowmanager::Event_SyncDraw, [layoutHandler](json_object *object) {
- layoutHandler->endDraw(QString("homescreen"));
- });
-
- layoutHandler->set_event_handler(QLibWindowmanager::Event_ScreenUpdated, [layoutHandler, launcher](json_object *object) {
- json_object *jarray = json_object_object_get(object, "ids");
- int arrLen = json_object_array_length(jarray);
- for( int idx = 0; idx < arrLen; idx++)
- {
- QString label = QString(json_object_get_string( json_object_array_get_idx(jarray, idx) ));
- HMI_DEBUG("HomeScreen","Event_ScreenUpdated application: %s.", label.toStdString().c_str());
- QMetaObject::invokeMethod(launcher, "setCurrent", Qt::QueuedConnection, Q_ARG(QString, label));
- }
- });
-
- HomescreenHandler* homescreenHandler = new HomescreenHandler();
- homescreenHandler->init(port, token.toStdString().c_str());
-
QUrl bindingAddress;
bindingAddress.setScheme(QStringLiteral("ws"));
bindingAddress.setHost(QStringLiteral("localhost"));
@@ -134,7 +119,7 @@ int main(int argc, char *argv[])
// mail.qml loading
QQmlApplicationEngine engine;
- engine.rootContext()->setContextProperty("layoutHandler", layoutHandler);
+// engine.rootContext()->setContextProperty("layoutHandler", layoutHandler);
engine.rootContext()->setContextProperty("homescreenHandler", homescreenHandler);
engine.rootContext()->setContextProperty("touchArea", touchArea);
engine.rootContext()->setContextProperty("launcher", launcher);
@@ -143,6 +128,29 @@ int main(int argc, char *argv[])
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
QObject *root = engine.rootObjects().first();
+
+ layoutHandler->set_event_handler(QLibWindowmanager::Event_SyncDraw, [layoutHandler](json_object *object) {
+ layoutHandler->endDraw(QString("homescreen"));
+ });
+
+ layoutHandler->set_event_handler(QLibWindowmanager::Event_ScreenUpdated, [layoutHandler, launcher, root](json_object *object) {
+ json_object *jarray = json_object_object_get(object, "ids");
+ int arrLen = json_object_array_length(jarray);
+ for( int idx = 0; idx < arrLen; idx++)
+ {
+ QString label = QString(json_object_get_string( json_object_array_get_idx(jarray, idx) ));
+ HMI_DEBUG("HomeScreen","Event_ScreenUpdated application: %s.", label.toStdString().c_str());
+ QMetaObject::invokeMethod(launcher, "setCurrent", Qt::QueuedConnection, Q_ARG(QString, label));
+ if(label == "launcher") {
+ QMetaObject::invokeMethod(root, "turnToNormal");
+// homescreenHandler->emitTurnToFullscreen(false);
+ } else {
+ QMetaObject::invokeMethod(root, "turnToFullscreen");
+// homescreenHandler->emitTurnToFullscreen(true);
+ }
+ }
+ });
+
QQuickWindow *window = qobject_cast<QQuickWindow *>(root);
touchArea->setWindow(window);