mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
QML UI: make all buttons more attractive
Commit f3f7930
introduced a more attractive button style to the start page.
This patch turns it into its own type so it can easily be used everywhere.
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
f3f79309d3
commit
471270437b
8 changed files with 40 additions and 31 deletions
|
@ -79,7 +79,7 @@ Item {
|
||||||
Item {
|
Item {
|
||||||
height: saveButton.height
|
height: saveButton.height
|
||||||
width: saveButton.width
|
width: saveButton.width
|
||||||
Button {
|
SubsurfaceButton {
|
||||||
id: saveButton
|
id: saveButton
|
||||||
text: "Save"
|
text: "Save"
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
|
|
|
@ -150,7 +150,7 @@ Item {
|
||||||
wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere
|
wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Button {
|
SubsurfaceButton {
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
text: "Save"
|
text: "Save"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
|
|
@ -36,7 +36,7 @@ Item {
|
||||||
RowLayout {
|
RowLayout {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
TextField { Layout.fillWidth: true }
|
TextField { Layout.fillWidth: true }
|
||||||
Button { text: "..." }
|
SubsurfaceButton { text: "..." }
|
||||||
}
|
}
|
||||||
GridLayout {
|
GridLayout {
|
||||||
columns: 2
|
columns: 2
|
||||||
|
@ -51,7 +51,7 @@ Item {
|
||||||
RowLayout {
|
RowLayout {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
ProgressBar { Layout.fillWidth: true }
|
ProgressBar { Layout.fillWidth: true }
|
||||||
Button { text: "Download" }
|
SubsurfaceButton { text: "Download" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -62,10 +62,10 @@ Item {
|
||||||
Text {
|
Text {
|
||||||
text: "Downloaded dives"
|
text: "Downloaded dives"
|
||||||
}
|
}
|
||||||
Button {
|
SubsurfaceButton {
|
||||||
text: "Select All"
|
text: "Select All"
|
||||||
}
|
}
|
||||||
Button {
|
SubsurfaceButton {
|
||||||
text: "Unselect All"
|
text: "Unselect All"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -77,14 +77,14 @@ Item {
|
||||||
}
|
}
|
||||||
RowLayout {
|
RowLayout {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
Button {
|
SubsurfaceButton {
|
||||||
text: "OK"
|
text: "OK"
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
stackView.pop();
|
stackView.pop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Button {
|
SubsurfaceButton {
|
||||||
text: "Cancel"
|
text: "Cancel"
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
|
|
@ -58,7 +58,7 @@ GridLayout {
|
||||||
Item {
|
Item {
|
||||||
height: saveButton.height
|
height: saveButton.height
|
||||||
Layout.preferredWidth: saveButton.width
|
Layout.preferredWidth: saveButton.width
|
||||||
Button {
|
SubsurfaceButton {
|
||||||
id: saveButton
|
id: saveButton
|
||||||
text: "Save"
|
text: "Save"
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
|
|
|
@ -6,22 +6,6 @@ import org.kde.plasma.mobilecomponents 0.2 as MobileComponents
|
||||||
import org.subsurfacedivelog.mobile 1.0
|
import org.subsurfacedivelog.mobile 1.0
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
property var subsurfaceButton: Component {
|
|
||||||
ButtonStyle {
|
|
||||||
background: Rectangle {
|
|
||||||
border.width: 1
|
|
||||||
radius: height / 3
|
|
||||||
color: subsurfaceTheme.accentColor
|
|
||||||
}
|
|
||||||
label: Text{
|
|
||||||
text: control.text
|
|
||||||
color: subsurfaceTheme.accentTextColor
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
horizontalAlignment: Text.AlignHCenter
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
id: startpage
|
id: startpage
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
@ -42,8 +26,7 @@ Item {
|
||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WordWrap
|
||||||
Layout.columnSpan: 2
|
Layout.columnSpan: 2
|
||||||
}
|
}
|
||||||
Button {
|
SubsurfaceButton {
|
||||||
style: subsurfaceButton
|
|
||||||
id: cloudstorageButton
|
id: cloudstorageButton
|
||||||
Layout.bottomMargin: MobileComponents.Units.largeSpacing
|
Layout.bottomMargin: MobileComponents.Units.largeSpacing
|
||||||
Layout.preferredWidth: startpage.buttonWidth
|
Layout.preferredWidth: startpage.buttonWidth
|
||||||
|
@ -53,8 +36,7 @@ Item {
|
||||||
stackView.push(cloudCredWindow)
|
stackView.push(cloudCredWindow)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Button {
|
SubsurfaceButton {
|
||||||
style: subsurfaceButton
|
|
||||||
id: computerButton
|
id: computerButton
|
||||||
Layout.preferredWidth: startpage.buttonWidth
|
Layout.preferredWidth: startpage.buttonWidth
|
||||||
Layout.bottomMargin: MobileComponents.Units.largeSpacing
|
Layout.bottomMargin: MobileComponents.Units.largeSpacing
|
||||||
|
@ -64,8 +46,7 @@ Item {
|
||||||
stackView.push(downloadDivesWindow)
|
stackView.push(downloadDivesWindow)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Button {
|
SubsurfaceButton {
|
||||||
style: subsurfaceButton
|
|
||||||
id: manualButton
|
id: manualButton
|
||||||
Layout.preferredWidth: startpage.buttonWidth
|
Layout.preferredWidth: startpage.buttonWidth
|
||||||
Layout.bottomMargin: MobileComponents.Units.largeSpacing
|
Layout.bottomMargin: MobileComponents.Units.largeSpacing
|
||||||
|
|
26
qt-mobile/qml/SubsurfaceButton.qml
Normal file
26
qt-mobile/qml/SubsurfaceButton.qml
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
import QtQuick 2.5
|
||||||
|
import QtQuick.Controls 1.2
|
||||||
|
import QtQuick.Controls.Styles 1.2
|
||||||
|
import org.kde.plasma.mobilecomponents 0.2 as MobileComponents
|
||||||
|
|
||||||
|
Button {
|
||||||
|
style: ButtonStyle {
|
||||||
|
padding {
|
||||||
|
top: MobileComponents.Units.smallSpacing
|
||||||
|
left: MobileComponents.Units.smallSpacing * 2
|
||||||
|
right: MobileComponents.Units.smallSpacing * 2
|
||||||
|
bottom: MobileComponents.Units.smallSpacing
|
||||||
|
}
|
||||||
|
background: Rectangle {
|
||||||
|
border.width: 1
|
||||||
|
radius: height / 3
|
||||||
|
color: control.pressed ? subsurfaceTheme.shadedColor : subsurfaceTheme.accentColor
|
||||||
|
}
|
||||||
|
label: Text{
|
||||||
|
text: control.text
|
||||||
|
color: subsurfaceTheme.accentTextColor
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -189,6 +189,7 @@ MobileComponents.ApplicationWindow {
|
||||||
property int titlePointSize: Math.round(fontMetrics.font.pointSize * 1.5)
|
property int titlePointSize: Math.round(fontMetrics.font.pointSize * 1.5)
|
||||||
property int smallPointSize: Math.round(fontMetrics.font.pointSize * 0.8)
|
property int smallPointSize: Math.round(fontMetrics.font.pointSize * 0.8)
|
||||||
property color accentColor: "#2d5b9a"
|
property color accentColor: "#2d5b9a"
|
||||||
|
property color shadedColor: "#224575"
|
||||||
property color accentTextColor: "#ececec"
|
property color accentTextColor: "#ececec"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
<file>ThemeTest.qml</file>
|
<file>ThemeTest.qml</file>
|
||||||
<file>StartPage.qml</file>
|
<file>StartPage.qml</file>
|
||||||
<file>dive.jpg</file>
|
<file>dive.jpg</file>
|
||||||
|
<file>SubsurfaceButton.qml</file>
|
||||||
<file alias="subsurface-mobile-icon.png">../../icons/subsurface-mobile-icon.png</file>
|
<file alias="subsurface-mobile-icon.png">../../icons/subsurface-mobile-icon.png</file>
|
||||||
<file alias="main-menu.png">icons/main-menu.png</file>
|
<file alias="main-menu.png">icons/main-menu.png</file>
|
||||||
<file alias="context-menu.png">icons/context-menu.png</file>
|
<file alias="context-menu.png">icons/context-menu.png</file>
|
||||||
|
|
Loading…
Add table
Reference in a new issue