Changeset View
Changeset View
Standalone View
Standalone View
shell/shellcorona.cpp
Show First 20 Lines • Show All 45 Lines • ▼ Show 20 Line(s) | |||||
46 | #include <ksycoca.h> | 46 | #include <ksycoca.h> | ||
47 | #include <KGlobalAccel> | 47 | #include <KGlobalAccel> | ||
48 | #include <KAuthorized> | 48 | #include <KAuthorized> | ||
49 | #include <KWindowSystem> | 49 | #include <KWindowSystem> | ||
50 | #include <kdeclarative/kdeclarative.h> | 50 | #include <kdeclarative/kdeclarative.h> | ||
51 | #include <kdeclarative/qmlobjectsharedengine.h> | 51 | #include <kdeclarative/qmlobjectsharedengine.h> | ||
52 | #include <KMessageBox> | 52 | #include <KMessageBox> | ||
53 | #include <kdirwatch.h> | 53 | #include <kdirwatch.h> | ||
54 | #include <KUserFeedback/Provider> | ||||
55 | #include <KUserFeedback/ApplicationVersionSource> | ||||
56 | #include <KUserFeedback/CompilerInfoSource> | ||||
57 | #include <KUserFeedback/PlatformInfoSource> | ||||
58 | #include <KUserFeedback/QtVersionSource> | ||||
59 | #include <KUserFeedback/UsageTimeSource> | ||||
60 | #include <KUserFeedback/OpenGLInfoSource> | ||||
61 | #include <KUserFeedback/ScreenInfoSource> | ||||
54 | 62 | | |||
55 | #include <KPackage/PackageLoader> | 63 | #include <KPackage/PackageLoader> | ||
56 | 64 | | |||
57 | #include <KWayland/Client/connection_thread.h> | 65 | #include <KWayland/Client/connection_thread.h> | ||
58 | #include <KWayland/Client/registry.h> | 66 | #include <KWayland/Client/registry.h> | ||
59 | #include <KWayland/Client/plasmashell.h> | 67 | #include <KWayland/Client/plasmashell.h> | ||
60 | 68 | | |||
61 | #include "config-ktexteditor.h" // HAVE_KTEXTEDITOR | 69 | #include "config-ktexteditor.h" // HAVE_KTEXTEDITOR | ||
62 | 70 | | |||
63 | #include "alternativeshelper.h" | 71 | #include "alternativeshelper.h" | ||
64 | #include "desktopview.h" | 72 | #include "desktopview.h" | ||
65 | #include "panelview.h" | 73 | #include "panelview.h" | ||
66 | #include "scripting/scriptengine.h" | 74 | #include "scripting/scriptengine.h" | ||
67 | #include "osd.h" | 75 | #include "osd.h" | ||
68 | #include "screenpool.h" | 76 | #include "screenpool.h" | ||
69 | 77 | | |||
70 | #include "plasmashelladaptor.h" | 78 | #include "plasmashelladaptor.h" | ||
71 | #include "debug.h" | 79 | #include "debug.h" | ||
72 | #include "futureutil.h" | 80 | #include "futureutil.h" | ||
81 | #include "panelcountsource.h" | ||||
73 | 82 | | |||
74 | #ifndef NDEBUG | 83 | #ifndef NDEBUG | ||
75 | #define CHECK_SCREEN_INVARIANTS screenInvariants(); | 84 | #define CHECK_SCREEN_INVARIANTS screenInvariants(); | ||
76 | #else | 85 | #else | ||
77 | #define CHECK_SCREEN_INVARIANTS | 86 | #define CHECK_SCREEN_INVARIANTS | ||
78 | #endif | 87 | #endif | ||
79 | 88 | | |||
80 | #if HAVE_X11 | 89 | #if HAVE_X11 | ||
81 | #include <NETWM> | 90 | #include <NETWM> | ||
82 | #include <QX11Info> | 91 | #include <QX11Info> | ||
83 | #include <xcb/xcb.h> | 92 | #include <xcb/xcb.h> | ||
84 | #endif | 93 | #endif | ||
85 | 94 | | |||
86 | | ||||
87 | static const int s_configSyncDelay = 10000; // 10 seconds | 95 | static const int s_configSyncDelay = 10000; // 10 seconds | ||
davidedmundson: That's a nice idea, I like that. | |||||
88 | 96 | | |||
89 | ShellCorona::ShellCorona(QObject *parent) | 97 | ShellCorona::ShellCorona(QObject *parent) | ||
90 | : Plasma::Corona(parent), | 98 | : Plasma::Corona(parent), | ||
91 | m_config(KSharedConfig::openConfig(QStringLiteral("plasmarc"))), | 99 | m_config(KSharedConfig::openConfig(QStringLiteral("plasmarc"))), | ||
92 | m_screenPool(new ScreenPool(KSharedConfig::openConfig(), this)), | 100 | m_screenPool(new ScreenPool(KSharedConfig::openConfig(), this)), | ||
93 | m_activityController(new KActivities::Controller(this)), | 101 | m_activityController(new KActivities::Controller(this)), | ||
94 | m_addPanelAction(nullptr), | 102 | m_addPanelAction(nullptr), | ||
95 | m_addPanelsMenu(nullptr), | 103 | m_addPanelsMenu(nullptr), | ||
▲ Show 20 Lines • Show All 172 Lines • ▼ Show 20 Line(s) | 267 | if (themeName.isEmpty()) { | |||
268 | themeName = lnfCfg.readEntry(themeNameKey, themeName); | 276 | themeName = lnfCfg.readEntry(themeNameKey, themeName); | ||
269 | } | 277 | } | ||
270 | 278 | | |||
271 | if (!themeName.isEmpty()) { | 279 | if (!themeName.isEmpty()) { | ||
272 | Plasma::Theme *t = new Plasma::Theme(this); | 280 | Plasma::Theme *t = new Plasma::Theme(this); | ||
273 | t->setThemeName(themeName); | 281 | t->setThemeName(themeName); | ||
274 | } | 282 | } | ||
275 | 283 | | |||
284 | auto m_feedbackProvider = new KUserFeedback::Provider(this); | ||||
285 | m_feedbackProvider->setProductIdentifier(QStringLiteral("org.kde.plasmashell")); | ||||
286 | m_feedbackProvider->setFeedbackServer(QUrl(QStringLiteral("https://telemetry.kde.org/"))); | ||||
287 | m_feedbackProvider->setSubmissionInterval(7); | ||||
288 | m_feedbackProvider->setApplicationStartsUntilEncouragement(5); | ||||
289 | m_feedbackProvider->setEncouragementDelay(30); | ||||
290 | m_feedbackProvider->addDataSource(new KUserFeedback::ApplicationVersionSource); | ||||
291 | m_feedbackProvider->addDataSource(new KUserFeedback::CompilerInfoSource); | ||||
292 | m_feedbackProvider->addDataSource(new KUserFeedback::PlatformInfoSource); | ||||
293 | m_feedbackProvider->addDataSource(new KUserFeedback::QtVersionSource); | ||||
294 | m_feedbackProvider->addDataSource(new KUserFeedback::UsageTimeSource); | ||||
295 | m_feedbackProvider->addDataSource(new KUserFeedback::OpenGLInfoSource); | ||||
296 | m_feedbackProvider->addDataSource(new KUserFeedback::ScreenInfoSource); | ||||
297 | m_feedbackProvider->addDataSource(new PanelCountSource(this)); | ||||
298 | | ||||
299 | { | ||||
300 | auto plasmaConfig = KSharedConfig::openConfig(QStringLiteral("PlasmaUserFeedback")); | ||||
301 | m_feedbackProvider->setTelemetryMode(KUserFeedback::Provider::TelemetryMode(plasmaConfig->group("Global").readEntry("FeedbackLevel", int(KUserFeedback::Provider::BasicUsageStatistics)))); | ||||
302 | } | ||||
303 | | ||||
276 | //FIXME: this would change the runtime platform to a fixed one if available | 304 | //FIXME: this would change the runtime platform to a fixed one if available | ||
277 | // but a different way to load platform specific components is needed beforehand | 305 | // but a different way to load platform specific components is needed beforehand | ||
278 | // because if we import and use two different components plugin, the second time | 306 | // because if we import and use two different components plugin, the second time | ||
279 | // the import is called it will fail | 307 | // the import is called it will fail | ||
280 | /* KConfigGroup cg(KSharedConfig::openConfig(package.filePath("defaults")), "General"); | 308 | /* KConfigGroup cg(KSharedConfig::openConfig(package.filePath("defaults")), "General"); | ||
281 | KDeclarative::KDeclarative::setRuntimePlatform(cg.readEntry("DefaultRuntimePlatform", QStringList()));*/ | 309 | KDeclarative::KDeclarative::setRuntimePlatform(cg.readEntry("DefaultRuntimePlatform", QStringList()));*/ | ||
282 | 310 | | |||
283 | unload(); | 311 | unload(); | ||
Show All 20 Lines | |||||
304 | * The unique connection makes sure we don't reload plasma if KAMD ever crashes and reloads, the signal is disconnected in the body of load | 332 | * The unique connection makes sure we don't reload plasma if KAMD ever crashes and reloads, the signal is disconnected in the body of load | ||
305 | */ | 333 | */ | ||
306 | 334 | | |||
307 | connect(m_activityController, &KActivities::Controller::serviceStatusChanged, this, &ShellCorona::load, Qt::UniqueConnection); | 335 | connect(m_activityController, &KActivities::Controller::serviceStatusChanged, this, &ShellCorona::load, Qt::UniqueConnection); | ||
308 | 336 | | |||
309 | load(); | 337 | load(); | ||
310 | } | 338 | } | ||
311 | 339 | | |||
312 | | ||||
313 | QJsonObject dumpconfigGroupJS(const KConfigGroup &rootGroup) | 340 | QJsonObject dumpconfigGroupJS(const KConfigGroup &rootGroup) | ||
314 | { | 341 | { | ||
315 | QJsonObject result; | 342 | QJsonObject result; | ||
316 | 343 | | |||
317 | QStringList hierarchy; | 344 | QStringList hierarchy; | ||
318 | QStringList escapedHierarchy; | 345 | QStringList escapedHierarchy; | ||
319 | QList<KConfigGroup> groups{rootGroup}; | 346 | QList<KConfigGroup> groups{rootGroup}; | ||
320 | QSet<QString> visitedNodes; | 347 | QSet<QString> visitedNodes; | ||
▲ Show 20 Lines • Show All 1827 Lines • Show Last 20 Lines |
That's a nice idea, I like that.