From 69b08c5be33be992227eefb9a259ed157c6bc02d Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Tue, 26 May 2020 15:11:43 -0700 Subject: [PATCH] Add settings and settingsList; remove anchors from inside EllipsisLabel --- ButtonTextField.qml | 3 ++- EllipsisLabel.qml | 5 +--- PortraitRow.qml | 8 ++++-- Setting.qml | 61 +++++++++++++++++++++++++++++++++++++++++++++ SettingsList.qml | 40 +++++++++++++++++++++++++++++ Toolbar.qml | 4 +-- 6 files changed, 111 insertions(+), 10 deletions(-) create mode 100644 Setting.qml create mode 100644 SettingsList.qml diff --git a/ButtonTextField.qml b/ButtonTextField.qml index f216a92..0b9571b 100644 --- a/ButtonTextField.qml +++ b/ButtonTextField.qml @@ -13,6 +13,7 @@ TextField { color: Theme.mainTextColor font.pixelSize: Theme.secondaryTextSize * gcd.themeScale width: parent.width - 20 + property string icon property string button_text signal clicked @@ -38,7 +39,7 @@ TextField { text: button_text anchors { top: parent.top; right: parent.right } override_radius: 10 - height: parent.height; width: parent.height * 4 + height: parent.height; onClicked: { parent.focus = true; diff --git a/EllipsisLabel.qml b/EllipsisLabel.qml index 96388ad..a5b5331 100644 --- a/EllipsisLabel.qml +++ b/EllipsisLabel.qml @@ -9,13 +9,10 @@ import "theme" // Needs the parent to have an onWidthChanged that calls .textResize() Item { - anchors.right: parent.right - anchors.left: parent.left - property string text property alias color: label.color - property alias pixelSize: label.font.pixelSize + property alias size: label.font.pixelSize property alias weight: label.font.weight property alias strikeout: label.font.strikeout property alias font: label.font diff --git a/PortraitRow.qml b/PortraitRow.qml index 2397f03..092d045 100644 --- a/PortraitRow.qml +++ b/PortraitRow.qml @@ -70,7 +70,9 @@ Item { // LOTS OF NESTING TO DEAL WITH QT WEIRDNESS, SORRY EllipsisLabel { // CONTACT NAME id: cn - pixelSize: Theme.usernameSize * gcd.themeScale + anchors.right: parent.right + anchors.left: parent.left + size: Theme.usernameSize * gcd.themeScale weight: Font.Bold strikeout: blocked text: displayName @@ -79,7 +81,9 @@ Item { // LOTS OF NESTING TO DEAL WITH QT WEIRDNESS, SORRY EllipsisLabel { // Onion id: onion text: handle - pixelSize: Theme.secondaryTextSize * gcd.themeScale + anchors.right: parent.right + anchors.left: parent.left + size: Theme.secondaryTextSize * gcd.themeScale strikeout: blocked } diff --git a/Setting.qml b/Setting.qml new file mode 100644 index 0000000..d00e69d --- /dev/null +++ b/Setting.qml @@ -0,0 +1,61 @@ +import QtGraphicalEffects 1.0 +import QtQuick 2.7 +import QtQuick.Controls 2.4 +import QtQuick.Controls.Material 2.0 +import QtQuick.Layouts 1.3 +import QtQuick.Window 2.11 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 + +import "." as Opaque +import "../opaque/styles" +import "../opaque/theme" + + +Column { + id: tehcol + + width: parent.width - 20 + anchors.horizontalCenter: parent.horizontalCenter + padding: 10 + spacing: 10 + property bool inline: true + property bool last: false + + property alias label: settingLabel.text + property alias field: fieldContainer.children + + + + Grid { + id: container + columns: inline ? 2 : 1 + spacing: 10 + padding: 10 + + width: parent.width + + property int gridWidth: inline ? (parent.width / 2) - 20 : parent.width - 20 + + anchors.horizontalCenter: parent.horizontalCenter + + Opaque.EllipsisLabel { + id: settingLabel + width: container.gridWidth + color: Theme.mainTextColor + size: Theme.secondaryTextSize * gcd.themeScale + font.weight: Font.Bold + } + + + Item { + id: fieldContainer + width: container.gridWidth + // needs a height so !inline HLine "knows" how far down to be + height: fieldContainer.children[0].height + } + + } + + Opaque.HLine { visible: !last } +} diff --git a/SettingsList.qml b/SettingsList.qml new file mode 100644 index 0000000..f40e999 --- /dev/null +++ b/SettingsList.qml @@ -0,0 +1,40 @@ +import QtGraphicalEffects 1.0 +import QtQuick 2.7 +import QtQuick.Controls 2.4 +import QtQuick.Controls.Material 2.0 +import QtQuick.Layouts 1.3 +import QtQuick.Window 2.11 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 + +import "../opaque" as Opaque +import "../opaque/styles" +import "../opaque/theme" + + +ColumnLayout { // settingsList + id: root + anchors.right: parent.right + anchors.left: parent.left + anchors.top: parent.top + anchors.bottom: parent.bottom + anchors.topMargin: 20 + + property alias settings: flick.children + + Flickable { + anchors.fill: parent + id: flick + + boundsBehavior: Flickable.StopAtBounds + clip:true + + contentWidth: root.width + contentHeight: root.height + + // Settings go here in a col + } +} + + + diff --git a/Toolbar.qml b/Toolbar.qml index 078c60c..d628cb7 100644 --- a/Toolbar.qml +++ b/Toolbar.qml @@ -69,12 +69,10 @@ Rectangle { // Global Toolbar id: paneTitle visible: true - anchors.left: undefined - anchors.right: undefined anchors.horizontalCenter: parent.horizontalCenter color: Theme.mainTextColor - pixelSize: Theme.tabSize * gcd.themeScale + size: Theme.tabSize * gcd.themeScale weight: Font.Bold text: "global toolbar"