Changeset View
Changeset View
Standalone View
Standalone View
discover/qml/DiscoverWindow.qml
1 | import QtQuick 2.1 | 1 | import QtQuick 2.1 | ||
---|---|---|---|---|---|
2 | import QtQuick.Layouts 1.1 | 2 | import QtQuick.Layouts 1.1 | ||
3 | import QtQuick.Controls 1.1 | 3 | import QtQuick.Controls 1.1 | ||
4 | import org.kde.discover 1.0 | 4 | import org.kde.discover 1.0 | ||
5 | import org.kde.discover.app 1.0 | 5 | import org.kde.discover.app 1.0 | ||
6 | import org.kde.userfeedback 1.0 as UserFeedback | ||||
6 | import org.kde.kirigami 2.0 as Kirigami | 7 | import org.kde.kirigami 2.0 as Kirigami | ||
7 | import "navigation.js" as Navigation | 8 | import "navigation.js" as Navigation | ||
8 | 9 | | |||
9 | Kirigami.ApplicationWindow | 10 | Kirigami.ApplicationWindow | ||
10 | { | 11 | { | ||
11 | id: window | 12 | id: window | ||
12 | readonly property string applicationListComp: ("qrc:/qml/ApplicationsListPage.qml") | 13 | readonly property string applicationListComp: ("qrc:/qml/ApplicationsListPage.qml") | ||
13 | readonly property string applicationComp: ("qrc:/qml/ApplicationPage.qml") | 14 | readonly property string applicationComp: ("qrc:/qml/ApplicationPage.qml") | ||
Show All 24 Lines | |||||
38 | readonly property var leftPage: window.stack.depth>0 ? window.stack.get(0) : null | 39 | readonly property var leftPage: window.stack.depth>0 ? window.stack.get(0) : null | ||
39 | 40 | | |||
40 | Component.onCompleted: { | 41 | Component.onCompleted: { | ||
41 | Helpers.mainWindow = window | 42 | Helpers.mainWindow = window | ||
42 | if (app.isRoot) | 43 | if (app.isRoot) | ||
43 | showPassiveNotification(i18n("Running as <em>root</em> is discouraged and unnecessary.")); | 44 | showPassiveNotification(i18n("Running as <em>root</em> is discouraged and unnecessary.")); | ||
44 | } | 45 | } | ||
45 | 46 | | |||
47 | Component { | ||||
48 | id: feedbackPage | ||||
49 | Kirigami.OverlaySheet { | ||||
ngrahamUnsubmitted Done
ngraham: 1. What information? I'd change it to say "Submit usage statistics" (or whatever).
2. When you… | |||||
50 | id: sheet | ||||
ngraham: to better understand its users -> so we can better understand our users | |||||
51 | property QtObject provider | ||||
52 | contentItem: ColumnLayout { | ||||
53 | Kirigami.Heading { | ||||
54 | Layout.fillWidth: true | ||||
55 | text: i18n("Contribute Statistics") | ||||
56 | } | ||||
Actions need to start with a verb:
etc. ngraham: Actions need to start with a verb:
- Change feedback settings...
- Configure feedback settings.. | |||||
57 | Kirigami.Label { | ||||
58 | Layout.fillWidth: true | ||||
59 | wrapMode: Text.WordWrap | ||||
60 | text: i18n("We make this application for you. You can help us improve it by contributing information on how you use it. This allows us to make sure we focus on things that matter to you.\nContributing statistics is of course entirely anonymous, will not use any kind of unique identifier and will not cover any data you process with this application.") | ||||
61 | } | ||||
62 | ComboBox { | ||||
63 | id: statisticsModeCombo | ||||
64 | Layout.fillWidth: true | ||||
65 | currentIndex: 2 | ||||
66 | textRole: "text" | ||||
67 | model: ListModel { id: modeOptions } | ||||
vkrause: https://telemetry.kde.org/ | |||||
68 | Component.onCompleted: { | ||||
69 | modeOptions.append({text: i18n("No Statistics"), value: UserFeedback.Provider.NoStatistics}) | ||||
70 | modeOptions.append({text: i18n("Basic System Information"), value: UserFeedback.Provider.BasicSystemInformation}) | ||||
71 | modeOptions.append({text: i18n("Basic Usage Information"), value: UserFeedback.Provider.BasicUsageStatistics}) | ||||
72 | modeOptions.append({text: i18n("Detailed System Information"), value: UserFeedback.Provider.DetailedSystemInformation}) | ||||
73 | modeOptions.append({text: i18n("Detailed Usage Information"), value: UserFeedback.Provider.DetailedUsageStatistics}) | ||||
74 | | ||||
75 | for(var i = 0, c=modeOptions.count; i<c; ++i) { | ||||
76 | if (modeOptions.get(i).value === sheet.provider.statisticsCollectionMode) { | ||||
77 | currentIndex = i; | ||||
78 | break; | ||||
79 | } | ||||
80 | } | ||||
81 | } | ||||
82 | } | ||||
83 | Button { | ||||
84 | Layout.alignment: Qt.AlignRight | ||||
85 | text: i18n("Close") | ||||
86 | onClicked: sheetOpen = false | ||||
87 | } | ||||
88 | } | ||||
89 | onSheetOpenChanged: if (!sheetOpen) { | ||||
90 | var data = modeOptions.get(statisticsModeCombo.currentIndex) | ||||
91 | if (data) { | ||||
92 | sheet.provider.statisticsCollectionMode = data.value | ||||
93 | } | ||||
94 | destroy() | ||||
95 | } | ||||
96 | } | ||||
97 | } | ||||
98 | | ||||
99 | Action { | ||||
100 | id: submitStatisticsAction | ||||
101 | text: i18n("Submit information") | ||||
102 | onTriggered: { | ||||
103 | provider.submit() | ||||
104 | } | ||||
105 | } | ||||
106 | Action { | ||||
107 | id: feedbackSettingsAction | ||||
108 | text: i18n("Feedback settings...") | ||||
109 | onTriggered: { | ||||
110 | provider.encouraged() | ||||
111 | } | ||||
112 | } | ||||
113 | | ||||
114 | UserFeedback.Provider { | ||||
You probably want to set submissionInterval to a fixed positive value for it to actually send data automatically. For best results, pick one that matches the time aggregation modes in UserFeedbackConsole (1, 7 or 30). vkrause: You probably want to set submissionInterval to a fixed positive value for it to actually send… | |||||
115 | id: provider | ||||
116 | | ||||
117 | surveyInterval: 2 | ||||
118 | feedbackServer: "http://localhost:1234/" | ||||
119 | statisticsCollectionMode: UserFeedback.Provider.BasicUsageStatistics | ||||
Note that this means you have basic telemetry enabled by default. If you want to let the user control this entirely, just drop the line. Same for surveyInterval above. vkrause: Note that this means you have basic telemetry enabled by default. If you want to let the user… | |||||
120 | | ||||
121 | function encouraged() { | ||||
122 | var overlay = feedbackPage.createObject(window, {provider: provider}) | ||||
123 | overlay.sheetOpen = true | ||||
124 | } | ||||
125 | | ||||
126 | property var lastSurvey: null | ||||
127 | | ||||
128 | function openSurvey() { | ||||
129 | Qt.openUrlExternally(lastSurvey.url); | ||||
130 | surveyCompleted(lastSurvey); | ||||
131 | } | ||||
132 | | ||||
133 | onShowEncouragementMessage: { | ||||
For this to trigger you will need to set some of the encouragement related properties on Provider, by default it's off. vkrause: For this to trigger you will need to set some of the encouragement related properties on… | |||||
134 | showPassiveNotification(i18n("You can help us improving this application by sharing statistics and participate in surveys."), 5000, i18n("Contribute..."), encouraged) | ||||
135 | } | ||||
136 | | ||||
137 | onSurveyAvailable: { | ||||
138 | lastSurvey = survey | ||||
139 | showPassiveNotification(i18n("We are looking for your feedback!"), 5000, i18n("Participate..."), openSurvey) | ||||
140 | } | ||||
141 | | ||||
142 | UserFeedback.ApplicationVersionSource { mode: UserFeedback.Provider.BasicSystemInformation } | ||||
143 | UserFeedback.CompilerInfoSource { mode: UserFeedback.Provider.BasicSystemInformation } | ||||
144 | UserFeedback.CpuInfoSource { mode: UserFeedback.Provider.DetailedSystemInformation } | ||||
145 | UserFeedback.LocaleInfoSource { mode: UserFeedback.Provider.DetailedSystemInformation } | ||||
146 | UserFeedback.OpenGLInfoSource{ mode: UserFeedback.Provider.DetailedSystemInformation } | ||||
147 | UserFeedback.PlatformInfoSource { mode: UserFeedback.Provider.BasicSystemInformation } | ||||
148 | UserFeedback.QtVersionSource { mode: UserFeedback.Provider.BasicSystemInformation } | ||||
149 | UserFeedback.ScreenInfoSource { mode: UserFeedback.Provider.DetailedSystemInformation } | ||||
150 | UserFeedback.StartCountSource { mode: UserFeedback.Provider.BasicUsageStatistics } | ||||
151 | UserFeedback.UsageTimeSource { mode: UserFeedback.Provider.BasicUsageStatistics } | ||||
152 | } | ||||
153 | | ||||
46 | TopLevelPageData { | 154 | TopLevelPageData { | ||
47 | iconName: "tools-wizard" | 155 | iconName: "tools-wizard" | ||
48 | text: i18n("Discover") | 156 | text: i18n("Discover") | ||
49 | component: topBrowsingComp | 157 | component: topBrowsingComp | ||
50 | objectName: "discover" | 158 | objectName: "discover" | ||
51 | shortcut: "Alt+D" | 159 | shortcut: "Alt+D" | ||
52 | } | 160 | } | ||
53 | TopLevelPageData { | 161 | TopLevelPageData { | ||
▲ Show 20 Lines • Show All 138 Lines • Show Last 20 Lines |