diff --git a/src/plugins/magiclamp/magiclamp_config.cpp b/src/plugins/magiclamp/magiclamp_config.cpp index b967dc82ad..5c986a8a6c 100644 --- a/src/plugins/magiclamp/magiclamp_config.cpp +++ b/src/plugins/magiclamp/magiclamp_config.cpp @@ -25,21 +25,13 @@ K_PLUGIN_CLASS(KWin::MagicLampEffectConfig) namespace KWin { -MagicLampEffectConfigForm::MagicLampEffectConfigForm(QWidget *parent) - : QWidget(parent) -{ - setupUi(this); -} - MagicLampEffectConfig::MagicLampEffectConfig(QObject *parent, const KPluginMetaData &data) : KCModule(parent, data) - , m_ui(widget()) { - QVBoxLayout *layout = new QVBoxLayout(widget()); - layout->addWidget(&m_ui); + m_ui.setupUi(widget()); MagicLampConfig::instance(KWIN_CONFIG); - addConfig(MagicLampConfig::self(), &m_ui); + addConfig(MagicLampConfig::self(), widget()); } void MagicLampEffectConfig::save() diff --git a/src/plugins/magiclamp/magiclamp_config.h b/src/plugins/magiclamp/magiclamp_config.h index fc50deb0fc..4c0f1c49b3 100644 --- a/src/plugins/magiclamp/magiclamp_config.h +++ b/src/plugins/magiclamp/magiclamp_config.h @@ -15,14 +15,6 @@ namespace KWin { - -class MagicLampEffectConfigForm : public QWidget, public Ui::MagicLampEffectConfigForm -{ - Q_OBJECT -public: - explicit MagicLampEffectConfigForm(QWidget *parent); -}; - class MagicLampEffectConfig : public KCModule { Q_OBJECT @@ -33,7 +25,7 @@ public Q_SLOTS: void save() override; private: - MagicLampEffectConfigForm m_ui; + Ui::MagicLampEffectConfigForm m_ui; }; } // namespace diff --git a/src/plugins/magnifier/magnifier_config.cpp b/src/plugins/magnifier/magnifier_config.cpp index f42a014044..34290dbe67 100644 --- a/src/plugins/magnifier/magnifier_config.cpp +++ b/src/plugins/magnifier/magnifier_config.cpp @@ -30,22 +30,13 @@ K_PLUGIN_CLASS(KWin::MagnifierEffectConfig) namespace KWin { - -MagnifierEffectConfigForm::MagnifierEffectConfigForm(QWidget *parent) - : QWidget(parent) -{ - setupUi(this); -} - MagnifierEffectConfig::MagnifierEffectConfig(QObject *parent, const KPluginMetaData &data) : KCModule(parent, data) - , m_ui(widget()) { - QVBoxLayout *layout = new QVBoxLayout(widget()); - layout->addWidget(&m_ui); + m_ui.setupUi(widget()); MagnifierConfig::instance(KWIN_CONFIG); - addConfig(MagnifierConfig::self(), &m_ui); + addConfig(MagnifierConfig::self(), widget()); connect(m_ui.editor, &KShortcutsEditor::keyChange, this, &KCModule::markAsChanged); diff --git a/src/plugins/magnifier/magnifier_config.h b/src/plugins/magnifier/magnifier_config.h index bab274437d..227f4e408b 100644 --- a/src/plugins/magnifier/magnifier_config.h +++ b/src/plugins/magnifier/magnifier_config.h @@ -18,13 +18,6 @@ class KActionCollection; namespace KWin { -class MagnifierEffectConfigForm : public QWidget, public Ui::MagnifierEffectConfigForm -{ - Q_OBJECT -public: - explicit MagnifierEffectConfigForm(QWidget *parent); -}; - class MagnifierEffectConfig : public KCModule { Q_OBJECT @@ -35,7 +28,7 @@ public: void defaults() override; private: - MagnifierEffectConfigForm m_ui; + Ui::MagnifierEffectConfigForm m_ui; KActionCollection *m_actionCollection; }; diff --git a/src/plugins/mouseclick/mouseclick_config.cpp b/src/plugins/mouseclick/mouseclick_config.cpp index ae866ef445..45ba8007aa 100644 --- a/src/plugins/mouseclick/mouseclick_config.cpp +++ b/src/plugins/mouseclick/mouseclick_config.cpp @@ -28,18 +28,10 @@ K_PLUGIN_CLASS(KWin::MouseClickEffectConfig) namespace KWin { -MouseClickEffectConfigForm::MouseClickEffectConfigForm(QWidget *parent) - : QWidget(parent) -{ - setupUi(this); -} - MouseClickEffectConfig::MouseClickEffectConfig(QObject *parent, const KPluginMetaData &data) : KCModule(parent, data) - , m_ui(widget()) { - QVBoxLayout *layout = new QVBoxLayout(widget()); - layout->addWidget(&m_ui); + m_ui.setupUi(widget()); connect(m_ui.editor, &KShortcutsEditor::keyChange, this, &KCModule::markAsChanged); @@ -56,7 +48,7 @@ MouseClickEffectConfig::MouseClickEffectConfig(QObject *parent, const KPluginMet m_ui.editor->addCollection(m_actionCollection); MouseClickConfig::instance(KWIN_CONFIG); - addConfig(MouseClickConfig::self(), &m_ui); + addConfig(MouseClickConfig::self(), widget()); } void MouseClickEffectConfig::save() diff --git a/src/plugins/mouseclick/mouseclick_config.h b/src/plugins/mouseclick/mouseclick_config.h index 9582665712..6fe11ef411 100644 --- a/src/plugins/mouseclick/mouseclick_config.h +++ b/src/plugins/mouseclick/mouseclick_config.h @@ -18,13 +18,6 @@ class KActionCollection; namespace KWin { -class MouseClickEffectConfigForm : public QWidget, public Ui::MouseClickEffectConfigForm -{ - Q_OBJECT -public: - explicit MouseClickEffectConfigForm(QWidget *parent); -}; - class MouseClickEffectConfig : public KCModule { Q_OBJECT @@ -34,7 +27,7 @@ public: void save() override; private: - MouseClickEffectConfigForm m_ui; + Ui::MouseClickEffectConfigForm m_ui; KActionCollection *m_actionCollection; }; diff --git a/src/plugins/mousemark/mousemark_config.cpp b/src/plugins/mousemark/mousemark_config.cpp index ba354c6359..b49ae20a07 100644 --- a/src/plugins/mousemark/mousemark_config.cpp +++ b/src/plugins/mousemark/mousemark_config.cpp @@ -30,21 +30,13 @@ K_PLUGIN_CLASS(KWin::MouseMarkEffectConfig) namespace KWin { -MouseMarkEffectConfigForm::MouseMarkEffectConfigForm(QWidget *parent) - : QWidget(parent) -{ - setupUi(this); -} - MouseMarkEffectConfig::MouseMarkEffectConfig(QObject *parent, const KPluginMetaData &data) : KCModule(parent, data) - , m_ui(widget()) { - QVBoxLayout *layout = new QVBoxLayout(widget()); - layout->addWidget(&m_ui); + m_ui.setupUi(widget()); MouseMarkConfig::instance(KWIN_CONFIG); - addConfig(MouseMarkConfig::self(), &m_ui); + addConfig(MouseMarkConfig::self(), widget()); // Shortcut config. The shortcut belongs to the component "kwin"! m_actionCollection = new KActionCollection(this, QStringLiteral("kwin")); diff --git a/src/plugins/mousemark/mousemark_config.h b/src/plugins/mousemark/mousemark_config.h index 670f887024..768aba2a1f 100644 --- a/src/plugins/mousemark/mousemark_config.h +++ b/src/plugins/mousemark/mousemark_config.h @@ -19,13 +19,6 @@ class KActionCollection; namespace KWin { -class MouseMarkEffectConfigForm : public QWidget, public Ui::MouseMarkEffectConfigForm -{ - Q_OBJECT -public: - explicit MouseMarkEffectConfigForm(QWidget *parent); -}; - class MouseMarkEffectConfig : public KCModule { Q_OBJECT @@ -38,7 +31,7 @@ public: private: void updateSpinBoxSuffix(); - MouseMarkEffectConfigForm m_ui; + Ui::MouseMarkEffectConfigForm m_ui; KActionCollection *m_actionCollection; }; diff --git a/src/plugins/showpaint/showpaint_config.cpp b/src/plugins/showpaint/showpaint_config.cpp index 70fffca600..4b1cd8afd5 100644 --- a/src/plugins/showpaint/showpaint_config.cpp +++ b/src/plugins/showpaint/showpaint_config.cpp @@ -24,9 +24,8 @@ namespace KWin ShowPaintEffectConfig::ShowPaintEffectConfig(QObject *parent, const KPluginMetaData &data) : KCModule(parent, data) - , m_ui(std::make_unique()) { - m_ui->setupUi(widget()); + m_ui.setupUi(widget()); auto *actionCollection = new KActionCollection(this, QStringLiteral("kwin")); @@ -40,20 +39,20 @@ ShowPaintEffectConfig::ShowPaintEffectConfig(QObject *parent, const KPluginMetaD KGlobalAccel::self()->setDefaultShortcut(toggleAction, {}); KGlobalAccel::self()->setShortcut(toggleAction, {}); - m_ui->shortcutsEditor->addCollection(actionCollection); + m_ui.shortcutsEditor->addCollection(actionCollection); - connect(m_ui->shortcutsEditor, &KShortcutsEditor::keyChange, this, &KCModule::markAsChanged); + connect(m_ui.shortcutsEditor, &KShortcutsEditor::keyChange, this, &KCModule::markAsChanged); } void ShowPaintEffectConfig::save() { KCModule::save(); - m_ui->shortcutsEditor->save(); + m_ui.shortcutsEditor->save(); } void ShowPaintEffectConfig::defaults() { - m_ui->shortcutsEditor->allDefault(); + m_ui.shortcutsEditor->allDefault(); KCModule::defaults(); } diff --git a/src/plugins/showpaint/showpaint_config.h b/src/plugins/showpaint/showpaint_config.h index d752f870b8..63463ceefd 100644 --- a/src/plugins/showpaint/showpaint_config.h +++ b/src/plugins/showpaint/showpaint_config.h @@ -28,7 +28,7 @@ public Q_SLOTS: void defaults() override; private: - std::unique_ptr m_ui; + Ui::ShowPaintEffectConfig m_ui; }; } // namespace KWin diff --git a/src/plugins/thumbnailaside/thumbnailaside_config.cpp b/src/plugins/thumbnailaside/thumbnailaside_config.cpp index f3afbc9989..fa567c6cbe 100644 --- a/src/plugins/thumbnailaside/thumbnailaside_config.cpp +++ b/src/plugins/thumbnailaside/thumbnailaside_config.cpp @@ -29,19 +29,10 @@ K_PLUGIN_CLASS(KWin::ThumbnailAsideEffectConfig) namespace KWin { - -ThumbnailAsideEffectConfigForm::ThumbnailAsideEffectConfigForm(QWidget *parent) - : QWidget(parent) -{ - setupUi(this); -} - ThumbnailAsideEffectConfig::ThumbnailAsideEffectConfig(QObject *parent, const KPluginMetaData &data) : KCModule(parent, data) - , m_ui(widget()) { - QVBoxLayout *layout = new QVBoxLayout(widget()); - layout->addWidget(&m_ui); + m_ui.setupUi(widget()); connect(m_ui.editor, &KShortcutsEditor::keyChange, this, &KCModule::markAsChanged); diff --git a/src/plugins/thumbnailaside/thumbnailaside_config.h b/src/plugins/thumbnailaside/thumbnailaside_config.h index ec0f72c04e..481d873693 100644 --- a/src/plugins/thumbnailaside/thumbnailaside_config.h +++ b/src/plugins/thumbnailaside/thumbnailaside_config.h @@ -17,14 +17,6 @@ class KActionCollection; namespace KWin { - -class ThumbnailAsideEffectConfigForm : public QWidget, public Ui::ThumbnailAsideEffectConfigForm -{ - Q_OBJECT -public: - explicit ThumbnailAsideEffectConfigForm(QWidget *parent); -}; - class ThumbnailAsideEffectConfig : public KCModule { Q_OBJECT @@ -34,7 +26,7 @@ public: void save() override; private: - ThumbnailAsideEffectConfigForm m_ui; + Ui::ThumbnailAsideEffectConfigForm m_ui; KActionCollection *m_actionCollection; }; diff --git a/src/plugins/trackmouse/trackmouse_config.cpp b/src/plugins/trackmouse/trackmouse_config.cpp index 2f2ad33a05..89b45a6aff 100644 --- a/src/plugins/trackmouse/trackmouse_config.cpp +++ b/src/plugins/trackmouse/trackmouse_config.cpp @@ -32,21 +32,13 @@ namespace KWin static const QString s_toggleTrackMouseActionName = QStringLiteral("TrackMouse"); -TrackMouseEffectConfigForm::TrackMouseEffectConfigForm(QWidget *parent) - : QWidget(parent) -{ - setupUi(this); -} - TrackMouseEffectConfig::TrackMouseEffectConfig(QObject *parent, const KPluginMetaData &data) : KCModule(parent, data) { TrackMouseConfig::instance(KWIN_CONFIG); - m_ui = new TrackMouseEffectConfigForm(widget()); - QVBoxLayout *layout = new QVBoxLayout(widget()); - layout->addWidget(m_ui); + m_ui.setupUi(widget()); - addConfig(TrackMouseConfig::self(), m_ui); + addConfig(TrackMouseConfig::self(), widget()); m_actionCollection = new KActionCollection(this, QStringLiteral("kwin")); m_actionCollection->setComponentDisplayName(i18n("KWin")); @@ -60,7 +52,7 @@ TrackMouseEffectConfig::TrackMouseEffectConfig(QObject *parent, const KPluginMet KGlobalAccel::self()->setDefaultShortcut(a, QList()); KGlobalAccel::self()->setShortcut(a, QList()); - connect(m_ui->shortcut, &KKeySequenceWidget::keySequenceChanged, + connect(m_ui.shortcut, &KKeySequenceWidget::keySequenceChanged, this, &TrackMouseEffectConfig::shortcutChanged); } @@ -75,7 +67,7 @@ void TrackMouseEffectConfig::load() if (QAction *a = m_actionCollection->action(s_toggleTrackMouseActionName)) { auto shortcuts = KGlobalAccel::self()->shortcut(a); if (!shortcuts.isEmpty()) { - m_ui->shortcut->setKeySequence(shortcuts.first()); + m_ui.shortcut->setKeySequence(shortcuts.first()); } } } @@ -93,7 +85,7 @@ void TrackMouseEffectConfig::save() void TrackMouseEffectConfig::defaults() { KCModule::defaults(); - m_ui->shortcut->clearKeySequence(); + m_ui.shortcut->clearKeySequence(); } void TrackMouseEffectConfig::shortcutChanged(const QKeySequence &seq) diff --git a/src/plugins/trackmouse/trackmouse_config.h b/src/plugins/trackmouse/trackmouse_config.h index 5091d83571..4ba1d95b58 100644 --- a/src/plugins/trackmouse/trackmouse_config.h +++ b/src/plugins/trackmouse/trackmouse_config.h @@ -18,14 +18,6 @@ class KActionCollection; namespace KWin { - -class TrackMouseEffectConfigForm : public QWidget, public Ui::TrackMouseEffectConfigForm -{ - Q_OBJECT -public: - explicit TrackMouseEffectConfigForm(QWidget *parent); -}; - class TrackMouseEffectConfig : public KCModule { Q_OBJECT @@ -41,7 +33,7 @@ private Q_SLOTS: void shortcutChanged(const QKeySequence &seq); private: - TrackMouseEffectConfigForm *m_ui; + Ui::TrackMouseEffectConfigForm m_ui; KActionCollection *m_actionCollection; }; diff --git a/src/plugins/zoom/zoom_config.cpp b/src/plugins/zoom/zoom_config.cpp index 7e63bc7e00..6040cb137d 100644 --- a/src/plugins/zoom/zoom_config.cpp +++ b/src/plugins/zoom/zoom_config.cpp @@ -28,25 +28,15 @@ K_PLUGIN_CLASS(KWin::ZoomEffectConfig) namespace KWin { - -ZoomEffectConfigForm::ZoomEffectConfigForm(QWidget *parent) - : QWidget(parent) -{ - setupUi(this); -} - ZoomEffectConfig::ZoomEffectConfig(QObject *parent, const KPluginMetaData &data) : KCModule(parent, data) { ZoomConfig::instance(KWIN_CONFIG); - m_ui = new ZoomEffectConfigForm(widget()); + m_ui.setupUi(widget()); - QVBoxLayout *layout = new QVBoxLayout(widget()); - layout->addWidget(m_ui); + addConfig(ZoomConfig::self(), widget()); - addConfig(ZoomConfig::self(), m_ui); - - connect(m_ui->editor, &KShortcutsEditor::keyChange, this, &KCModule::markAsChanged); + connect(m_ui.editor, &KShortcutsEditor::keyChange, this, &KCModule::markAsChanged); #if !HAVE_ACCESSIBILITY m_ui->kcfg_EnableFocusTracking->setVisible(false); @@ -117,12 +107,12 @@ ZoomEffectConfig::ZoomEffectConfig(QObject *parent, const KPluginMetaData &data) KGlobalAccel::self()->setDefaultShortcut(a, QList() << (Qt::META | Qt::Key_F6)); KGlobalAccel::self()->setShortcut(a, QList() << (Qt::META | Qt::Key_F6)); - m_ui->editor->addCollection(actionCollection); + m_ui.editor->addCollection(actionCollection); } void ZoomEffectConfig::save() { - m_ui->editor->save(); // undo() will restore to this state from now on + m_ui.editor->save(); // undo() will restore to this state from now on KCModule::save(); OrgKdeKwinEffectsInterface interface(QStringLiteral("org.kde.KWin"), QStringLiteral("/Effects"), diff --git a/src/plugins/zoom/zoom_config.h b/src/plugins/zoom/zoom_config.h index 80d8aebfe0..ddd3c8ac8b 100644 --- a/src/plugins/zoom/zoom_config.h +++ b/src/plugins/zoom/zoom_config.h @@ -16,14 +16,6 @@ namespace KWin { - -class ZoomEffectConfigForm : public QWidget, public Ui::ZoomEffectConfigForm -{ - Q_OBJECT -public: - explicit ZoomEffectConfigForm(QWidget *parent = nullptr); -}; - class ZoomEffectConfig : public KCModule { Q_OBJECT @@ -34,7 +26,7 @@ public Q_SLOTS: void save() override; private: - ZoomEffectConfigForm *m_ui; + Ui::ZoomEffectConfigForm m_ui; enum MouseTracking { MouseCentred = 0, MouseProportional = 1,