use just a combobox
This commit is contained in:
parent
2a293e0680
commit
4c2a1046c2
@ -167,6 +167,7 @@ QVariant ConfigModel::get(int row) const
|
|||||||
|
|
||||||
value["name"] = m_categories.at(row)->name();
|
value["name"] = m_categories.at(row)->name();
|
||||||
value["icon"] = m_categories.at(row)->icon();
|
value["icon"] = m_categories.at(row)->icon();
|
||||||
|
value["pluginName"] = m_categories.at(row)->pluginName();
|
||||||
if (m_appletInterface) {
|
if (m_appletInterface) {
|
||||||
value["source"] = QUrl::fromLocalFile(m_appletInterface.data()->package().filePath("ui", m_categories.at(row)->source()));
|
value["source"] = QUrl::fromLocalFile(m_appletInterface.data()->package().filePath("ui", m_categories.at(row)->source()));
|
||||||
} else {
|
} else {
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import QtQuick 2.0
|
import QtQuick 2.0
|
||||||
import org.kde.plasma.extras 2.0 as PlasmaExtras
|
|
||||||
import org.kde.plasma.configuration 2.0
|
import org.kde.plasma.configuration 2.0
|
||||||
import QtQuick.Controls 1.0 as QtControls
|
import QtQuick.Controls 1.0 as QtControls
|
||||||
import QtQuick.Layouts 1.0
|
import QtQuick.Layouts 1.0
|
||||||
@ -26,9 +25,6 @@ ColumnLayout {
|
|||||||
id: root
|
id: root
|
||||||
|
|
||||||
spacing: _m
|
spacing: _m
|
||||||
PlasmaExtras.Title {
|
|
||||||
text: "Plugins"
|
|
||||||
}
|
|
||||||
|
|
||||||
//BEGIN functions
|
//BEGIN functions
|
||||||
function saveConfig() {
|
function saveConfig() {
|
||||||
@ -49,68 +45,19 @@ ColumnLayout {
|
|||||||
}
|
}
|
||||||
//END functions
|
//END functions
|
||||||
|
|
||||||
ListView {
|
Component.onCompleted: {
|
||||||
id: categoriesView
|
for (var i = 0; i < configDialog.wallpaperConfigModel.count; ++i) {
|
||||||
anchors {
|
var data = configDialog.wallpaperConfigModel.get(i);
|
||||||
left: parent.left
|
for(var j in data) print(j)
|
||||||
right: parent.right
|
if (configDialog.currentWallpaper == data.pluginName) {
|
||||||
}
|
pluginCombobox.currentIndex = i
|
||||||
height: 100
|
break;
|
||||||
orientation: ListView.Horizontal
|
|
||||||
|
|
||||||
model: configDialog.wallpaperConfigModel
|
|
||||||
delegate: ConfigCategoryDelegate {
|
|
||||||
id: delegate
|
|
||||||
current: categoriesView.currentIndex == index
|
|
||||||
anchors {
|
|
||||||
top: parent.top
|
|
||||||
bottom: parent.bottom
|
|
||||||
left: undefined
|
|
||||||
right: undefined
|
|
||||||
}
|
|
||||||
width: 64
|
|
||||||
onClicked: {
|
|
||||||
configDialog.currentWallpaper = model.pluginName
|
|
||||||
if (categoriesView.currentIndex == index) {
|
|
||||||
return
|
|
||||||
} else {
|
|
||||||
categoriesView.currentIndex = index;
|
|
||||||
main.sourceFile = model.source
|
|
||||||
root.restoreConfig()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
onCurrentChanged: {
|
|
||||||
categoriesView.currentIndex = index
|
|
||||||
if (current) {
|
|
||||||
categoriesView.currentIndex = index
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Component.onCompleted: {
|
|
||||||
if (configDialog.currentWallpaper == model.pluginName) {
|
|
||||||
loadWallpaperTimer.pendingCurrent = model
|
|
||||||
loadWallpaperTimer.restart()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
highlight: Rectangle {
|
|
||||||
color: theme.highlightColor
|
|
||||||
}
|
|
||||||
Timer {
|
|
||||||
id: loadWallpaperTimer
|
|
||||||
interval: 100
|
|
||||||
property variant pendingCurrent
|
|
||||||
onTriggered: {
|
|
||||||
if (pendingCurrent) {
|
|
||||||
categoriesView.currentIndex = pendingCurrent.index
|
|
||||||
main.sourceFile = pendingCurrent.source
|
|
||||||
root.restoreConfig()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
spacing: 10
|
spacing: 4
|
||||||
QtControls.Label {
|
QtControls.Label {
|
||||||
anchors.verticalCenter: pluginCombobox.verticalCenter
|
anchors.verticalCenter: pluginCombobox.verticalCenter
|
||||||
text: "Wallpaper plugin:"
|
text: "Wallpaper plugin:"
|
||||||
@ -119,6 +66,11 @@ ColumnLayout {
|
|||||||
id: pluginCombobox
|
id: pluginCombobox
|
||||||
model: configDialog.wallpaperConfigModel
|
model: configDialog.wallpaperConfigModel
|
||||||
textRole: "name"
|
textRole: "name"
|
||||||
|
onCurrentIndexChanged: {
|
||||||
|
var model = configDialog.wallpaperConfigModel.get(currentIndex)
|
||||||
|
main.sourceFile = model.source
|
||||||
|
root.restoreConfig()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,7 +78,7 @@ ColumnLayout {
|
|||||||
id: main
|
id: main
|
||||||
Layout.fillHeight: true;
|
Layout.fillHeight: true;
|
||||||
anchors {
|
anchors {
|
||||||
left: categoriesView.left;
|
left: parent.left;
|
||||||
right: parent.right;
|
right: parent.right;
|
||||||
}
|
}
|
||||||
property string sourceFile
|
property string sourceFile
|
||||||
|
Loading…
x
Reference in New Issue
Block a user