From 49ed0361fd399349b8810d82e43e8169a8e9f981 Mon Sep 17 00:00:00 2001 From: Nicolas Fella Date: Wed, 30 Sep 2020 13:44:07 +0200 Subject: [PATCH] Add config module information to builtin effects Add a new field to EffectData that stores an effect's config module. We currently determine an effect's configModule using KPluginTrader and the X-KDE-ParentComponents metadata. IMO it's much more straight forward to let the effect specify its config module directly instead. --- effects/effect_builtins.cpp | 116 ++++++++++++++++++++++++------------ effects/effect_builtins.h | 1 + 2 files changed, 78 insertions(+), 39 deletions(-) diff --git a/effects/effect_builtins.cpp b/effects/effect_builtins.cpp index 90a7554c37..889654b67c 100644 --- a/effects/effect_builtins.cpp +++ b/effects/effect_builtins.cpp @@ -54,7 +54,7 @@ #include #ifndef EFFECT_BUILTINS -#define EFFECT_FALLBACK nullptr, nullptr, nullptr +#define EFFECT_FALLBACK nullptr, nullptr, nullptr, #else #define EFFECT_FALLBACK #endif @@ -85,7 +85,8 @@ static const QVector &effectData() false, nullptr, nullptr, - nullptr + nullptr, + QString() }, { QStringLiteral("blur"), i18ndc("kwin_effects", "Name of a KWin Effect", "Blur"), @@ -98,9 +99,10 @@ static const QVector &effectData() #ifdef EFFECT_BUILTINS &createHelper, &BlurEffect::supported, - &BlurEffect::enabledByDefault + &BlurEffect::enabledByDefault, #endif EFFECT_FALLBACK + QStringLiteral("kwin_blur_config") }, { QStringLiteral("colorpicker"), i18ndc("kwin_effects", "Name of a KWin Effect", "Color Picker"), @@ -113,9 +115,10 @@ EFFECT_FALLBACK #ifdef EFFECT_BUILTINS &createHelper, &ColorPickerEffect::supported, - nullptr + nullptr, #endif EFFECT_FALLBACK + QString() }, { QStringLiteral("contrast"), i18ndc("kwin_effects", "Name of a KWin Effect", "Background contrast"), @@ -128,9 +131,10 @@ EFFECT_FALLBACK #ifdef EFFECT_BUILTINS &createHelper, &ContrastEffect::supported, - &ContrastEffect::enabledByDefault + &ContrastEffect::enabledByDefault, #endif EFFECT_FALLBACK + QString() }, { QStringLiteral("coverswitch"), i18ndc("kwin_effects", "Name of a KWin Effect", "Cover Switch"), @@ -143,9 +147,10 @@ EFFECT_FALLBACK #ifdef EFFECT_BUILTINS &createHelper, &CoverSwitchEffect::supported, - nullptr + nullptr, #endif EFFECT_FALLBACK + QStringLiteral("kwin_coverswitch_config") }, { QStringLiteral("cube"), i18ndc("kwin_effects", "Name of a KWin Effect", "Desktop Cube"), @@ -158,9 +163,10 @@ EFFECT_FALLBACK #ifdef EFFECT_BUILTINS &createHelper, &CubeEffect::supported, - nullptr + nullptr, #endif EFFECT_FALLBACK + QStringLiteral("kwin_cube_config") }, { QStringLiteral("cubeslide"), i18ndc("kwin_effects", "Name of a KWin Effect", "Desktop Cube Animation"), @@ -173,9 +179,10 @@ EFFECT_FALLBACK #ifdef EFFECT_BUILTINS &createHelper, &CubeSlideEffect::supported, - nullptr + nullptr, #endif EFFECT_FALLBACK + QStringLiteral("kwin_cubeslide_config") }, { QStringLiteral("desktopgrid"), i18ndc("kwin_effects", "Name of a KWin Effect", "Desktop Grid"), @@ -188,9 +195,10 @@ EFFECT_FALLBACK #ifdef EFFECT_BUILTINS &createHelper, nullptr, - nullptr + nullptr, #endif EFFECT_FALLBACK + QStringLiteral("kwin_desktopgrid_config") }, { QStringLiteral("diminactive"), i18ndc("kwin_effects", "Name of a KWin Effect", "Dim Inactive"), @@ -203,9 +211,10 @@ EFFECT_FALLBACK #ifdef EFFECT_BUILTINS &createHelper, nullptr, - nullptr + nullptr, #endif EFFECT_FALLBACK + QStringLiteral("kwin_diminactive_config") }, { QStringLiteral("fallapart"), i18ndc("kwin_effects", "Name of a KWin Effect", "Fall Apart"), @@ -218,9 +227,10 @@ EFFECT_FALLBACK #ifdef EFFECT_BUILTINS &createHelper, &FallApartEffect::supported, - nullptr + nullptr, #endif EFFECT_FALLBACK + QString() }, { QStringLiteral("flipswitch"), i18ndc("kwin_effects", "Name of a KWin Effect", "Flip Switch"), @@ -233,9 +243,10 @@ EFFECT_FALLBACK #ifdef EFFECT_BUILTINS &createHelper, &FlipSwitchEffect::supported, - nullptr + nullptr, #endif EFFECT_FALLBACK + QStringLiteral("kwin_flipswitch_config") }, { QStringLiteral("glide"), i18ndc("kwin_effects", "Name of a KWin Effect", "Glide"), @@ -248,9 +259,10 @@ EFFECT_FALLBACK #ifdef EFFECT_BUILTINS &createHelper, &GlideEffect::supported, - nullptr + nullptr, #endif EFFECT_FALLBACK + QStringLiteral("kwin_glide_config") }, { QStringLiteral("highlightwindow"), i18ndc("kwin_effects", "Name of a KWin Effect", "Highlight Window"), @@ -263,9 +275,10 @@ EFFECT_FALLBACK #ifdef EFFECT_BUILTINS &createHelper, nullptr, - nullptr + nullptr, #endif EFFECT_FALLBACK + QString() }, { QStringLiteral("invert"), i18ndc("kwin_effects", "Name of a KWin Effect", "Invert"), @@ -278,9 +291,10 @@ EFFECT_FALLBACK #ifdef EFFECT_BUILTINS &createHelper, &InvertEffect::supported, - nullptr + nullptr, #endif EFFECT_FALLBACK + QStringLiteral("kwin_invert_config") }, { QStringLiteral("kscreen"), i18ndc("kwin_effects", "Name of a KWin Effect", "Kscreen"), @@ -293,9 +307,10 @@ EFFECT_FALLBACK #ifdef EFFECT_BUILTINS &createHelper, nullptr, - nullptr + nullptr, #endif EFFECT_FALLBACK + QString() }, { QStringLiteral("lookingglass"), i18ndc("kwin_effects", "Name of a KWin Effect", "Looking Glass"), @@ -308,9 +323,10 @@ EFFECT_FALLBACK #ifdef EFFECT_BUILTINS &createHelper, &LookingGlassEffect::supported, - nullptr + nullptr, #endif EFFECT_FALLBACK + QStringLiteral("kwin_lookingglass_config") }, { QStringLiteral("magiclamp"), i18ndc("kwin_effects", "Name of a KWin Effect", "Magic Lamp"), @@ -323,9 +339,10 @@ EFFECT_FALLBACK #ifdef EFFECT_BUILTINS &createHelper, &MagicLampEffect::supported, - nullptr + nullptr, #endif EFFECT_FALLBACK + QStringLiteral("kwin_magiclamp_config") }, { QStringLiteral("magnifier"), i18ndc("kwin_effects", "Name of a KWin Effect", "Magnifier"), @@ -338,9 +355,10 @@ EFFECT_FALLBACK #ifdef EFFECT_BUILTINS &createHelper, &MagnifierEffect::supported, - nullptr + nullptr, #endif EFFECT_FALLBACK + QStringLiteral("kwin_magnifier_config") }, { QStringLiteral("mouseclick"), i18ndc("kwin_effects", "Name of a KWin Effect", "Mouse Click Animation"), @@ -353,9 +371,10 @@ EFFECT_FALLBACK #ifdef EFFECT_BUILTINS &createHelper, nullptr, - nullptr + nullptr, #endif EFFECT_FALLBACK + QStringLiteral("kwin_mouseclick_config") }, { QStringLiteral("mousemark"), i18ndc("kwin_effects", "Name of a KWin Effect", "Mouse Mark"), @@ -368,9 +387,10 @@ EFFECT_FALLBACK #ifdef EFFECT_BUILTINS &createHelper, nullptr, - nullptr + nullptr, #endif EFFECT_FALLBACK + QStringLiteral("kwin_mousemark_config") }, { QStringLiteral("presentwindows"), i18ndc("kwin_effects", "Name of a KWin Effect", "Present Windows"), @@ -383,9 +403,10 @@ EFFECT_FALLBACK #ifdef EFFECT_BUILTINS &createHelper, nullptr, - nullptr + nullptr, #endif EFFECT_FALLBACK + QStringLiteral("kwin_presentwindows_config") }, { QStringLiteral("resize"), i18ndc("kwin_effects", "Name of a KWin Effect", "Resize Window"), @@ -398,9 +419,10 @@ EFFECT_FALLBACK #ifdef EFFECT_BUILTINS &createHelper, nullptr, - nullptr + nullptr, #endif EFFECT_FALLBACK + QStringLiteral("kwin_resize_config") }, { QStringLiteral("screenedge"), i18ndc("kwin_effects", "Name of a KWin Effect", "Screen Edge"), @@ -413,9 +435,10 @@ EFFECT_FALLBACK #ifdef EFFECT_BUILTINS &createHelper, nullptr, - nullptr + nullptr, #endif EFFECT_FALLBACK + QString() }, { QStringLiteral("screenshot"), i18ndc("kwin_effects", "Name of a KWin Effect", "Screenshot"), @@ -428,9 +451,10 @@ EFFECT_FALLBACK #ifdef EFFECT_BUILTINS &createHelper, &ScreenShotEffect::supported, - nullptr + nullptr, #endif EFFECT_FALLBACK + QString() }, { QStringLiteral("sheet"), i18ndc("kwin_effects", "Name of a KWin Effect", "Sheet"), @@ -443,9 +467,10 @@ EFFECT_FALLBACK #ifdef EFFECT_BUILTINS &createHelper, &SheetEffect::supported, - nullptr + nullptr, #endif EFFECT_FALLBACK + QString() }, { QStringLiteral("showfps"), i18ndc("kwin_effects", "Name of a KWin Effect", "Show FPS"), @@ -458,9 +483,10 @@ EFFECT_FALLBACK #ifdef EFFECT_BUILTINS &createHelper, nullptr, - nullptr + nullptr, #endif EFFECT_FALLBACK + QStringLiteral("kwin_showfps_config") }, { QStringLiteral("showpaint"), i18ndc("kwin_effects", "Name of a KWin Effect", "Show Paint"), @@ -473,9 +499,10 @@ EFFECT_FALLBACK #ifdef EFFECT_BUILTINS &createHelper, nullptr, - nullptr + nullptr, #endif EFFECT_FALLBACK + QStringLiteral("kwin_showpaint_config") }, { QStringLiteral("slide"), i18ndc("kwin_effects", "Name of a KWin Effect", "Slide"), @@ -488,9 +515,10 @@ EFFECT_FALLBACK #ifdef EFFECT_BUILTINS &createHelper, &SlideEffect::supported, - nullptr + nullptr, #endif EFFECT_FALLBACK + QStringLiteral("kwin_slide_config") }, { QStringLiteral("slideback"), i18ndc("kwin_effects", "Name of a KWin Effect", "Slide Back"), @@ -503,9 +531,10 @@ EFFECT_FALLBACK #ifdef EFFECT_BUILTINS &createHelper, nullptr, - nullptr + nullptr, #endif EFFECT_FALLBACK + QString() }, { QStringLiteral("slidingpopups"), i18ndc("kwin_effects", "Name of a KWin Effect", "Sliding popups"), @@ -518,9 +547,10 @@ EFFECT_FALLBACK #ifdef EFFECT_BUILTINS &createHelper, &SlidingPopupsEffect::supported, - nullptr + nullptr, #endif EFFECT_FALLBACK + QString() }, { QStringLiteral("snaphelper"), i18ndc("kwin_effects", "Name of a KWin Effect", "Snap Helper"), @@ -533,9 +563,10 @@ EFFECT_FALLBACK #ifdef EFFECT_BUILTINS &createHelper, nullptr, - nullptr + nullptr, #endif EFFECT_FALLBACK + QString() }, { QStringLiteral("startupfeedback"), i18ndc("kwin_effects", "Name of a KWin Effect", "Startup Feedback"), @@ -548,9 +579,10 @@ EFFECT_FALLBACK #ifdef EFFECT_BUILTINS &createHelper, &StartupFeedbackEffect::supported, - nullptr + nullptr, #endif EFFECT_FALLBACK + QString() }, { QStringLiteral("thumbnailaside"), i18ndc("kwin_effects", "Name of a KWin Effect", "Thumbnail Aside"), @@ -563,9 +595,10 @@ EFFECT_FALLBACK #ifdef EFFECT_BUILTINS &createHelper, nullptr, - nullptr + nullptr, #endif EFFECT_FALLBACK + QStringLiteral("kwin_thumbnailaside_config") }, { QStringLiteral("touchpoints"), i18ndc("kwin_effects", "Name of a KWin Effect", "Touch Points"), @@ -578,9 +611,10 @@ EFFECT_FALLBACK #ifdef EFFECT_BUILTINS &createHelper, nullptr, - nullptr + nullptr, #endif EFFECT_FALLBACK + QString() }, { QStringLiteral("trackmouse"), i18ndc("kwin_effects", "Name of a KWin Effect", "Track Mouse"), @@ -593,9 +627,10 @@ EFFECT_FALLBACK #ifdef EFFECT_BUILTINS &createHelper, nullptr, - nullptr + nullptr, #endif EFFECT_FALLBACK + QStringLiteral("kwin_trackmouse_config") }, { QStringLiteral("windowgeometry"), i18ndc("kwin_effects", "Name of a KWin Effect", "Window Geometry"), @@ -608,9 +643,10 @@ EFFECT_FALLBACK #ifdef EFFECT_BUILTINS &createHelper, nullptr, - nullptr + nullptr, #endif EFFECT_FALLBACK + QStringLiteral("kwin_windowgeometry_config") }, { QStringLiteral("wobblywindows"), i18ndc("kwin_effects", "Name of a KWin Effect", "Wobbly Windows"), @@ -623,9 +659,10 @@ EFFECT_FALLBACK #ifdef EFFECT_BUILTINS &createHelper, &WobblyWindowsEffect::supported, - nullptr + nullptr, #endif EFFECT_FALLBACK + QStringLiteral("kwin_wobblywindows_config") }, { QStringLiteral("zoom"), i18ndc("kwin_effects", "Name of a KWin Effect", "Zoom"), @@ -638,9 +675,10 @@ EFFECT_FALLBACK #ifdef EFFECT_BUILTINS &createHelper, nullptr, - nullptr + nullptr, #endif EFFECT_FALLBACK + QStringLiteral("kwin_zoom_config") } }; return s_effectData; diff --git a/effects/effect_builtins.h b/effects/effect_builtins.h index d0dd751a94..9a3cac4aa6 100644 --- a/effects/effect_builtins.h +++ b/effects/effect_builtins.h @@ -77,6 +77,7 @@ struct EffectData { std::function createFunction; std::function supportedFunction; std::function enabledFunction; + QString configModule; }; KWINEFFECTS_EXPORT Effect *create(BuiltInEffect effect);