move general singleton to shared part, update part of desktop-panel ui

This commit is contained in:
Evgenii Alekseev 2016-10-09 21:23:27 +03:00
parent fcb698e7fc
commit 335fbb137e
8 changed files with 124 additions and 313 deletions

View File

@ -16,8 +16,6 @@
***************************************************************************/ ***************************************************************************/
import QtQuick 2.0 import QtQuick 2.0
import QtQuick.Controls 1.3 as QtControls
import QtQuick.Layouts 1.0 as QtLayouts
import org.kde.plasma.private.awesomewidget 1.0 import org.kde.plasma.private.awesomewidget 1.0
@ -34,4 +32,8 @@ Item {
AboutTab { AboutTab {
textProvider: awActions textProvider: awActions
} }
Component.onCompleted: {
if (debug) console.debug()
}
} }

View File

@ -1,4 +1,4 @@
singleton general 1.0 general.qml singleton general 1.0 file:///usr/share/awesomewidgets/qml/general.qml
AboutTab file:///usr/share/awesomewidgets/qml/AboutTab.qml AboutTab file:///usr/share/awesomewidgets/qml/AboutTab.qml
BugReport file:///usr/share/awesomewidgets/qml/BugReport.qml BugReport file:///usr/share/awesomewidgets/qml/BugReport.qml

View File

