From 06e46a19e9eae5b16fd8d2bbc29502add9564f35 Mon Sep 17 00:00:00 2001 From: David Baum Date: Sat, 2 Jun 2018 13:28:53 +0200 Subject: [PATCH] improve config gui --- plasmoid/contents/config/config.qml | 10 +-- plasmoid/contents/ui/config/Config.qml | 106 +++++++++++++++++-------- plasmoid/contents/ui/main.qml | 8 +- 3 files changed, 81 insertions(+), 43 deletions(-) diff --git a/plasmoid/contents/config/config.qml b/plasmoid/contents/config/config.qml index 06007f3..ad30633 100644 --- a/plasmoid/contents/config/config.qml +++ b/plasmoid/contents/config/config.qml @@ -1,23 +1,23 @@ /* - * Copyright (C) 2017 by David Baum + * Copyright (C) 2018 by David Baum * * This file is part of plasma-yamaha. * - * plasma-systemd is free software: you can redistribute it and/or modify + * plasma-docker 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. * - * plasma-systemd is distributed in the hope that it will be useful, + * plasma-docker 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 plasma-codeship. If not, see . + * along with plasma-docker. If not, see . */ -import QtQuick 2.2 +import QtQuick 2.5 import org.kde.plasma.configuration 2.0 ConfigModel { diff --git a/plasmoid/contents/ui/config/Config.qml b/plasmoid/contents/ui/config/Config.qml index 8e53f83..ade129e 100644 --- a/plasmoid/contents/ui/config/Config.qml +++ b/plasmoid/contents/ui/config/Config.qml @@ -1,26 +1,26 @@ /* - * Copyright (C) 2017 by David Baum + * Copyright (C) 2018 by David Baum * * This file is part of plasma-yamaha. * - * plasma-systemd is free software: you can redistribute it and/or modify + * plasma-docker 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. * - * plasma-systemd is distributed in the hope that it will be useful, + * plasma-docker 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 plasma-codeship. If not, see . + * along with plasma-docker. If not, see . */ import QtQuick 2.5 -import QtQuick.Controls 1.4 -import QtQuick.Layouts 1.1 -import QtQuick.Dialogs 1.2 +import QtQuick.Controls 1.3 +import QtQuick.Layouts 1.3 +import QtQuick.Dialogs 1.3 Item { property var cfg_container: [] @@ -37,6 +37,18 @@ Item { } } + function up(index, name) { + serviceModel.move(index, index-1,1) + var object = cfg_container.splice(index,1) + cfg_container.splice(index-1, 0, object ) + } + + function down(index, name) { + serviceModel.move(index, index+1,1) + var object = cfg_container.splice(index,1) + cfg_container.splice(index+1, 0, object) + } + function addService(object) { serviceModel.append( object ) cfg_container.push( JSON.stringify(object) ) @@ -60,25 +72,25 @@ Item { width: parent.width Label { - text: i18n('Project name') + text: i18n('Title') Layout.alignment: Qt.AlignRight } TextField { id: name Layout.fillWidth: true - placeholderText: "project name" + placeholderText: "Display name" } Label { - text: i18n('YAML file') + text: i18n('Compose file') Layout.alignment: Qt.AlignRight } TextField { id: dir Layout.fillWidth: true - placeholderText: "Path of YAML file" + placeholderText: "Path of compose file" } Button { @@ -104,37 +116,63 @@ Item { id: serviceModel } - RowLayout { + TableView { + model: serviceModel + id: view Layout.fillWidth: true Layout.fillHeight: true + sortIndicatorVisible: false + + TableViewColumn { + role: "service" + title: i18n("Service name") + width: parent.width * 0.3 + horizontalAlignment: Text.AlignHCenter + delegate: Component { + Text { + text: styleData.value + color: styleData.textColor + } + } + } - ScrollView { - Layout.fillWidth: true - Layout.fillHeight: true - - frameVisible: true - - ListView { - width: parent.width - model: serviceModel - - delegate: RowLayout { - width: parent.width + TableViewColumn { + role: "dir" + title: i18n("Compose file") + width: parent.width * 0.58 + horizontalAlignment: Text.AlignHCenter + delegate: Component { + Text { + text: styleData.value + color: styleData.textColor + } + } + } - Label { - Layout.fillWidth: true - text: model.service + TableViewColumn { + role: "actions" + title: i18n("Actions") + width: parent.width * 0.1 + horizontalAlignment: Text.AlignHCenter + delegate: Component { + Row { + id: row + Button { + iconName: "list-remove" + onClicked: removeService(model.index) + height: 20 } - - Label { - Layout.fillWidth: true - text: model.dir + + Button { + iconName: "arrow-up" + onClicked: up(model.index) + height: 20 } Button { - id: removeServiceButton - iconName: "list-remove" - onClicked: removeService(model.index) + iconName: "arrow-down" + onClicked: down(model.index) + height: 20 } } } diff --git a/plasmoid/contents/ui/main.qml b/plasmoid/contents/ui/main.qml index fd4a351..6ee1be0 100644 --- a/plasmoid/contents/ui/main.qml +++ b/plasmoid/contents/ui/main.qml @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 by David Baum + * Copyright (C) 2018 by David Baum * * This file is part of plasma-docker. * @@ -19,9 +19,9 @@ import QtQuick 2.5 import QtQuick.Layouts 1.3 -import QtQuick.Controls 1.4 -import QtQuick.Dialogs 1.2 -import QtQuick.Controls.Styles 1.2 +import QtQuick.Controls 1.3 +import QtQuick.Dialogs 1.3 +import QtQuick.Controls.Styles 1.3 import eu.naraesk.docker.process 1.0 Item {