diff --git a/containments/desktop/package/contents/ui/ConfigIcons.qml b/containments/desktop/package/contents/ui/ConfigIcons.qml index d352a6f5a..79ec8c51e 100644 --- a/containments/desktop/package/contents/ui/ConfigIcons.qml +++ b/containments/desktop/package/contents/ui/ConfigIcons.qml @@ -1,352 +1,445 @@ /*************************************************************************** * Copyright (C) 2014 by Eike Hein * * Copyright (C) 2015 by Kai Uwe Broulik * * * * This program 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 2 of the License, or * * (at your option) any later version. * * * * This program 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 this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * ***************************************************************************/ import QtQuick 2.4 import QtQuick.Controls 1.0 import QtQuick.Dialogs 1.1 import QtQuick.Layouts 1.0 import org.kde.plasma.plasmoid 2.0 import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.components 2.0 as PlasmaComponents import org.kde.kquickcontrolsaddons 2.0 import org.kde.private.desktopcontainment.desktop 0.1 as Desktop import org.kde.private.desktopcontainment.folder 0.1 as Folder Item { id: configIcons width: childrenRect.width height: childrenRect.height property bool isPopup: (plasmoid.location != PlasmaCore.Types.Floating) property string cfg_icon: plasmoid.configuration.icon property alias cfg_useCustomIcon: useCustomIcon.checked property alias cfg_arrangement: arrangement.currentIndex property alias cfg_alignment: alignment.currentIndex property alias cfg_locked: locked.checked property alias cfg_sortMode: sortMode.mode property alias cfg_sortDesc: sortDesc.checked property alias cfg_sortDirsFirst: sortDirsFirst.checked property alias cfg_toolTips: toolTips.checked property alias cfg_selectionMarkers: selectionMarkers.checked property alias cfg_popups: popups.checked property alias cfg_previews: previews.checked property alias cfg_previewPlugins: previewPluginsDialog.previewPlugins property alias cfg_viewMode: viewMode.currentIndex property alias cfg_iconSize: iconSize.value property alias cfg_textLines: textLines.value IconDialog { id: iconDialog onIconNameChanged: cfg_icon = iconName || "folder" } - ColumnLayout { - GroupBox { - id: panelButtonGroupBox + GridLayout { - Layout.fillWidth: true + // Row 0: "Panel button" + Label { + Layout.row: 0 + Layout.column: 0 + + visible: isPopup + text: i18n("Panel button:") + } + + CheckBox { + id: useCustomIcon + Layout.row: 0 + Layout.column: 1 + Layout.columnSpan: 2 visible: isPopup + checked: cfg_useCustomIcon + text: i18n("Use a custom icon") + } - title: i18n("Panel Button") + RowLayout { + Layout.row: 0 + Layout.column: 3 + Layout.alignment: Qt.AlignRight + spacing: units.smallSpacing - flat: true + visible: isPopup - RowLayout { - spacing: units.smallSpacing + Button { + id: iconButton + Layout.minimumWidth: units.iconSizes.large + units.smallSpacing * 2 + Layout.maximumWidth: Layout.minimumWidth + Layout.minimumHeight: Layout.minimumWidth + Layout.maximumHeight: Layout.minimumWidth - CheckBox { - id: useCustomIcon + checkable: true + enabled: useCustomIcon.checked - checked: cfg_useCustomIcon + onClicked: { + checked = Qt.binding(function() { + return iconMenu.status === PlasmaComponents.DialogStatus.Open; + }) - text: i18n("Custom icon:") + iconMenu.open(0, height); } - Button { - id: iconButton - Layout.minimumWidth: units.iconSizes.large + units.smallSpacing * 2 - Layout.maximumWidth: Layout.minimumWidth - Layout.minimumHeight: Layout.minimumWidth - Layout.maximumHeight: Layout.minimumWidth - - checkable: true - - onClicked: { - checked = Qt.binding(function() { - return iconMenu.status === PlasmaComponents.DialogStatus.Open; - }) - - iconMenu.open(0, height); - } - - PlasmaCore.IconItem { - anchors.centerIn: parent - width: units.iconSizes.large - height: width - source: cfg_icon - } + PlasmaCore.IconItem { + anchors.centerIn: parent + width: units.iconSizes.large + height: width + source: cfg_icon } + } - PlasmaComponents.ContextMenu { - id: iconMenu - visualParent: iconButton - - PlasmaComponents.MenuItem { - text: i18nc("@item:inmenu Open icon chooser dialog", "Choose...") - icon: "document-open-folder" - onClicked: iconDialog.open() - } - - PlasmaComponents.MenuItem { - text: i18nc("@item:inmenu Reset icon to default", "Clear Icon") - icon: "edit-clear" - onClicked: cfg_icon = "folder" - } + PlasmaComponents.ContextMenu { + id: iconMenu + visualParent: iconButton + + PlasmaComponents.MenuItem { + text: i18nc("@item:inmenu Open icon chooser dialog", "Choose...") + icon: "document-open-folder" + onClicked: iconDialog.open() + } + + PlasmaComponents.MenuItem { + text: i18nc("@item:inmenu Reset icon to default", "Clear Icon") + icon: "edit-clear" + onClicked: cfg_icon = "folder" } } } - GroupBox { - id: arrangementGroupBox + // Row 1: Spacing + Item { + Layout.row: 1 + Layout.column: 0 + Layout.minimumHeight: units.largeSpacing + visible: isPopup + } - Layout.fillWidth: true + // Row 2: "Arrangment" - "Arrange in" + Label { + Layout.row: 2 + Layout.column: 0 - visible: !isPopup + text: i18n("Arrangement:") + } - title: i18n("Arrangement") + Label { + Layout.row: 2 + Layout.column: 1 - flat: true + text: i18n("Arrange in") + } - ColumnLayout { - Layout.fillWidth: true + ComboBox { + id: arrangement + Layout.row: 2 + Layout.column: 2 + Layout.columnSpan: 2 + Layout.fillWidth: true - RowLayout { - Label { - text: i18n("Arrange in:") - } + model: [i18n("Rows"), i18n("Columns")] + } - ComboBox { - id: arrangement + // Row 3: "Arrangment" - "Align" + Label { + Layout.row: 3 + Layout.column: 1 - model: [i18n("Rows"), i18n("Columns")] - } - } + text: i18n("Align") + } - RowLayout { - Label { - text: i18n("Align:") - } + ComboBox { + id: alignment + Layout.row: 3 + Layout.column: 2 + Layout.columnSpan: 2 + Layout.fillWidth: true - ComboBox { - id: alignment + model: [i18n("Left"), i18n("Right")] + } - model: [i18n("Left"), i18n("Right")] - } - } + // Row 4: "Arrangment" - "Lock" + CheckBox { + id: locked + Layout.row: 4 + Layout.column: 1 + Layout.columnSpan: 3 - CheckBox { - id: locked + visible: ("containmentType" in plasmoid) - visible: ("containmentType" in plasmoid) + text: i18n("Lock in place") + } - text: i18n("Lock in place") - } - } + // Row 5: Spacing + Item { + Layout.row: 5 + Layout.column: 0 + Layout.minimumHeight: units.largeSpacing } - GroupBox { - id: sortingGroupBox + // Row 6: "Sorting" - "Sort by" + Label { + Layout.row: 6 + Layout.column: 0 - Layout.fillWidth: true + text: i18n("Sorting:") + } - title: i18n("Sorting") + Label { + Layout.row: 6 + Layout.column: 1 - flat: true + text: i18n("Sort by") + } - ColumnLayout { - RowLayout { - Label { - text: i18n("Sorting:") - } + ComboBox { + id: sortMode + Layout.row: 6 + Layout.column: 2 + Layout.columnSpan: 2 + Layout.fillWidth: true - ComboBox { - id: sortMode + property int mode + // FIXME TODO HACK: This maps the combo box list model to the KDirModel::ModelColumns + // enum, which should be done in C++. + property variant indexToMode: [-1, 0, 1, 6, 2] + property variant modeToIndex: {'-1' : '0', '0' : '1', '1' : '2', '6' : '3', '2' : '4'} - property int mode - // FIXME TODO HACK: This maps the combo box's list model to the KDirModel::ModelColumns - // enum, which should be done in C++. - property variant indexToMode: [-1, 0, 1, 6, 2] - property variant modeToIndex: {'-1' : '0', '0' : '1', '1' : '2', '6' : '3', '2' : '4'} + model: [i18n("Unsorted"), i18n("Name"), i18n("Size"), i18n("Type"), i18n("Date")] - model: [i18n("Unsorted"), i18n("Name"), i18n("Size"), i18n("Type"), i18n("Date")] + Component.onCompleted: currentIndex = modeToIndex[mode] + onActivated: mode = indexToMode[index] + } - Component.onCompleted: currentIndex = modeToIndex[mode] - onActivated: mode = indexToMode[index] - } - } + // Row 7: "Sorting" - "Descending" + CheckBox { + id: sortDesc + Layout.row: 7 + Layout.column: 1 + Layout.columnSpan: 3 - CheckBox { - id: sortDesc + enabled: (sortMode.currentIndex != 0) - enabled: (sortMode.currentIndex != 0) + text: i18n("Descending") + } - text: i18n("Descending") - } + // Row 8: "Sorting" - "Directories first" + CheckBox { + id: sortDirsFirst + Layout.row: 8 + Layout.column: 1 + Layout.columnSpan: 3 - CheckBox { - id: sortDirsFirst + enabled: (sortMode.currentIndex != 0) - enabled: (sortMode.currentIndex != 0) + text: i18n("Folders first") + } - text: i18n("Folders first") - } - } + // Row 9: Spacing + Item { + Layout.row: 9 + Layout.column: 0 + Layout.minimumHeight: units.largeSpacing } - GroupBox { - id: appearanceGroupBox + // Row 10: "Appearance" - "View mode" + Label { + Layout.row: (isPopup ? 10 : 11) + Layout.column: 0 + + text: i18n("Appearance:") + } + Label { + Layout.row: 10 + Layout.column: 1 + + visible: isPopup + + text: i18nc("whether to use icon or list view", "View mode") + } + + ComboBox { + id: viewMode + Layout.row: 10 + Layout.column: 2 + Layout.columnSpan: 2 Layout.fillWidth: true - title: i18n("Appearance") + visible: isPopup - flat: true + model: [i18n("List"), i18n("Icons")] + } - ColumnLayout { - RowLayout { - visible: isPopup + // Rows 11+12: "Appearance" - "Size" + Label { + Layout.row: 11 + Layout.column: 1 - Label { - text: i18nc("whether to use icon or list view", "View Mode:") - } + visible: !isPopup || viewMode.currentIndex === 1 - ComboBox { - id: viewMode - model: [i18n("List"), i18n("Icons")] - } - } + text: i18n("Size") + } - RowLayout { - visible: !isPopup || viewMode.currentIndex === 1 + Slider { + id: iconSize + Layout.row: 11 + Layout.column: 2 + Layout.columnSpan: 2 + Layout.fillWidth: true - Label { - text: i18n("Size:") - } + visible: !isPopup || viewMode.currentIndex === 1 - Label { - text: i18n("Small") - } + minimumValue: 0 + maximumValue: 5 + stepSize: 1 + tickmarksEnabled: true + } - Slider { - id: iconSize + Label { + Layout.row: 12 + Layout.column: 2 + Layout.alignment: Qt.AlignLeft - minimumValue: 0 - maximumValue: 5 - stepSize: 1 + visible: !isPopup || viewMode.currentIndex === 1 - tickmarksEnabled: true - } + text: i18n("Small") + } - Label { - text: i18n("Large") - } - } + Label { + Layout.row: 12 + Layout.column: 3 + Layout.alignment: Qt.AlignRight - RowLayout { - visible: !isPopup || viewMode.currentIndex === 1 + visible: !isPopup || viewMode.currentIndex === 1 - Label { - text: i18n("Text lines:") - } + text: i18n("Large") + } - SpinBox { - id: textLines + // Row 13: "Appearance" - "Text lines" + Label { + Layout.row: 13 + Layout.column: 1 - minimumValue: 1 - maximumValue: 10 - stepSize: 1 - } - } + visible: !isPopup || viewMode.currentIndex === 1 - } + text: i18n("Text lines") } - GroupBox { - id: behaviorGroupBox + SpinBox { + id: textLines + Layout.row: 13 + Layout.column: 2 + Layout.columnSpan: 2 - Layout.fillWidth: true + visible: !isPopup || viewMode.currentIndex === 1 - title: i18n("Features") + minimumValue: 1 + maximumValue: 10 + stepSize: 1 + } - flat: true + // Row 14: Spacing + Item { + Layout.row: 14 + Layout.column: 0 + Layout.minimumHeight: units.largeSpacing + } - ColumnLayout { - CheckBox { - id: toolTips + // Row 15: "Features" - "Tool tips" + Label { + Layout.row: 15 + Layout.column: 0 - text: i18n("Tooltips") - } + text: i18n("Features:") + } + + CheckBox { + id: toolTips + Layout.row: 15 + Layout.column: 1 + Layout.columnSpan: 3 - CheckBox { - id: selectionMarkers + text: i18n("Tool tips") + } - visible: Qt.styleHints.singleClickActivation + // Row 16: "Features" - "Selection markers" + CheckBox { + id: selectionMarkers + Layout.row: 16 + Layout.column: 1 + Layout.columnSpan: 3 - text: i18n("Selection markers") - } + visible: Qt.styleHints.singleClickActivation - CheckBox { - id: popups + text: i18n("Selection markers") + } - visible: !isPopup + // Row 17: "Features" - "Folder preview popups" + CheckBox { + id: popups + Layout.row: 17 + Layout.column: 1 + Layout.columnSpan: 3 - text: i18n("Folder preview popups") - } + visible: !isPopup - RowLayout { - CheckBox { - id: previews + text: i18n("Folder preview popups") + } - text: i18n("Preview thumbnails") - } + // Rows 18+19: "Features" - "Preview thumbnails" + CheckBox { + id: previews + Layout.row: 18 + Layout.column: 1 + Layout.columnSpan: 3 - Button { - id: previewSettings + text: i18n("Preview thumbnails") + } - text: i18n("More Preview Options...") + Button { + id: previewSettings + Layout.row: 19 + Layout.column: 3 + Layout.alignment: Qt.AlignRight - onClicked: { - previewPluginsDialog.visible = true; - } - } - } + text: i18n("More Preview Options...") + + onClicked: { + previewPluginsDialog.visible = true; } } + } - FolderItemPreviewPluginsDialog { - id: previewPluginsDialog - } + FolderItemPreviewPluginsDialog { + id: previewPluginsDialog } }