@ -16,113 +16,23 @@
***************************************************************************/ ***************************************************************************/
import QtQuick 2.0 import QtQuick 2.0
import QtQuick.Controls 1.3 as QtControls
import QtQuick.Layouts 1.0 as QtLayouts
import org.kde.plasma.private.desktoppanel 1.0 import org.kde.plasma.private.desktoppanel 1.0
Item { Item {
id: aboutPage id: aboutPage
// backend
DPAdds { DPAdds {
id: dpAdds id: dpAdds
} }
width: childrenRect.width width: childrenRect.width
height: childrenRect.height height: childrenRect.height
implicitWidth: pageColumn.implicitWidth
implicitHeight: pageColumn.implicitHeight
property bool debug: dpAdds.isDebugEnabled() AboutTab {
textProvider: dpAdds
Column {
id: pageColumn
anchors.fill: parent
QtControls.TabView {
height: parent.height
width: parent.width
QtControls.Tab {
anchors.margins: 10.0
title: i18n("About")
QtLayouts.ColumnLayout {
QtControls.Label {
QtLayouts.Layout.fillWidth: true
horizontalAlignment: Text.AlignHCenter
text: dpAdds.getAboutText("header")
} }
QtControls.Label {
QtLayouts.Layout.fillWidth: true
horizontalAlignment: Text.AlignHCenter
text: dpAdds.getAboutText("version")
}
QtControls.Label {
QtLayouts.Layout.fillWidth: true
horizontalAlignment: Text.AlignJustify
text: dpAdds.getAboutText("description")
}
QtControls.Label {
QtLayouts.Layout.fillWidth: true
horizontalAlignment: Text.AlignLeft
textFormat: Text.RichText
text: dpAdds.getAboutText("links")
onLinkActivated: Qt.openUrlExternally(link)
}
QtControls.Label {
QtLayouts.Layout.fillHeight: true
QtLayouts.Layout.fillWidth: true
font.capitalization: Font.SmallCaps
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignBottom
textFormat: Text.RichText
text: dpAdds.getAboutText("copy")
}
}
}
QtControls.Tab {
anchors.margins: 10.0
title: i18n("Acknowledgment")
QtLayouts.ColumnLayout {
QtControls.Label {
QtLayouts.Layout.fillWidth: true
wrapMode: Text.WordWrap
horizontalAlignment: Text.AlignJustify
text: dpAdds.getAboutText("translators")
}
QtControls.Label {
QtLayouts.Layout.fillWidth: true
wrapMode: Text.WordWrap
horizontalAlignment: Text.AlignJustify
textFormat: Text.RichText
text: dpAdds.getAboutText("3rdparty")
onLinkActivated: Qt.openUrlExternally(link)
}
QtControls.Label {
QtLayouts.Layout.fillHeight: true
QtLayouts.Layout.fillWidth: true
wrapMode: Text.WordWrap
horizontalAlignment: Text.AlignJustify
verticalAlignment: Text.AlignTop
textFormat: Text.RichText
text: dpAdds.getAboutText("thanks")
onLinkActivated: Qt.openUrlExternally(link)
}
}
}
}
}
Component.onCompleted: { Component.onCompleted: {
if (debug) console.debug() if (debug) console.debug()
} }

View File

@ -41,125 +41,109 @@ Item {
property alias cfg_verticalLayout: verticalLayout.checked property alias cfg_verticalLayout: verticalLayout.checked
property alias cfg_height: widgetHeight.value property alias cfg_height: widgetHeight.value
property alias cfg_width: widgetWidth.value property alias cfg_width: widgetWidth.value
property string cfg_mark: mark.currentText property string cfg_mark: mark.value
property string cfg_tooltipType: tooltipType.currentText property string cfg_tooltipType: tooltipType.value
property alias cfg_tooltipWidth: tooltipWidth.value property alias cfg_tooltipWidth: tooltipWidth.value
property alias cfg_tooltipColor: tooltipColor.text property alias cfg_tooltipColor: tooltipColor.value
Column { Column {
id: pageColumn id: pageColumn
anchors.fill: parent anchors.fill: parent
Row {
height: implicitHeight CheckBoxSelector {
width: parent.width
QtControls.Label {
height: parent.heigth
width: parent.width * 2 / 5
}
QtControls.CheckBox {
id: background id: background
width: parent.width * 3 / 5
text: i18n("Enable background") text: i18n("Enable background")
} }
}
Row { CheckBoxSelector {
height: implicitHeight
width: parent.width
QtControls.Label {
height: parent.heigth
width: parent.width * 2 / 5
}
QtControls.CheckBox {
id: verticalLayout id: verticalLayout
width: parent.width * 3 / 5
text: i18n("Vertical layout") text: i18n("Vertical layout")
} }
}
Row { IntegerSelector {
height: implicitHeight
width: parent.width
QtControls.Label {
height: parent.height
width: parent.width * 2 / 5
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
text: i18n("Widget height, px")
}
QtControls.SpinBox {
id: widgetHeight id: widgetHeight
width: parent.width * 3 / 5
minimumValue: 0
maximumValue: 4096 maximumValue: 4096
minimumValue: 0
stepSize: 50 stepSize: 50
text: i18n("Widget height, px")
value: plasmoid.configuration.height value: plasmoid.configuration.height
} }
}
Row { IntegerSelector {
height: implicitHeight
width: parent.width
QtControls.Label {
height: parent.height
width: parent.width * 2 / 5
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
text: i18n("Widget width, px")
}
QtControls.SpinBox {
id: widgetWidth id: widgetWidth
width: parent.width * 3 / 5
minimumValue: 0
maximumValue: 4096 maximumValue: 4096
minimumValue: 0
stepSize: 50 stepSize: 50
text: i18n("Widget width, px")
value: plasmoid.configuration.width value: plasmoid.configuration.width
} }
}
Row { ComboBoxSelector {
height: implicitHeight
width: parent.width
QtControls.Label {
height: parent.height
width: parent.width * 2 / 5
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
text: i18n("Mark")
}
QtControls.ComboBox {
id: mark id: mark
width: parent.width * 3 / 5
editable: true editable: true
model: ["#", "$", "%", "&", "*", "@", "¤", "¶", "·", "º", model: [
plasmoid.configuration.mark] {
currentIndex: model.length - 1 'label': '#',
onCurrentIndexChanged: cfg_mark = currentText 'name': '#'
},
{
'label': '$',
'name': '$'
},
{
'label': '%',
'name': '%'
},
{
'label': '&',
'name': '&'
},
{
'label': '*',
'name': '*'
},
{
'label': '@',
'name': '@'
},
{
'label': '¤',
'name': '¤'
},
{
'label': '¶',
'name': '¶'
},
{
'label': '·',
'name': '·'
},
{
'label': 'º',
'name': 'º'
},
{
'label': plasmoid.configuration.mark,
'name': plasmoid.configuration.mark
} }
]
text: i18n("Mark")
currentIndex: model.length - 1
onValueEdited: cfg_mark = newValue
} }
QtControls.GroupBox { QtControls.GroupBox {
height: implicitHeight height: implicitHeight
width: parent.width width: parent.width
title: i18n("Tooltip") title: i18n("Tooltip")
Column { Column {
height: implicitHeight height: implicitHeight
width: parent.width width: parent.width
Row {
height: implicitHeight ComboBoxSelector {
width: parent.width
QtControls.Label {
height: parent.height
width: parent.width * 2 / 5
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
text: i18n("Tooltip type")
}
QtControls.ComboBox {
id: tooltipType id: tooltipType
width: parent.width * 3 / 5
textRole: "label"
model: [ model: [
{ {
'label': i18n("contours"), 'label': i18n("contours"),
@ -182,71 +166,28 @@ Item {
'name': "none" 'name': "none"
} }
] ]
onCurrentIndexChanged: cfg_tooltipType = model[currentIndex]["name"] text: i18n("Tooltip type")
Component.onCompleted: { value: plasmoid.configuration.tooltipType
if (debug) console.debug() onValueEdited: cfg_tooltipType = newValue
for (var i = 0; i < model.length; i++) {
if (model[i]["name"] == plasmoid.configuration.tooltipType) {
if (debug) console.info("Found", model[i]["name"], "on", i)
tooltipType.currentIndex = i
}
}
}
}
} }
Row { IntegerSelector {
height: implicitHeight
width: parent.width
QtControls.Label {
height: parent.height
width: parent.width * 2 / 5
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
text: i18n("Tooltip width")
}
QtControls.SpinBox {
id: tooltipWidth id: tooltipWidth
width: parent.width * 3 / 5
minimumValue: 100
maximumValue: 1000 maximumValue: 1000
minimumValue: 100
stepSize: 50 stepSize: 50
text: i18n("Tooltip width")
value: plasmoid.configuration.tooltipWidth value: plasmoid.configuration.tooltipWidth
} }
}
Row { ColorSelector {
height: implicitHeight
width: parent.width
QtControls.Label {
height: parent.height
width: parent.width * 2 / 5
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
text: i18n("Font color")
}
QtControls.Button {
id: tooltipColor id: tooltipColor
width: parent.width * 3 / 5 text: i18n("Font color")
style: QtStyles.ButtonStyle { value: plasmoid.configuration.tooltipColor
background: Rectangle {
color: plasmoid.configuration.tooltipColor
}
}
text: plasmoid.configuration.tooltipColor
onClicked: colorDialog.visible = true
} }
} }
} }
} }
}
QtDialogs.ColorDialog {
id: colorDialog
title: i18n("Select a color")
color: tooltipColor.text
onAccepted: tooltipColor.text = colorDialog.color
}
Component.onCompleted: { Component.onCompleted: {
if (debug) console.debug() if (debug) console.debug()

View File

@ -1,42 +0,0 @@
/***************************************************************************
* This file is part of awesome-widgets *
* *
* awesome-widgets is free software: you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation, either version 3 of the *
* License, or (at your option) any later version. *
* *
* awesome-widgets is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
pragma Singleton
import QtQuick 2.0
QtObject {
property variant fontWeight: {
"light": Font.Light,
"normal": Font.Normal,
"demibold": Font.DemiBold,
"bold": Font.Bold,
"black": Font.Black
}
property variant align: {
"left": Text.AlignLeft,
"center": Text.AlignHCenter,
"right": Text.AlignRight,
"justify": Text.AlignJustify
}
property variant textStyle: {
"normal": Text.Normal,
"outline": Text.Outline,
"raised": Text.Raised,
"sunken": Text.Sunken
}
}

View File

@ -1,4 +1,4 @@
singleton general 1.0 general.qml singleton general 1.0 file:///usr/share/awesomewidgets/qml/general.qml
AboutTab file:///usr/share/awesomewidgets/qml/AboutTab.qml AboutTab file:///usr/share/awesomewidgets/qml/AboutTab.qml
BugReport file:///usr/share/awesomewidgets/qml/BugReport.qml BugReport file:///usr/share/awesomewidgets/qml/BugReport.qml

View File

@ -1,4 +1,4 @@
singleton general 1.0 general.qml singleton general 1.0 file://@CMAKE_INSTALL_PREFIX@/@DATA_INSTALL_DIR@/@PROJECT_NAME@/qml/general.qml
AboutTab file://@CMAKE_INSTALL_PREFIX@/@DATA_INSTALL_DIR@/@PROJECT_NAME@/qml/AboutTab.qml AboutTab file://@CMAKE_INSTALL_PREFIX@/@DATA_INSTALL_DIR@/@PROJECT_NAME@/qml/AboutTab.qml
BugReport file://@CMAKE_INSTALL_PREFIX@/@DATA_INSTALL_DIR@/@PROJECT_NAME@/qml/BugReport.qml BugReport file://@CMAKE_INSTALL_PREFIX@/@DATA_INSTALL_DIR@/@PROJECT_NAME@/qml/BugReport.qml