Verified Commit e4ac1d77 authored by Artem Sidyakin's avatar Artem Sidyakin
Browse files

Reworked DI demo

parent ef6d59bf
import QtQuick 2.11
import QtQuick.Controls 2.4
import "." // you have to have that for singleton
Button {
id: control
......@@ -10,7 +9,7 @@ Button {
contentItem: Text {
text: control.text
font.pointSize: Styles.secondaryFontSize
font.pixelSize: Styles.secondaryFontSize
font.family: "Titillium Web"
}
......
import QtQuick 2.11
import "." // you have to have that for singleton
Rectangle {
width: ti.contentWidth
......@@ -14,7 +13,7 @@ Rectangle {
TextInput {
id: ti
anchors.centerIn: parent
font.pointSize: Styles.secondaryFontSize
font.pixelSize: Styles.secondaryFontSize
font.family: "Titillium Web"
}
}
import QtQuick 2.11
import "." // you have to have that for singleton
Text {
font.pointSize: Styles.primaryFontSize
property bool bold: false
font.pixelSize: Styles.primaryFontSize
font.family: "Titillium Web"
font.styleName: bold ? "Bold" : "Regular"
}
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include <QFont>
#include <QFontDatabase>
#include <QDebug>
#include <QFile>
#include "backend.h"
int main(int argc, char *argv[])
......@@ -15,6 +18,9 @@ int main(int argc, char *argv[])
QGuiApplication app(argc, argv);
QFontDatabase::addApplicationFont(":/fonts/TitilliumWeb-Regular.ttf");
QFontDatabase::addApplicationFont(":/fonts/TitilliumWeb-Bold.ttf");
QQmlApplicationEngine engine;
qmlRegisterType<Backend>("io.qt.Backend", 1, 0, "Backend");
engine.load(QUrl("qrc:/main.qml"));
......
import QtQuick 2.11
import QtQuick.Controls 2.4
import QtQuick.Layouts 1.11
import io.qt.Backend 1.0
import "." // you have to have that for singleton
ApplicationWindow {
id: root
visible: true
//visibility: "FullScreen"
width: 900
height: 600
visibility: "Maximized"
// width: 900
minimumWidth: 1100
// height: 500
minimumHeight: 700
title: "Device Information"
Backend { id: backend }
......@@ -44,27 +46,26 @@ ApplicationWindow {
header: TabBar {
id: tabBar
currentIndex: swipeView.currentIndex
currentIndex: sl.currentIndex
font.family: "Titillium Web"
font.pointSize: Styles.primaryFontSize
height: tb4hate.height // sneaky little bastard, aren't u
font.pixelSize: Styles.primaryFontSize
TabButton { id: tb4hate; text: qsTr("Startup") }
TabButton { text: qsTr("Network") }
TabButton { text: qsTr("Screen") }
// TabButton { text: qsTr("Startup") }
TabButton { text: qsTr("OS") }
TabButton { text: qsTr("Screen") }
TabButton { text: qsTr("Network") }
// TabButton { text: qsTr("Specs") }
}
SwipeView {
id: swipeView
StackLayout {
id: sl
anchors.fill: parent
currentIndex: tabBar.currentIndex
Page { Loader { source: "/pages/pageStartup.qml"; anchors.centerIn: parent } }
Page { Loader { source: "/pages/pageNet.qml"; anchors.fill: parent } }
Page { Loader { source: "/pages/pageScreen.qml"; anchors.centerIn: parent } }
Page { Loader { source: "/pages/pageOS.qml"; anchors.centerIn: parent } }
// Page { Loader { source: "/pages/pageStartup.qml"; anchors.centerIn: parent } }
Page { Loader { source: "qrc:/pages/pageOS.qml"; anchors.centerIn: parent; } }
Page { Loader { source: "/pages/pageScreen.qml"; anchors.centerIn: parent; } }
Page { Loader { source: "qrc:/pages/pageNet.qml"; anchors.centerIn: parent; } }
//Page { Loader { source: "/pages/pageSys.qml"; anchors.centerIn: parent } }
}
......
import QtQuick 2.11
import QtQuick.Controls 2.4
import QtQuick.Layouts 1.11
import "../" // jeez
import ".."
Flickable {
anchors.fill: parent
clip: true
flickableDirection: Flickable.HorizontalAndVerticalFlick
GridLayout {
id: grd2flck
anchors.centerIn: parent
GridLayout {
id: grd2flck
columns: 2
columnSpacing: 10
TitilliumText {
Layout.alignment: Qt.AlignRight | Qt.AlignTop
text: "Hostname:"
font.bold: true
}
TitilliumText {
text: backend.getMachineHostName();
}
rows: 3
columns: 2
rowSpacing: 10
columnSpacing: 10
TitilliumText {
Layout.alignment: Qt.AlignRight | Qt.AlignTop
text: "IP address:"
font.bold: true
}
ListView {
// Layout.fillHeight: true
// Layout.fillWidth: true
Layout.preferredHeight: childrenRect.height
model: backend.getIPaddress()
delegate: TitilliumText { text: modelData }
}
TitilliumText {
Layout.alignment: Qt.AlignRight | Qt.AlignTop
text: "Hostname:"
bold: true
}
TitilliumText {
Layout.alignment: Qt.AlignTop
text: backend.getMachineHostName();
}
TitilliumText {
Layout.alignment: Qt.AlignRight | Qt.AlignTop
text: "MAC address:"
font.bold: true
}
ListView {
Layout.preferredHeight: childrenRect.height
model: backend.getMACaddress()
delegate: TitilliumText { text: modelData }
}
TitilliumText {
Layout.alignment: Qt.AlignRight | Qt.AlignTop
text: "IP address:"
bold: true
}
ListView {
Layout.alignment: Qt.AlignTop
Layout.preferredHeight: childrenRect.height
model: backend.getIPaddress()
delegate: TitilliumText { text: modelData }
}
// TitilliumText {
// Layout.alignment: Qt.AlignRight | Qt.AlignTop
// text: "MAC address:"
// bold: true
// }
// ListView {
// Layout.alignment: Qt.AlignTop
// Layout.preferredHeight: childrenRect.height
// model: backend.getMACaddress()
// delegate: TitilliumText { text: modelData }
// }
}
import QtQuick 2.11
import QtQuick.Controls 2.4
import QtQuick.Layouts 1.11
import "../" // jeez
import ".."
GridLayout {
columns: 2
......@@ -10,7 +10,7 @@ GridLayout {
TitilliumText {
Layout.alignment: Qt.AlignRight | Qt.AlignTop
text: "Custom name:"
font.bold: true
bold: true
}
TitilliumText {
text: backend.getPrettyProductName();
......@@ -19,7 +19,7 @@ GridLayout {
TitilliumText {
Layout.alignment: Qt.AlignRight | Qt.AlignTop
text: "Architecture:"
font.bold: true
bold: true
}
TitilliumText {
text: backend.getArchitecture();
......@@ -28,7 +28,7 @@ GridLayout {
TitilliumText {
Layout.alignment: Qt.AlignRight | Qt.AlignTop
text: "Kernel:"
font.bold: true
bold: true
}
TitilliumText {
text: backend.getKernel();
......
......@@ -2,7 +2,7 @@ import QtQuick 2.11
import QtQuick.Controls 2.4
import QtQuick.Layouts 1.11
import QtQuick.Window 2.11
import "../" // jeez
import ".."
GridLayout {
// anchors.verticalCenter: parent.verticalCenter
......@@ -14,7 +14,7 @@ GridLayout {
TitilliumText {
Layout.alignment: Qt.AlignRight | Qt.AlignTop
text: "Resolution:"
font.bold: true
bold: true
}
TitilliumText {
text: Screen.width + "x" + Screen.height
......@@ -23,7 +23,7 @@ GridLayout {
TitilliumText {
Layout.alignment: Qt.AlignRight | Qt.AlignTop
text: "DPI:"
font.bold: true
bold: true
}
TitilliumText {
text: backend.getDotsPerInch()
......@@ -32,7 +32,7 @@ GridLayout {
TitilliumText {
Layout.alignment: Qt.AlignRight | Qt.AlignTop
text: "Pixel ratio:"
font.bold: true
bold: true
}
TitilliumText {
text: Screen.devicePixelRatio.toFixed(1)
......@@ -41,7 +41,7 @@ GridLayout {
TitilliumText {
Layout.alignment: Qt.AlignRight | Qt.AlignTop
text: "Pixel density:"
font.bold: true
bold: true
}
TitilliumText {
text: Screen.pixelDensity.toFixed(3)
......@@ -50,7 +50,7 @@ GridLayout {
TitilliumText {
Layout.alignment: Qt.AlignRight | Qt.AlignTop
text: "Color depth:"
font.bold: true
bold: true
}
TitilliumText {
text: backend.getScreenDepth()
......
import QtQuick 2.11
import QtQuick.Controls 2.4
import QtQuick.Layouts 1.11
import "../" // jeez
import ".."
GridLayout {
columns: 2
......@@ -16,7 +16,7 @@ GridLayout {
id: ssid
Layout.fillHeight: true
Layout.minimumWidth: 300
text: "qt-visitor"
text: "some"
}
TitilliumText {
......@@ -29,7 +29,7 @@ GridLayout {
Layout.fillHeight: true
Layout.minimumWidth: 300
echoMode: TextInput.Password
text: "WlanVisitor"
text: "password"
}
Item {
......
import QtQuick 2.11
import QtQuick.Controls 2.4
import QtQuick.Layouts 1.11
import "../" // jeez
import ".."
ColumnLayout {
anchors.fill: parent
......@@ -55,7 +55,7 @@ ColumnLayout {
onCursorRectangleChanged: flick.ensureVisible(cursorRectangle)
text: "asd"
font.family: "Titillium Web"
font.pointSize: 40 / Screen.pixelDensity
font.pixelSize: 40 / Screen.pixelDensity
readOnly: true
selectByMouse: true
}
......
import QtQuick 2.11
import QtQuick.Controls 2.4
import QtQuick.Layouts 1.11
import "../" // jeez
import ".."
Flickable {
// anchors.verticalCenter: parent.verticalCenter
......
......@@ -12,5 +12,7 @@
<file>pages/pageTest.qml</file>
<file>qmldir</file>
<file>styles.qml</file>
<file>fonts/TitilliumWeb-Regular.ttf</file>
<file>fonts/TitilliumWeb-Bold.ttf</file>
</qresource>
</RCC>
......@@ -4,7 +4,7 @@ import QtQuick.Window 2.11
Item {
// primary font size for texts and tabs
property int primaryFontSize: 80 / Screen.pixelDensity * Screen.devicePixelRatio
property int primaryFontSize: 100 / Screen.pixelDensity * Screen.devicePixelRatio
// secondary font size for buttons and inputs
property int secondaryFontSize: 60 / Screen.pixelDensity * Screen.devicePixelRatio
property int secondaryFontSize: 80 / Screen.pixelDensity * Screen.devicePixelRatio
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment