Changeset View
Changeset View
Standalone View
Standalone View
kcmkwin/kwineffects/kcm.cpp
Show All 10 Lines | |||||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | 12 | * GNU General Public License for more details. | ||
13 | * | 13 | * | ||
14 | * You should have received a copy of the GNU General Public License | 14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | */ | 16 | */ | ||
17 | 17 | | |||
18 | #include "kcm.h" | 18 | #include "kcm.h" | ||
19 | #include "effectmodel.h" | | |||
20 | #include "effectsfilterproxymodel.h" | 19 | #include "effectsfilterproxymodel.h" | ||
20 | #include "effectsmodel.h" | ||||
21 | 21 | | |||
22 | #include <KAboutData> | 22 | #include <KAboutData> | ||
23 | #include <KLocalizedString> | 23 | #include <KLocalizedString> | ||
24 | #include <KNS3/DownloadDialog> | 24 | #include <KNS3/DownloadDialog> | ||
25 | 25 | | |||
26 | #include <QQuickWindow> | 26 | #include <QQuickWindow> | ||
27 | #include <QWindow> | 27 | #include <QWindow> | ||
28 | 28 | | |||
29 | K_PLUGIN_FACTORY_WITH_JSON(DesktopEffectsKCMFactory, | 29 | K_PLUGIN_FACTORY_WITH_JSON(DesktopEffectsKCMFactory, | ||
30 | "kcm_kwin_effects.json", | 30 | "kcm_kwin_effects.json", | ||
31 | registerPlugin<KWin::DesktopEffectsKCM>();) | 31 | registerPlugin<KWin::DesktopEffectsKCM>();) | ||
32 | 32 | | |||
33 | namespace KWin | 33 | namespace KWin | ||
34 | { | 34 | { | ||
35 | 35 | | |||
36 | DesktopEffectsKCM::DesktopEffectsKCM(QObject *parent, const QVariantList &args) | 36 | DesktopEffectsKCM::DesktopEffectsKCM(QObject *parent, const QVariantList &args) | ||
37 | : KQuickAddons::ConfigModule(parent, args) | 37 | : KQuickAddons::ConfigModule(parent, args) | ||
38 | , m_model(new EffectModel(this)) | 38 | , m_model(new EffectsModel(this)) | ||
39 | { | 39 | { | ||
40 | qmlRegisterType<EffectsFilterProxyModel>("org.kde.private.kcms.kwin.effects", 1, 0, "EffectsFilterProxyModel"); | 40 | qmlRegisterType<EffectsFilterProxyModel>("org.kde.private.kcms.kwin.effects", 1, 0, "EffectsFilterProxyModel"); | ||
41 | 41 | | |||
42 | auto about = new KAboutData( | 42 | auto about = new KAboutData( | ||
43 | QStringLiteral("kcm_kwin_effects"), | 43 | QStringLiteral("kcm_kwin_effects"), | ||
44 | i18n("Desktop Effects"), | 44 | i18n("Desktop Effects"), | ||
45 | QStringLiteral("2.0"), | 45 | QStringLiteral("2.0"), | ||
46 | QString(), | 46 | QString(), | ||
47 | KAboutLicense::GPL | 47 | KAboutLicense::GPL | ||
48 | ); | 48 | ); | ||
49 | about->addAuthor(i18n("Vlad Zagorodniy"), QString(), QStringLiteral("vladzzag@gmail.com")); | 49 | about->addAuthor(i18n("Vlad Zagorodniy"), QString(), QStringLiteral("vladzzag@gmail.com")); | ||
50 | setAboutData(about); | 50 | setAboutData(about); | ||
51 | 51 | | |||
52 | setButtons(Apply | Default); | 52 | setButtons(Apply | Default); | ||
53 | 53 | | |||
54 | connect(m_model, &EffectModel::dataChanged, this, &DesktopEffectsKCM::updateNeedsSave); | 54 | connect(m_model, &EffectsModel::dataChanged, this, &DesktopEffectsKCM::updateNeedsSave); | ||
55 | } | 55 | } | ||
56 | 56 | | |||
57 | DesktopEffectsKCM::~DesktopEffectsKCM() | 57 | DesktopEffectsKCM::~DesktopEffectsKCM() | ||
58 | { | 58 | { | ||
59 | } | 59 | } | ||
60 | 60 | | |||
61 | QAbstractItemModel *DesktopEffectsKCM::effectsModel() const | 61 | QAbstractItemModel *DesktopEffectsKCM::effectsModel() const | ||
62 | { | 62 | { | ||
Show All 24 Lines | 84 | { | |||
87 | dialog->winId(); | 87 | dialog->winId(); | ||
88 | 88 | | |||
89 | if (context && context->window()) { | 89 | if (context && context->window()) { | ||
90 | dialog->windowHandle()->setTransientParent(context->window()); | 90 | dialog->windowHandle()->setTransientParent(context->window()); | ||
91 | } | 91 | } | ||
92 | 92 | | |||
93 | if (dialog->exec() == QDialog::Accepted) { | 93 | if (dialog->exec() == QDialog::Accepted) { | ||
94 | if (!dialog->changedEntries().isEmpty()) { | 94 | if (!dialog->changedEntries().isEmpty()) { | ||
95 | m_model->load(EffectModel::LoadOptions::KeepDirty); | 95 | m_model->load(EffectsModel::LoadOptions::KeepDirty); | ||
96 | } | 96 | } | ||
97 | } | 97 | } | ||
98 | 98 | | |||
99 | delete dialog; | 99 | delete dialog; | ||
100 | } | 100 | } | ||
101 | 101 | | |||
102 | void DesktopEffectsKCM::configure(const QString &pluginId, QQuickItem *context) | 102 | void DesktopEffectsKCM::configure(const QString &pluginId, QQuickItem *context) | ||
103 | { | 103 | { | ||
Show All 18 Lines |