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 | ||
Show All 16 Lines | |||||
78 | #endif | 86 | #endif | ||
79 | 87 | | |||
80 | #if HAVE_X11 | 88 | #if HAVE_X11 | ||
81 | #include <NETWM> | 89 | #include <NETWM> | ||
82 | #include <QX11Info> | 90 | #include <QX11Info> | ||
83 | #include <xcb/xcb.h> | 91 | #include <xcb/xcb.h> | ||
84 | #endif | 92 | #endif | ||
85 | 93 | | |||
94 | class PanelCountSource : public KUserFeedback::AbstractDataSource | ||||
davidedmundson: That's a nice idea, I like that. | |||||
95 | { | ||||
96 | public: | ||||
97 | /*! Create a new start count data source. */ | ||||
98 | PanelCountSource(ShellCorona* corona) | ||||
99 | : AbstractDataSource(QStringLiteral("panelCount"), KUserFeedback::Provider::DetailedSystemInformation) | ||||
100 | , corona(corona) | ||||
101 | {} | ||||
102 | | ||||
103 | QString name() const override { return i18n("Panel Count"); } | ||||
104 | QString description() const override { return i18n("Counts the panels"); } | ||||
105 | | ||||
106 | QVariant data() override { return corona->panelCount(); } | ||||
107 | | ||||
108 | private: | ||||
109 | ShellCorona* const corona; | ||||
110 | }; | ||||
86 | 111 | | |||
87 | static const int s_configSyncDelay = 10000; // 10 seconds | 112 | static const int s_configSyncDelay = 10000; // 10 seconds | ||
88 | 113 | | |||
89 | ShellCorona::ShellCorona(QObject *parent) | 114 | ShellCorona::ShellCorona(QObject *parent) | ||
90 | : Plasma::Corona(parent), | 115 | : Plasma::Corona(parent), | ||
91 | m_config(KSharedConfig::openConfig(QStringLiteral("plasmarc"))), | 116 | m_config(KSharedConfig::openConfig(QStringLiteral("plasmarc"))), | ||
92 | m_screenPool(new ScreenPool(KSharedConfig::openConfig(), this)), | 117 | m_screenPool(new ScreenPool(KSharedConfig::openConfig(), this)), | ||
93 | m_activityController(new KActivities::Controller(this)), | 118 | m_activityController(new KActivities::Controller(this)), | ||
▲ Show 20 Lines • Show All 174 Lines • ▼ Show 20 Line(s) | 284 | if (themeName.isEmpty()) { | |||
268 | themeName = lnfCfg.readEntry(themeNameKey, themeName); | 293 | themeName = lnfCfg.readEntry(themeNameKey, themeName); | ||
269 | } | 294 | } | ||
270 | 295 | | |||
271 | if (!themeName.isEmpty()) { | 296 | if (!themeName.isEmpty()) { | ||
272 | Plasma::Theme *t = new Plasma::Theme(this); | 297 | Plasma::Theme *t = new Plasma::Theme(this); | ||
273 | t->setThemeName(themeName); | 298 | t->setThemeName(themeName); | ||
274 | } | 299 | } | ||
275 | 300 | | |||
301 | auto m_feedbackProvider = new KUserFeedback::Provider(this); | ||||
302 | m_feedbackProvider->setProductIdentifier(QStringLiteral("org.kde.plasmashell")); | ||||
303 | m_feedbackProvider->setFeedbackServer(QUrl(QStringLiteral("https://telemetry.kde.org/"))); | ||||
304 | m_feedbackProvider->setSubmissionInterval(7); | ||||
305 | m_feedbackProvider->setApplicationStartsUntilEncouragement(5); | ||||
306 | m_feedbackProvider->setEncouragementDelay(30); | ||||
307 | m_feedbackProvider->addDataSource(new KUserFeedback::ApplicationVersionSource); | ||||
308 | m_feedbackProvider->addDataSource(new KUserFeedback::CompilerInfoSource); | ||||
309 | m_feedbackProvider->addDataSource(new KUserFeedback::PlatformInfoSource); | ||||
310 | m_feedbackProvider->addDataSource(new KUserFeedback::QtVersionSource); | ||||
311 | m_feedbackProvider->addDataSource(new KUserFeedback::UsageTimeSource); | ||||
312 | m_feedbackProvider->addDataSource(new KUserFeedback::OpenGLInfoSource); | ||||
313 | m_feedbackProvider->addDataSource(new KUserFeedback::ScreenInfoSource); | ||||
314 | m_feedbackProvider->addDataSource(new PanelCountSource(this)); | ||||
315 | | ||||
316 | { | ||||
317 | auto plasmaConfig = KSharedConfig::openConfig(QStringLiteral("PlasmaUserFeedback")); | ||||
318 | m_feedbackProvider->setTelemetryMode(KUserFeedback::Provider::TelemetryMode(plasmaConfig->group("Global").readEntry("FeedbackLevel", int(KUserFeedback::Provider::BasicUsageStatistics)))); | ||||
319 | } | ||||
320 | | ||||
276 | //FIXME: this would change the runtime platform to a fixed one if available | 321 | //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 | 322 | // 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 | 323 | // because if we import and use two different components plugin, the second time | ||
279 | // the import is called it will fail | 324 | // the import is called it will fail | ||
280 | /* KConfigGroup cg(KSharedConfig::openConfig(package.filePath("defaults")), "General"); | 325 | /* KConfigGroup cg(KSharedConfig::openConfig(package.filePath("defaults")), "General"); | ||
281 | KDeclarative::KDeclarative::setRuntimePlatform(cg.readEntry("DefaultRuntimePlatform", QStringList()));*/ | 326 | KDeclarative::KDeclarative::setRuntimePlatform(cg.readEntry("DefaultRuntimePlatform", QStringList()));*/ | ||
282 | 327 | | |||
283 | unload(); | 328 | 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 | 349 | * 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 | */ | 350 | */ | ||
306 | 351 | | |||
307 | connect(m_activityController, &KActivities::Controller::serviceStatusChanged, this, &ShellCorona::load, Qt::UniqueConnection); | 352 | connect(m_activityController, &KActivities::Controller::serviceStatusChanged, this, &ShellCorona::load, Qt::UniqueConnection); | ||
308 | 353 | | |||
309 | load(); | 354 | load(); | ||
310 | } | 355 | } | ||
311 | 356 | | |||
312 | | ||||
313 | QJsonObject dumpconfigGroupJS(const KConfigGroup &rootGroup) | 357 | QJsonObject dumpconfigGroupJS(const KConfigGroup &rootGroup) | ||
314 | { | 358 | { | ||
315 | QJsonObject result; | 359 | QJsonObject result; | ||
316 | 360 | | |||
317 | QStringList hierarchy; | 361 | QStringList hierarchy; | ||
318 | QStringList escapedHierarchy; | 362 | QStringList escapedHierarchy; | ||
319 | QList<KConfigGroup> groups{rootGroup}; | 363 | QList<KConfigGroup> groups{rootGroup}; | ||
320 | QSet<QString> visitedNodes; | 364 | QSet<QString> visitedNodes; | ||
▲ Show 20 Lines • Show All 1827 Lines • Show Last 20 Lines |
That's a nice idea, I like that.