Buttons are enable only when they have something to do

This commit is contained in:
Antonis Tsiapaliokas 2013-08-02 16:21:33 +03:00 committed by Martin Gräßlin
parent 837c44434d
commit 2431da8222
5 changed files with 36 additions and 2 deletions

View file

@ -22,6 +22,7 @@ find_package(Qt5Transitional MODULE)
find_package(Qt5Core REQUIRED NO_MODULE) find_package(Qt5Core REQUIRED NO_MODULE)
find_package(Qt5Quick REQUIRED NO_MODULE) find_package(Qt5Quick REQUIRED NO_MODULE)
find_package(KCoreAddons REQUIRED NO_MODULE)
add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0 -std=c++0x) add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0 -std=c++0x)
@ -87,7 +88,9 @@ target_link_libraries(kwincompositing
${Qt5Widgets_LIBRARIES} ${Qt5Widgets_LIBRARIES}
${KDE4_KDECORE_LIBS} ${KDE4_KDECORE_LIBS}
${KDE4_KCMUTILS_LIBS} ${KDE4_KCMUTILS_LIBS}
)
${KDE4Support_LIBRARIES}
${KCoreAddons_LIBRARIES})
INSTALL(DIRECTORY qml DESTINATION ${DATA_INSTALL_DIR}/kwincompositing) INSTALL(DIRECTORY qml DESTINATION ${DATA_INSTALL_DIR}/kwincompositing)
INSTALL(TARGETS kwincompositing ${INSTALL_TARGETS_DEFAULT_ARGS}) INSTALL(TARGETS kwincompositing ${INSTALL_TARGETS_DEFAULT_ARGS})

View file

@ -56,6 +56,7 @@ void EffectConfig::openConfig(const QString &effectName) {
if (plugin.name() == effectName) { if (plugin.name() == effectName) {
QString effectConfig = serviceName(plugin.name() + "_config"); QString effectConfig = serviceName(plugin.name() + "_config");
KCModuleProxy *proxy = new KCModuleProxy(effectConfig); KCModuleProxy *proxy = new KCModuleProxy(effectConfig);
proxy->show(); proxy->show();
} }
} }

View file

@ -23,8 +23,26 @@
#include "model.h" #include "model.h"
#include <QApplication> #include <QApplication>
#include <KAboutData>
#include <kcmdlineargs.h>
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
KAboutData aboutData("kwincompositing", 0, i18n("KWinCompositing"),
"1.0", i18n("Plasma Add-Ons Creator"),
KAboutData::License_GPL,
i18n("Copyright 2009-2013 Plasma Development Team"),
"", "", "kwin@kde.org");
aboutData.addAuthor(i18n("Antonis Tsiapaliokas"),
i18n("Author and maintainer"),
"kok3rs@gmail.com");
KCmdLineArgs::init(argc, argv,
"kwincompositing", "",
ki18n("KWinCompositing"),
"0.1");
QApplication app(argc, argv); QApplication app(argc, argv);
EffectView *view = new EffectView(); EffectView *view = new EffectView();

View file

@ -40,8 +40,13 @@ Component {
id: myCheckBox id: myCheckBox
checked: engineObject.isEnabled(model.Name) checked: engineObject.isEnabled(model.Name)
onClicked: { onClicked: {
apply.enabled = true;
engineObject.effectStatus(model.Name, checked); engineObject.effectStatus(model.Name, checked);
} }
onCheckedChanged: {
configureButton.enabled = myCheckBox.checked;
}
} }
Item { Item {
@ -86,6 +91,7 @@ Component {
anchors.left: effectItem.right anchors.left: effectItem.right
visible: effectConfig.effectUiConfigExists(model.Name) visible: effectConfig.effectUiConfigExists(model.Name)
text: "CONFIGURE EFFECT" text: "CONFIGURE EFFECT"
enabled: myCheckBox.checked
onClicked: { onClicked: {
effectConfig.openConfig(model.Name); effectConfig.openConfig(model.Name);
} }

View file

@ -90,6 +90,7 @@ Item {
anchors.fill: parent anchors.fill: parent
model: searchModel model: searchModel
delegate: Effect {} delegate: Effect {}
section.property: "Category" section.property: "Category"
section.delegate: sectionHeading section.delegate: sectionHeading
} }
@ -98,10 +99,15 @@ Item {
Button { Button {
id: apply id: apply
text: "Apply" text: "Apply"
enabled: false
anchors { anchors {
bottom: parent.bottom bottom: parent.bottom
} }
onClicked: { engineObject.syncConfig(); }
onClicked: {
engineObject.syncConfig();
apply.enabled = false;
}
} }
} }
} }