Commit ef334013 authored by Ronan Abhamon's avatar Ronan Abhamon

feat(manageAccounts): use reusable components (DialogDescription/DialogPlus)

parent fd30f4d6
...@@ -21,6 +21,7 @@ TRANSLATIONS = \ ...@@ -21,6 +21,7 @@ TRANSLATIONS = \
lupdate_only{ lupdate_only{
# Each component folder must be added explicitly. # Each component folder must be added explicitly.
SOURCES = \ SOURCES = \
ui/components/dialog/*.qml \
ui/components/form/*.qml \ ui/components/form/*.qml \
ui/views/*.qml ui/views/*.qml
} }
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
<file>languages/fr.qm</file> <file>languages/fr.qm</file>
<!-- UI. --> <!-- UI. -->
<file>ui/components/dialog/DialogDescription.qml</file>
<file>ui/components/dialog/DialogPlus.qml</file>
<file>ui/components/form/Collapse.qml</file> <file>ui/components/form/Collapse.qml</file>
<file>ui/components/form/DialogButton.qml</file> <file>ui/components/form/DialogButton.qml</file>
<file>ui/components/form/DialogComboBox.qml</file> <file>ui/components/form/DialogComboBox.qml</file>
......
import QtQuick 2.7
Item {
property alias text: description.text
property alias fontSize: description.font.pointSize
height: 90
Text {
anchors.fill: parent
anchors.leftMargin: 50
anchors.rightMargin: 50
font.pointSize: 12
id: description
verticalAlignment: Text.AlignVCenter
wrapMode: Text.WordWrap
}
}
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.3
import QtQuick.Window 2.2
import 'qrc:/ui/components/dialog'
import 'qrc:/ui/components/form'
Window {
default property alias contents: content.data
// Optionnal description text.
property alias descriptionText: description.text
// Required buttons.
property alias buttons: buttons.data
id: window
modality: Qt.WindowModal
ColumnLayout {
anchors.fill: parent
spacing: 0
// Description.
DialogDescription {
Layout.alignment : Qt.AlignTop
Layout.fillWidth: true
id: description
}
// Content.
Item {
Layout.alignment: Qt.AlignTop
Layout.fillHeight: true
Layout.fillWidth: true
id: content
}
// Buttons.
Item {
Layout.alignment: Qt.AlignTop
Layout.fillWidth: true
height: 100
Row {
anchors.left: parent.left
anchors.leftMargin: 50
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
height: 30
id: buttons
spacing: 20
}
}
}
}
...@@ -5,7 +5,6 @@ Button { ...@@ -5,7 +5,6 @@ Button {
background: Rectangle { background: Rectangle {
color: button.down ? '#FE5E00' : '#434343' color: button.down ? '#FE5E00' : '#434343'
implicitWidth: 120 implicitWidth: 120
implicitHeight: 30
radius: 4 radius: 4
} }
contentItem: Text { contentItem: Text {
......
...@@ -29,11 +29,18 @@ ApplicationWindow { ...@@ -29,11 +29,18 @@ ApplicationWindow {
// User actions. // User actions.
ToolBarButton { ToolBarButton {
onClicked: { onClicked: {
var component = Qt.createComponent("qrc:/ui/views/manage_accounts.qml"); var component = Qt.createComponent('qrc:/ui/views/manage_accounts.qml');
if (component.status !== Component.Ready) {
console.debug('Window not ready.')
if(component.status === Component.Error) {
console.debug('Error:' + component.errorString())
}
} else {
var win = component.createObject(mainWindow); var win = component.createObject(mainWindow);
win.show(); win.show();
} }
} }
}
// Search. // Search.
TextField { TextField {
......
...@@ -3,42 +3,24 @@ import QtQuick.Controls 2.0 ...@@ -3,42 +3,24 @@ import QtQuick.Controls 2.0
import QtQuick.Layouts 1.3 import QtQuick.Layouts 1.3
import QtQuick.Window 2.2 import QtQuick.Window 2.2
import 'qrc:/ui/components/dialog'
import 'qrc:/ui/components/form' import 'qrc:/ui/components/form'
Window { DialogPlus {
descriptionText: qsTr('manageAccountsDescription')
id: window id: window
minimumHeight: 328 minimumHeight: 328
minimumWidth: 480 minimumWidth: 480
modality: Qt.WindowModal
title: qsTr('manageAccountsTitle') title: qsTr('manageAccountsTitle')
ColumnLayout { buttons: DialogButton {
anchors.fill: parent text: qsTr('validate')
spacing: 0
// Window description.
Item {
Layout.alignment : Qt.AlignTop
Layout.fillWidth: true
height: 90
Text {
anchors.fill: parent
anchors.leftMargin: 50
anchors.rightMargin: 50
font.pointSize: 12
text: qsTr('manageAccountsDescription')
verticalAlignment: Text.AlignVCenter
wrapMode: Text.WordWrap
}
} }
// Accounts list. // Accounts list.
Item { Item {
Layout.alignment: Qt.AlignTop
Layout.fillHeight: true
Layout.fillWidth: true
id: listViewContainer id: listViewContainer
anchors.fill: parent
ListView { ListView {
anchors.fill: parent anchors.fill: parent
...@@ -47,7 +29,7 @@ Window { ...@@ -47,7 +29,7 @@ Window {
highlightRangeMode: ListView.ApplyRange highlightRangeMode: ListView.ApplyRange
id: accountsList id: accountsList
spacing: 0 spacing: 0
horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOn
// TODO: Remove, use C++ model instead. // TODO: Remove, use C++ model instead.
model: ListModel { model: ListModel {
ListElement { ListElement {
...@@ -176,20 +158,4 @@ Window { ...@@ -176,20 +158,4 @@ Window {
} }
} }
} }
// Validate
Rectangle {
Layout.alignment: Qt.AlignTop
Layout.fillWidth: true
height: 100
DialogButton {
anchors.bottom: parent.bottom
anchors.bottomMargin: 30
anchors.left: parent.left
anchors.leftMargin: 54
text: qsTr('validate')
}
}
}
} }
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