diff --git a/applets/mediaframe/package/contents/ui/ConfigGeneral.qml b/applets/mediaframe/package/contents/ui/ConfigGeneral.qml index acf19e205..416094d5e 100644 --- a/applets/mediaframe/package/contents/ui/ConfigGeneral.qml +++ b/applets/mediaframe/package/contents/ui/ConfigGeneral.qml @@ -1,215 +1,209 @@ /* * Copyright 2015 Lars Pontoppidan * * 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 2.010-1301, USA. */ import QtQuick 2.7 import QtQuick.Controls 1.5 import QtQuick.Layouts 1.1 -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 as KQuickAddons - Item { id: root property alias cfg_interval: intervalSpinBox.value property alias cfg_randomize: randomizeCheckBox.checked property alias cfg_pauseOnMouseOver: pauseOnMouseOverCheckBox.checked property alias cfg_useBackground: useBackgroundCheckBox.checked property alias cfg_leftClickOpenImage: leftClickOpenImageCheckBox.checked //property alias cfg_showCountdown: showCountdownCheckBox.checked property alias cfg_fillMode: root.fillMode /* * Image.Stretch - the image is scaled to fit * Image.PreserveAspectFit - the image is scaled uniformly to fit without cropping * Image.PreserveAspectCrop - the image is scaled uniformly to fill, cropping if necessary * Image.Tile - the image is duplicated horizontally and vertically * Image.TileVertically - the image is stretched horizontally and tiled vertically * Image.TileHorizontally - the image is stretched vertically and tiled horizontally * Image.Pad - the image is not transformed */ property int fillMode: Image.PreserveAspectFit ColumnLayout { spacing: 20 Grid { columns: 2 rows: 7 rowSpacing: 20 columnSpacing: 10 verticalItemAlignment: Grid.AlignVCenter // Row 1, Col 1 Label { text: i18n("Change picture every") } // Row 1, Col 2 SpinBox { id: intervalSpinBox suffix: i18n("s") decimals: 1 // Once a day should be high enough maximumValue: 24*(60*60) } // end SpinBox // Row 2, Col 1 Label { id: fillLabel text: i18n("Fill mode:") } // Row 2, Col 2 ComboBox { id: comboBox width: units.gridUnit * 10 currentIndex: fillModeToIndex(fillMode) model: [ { text: i18n("Stretch"), value: Image.Stretch }, { text: i18n("Preserve aspect fit"), value: Image.PreserveAspectFit }, { text: i18n("Preserve aspect crop"), value: Image.PreserveAspectCrop }, { text: i18n("Tile"), value: Image.Tile }, { text: i18n("Tile vertically"), value: Image.TileVertically }, { text: i18n("Tile horizontally"), value: Image.TileHorizontally }, { text: i18n("Pad"), value: Image.Pad } ] // end of ComboBox model onCurrentIndexChanged: { root.fillMode = comboBox.currentIndex fillModeToIndex(root.fillMode) //console.log(comboBox.currentIndex); } function fillModeToIndex(fillMode) { //console.log("function called"); if(fillMode == Image.Stretch) { fillModeDescription.text = i18n( "The image is scaled to fit the frame"); return 0 } else if(fillMode == Image.PreserveAspectFit) { fillModeDescription.text = i18n("The image is scaled uniformly to fit without cropping"); return 1 } else if(fillMode == Image.PreserveAspectCrop) { fillModeDescription.text = i18n( "The image is scaled uniformly to fill, cropping if necessary"); return 2 } else if(fillMode == Image.Tile) { fillModeDescription.text = i18n("The image is duplicated horizontally and vertically"); return 3 } else if(fillMode == Image.TileVertically) { fillModeDescription.text = i18n("The image is stretched horizontally and tiled vertically"); return 4 } else if(fillMode == Image.TileHorizontally) { fillModeDescription.text = i18n("The image is stretched vertically and tiled horizontally"); return 5 } else if(fillMode == Image.Pad) { fillModeDescription.text = i18n("The image is not transformed"); return 6 } } // end of fillModeToIndex function } // end of ComboBox and related functions // Row 3, Col 1 (cheater to fill empty cell) Label { width: 10 text: "" } //Row 3, Col 2 Label { id: fillModeDescription text: i18n("The image is scaled uniformly to fit without cropping") } } // end of top section GridLayout // these CheckBoxes should take over as their own ColumnLayout entries CheckBox { id: randomizeCheckBox text: i18n("Randomize items") } CheckBox { id: pauseOnMouseOverCheckBox text: i18n("Pause on mouseover") } CheckBox { id: useBackgroundCheckBox text: i18n("Background frame") } CheckBox { id: leftClickOpenImageCheckBox text: i18n("Left click image opens in external viewer") } } // end ColumnLayout } // end Item diff --git a/applets/mediaframe/package/contents/ui/ConfigPaths.qml b/applets/mediaframe/package/contents/ui/ConfigPaths.qml index 8adca1037..a4888e281 100644 --- a/applets/mediaframe/package/contents/ui/ConfigPaths.qml +++ b/applets/mediaframe/package/contents/ui/ConfigPaths.qml @@ -1,181 +1,177 @@ /* * Copyright 2015 Lars Pontoppidan * * 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 2.010-1301, USA. */ import QtQuick 2.1 import QtQuick.Controls 1.1 import QtQuick.Dialogs 1.2 import QtQuick.Layouts 1.1 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 as KQuickAddons Item { id: root width: parent.width height: parent.height property var cfg_pathList: [] function addPath(object) { pathModel.append( object ) cfg_pathList.push( JSON.stringify(object) ) } function removePath(index) { if(pathModel.count > 0) { pathModel.remove(index) cfg_pathList.splice(index,1) } } Component.onCompleted: { // Load the list back in var list = plasmoid.configuration.pathList cfg_pathList = [] for(var i in list) { addPath( JSON.parse(list[i]) ) } } FileDialog { id: fileDialog visible: false title: i18n("Choose files") folder: shortcuts.pictures selectMultiple: true // TODO get valid filter list from native code? //nameFilters: [ "Image files (*.png *.jpg)", "All files (*)" ] //selectedNameFilter: "All files (*)" onAccepted: { console.log("Accepted: " + fileUrls) for (var i = 0; i < fileUrls.length; ++i) { var item = { 'path':fileUrls[i], 'type':'file' } addPath(item) } } onRejected: { console.log("Canceled") } } FileDialog { id: folderDialog visible: false title: i18n("Choose a folder") folder: shortcuts.pictures selectFolder: true onAccepted: { console.log("Accepted: " + fileUrls) for (var i = 0; i < fileUrls.length; ++i) { var item = { 'path':fileUrls[i], 'type':'folder' } addPath(item) } } onRejected: { console.log("Canceled") } } ColumnLayout { width: parent.width height: parent.height RowLayout { Layout.fillWidth: true Button { iconName: "folder-new" onClicked: folderDialog.visible = true text: i18n("Add folder...") } Button { iconName: "document-new" onClicked: fileDialog.visible = true text: i18n("Add files...") } } Label { Layout.fillWidth: true text: i18n("Paths:") } ListModel { id: pathModel } RowLayout { Layout.fillWidth: true Layout.fillHeight: true ScrollView { Layout.fillWidth: true Layout.fillHeight: true frameVisible: true ListView { width: parent.width model: pathModel delegate: RowLayout { width: parent.width Label { id: pathText Layout.fillWidth: true text: model.path } Button { id: removePathButton iconName: "list-remove" onClicked: removePath(model.index) } } } } } } }