Commit 9b6ab165 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧
Browse files

Port all uses of QQC1 to QQC2

This way we don't have two weird uses of very similar APIs
parent 13a87221
......@@ -8,7 +8,7 @@ find_package(ECM REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR} "${CMAKE_SOURCE_DIR}/cmake")
find_package(Qt5 5.7.0 REQUIRED CONFIG COMPONENTS Widgets Test Network Xml Concurrent DBus Quick)
find_package(Qt5 5.10.0 REQUIRED CONFIG COMPONENTS Widgets Test Network Xml Concurrent DBus Quick)
include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
......
import QtQuick 2.1
import QtQuick.Controls 1.4
import QtTest 1.1
import org.kde.discover.app 1.0
......@@ -10,13 +9,6 @@ Item
signal reset()
property QtObject appRoot
StackViewDelegate {
id: noTransitionsDelegate
popTransition: StackViewTransition { immediate: true }
pushTransition: StackViewTransition { immediate: true }
replaceTransition: StackViewTransition { immediate: true }
}
function verify(condition, msg) {
if (!condition) {
console.trace();
......
......@@ -19,7 +19,7 @@
***************************************************************************/
import QtQml 2.0
import QtQuick.Controls 1.0
import QtQuick.Controls 2.3
Action
{
......@@ -31,8 +31,7 @@ Action
text: action ? removeAmpersand(action.text) : "<null>"
checked: action && action.checked
enabled: action && action.enabled
tooltip: action ? action.toolTip : ""
iconName: action ? app.iconName(action.icon) : ""
icon.name: action ? app.iconName(action.icon) : ""
shortcut: action ? action.shortcut : undefined
onTriggered: action.trigger()
......
import QtQuick 2.1
import QtQuick.Controls 1.1
import QtQuick.Controls 2.1
import QtQuick.Layouts 1.1
import org.kde.discover 2.0
import "navigation.js" as Navigation
......@@ -69,14 +69,14 @@ Kirigami.OverlaySheet
spacing: 5
Button {
iconName: "dialog-ok"
icon.name: "dialog-ok"
text: i18n("Apply Changes")
onClicked: addonsModel.applyChanges()
visible: parent.active
}
Button {
iconName: "document-revert"
icon.name: "document-revert"
text: i18n("Discard")
onClicked: addonsModel.discardChanges()
......
......@@ -18,8 +18,7 @@
*/
import QtQuick 2.1
import QtQuick.Controls 1.1
import QtQuick.Controls 2.1 as QQC2
import QtQuick.Controls 2.1
import QtQuick.Layouts 1.1
import QtQuick.Window 2.1
import "navigation.js" as Navigation
......@@ -92,14 +91,14 @@ Kirigami.AbstractCard
rating: delegateArea.application.rating ? delegateArea.application.rating.sortableRating : 0
starSize: delegateArea.compact ? summary.font.pointSize : head.font.pointSize
}
QQC2.Label {
Label {
text: delegateArea.application.rating ? i18np("%1 rating", "%1 ratings", delegateArea.application.rating.ratingCount) : i18n("No ratings yet")
opacity: 0.5
}
}
Layout.fillWidth: true
QQC2.Label {
Label {
id: summary
Layout.fillWidth: true
Layout.rightMargin: delegateArea.compact ? installButton.width : 0
......
......@@ -18,8 +18,7 @@
*/
import QtQuick 2.5
import QtQuick.Controls 1.1
import QtQuick.Controls 2.3 as QQC2
import QtQuick.Controls 2.3
import QtQuick.Window 2.1
import QtQuick.Layouts 1.1
import org.kde.discover 2.0
......@@ -44,7 +43,7 @@ DiscoverPage {
contextualActions: [originsMenuAction]
QQC2.ActionGroup {
ActionGroup {
id: sourcesGroup
exclusive: true
}
......@@ -60,8 +59,8 @@ DiscoverPage {
allBackends: true
resourcesUrl: appInfo.application.url
}
delegate: QQC2.Action {
QQC2.ActionGroup.group: sourcesGroup
delegate: Action {
ActionGroup.group: sourcesGroup
text: displayOrigin
icon.name: sourceIcon
checked: appInfo.application == model.application
......@@ -122,7 +121,7 @@ DiscoverPage {
rating: appInfo.application.rating ? appInfo.application.rating.sortableRating : 0
starSize: summary.font.pointSize
}
QQC2.Label {
Label {
text: appInfo.application.rating ? i18np("%1 rating", "%1 ratings", appInfo.application.rating.ratingCount) : i18n("No ratings yet")
opacity: 0.5
}
......@@ -146,14 +145,14 @@ DiscoverPage {
Layout.fillWidth: true
visible: count > 0
resource: appInfo.application
QQC2.ScrollBar.horizontal: screenshotsScrollbar
ScrollBar.horizontal: screenshotsScrollbar
}
QQC2.ScrollBar {
ScrollBar {
id: screenshotsScrollbar
Layout.fillWidth: true
}
QQC2.Label {
Label {
Layout.topMargin: Kirigami.Units.largeSpacing
Layout.fillWidth: true
wrapMode: Text.WordWrap
......@@ -174,7 +173,7 @@ DiscoverPage {
visible: changelogLabel.text.length > 0
}
QQC2.Label {
Label {
id: changelogLabel
Layout.topMargin: Kirigami.Units.largeSpacing
Layout.fillWidth: true
......@@ -267,23 +266,23 @@ DiscoverPage {
columns: 2
// Category row
QQC2.Label {
Label {
Layout.alignment: Qt.AlignRight
text: i18n("Category:")
}
QQC2.Label {
Label {
Layout.fillWidth: true
elide: Text.ElideRight
text: appInfo.application.categoryDisplay
}
// Version row
QQC2.Label {
Label {
visible: versionLabel.visible
Layout.alignment: Qt.AlignRight
text: i18n("Version:")
}
QQC2.Label {
Label {
readonly property string version: appInfo.application.isInstalled ? appInfo.application.installedVersion : appInfo.application.availableVersion
id: versionLabel
visible: text.length > 0
......@@ -293,22 +292,22 @@ DiscoverPage {
}
// Size row
QQC2.Label {
Label {
Layout.alignment: Qt.AlignRight
text: i18n("Size:")
}
QQC2.Label {
Label {
Layout.fillWidth: true
elide: Text.ElideRight
text: appInfo.application.sizeDescription
}
// Source row
QQC2.Label {
Label {
Layout.alignment: Qt.AlignRight
text: i18n("Source:")
}
QQC2.Label {
Label {
Layout.fillWidth: true
horizontalAlignment: Text.AlignLeft
text: appInfo.application.displayOrigin
......@@ -316,7 +315,7 @@ DiscoverPage {
}
// License row
QQC2.Label {
Label {
Layout.alignment: Qt.AlignRight
text: i18n("License:")
visible: appInfo.application.license.length>0
......@@ -332,7 +331,7 @@ DiscoverPage {
}
// Homepage row
QQC2.Label {
Label {
visible: homepageLink.visible
Layout.alignment: Qt.AlignRight
text: i18n("Homepage:")
......@@ -348,7 +347,7 @@ DiscoverPage {
}
// "User Guide" row
QQC2.Label {
Label {
visible: docsLink.visible
Layout.alignment: Qt.AlignRight
text: i18n("User Guide:")
......@@ -364,7 +363,7 @@ DiscoverPage {
}
// Donate row
QQC2.Label {
Label {
visible: donationLink.visible
Layout.alignment: Qt.AlignRight
text: i18n("Donate:")
......@@ -380,7 +379,7 @@ DiscoverPage {
}
// "Report a Droblem" row
QQC2.Label {
Label {
visible: bugLink.visible
Layout.alignment: Qt.AlignRight
text: i18n("Report a Problem:")
......
......@@ -20,7 +20,7 @@
import QtQuick 2.1
import QtQuick.Layouts 1.1
import QtQuick.Controls 1.1
import QtQuick.Controls 2.1
import QtQuick.Controls 2.1 as QQC2
import QtGraphicalEffects 1.0
import org.kde.discover 2.0
......@@ -68,7 +68,7 @@ Flickable {
verticalCenter: parent.verticalCenter
}
visible: leftAction.visible
iconName: leftAction.iconName
icon.name: leftAction.iconName
onClicked: leftAction.triggered(null)
}
......@@ -78,13 +78,13 @@ Flickable {
verticalCenter: parent.verticalCenter
}
visible: rightAction.visible
iconName: rightAction.iconName
icon.name: rightAction.iconName
onClicked: rightAction.triggered(null)
}
Kirigami.Action {
id: leftAction
iconName: "arrow-left"
icon.name: "arrow-left"
enabled: overlay.visible && visible
visible: root.currentIndex >= 1
onTriggered: root.currentIndex = (root.currentIndex - 1) % screenshotsModel.count
......@@ -92,7 +92,7 @@ Flickable {
Kirigami.Action {
id: rightAction
iconName: "arrow-right"
icon.name: "arrow-right"
enabled: overlay.visible && visible
visible: root.currentIndex < (root.count - 1)
onTriggered: root.currentIndex = (root.currentIndex + 1) % screenshotsModel.count
......
......@@ -18,8 +18,7 @@
*/
import QtQuick 2.5
import QtQuick.Controls 1.1
import QtQuick.Controls 2.3 as QQC2
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.1
import QtQuick.Window 2.2
import "navigation.js" as Navigation
......@@ -59,7 +58,7 @@ DiscoverPage {
refreshing = false
}
QQC2.ActionGroup {
ActionGroup {
id: sortGroup
exclusive: true
}
......@@ -67,8 +66,8 @@ DiscoverPage {
contextualActions: [
Kirigami.Action {
text: i18n("Sort: %1", sortGroup.checkedAction.text)
QQC2.Action {
QQC2.ActionGroup.group: sortGroup
Action {
ActionGroup.group: sortGroup
text: i18n("Name")
onTriggered: {
appsModel.sortRole = ResourcesProxyModel.NameRole
......@@ -77,8 +76,8 @@ DiscoverPage {
checkable: true
checked: appsModel.sortRole == ResourcesProxyModel.NameRole
}
QQC2.Action {
QQC2.ActionGroup.group: sortGroup
Action {
ActionGroup.group: sortGroup
text: i18n("Rating")
onTriggered: {
appsModel.sortRole = ResourcesProxyModel.SortableRatingRole
......@@ -87,8 +86,8 @@ DiscoverPage {
checkable: true
checked: appsModel.sortRole == ResourcesProxyModel.SortableRatingRole
}
QQC2.Action {
QQC2.ActionGroup.group: sortGroup
Action {
ActionGroup.group: sortGroup
text: i18n("Size")
onTriggered: {
appsModel.sortRole = ResourcesProxyModel.SizeRole
......@@ -97,8 +96,8 @@ DiscoverPage {
checkable: true
checked: appsModel.sortRole == ResourcesProxyModel.SizeRole
}
QQC2.Action {
QQC2.ActionGroup.group: sortGroup
Action {
ActionGroup.group: sortGroup
text: i18n("Release Date")
onTriggered: {
appsModel.sortRole = ResourcesProxyModel.ReleaseDateRole
......@@ -113,7 +112,7 @@ DiscoverPage {
Kirigami.CardsListView {
id: apps
section.delegate: QQC2.Label {
section.delegate: Label {
text: section
anchors {
right: parent.right
......@@ -135,7 +134,7 @@ DiscoverPage {
showRating: page.showRating
}
QQC2.Label {
Label {
anchors.centerIn: parent
opacity: apps.count == 0 && !appsModel.isBusy ? 0.3 : 0
Behavior on opacity { PropertyAnimation { duration: Kirigami.Units.longDuration; easing.type: Easing.InOutQuad; } }
......@@ -180,7 +179,7 @@ DiscoverPage {
}
}
]
QQC2.Label {
Label {
id: busyLabel
anchors {
horizontalCenter: parent.horizontalCenter
......
......@@ -18,7 +18,7 @@
*/
import QtQuick 2.4
import QtQuick.Controls 1.1
import QtQuick.Controls 2.1
import QtQuick.Layouts 1.1
import org.kde.discover 2.0
import org.kde.discover.app 1.0
......
......@@ -20,7 +20,7 @@
import QtQuick 2.5
import QtQuick.Layouts 1.1
import QtQuick.Controls 1.1
import QtQuick.Controls 2.1
import org.kde.discover 2.0
import org.kde.discover.app 1.0
import org.kde.kirigami 2.0 as Kirigami
......
import QtQuick 2.5
import QtQuick.Layouts 1.1
import QtQuick.Controls 1.1
import QtQuick.Controls 2.1 as QQC2
import QtQuick.Controls 2.1
import org.kde.discover 2.0
import org.kde.discover.app 1.0
import org.kde.kirigami 2.2 as Kirigami
......@@ -168,7 +167,7 @@ Kirigami.ApplicationWindow
Kirigami.Heading {
id: heading
}
QQC2.Label {
Label {
id: desc
Layout.fillWidth: true
textFormat: Text.StyledText
......@@ -178,7 +177,7 @@ Kirigami.ApplicationWindow
Layout.alignment: Qt.AlignRight
Button {
text: i18n("Proceed")
iconName: "dialog-ok"
icon.name: "dialog-ok"
onClicked: {
transaction.proceed()
sheet.acted = true
......@@ -188,7 +187,7 @@ Kirigami.ApplicationWindow
Button {
Layout.alignment: Qt.AlignRight
text: i18n("Cancel")
iconName: "dialog-cancel"
icon.name: "dialog-cancel"
onClicked: {
transaction.cancel()
sheet.acted = true
......
import QtQuick 2.1
import QtQuick.Controls 1.1
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.1
import org.kde.discover 2.0
import org.kde.kirigami 2.0 as Kirigami
......@@ -49,7 +49,7 @@ ConditionalLoader
ToolButton {
Layout.fillHeight: true
iconName: "dialog-cancel"
icon.name: "dialog-cancel"
enabled: listener.isCancellable
onClicked: listener.cancel()
}
......
import QtQuick 2.1
import QtQuick.Controls 1.1
import QtQuick.Controls 2.1 as QQC2
import QtQuick.Controls 2.1
import QtQuick.Layouts 1.1
import org.kde.discover 2.0
import org.kde.kirigami 2.0 as Kirigami
......@@ -69,19 +68,19 @@ Kirigami.BasicListItem {
source: model.transaction.icon
}
QQC2.Label {
Label {
Layout.alignment: Qt.AlignVCenter
Layout.fillWidth: true
elide: Text.ElideRight
text: listener.isActive ? i18nc("TransactioName - TransactionStatus", "%1 - %2: %3", model.transaction.name, listener.statusText, model.transaction.downloadSpeedString) : model.transaction.name
}
ToolButton {
iconName: "dialog-cancel"
icon.name: "dialog-cancel"
visible: listener.isCancellable
onClicked: listener.cancel()
}
ToolButton {
iconName: "system-run"
icon.name: "system-run"
visible: model.application != undefined && model.application.isInstalled && !listener.isActive && model.application.canExecute
onClicked: {
model.application.invokeApplication()
......@@ -92,8 +91,7 @@ Kirigami.BasicListItem {
ProgressBar {
Layout.fillWidth: true
visible: listener.isActive
value: listener.progress
maximumValue: 100
value: listener.progress / 100
}
}
}
......
import QtQuick 2.3
import QtQuick.Controls 1.2
import QtQuick.Controls 2.2
import QtQuick.Dialogs 1.2
import QtQuick.Layouts 1.1
import QtQuick.Window 2.0
......
......@@ -19,7 +19,7 @@
***************************************************************************/
import QtQuick 2.1
import QtQuick.Controls 1.1
import QtQuick.Controls 2.1
import org.kde.discover 2.0
import org.kde.discover.app 1.0
import org.kde.kirigami 2.0 as Kirigami
......@@ -52,7 +52,7 @@ Kirigami.OverlaySheet {
header: Item {
width: parent.width
height: reviewButton.height + 2 * Kirigami.Units.largeSpacing
height: reviewButton.implicitHeight + 2 * Kirigami.Units.largeSpacing
Button {
id: reviewButton
......
......@@ -19,7 +19,6 @@
***************************************************************************/
import QtQuick 2.5
import QtQuick.Controls 1.1 as QQC1
import QtQuick.Controls 2.1
import org.kde.kirigami 2.1 as Kirigami
......@@ -54,14 +53,14 @@ TextField
searchField.accepted()
}
QQC1.ToolButton {
ToolButton {
anchors {
top: parent.top
right: parent.right
bottom: parent.bottom
margins: Kirigami.Units.smallSpacing
}
iconName: "edit-clear"
icon.name: "edit-clear"
visible: searchField.text != ""
onClicked: clearText()
}
......
import QtQuick 2.4
import QtQuick.Controls 1.1
import QtQuick.Controls 2.1 as QQC2
import QtQuick.Controls 2.1
import QtQuick.Layouts 1.1
import org.kde.discover 2.0
import org.kde.discover.app 1.0
......@@ -60,7 +59,7 @@ DiscoverPage {
}
Button {
Layout.rightMargin: Kirigami.Units.smallSpacing
iconName: "preferences-other"
icon.name: "preferences-other"
visible: resourcesBackend && resourcesBackend.hasApplications
Component {
......@@ -73,7 +72,9 @@ DiscoverPage {
}
}
menu: Menu {
id: this
onClicked: settingsMenu.popup(this)
Menu {
id: settingsMenu
MenuItem {
enabled: !backendItem.isDefault
......@@ -101,7 +102,9 @@ DiscoverPage {
actions: backendItem.backend ? backendItem.backend.actions : undefined
}
delegate: MenuItem {
action: ActionBridge { action: modelData.action }
action: ActionBridge {
action: modelData.action
}
}
onObjectAdded: {
settingsMenu.insertItem(index, object)
......@@ -188,7 +191,7 @@ DiscoverPage {
sourcesView.model.setData(modelIndex, checkedState, Qt.CheckStateRole)
}
}
QQC2.Label {
Label {
text: display + " - <i>" + toolTip + "</i>"
elide: Text.ElideRight
Layout.fillWidth: true
......
import QtQuick.Controls 1.2
import QtQuick.Controls 2.3 as QQC2
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.1
import QtQuick 2.4
import org.kde.discover 2.0
......@@ -45,12 +44,12 @@ DiscoverPage
onTriggered: resourcesUpdatesModel.updateAll()
}
footer: QQC2.ScrollView {
footer: ScrollView {
id: scv
width: parent.width
height: visible ? Kirigami.Units.gridUnit * 10 : 0
visible: log.contents.length > 0
QQC2.TextArea {
TextArea {
readOnly: true
text: log.contents