Support for custom configuration dialogs for QML decorations
If the decoration package contains a ui file in ui/config.ui and and KConfigXT xml file in config/main.xml the configure dialog is extended by the custom values. For this the ui file is loaded and included in the dialog's layout. To make this possible the AuroraeConfigForm is changed to a VBoxLayout containing the so far used FormLayout. The configuration settings are loaded using Plasma's ConfigLoader and attached to the widget through a KConfigDialogManager. Marking this commit as the one which implements QML support for Aurorae themes: REVIEW: 105751 REVIEW: 105768 BUG: 303810 FIXED-IN: 4.10icc-effect-5.14.5
parent
8de1fea67e
commit
25ac108a76
|
@ -24,7 +24,7 @@ kde4_add_ui_files(kcm_kwindecoration_PART_SRCS
|
||||||
)
|
)
|
||||||
|
|
||||||
kde4_add_plugin(kcm_kwindecoration ${kcm_kwindecoration_PART_SRCS})
|
kde4_add_plugin(kcm_kwindecoration ${kcm_kwindecoration_PART_SRCS})
|
||||||
target_link_libraries(kcm_kwindecoration ${KDE4_KNEWSTUFF3_LIBS} kdecorations ${QT_QTDECLARATIVE_LIBRARY} ${X11_LIBRARIES})
|
target_link_libraries(kcm_kwindecoration ${KDE4_KNEWSTUFF3_LIBS} kdecorations ${KDE4_PLASMA_LIBS} ${QT_QTDECLARATIVE_LIBRARY} ${QT_QTUITOOLS_LIBRARY} ${X11_LIBRARIES})
|
||||||
install(TARGETS kcm_kwindecoration DESTINATION ${PLUGIN_INSTALL_DIR} )
|
install(TARGETS kcm_kwindecoration DESTINATION ${PLUGIN_INSTALL_DIR} )
|
||||||
|
|
||||||
########### install files ###############
|
########### install files ###############
|
||||||
|
|
|
@ -6,113 +6,114 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>400</width>
|
<width>384</width>
|
||||||
<height>300</height>
|
<height>95</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QFormLayout" name="formLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<property name="fieldGrowthPolicy">
|
<item>
|
||||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
<layout class="QFormLayout" name="formLayout">
|
||||||
</property>
|
<item row="0" column="0">
|
||||||
<item row="0" column="0">
|
<widget class="QLabel" name="label">
|
||||||
<widget class="QLabel" name="label">
|
<property name="text">
|
||||||
<property name="text">
|
<string>Border size:</string>
|
||||||
<string>Border size:</string>
|
</property>
|
||||||
</property>
|
<property name="buddy">
|
||||||
<property name="buddy">
|
<cstring>borderSizesCombo</cstring>
|
||||||
<cstring>borderSizesCombo</cstring>
|
</property>
|
||||||
</property>
|
</widget>
|
||||||
</widget>
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="KComboBox" name="borderSizesCombo">
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string comment="@item:inlistbox Border size:">Tiny</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string comment="@item:inlistbox Border size:">Normal</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string comment="@item:inlistbox Border size:">Large</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string comment="@item:inlistbox Border size:">Very Large</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string comment="@item:inlistbox Border size:">Huge</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string comment="@item:inlistbox Border size:">Very Huge</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string comment="@item:inlistbox Border size:">Oversized</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Button size:</string>
|
||||||
|
</property>
|
||||||
|
<property name="buddy">
|
||||||
|
<cstring>buttonSizesCombo</cstring>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="KComboBox" name="buttonSizesCombo">
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string comment="@item:inlistbox Button size:">Tiny</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string comment="@item:inlistbox Button size:">Normal</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string comment="@item:inlistbox Button size:">Large</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string comment="@item:inlistbox Button size:">Very Large</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string comment="@item:inlistbox Button size:">Huge</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string comment="@item:inlistbox Button size:">Very Huge</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string comment="@item:inlistbox Button size:">Oversized</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item>
|
||||||
<widget class="KComboBox" name="borderSizesCombo">
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string comment="@item:inlistbox Border size:">Tiny</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string comment="@item:inlistbox Border size:">Normal</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string comment="@item:inlistbox Border size:">Large</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string comment="@item:inlistbox Border size:">Very Large</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string comment="@item:inlistbox Border size:">Huge</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string comment="@item:inlistbox Border size:">Very Huge</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string comment="@item:inlistbox Border size:">Oversized</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLabel" name="label_2">
|
|
||||||
<property name="text">
|
|
||||||
<string>Button size:</string>
|
|
||||||
</property>
|
|
||||||
<property name="buddy">
|
|
||||||
<cstring>buttonSizesCombo</cstring>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="KComboBox" name="buttonSizesCombo">
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string comment="@item:inlistbox Button size:">Tiny</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string comment="@item:inlistbox Button size:">Normal</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string comment="@item:inlistbox Button size:">Large</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string comment="@item:inlistbox Button size:">Very Large</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string comment="@item:inlistbox Button size:">Huge</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string comment="@item:inlistbox Button size:">Very Huge</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string comment="@item:inlistbox Button size:">Oversized</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0" colspan="2">
|
|
||||||
<widget class="QCheckBox" name="closeWindowsDoubleClick">
|
<widget class="QCheckBox" name="closeWindowsDoubleClick">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string extracomment="Check this option if you want windows to be closed when you double click the menu button."/>
|
<string extracomment="Check this option if you want windows to be closed when you double click the menu button."/>
|
||||||
|
|
|
@ -457,4 +457,12 @@ QVariant DecorationModel::readConfig(const QString &themeName, const QString &ke
|
||||||
return m_config->group(themeName).readEntry(key, defaultValue);
|
return m_config->group(themeName).readEntry(key, defaultValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DecorationModel::notifyConfigChanged(const QModelIndex &index)
|
||||||
|
{
|
||||||
|
if (!index.isValid()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
emit configChanged(m_decorations[index.row()].auroraeName);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace KWin
|
} // namespace KWin
|
||||||
|
|
|
@ -121,6 +121,8 @@ public:
|
||||||
|
|
||||||
Q_INVOKABLE QVariant readConfig(const QString &themeName, const QString &key, const QVariant &defaultValue = QVariant());
|
Q_INVOKABLE QVariant readConfig(const QString &themeName, const QString &key, const QVariant &defaultValue = QVariant());
|
||||||
|
|
||||||
|
void notifyConfigChanged(const QModelIndex &index);
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void configChanged(QString themeName);
|
void configChanged(QString themeName);
|
||||||
public slots:
|
public slots:
|
||||||
|
|
|
@ -43,13 +43,16 @@
|
||||||
#include <QtGui/QSortFilterProxyModel>
|
#include <QtGui/QSortFilterProxyModel>
|
||||||
#include <QtGui/QGraphicsObject>
|
#include <QtGui/QGraphicsObject>
|
||||||
#include <QtGui/QScrollBar>
|
#include <QtGui/QScrollBar>
|
||||||
|
#include <QUiLoader>
|
||||||
// KDE
|
// KDE
|
||||||
#include <KAboutData>
|
#include <KAboutData>
|
||||||
#include <KDialog>
|
#include <KDialog>
|
||||||
#include <KLocale>
|
#include <KLocale>
|
||||||
#include <KNS3/DownloadDialog>
|
#include <KNS3/DownloadDialog>
|
||||||
#include <KDE/KStandardDirs>
|
#include <KDE/KStandardDirs>
|
||||||
|
#include <KDE/KConfigDialogManager>
|
||||||
#include <KPluginFactory>
|
#include <KPluginFactory>
|
||||||
|
#include <Plasma/ConfigLoader>
|
||||||
#include <qdeclarative.h>
|
#include <qdeclarative.h>
|
||||||
|
|
||||||
// KCModule plugin interface
|
// KCModule plugin interface
|
||||||
|
@ -353,10 +356,39 @@ void KWinDecorationModule::slotConfigureDecoration()
|
||||||
form->borderSizesCombo->setCurrentIndex(index.data(DecorationModel::BorderSizeRole).toInt());
|
form->borderSizesCombo->setCurrentIndex(index.data(DecorationModel::BorderSizeRole).toInt());
|
||||||
form->buttonSizesCombo->setCurrentIndex(index.data(DecorationModel::ButtonSizeRole).toInt());
|
form->buttonSizesCombo->setCurrentIndex(index.data(DecorationModel::ButtonSizeRole).toInt());
|
||||||
form->closeWindowsDoubleClick->setChecked(index.data(DecorationModel::CloseOnDblClickRole).toBool());
|
form->closeWindowsDoubleClick->setChecked(index.data(DecorationModel::CloseOnDblClickRole).toBool());
|
||||||
|
// in case of QmlDecoration look for a config.ui in the package structure
|
||||||
|
KConfigDialogManager *configManager = NULL;
|
||||||
|
if (index.data(DecorationModel::TypeRole).toInt() == DecorationModelData::QmlDecoration) {
|
||||||
|
const QString packageName = index.data(DecorationModel::AuroraeNameRole).toString();
|
||||||
|
const QString uiPath = KStandardDirs::locate("data", "kwin/decorations/" + packageName + "/contents/ui/config.ui");
|
||||||
|
const QString configPath = KStandardDirs::locate("data", "kwin/decorations/" + packageName + "/contents/config/main.xml");
|
||||||
|
if (!uiPath.isEmpty() && !configPath.isEmpty()) {
|
||||||
|
// load the KConfigSkeleton
|
||||||
|
QFile configFile(configPath);
|
||||||
|
KSharedConfigPtr auroraeConfig = KSharedConfig::openConfig("auroraerc");
|
||||||
|
KConfigGroup configGroup = auroraeConfig->group(packageName);
|
||||||
|
Plasma::ConfigLoader *skeleton = new Plasma::ConfigLoader(&configGroup, &configFile, dlg);
|
||||||
|
// load the ui file
|
||||||
|
QUiLoader *loader = new QUiLoader(dlg);
|
||||||
|
QFile uiFile(uiPath);
|
||||||
|
uiFile.open(QFile::ReadOnly);
|
||||||
|
QWidget *customConfigForm = loader->load(&uiFile, form);
|
||||||
|
uiFile.close();
|
||||||
|
form->layout()->addWidget(customConfigForm);
|
||||||
|
// connect the ui file with the skeleton
|
||||||
|
configManager = new KConfigDialogManager(customConfigForm, skeleton);
|
||||||
|
configManager->updateWidgets();
|
||||||
|
}
|
||||||
|
}
|
||||||
if (dlg->exec() == KDialog::Accepted) {
|
if (dlg->exec() == KDialog::Accepted) {
|
||||||
m_model->setData(index, form->borderSizesCombo->currentIndex(), DecorationModel::BorderSizeRole);
|
m_model->setData(index, form->borderSizesCombo->currentIndex(), DecorationModel::BorderSizeRole);
|
||||||
m_model->setData(index, form->buttonSizesCombo->currentIndex(), DecorationModel::ButtonSizeRole);
|
m_model->setData(index, form->buttonSizesCombo->currentIndex(), DecorationModel::ButtonSizeRole);
|
||||||
m_model->setData(index, form->closeWindowsDoubleClick->isChecked(), DecorationModel::CloseOnDblClickRole);
|
m_model->setData(index, form->closeWindowsDoubleClick->isChecked(), DecorationModel::CloseOnDblClickRole);
|
||||||
|
if (configManager && configManager->hasChanged()) {
|
||||||
|
// we have a config manager and the settings changed
|
||||||
|
configManager->updateSettings();
|
||||||
|
m_model->notifyConfigChanged(index);
|
||||||
|
}
|
||||||
reload = true;
|
reload = true;
|
||||||
}
|
}
|
||||||
delete dlg;
|
delete dlg;
|
||||||
|
|
Loading…
Reference in New Issue