Преглед изворни кода

Advertize resolution

Change-Id: Ic5d48a65ae8b7e0cd682fac037d3cea121299a76
Donald Carr пре 8 година
родитељ
комит
3d2c773ff5
2 измењених фајлова са 23 додато и 2 уклоњено
  1. 21 2
      qml/main.qml
  2. 2 0
      src/main.cpp

+ 21 - 2
qml/main.qml

@@ -55,7 +55,8 @@ Window {
         id: globalSettings
         property int columnCount: 5
         property int interval: 5
-        property bool viewItemCount: false
+        property bool showViewItemCount: false
+        property bool showScreenResolution: false
         property string effect: ""
         property string view: "Conveyor"
         property bool smoothArt: false
@@ -106,7 +107,7 @@ Window {
     Rectangle {
         z: 1
         opacity: 0.5
-        visible: globalSettings.viewItemCount
+        visible: globalSettings.showViewItemCount
         color: "black"
 
         anchors { right: parent.right; top: parent.top }
@@ -121,6 +122,24 @@ Window {
         }
     }
 
+    Rectangle {
+        z: 1
+        opacity: 0.5
+        visible: globalSettings.showScreenResolution
+        color: "black"
+
+        anchors { right: parent.right; top: parent.top }
+        width: resolutionLabel.width
+        height: resolutionLabel.height
+
+        Text {
+            id: resolutionLabel
+            font.pixelSize: 100
+            text: screenSize.width + "x" + screenSize.height
+            color: "white"
+        }
+    }
+
     Component.onCompleted: {
         globalSettings.fullscreen ? showFullScreen() : show()
     }

+ 2 - 0
src/main.cpp

@@ -32,6 +32,7 @@
 #include <QTextStream>
 
 #include <QDebug>
+#include <QScreen>
 
 class FileReader : public QObject {
     Q_OBJECT
@@ -88,6 +89,7 @@ int main(int argc, char *argv[])
     QQmlApplicationEngine engine;
     qmlRegisterType<PictureModel>("PictureModel", 1, 0, "PictureModel");
 
+    engine.rootContext()->setContextProperty("screenSize", app.screens().at(0)->availableSize());
     engine.rootContext()->setContextProperty("fileReader", new FileReader(&app));
     engine.load(QUrl(QStringLiteral("qrc:/main.qml")));