Changeset View
Changeset View
Standalone View
Standalone View
src/qtquick/qml/NewStuffList.qml
Show All 13 Lines | |||||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
15 | * Lesser General Public License for more details. | 15 | * Lesser General Public License for more details. | ||
16 | * | 16 | * | ||
17 | * You should have received a copy of the GNU Lesser General Public | 17 | * You should have received a copy of the GNU Lesser General Public | ||
18 | * License along with this library. If not, see <http://www.gnu.org/licenses/>. | 18 | * License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||
19 | * | 19 | * | ||
20 | */ | 20 | */ | ||
21 | 21 | | |||
22 | import QtQuick 2.2 | 22 | import QtQuick 2.11 | ||
23 | import QtQuick.Controls 2.11 as QtControls | ||||
24 | import QtQuick.Layouts 1.11 as QtLayouts | ||||
23 | 25 | | |||
24 | import org.kde.newstuff 1.0 as NewStuff | 26 | import org.kde.newstuff 1.62 as NewStuff | ||
25 | 27 | | |||
26 | /** | 28 | /** | ||
27 | * To use NewStuffList, simply instantiate it and pass the | 29 | * To use NewStuffList, simply instantiate it and pass the | ||
28 | * local file location of a knsrc file to the configFile property. | 30 | * local file location of a knsrc file to the configFile property. | ||
29 | * The components will, in this case, take care of the rest for you. | 31 | * The components will, in this case, take care of the rest for you. | ||
30 | * If you want more, you can look at what NewStuffItem does with the | 32 | * If you want more, you can look at what NewStuffItem does with the | ||
31 | * various bits, and be inspired by that. | 33 | * various bits, and be inspired by that. | ||
32 | * | 34 | * | ||
Show All 21 Lines | 50 | ListView { | |||
54 | * KNS3::DownloadDialog | 56 | * KNS3::DownloadDialog | ||
55 | */ | 57 | */ | ||
56 | property alias configFile: newStuffEngine.configFile; | 58 | property alias configFile: newStuffEngine.configFile; | ||
57 | signal message(string message); | 59 | signal message(string message); | ||
58 | signal idleMessage(string message); | 60 | signal idleMessage(string message); | ||
59 | signal busyMessage(string message); | 61 | signal busyMessage(string message); | ||
60 | signal errorMessage(string message); | 62 | signal errorMessage(string message); | ||
61 | signal downloadedItemClicked(variant installedFiles); | 63 | signal downloadedItemClicked(variant installedFiles); | ||
64 | header: QtLayouts.RowLayout { | ||||
65 | anchors { | ||||
66 | left: parent.left | ||||
67 | right: parent.right | ||||
68 | } | ||||
69 | QtControls.ComboBox { | ||||
70 | id: categoriesCombo | ||||
71 | QtLayouts.Layout.fillWidth: true | ||||
72 | model: newStuffEngine.categories | ||||
73 | textRole: "displayName" | ||||
74 | onCurrentIndexChanged: { | ||||
75 | newStuffEngine.categoriesFilter = model.data(currentIndex, NewStuff.CategoriesModel.NameRole); | ||||
76 | } | ||||
77 | } | ||||
78 | QtControls.ComboBox { | ||||
79 | id: filterCombo | ||||
80 | QtLayouts.Layout.fillWidth: true | ||||
81 | model: ListModel {} | ||||
82 | Component.onCompleted: { | ||||
83 | filterCombo.model.append({ text: i18nc("List option which will set the filter to show everything", "Show Everything") }); | ||||
84 | filterCombo.model.append({ text: i18nc("List option which will set the filter so only installed items are shown", "Installed Only") }); | ||||
85 | filterCombo.model.append({ text: i18nc("List option which will set the filter so only installed items with updates available are shown", "Updateable Only") }); | ||||
86 | filterCombo.currentIndex = newStuffEngine.filter; | ||||
87 | } | ||||
88 | onCurrentIndexChanged: { | ||||
89 | newStuffEngine.filter = currentIndex; | ||||
90 | } | ||||
91 | } | ||||
92 | QtControls.ComboBox { | ||||
93 | id: sortCombo | ||||
94 | QtLayouts.Layout.fillWidth: true | ||||
95 | model: ListModel { } | ||||
96 | Component.onCompleted: { | ||||
97 | sortCombo.model.append({ text: i18nc("List option which will set the sort order to based on when items were most recently updated", "Show most recent first") }); | ||||
98 | sortCombo.model.append({ text: i18nc("List option which will set the sort order to be alphabetical based on the name", "Sort alphabetically") }); | ||||
99 | sortCombo.model.append({ text: i18nc("List option which will set the sort order to based on user ratings", "Show highest rated first") }); | ||||
100 | sortCombo.model.append({ text: i18nc("List option which will set the sort order to based on number of downloads", "Show most downloaded first") }); | ||||
101 | sortCombo.currentIndex = newStuffEngine.sortOrder; | ||||
102 | } | ||||
103 | onCurrentIndexChanged: { | ||||
104 | newStuffEngine.sortOrder = currentIndex; | ||||
105 | } | ||||
106 | } | ||||
107 | } | ||||
62 | delegate: NewStuffItem { | 108 | delegate: NewStuffItem { | ||
63 | listModel: newStuffModel; | 109 | listModel: newStuffModel; | ||
64 | onClicked: { | 110 | onClicked: { | ||
65 | if(model.status == NewStuff.ItemsModel.InstalledStatus) { | 111 | if(model.status == NewStuff.ItemsModel.InstalledStatus) { | ||
66 | root.downloadedItemClicked(model.installedFiles); | 112 | root.downloadedItemClicked(model.installedFiles); | ||
67 | } | 113 | } | ||
68 | } | 114 | } | ||
69 | } | 115 | } | ||
70 | model: NewStuff.ItemsModel { | 116 | model: NewStuff.ItemsModel { | ||
71 | id: newStuffModel; | 117 | id: newStuffModel; | ||
72 | engine: newStuffEngine.engine; | 118 | engine: newStuffEngine; | ||
73 | } | 119 | } | ||
74 | NewStuff.Engine { | 120 | NewStuff.Engine { | ||
75 | id: newStuffEngine; | 121 | id: newStuffEngine; | ||
76 | onMessage: root.message(message); | 122 | onMessage: root.message(message); | ||
77 | onIdleMessage: root.idleMessage(message); | 123 | onIdleMessage: root.idleMessage(message); | ||
78 | onBusyMessage: root.busyMessage(message); | 124 | onBusyMessage: root.busyMessage(message); | ||
79 | onErrorMessage: root.errorMessage(message); | 125 | onErrorMessage: root.errorMessage(message); | ||
80 | } | 126 | } | ||
127 | NewStuff.QuestionAsker {} | ||||
81 | } | 128 | } |