Permalink
Browse files

Changes... everywhere. New installed view, optimizations all around, …

…logging verbosity setting, and a host of other stuff
  • Loading branch information...
1 parent f9a5b4d commit 2ea865a5b30687346539711cb4299fb49eb21c9e @bzar committed Apr 9, 2012
2 deps/qtpndman/src
@@ -1 +1 @@
-Subproject commit 83616b299982964c28311f43ebc321b1228f08fc
+Subproject commit de2522588e71337fd5e39e4d58f47365dfd5ed5a
View
13 interfaces/PNDManager/Button.qml
@@ -6,7 +6,6 @@ Item {
property alias label: labelText.text
property alias sublabel: sublabelText.text
property alias pressed: mouseArea.pressed
- property alias hovered: mouseArea.hover
property alias font: labelText.font
property alias textColor: labelText.color
property alias enabled: mouseArea.enabled
@@ -24,9 +23,9 @@ Item {
smooth: radius != 0
gradient: Gradient {
- GradientStop { position: 0.0; color: Qt.darker(button.color, pressed ? 1.6 : hovered ? 0.8 : 1.0 ) }
- GradientStop { position: pressed ? 0.2 : 0.8; color: Qt.darker(button.color, pressed ? 1.4 : hovered ? 1.0 : 1.2) }
- GradientStop { position: 1.0; color: Qt.darker(button.color, pressed ? 1.2 : hovered ? 1.6 : 1.4) }
+ GradientStop { position: 0.0; color: Qt.darker(button.color, pressed ? 1.6 : 1.0 ) }
+ GradientStop { position: pressed ? 0.2 : 0.8; color: Qt.darker(button.color, pressed ? 1.4 : 1.2) }
+ GradientStop { position: 1.0; color: Qt.darker(button.color, pressed ? 1.2 : 1.4) }
}
clip: true
@@ -35,7 +34,7 @@ Item {
id: guiHint
anchors.right: parent.right
anchors.top: parent.top
- anchors.margins: 8
+ anchors.margins: Math.min(8, (parent.height - height) / 2)
}
Column {
anchors.centerIn: parent
@@ -61,12 +60,8 @@ Item {
MouseArea {
id: mouseArea
- property bool hover: false
anchors.fill: parent
- hoverEnabled: true
onClicked: button.clicked()
- onEntered: hover = true
- onExited: hover = false
}
Rectangle {
View
3 interfaces/PNDManager/CategoryView.qml
@@ -127,6 +127,9 @@ View {
anchors.margins: 4
font.pixelSize: 14
activeFocusOnPress: false
+ cursorVisible: true
+ Keys.onRightPressed: event.accepted = true
+ Keys.onLeftPressed: event.accepted = true
}
}
}
View
616 interfaces/PNDManager/InstalledView.qml
@@ -18,8 +18,8 @@ View {
onPackagesChanged: update()
}
- onUpgradeButton: upgradeAll()
- onInstallRemoveButton: cancelDownload()
+ onInstallUpgradeButton: upgradeAll()
+ onRemoveButton: cancelDownload()
onSelectButton: view.sortByTitle = !view.sortByTitle
function sort(list) {
@@ -72,7 +72,11 @@ View {
}
function getSelected() {
- return content.currentItem.pnd;
+ if(content.currentItem) {
+ return content.currentItem.pnd;
+ } else {
+ return null;
+ }
}
function openSelected() {
showPackage(getSelected());
@@ -87,354 +91,381 @@ View {
visible: installedModelPrefilter.length === 0 && downloadingModelPrefilter.length === 0 && upgradableModelPrefilter.length === 0
}
- Rectangle {
- id: upgradeAllButtonContainer
- anchors.left: parent.left
- anchors.right: parent.right
- anchors.top: parent.top
- height: visible ? upgradeAllButton.height + 16 : 0
- visible: upgradableModel.length > 0
- color: "#eee"
- z: 1
- Button {
- id: upgradeAllButton
- label: "Upgrade all"
- color: Theme.colors.upgrade
- control: "game-y"
- width: 256
- height: 64
- radius: 8
- onClicked: upgradeAll()
- anchors.centerIn: parent
- }
- Rectangle {
- height: 1
- color: "#ccc"
- anchors.bottom: parent.bottom
- anchors.left: parent.left
- anchors.right: parent.right
+ ScrollBar {
+ id: scrollbar
+ target: content
+ z: 3
+ anchors.right: content.right
+ Connections {
+ target: content
+ onMovementStarted: scrollbar.show()
+ onMovementEnded: scrollbar.hide()
+ onCurrentIndexChanged: scrollbar.showIfChanged(content.contentY)
}
}
- Item {
+ ListView {
+ id: content
anchors.left: parent.left
- anchors.right: parent.right
- anchors.top: upgradeAllButtonContainer.bottom
+ anchors.right: info.left
+ anchors.top: parent.top
anchors.bottom: parent.bottom
+ Keys.priority: Keys.AfterItem
+ Keys.forwardTo: [ui, search]
- ScrollBar {
- id: scrollbar
- target: content
- z: 3
- anchors.right: parent.right
- Connections {
- target: content
- onMovementStarted: scrollbar.show()
- onMovementEnded: scrollbar.hide()
- onCurrentIndexChanged: scrollbar.showIfChanged(content.contentY)
- }
+ model: ListModel {
+ id: packages
+ property int sectionDownloading: 1
+ property int sectionUpgradable: 2
+ property int sectionInstalled: 3
+ property int foo: createModel() // hack to make model update automatically
+ function createModel() {
+ clear();
+ for(var i = 0; i < downloadingModel.length; ++i) {
+ append({sect: sectionDownloading, item: downloadingModel[i]});
+ }
+ for(var i = 0; i < upgradableModel.length; ++i) {
+ append({sect: sectionUpgradable, item: upgradableModel[i]});
+ }
+ for(var i = 0; i < installedModel.length; ++i) {
+ append({sect: sectionInstalled, item: installedModel[i]});
+ }
+ return 1;
+ }
}
- ListView {
- id: content
- anchors.fill: parent
+ boundsBehavior: Flickable.DragOverBounds
+ onCurrentItemChanged: if(currentIndex === 0 && packages.count > 1) positionViewAtBeginning()
- Keys.priority: Keys.AfterItem
- Keys.forwardTo: [ui, search]
+ header: Item {
+ height: 64
+ width: content.width
+ Row {
+ spacing: 32
+ anchors.centerIn: parent
- model: ListModel {
- id: packages
+ Text {
+ text: "Sorting:"
+ anchors.verticalCenter: parent.verticalCenter
+ font.pixelSize: 16
+ }
+ Rectangle {
+ property bool selected: view.sortByTitle
+ width: sortByTitleText.paintedWidth + 32
+ height: 48
+ color: selected ? "#555" : "#eee"
+ radius: 8
+ Text {
+ anchors.centerIn: parent
+ id: sortByTitleText
+ text: "alphabetical"
+ color: parent.selected ? "white" : "black"
+ font.pixelSize: 16
+ }
- property int sectionDownloading: 1
- property int sectionUpgradable: 2
- property int sectionInstalled: 3
- property int foo: createModel() // hack to make model update automatically
- function createModel() {
- clear();
- for(var i = 0; i < downloadingModel.length; ++i) {
- append({sect: sectionDownloading, item: downloadingModel[i]});
+ MouseArea {
+ anchors.fill: parent
+ onClicked: view.sortByTitle = true
}
- for(var i = 0; i < upgradableModel.length; ++i) {
- append({sect: sectionUpgradable, item: upgradableModel[i]});
+ }
+
+ Rectangle {
+ property bool selected: !view.sortByTitle
+ width: sortByDateText.paintedWidth + 32
+ height: 48
+ color: selected ? "#555" : "#eee"
+ radius: 8
+ Text {
+ anchors.centerIn: parent
+ id: sortByDateText
+ text: "last updated"
+ color: parent.selected ? "white" : "black"
+ font.pixelSize: 16
}
- for(var i = 0; i < installedModel.length; ++i) {
- append({sect: sectionInstalled, item: installedModel[i]});
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: view.sortByTitle = false
}
- return 1;
+ }
+
+ GuiHint {
+ control: "select"
+ anchors.verticalCenter: parent.verticalCenter
+ width: 32
+ height: 32
}
}
+ }
- boundsBehavior: Flickable.DragOverBounds
- onCurrentItemChanged: if(currentIndex === 0 && packages.count > 1) positionViewAtBeginning()
+ highlightFollowsCurrentItem: false
- Component {
- id: downloadingComponent
- Item {
- Row {
- width: parent.width
+ highlight: Rectangle {
+ color: "#ddd"
+ width: content.currentItem ? content.currentItem.width : 0
+ height: content.currentItem ? content.currentItem.height : 0
+ visible: content.currentItem != null
- Rectangle {
- color: selected ? "#eee" : "#ddd"
- radius: 8
- height: 16
- width: parent.width / parent.children.length
-
- Connections {
- target: pkg
- onDownloadCancelled: view.update()
- }
-
- ProgressBar {
- anchors.left: parent.left
- anchors.right: parent.right
- anchors.verticalCenter: parent.verticalCenter
- anchors.margins: 4
- height: 8
- radius: 4
- color: "#333"
- minimumValue: 0
- maximumValue: pkg.bytesToDownload
- value: pkg.bytesDownloaded
- }
- Image {
- source: "img/x_alt_32x32.png"
- width: 16
- height: 16
- smooth: true
- anchors.left: parent.right
- anchors.verticalCenter: parent.verticalCenter
- anchors.margins: 16
-
- GuiHint {
- control: "game-a"
- anchors.left: parent.right
- anchors.verticalCenter: parent.verticalCenter
- height: parent.height
- width: parent.width
- anchors.margins: 4
- }
-
- MouseArea {
- anchors.fill: parent
- onClicked: cancelDownload()
- }
- }
- }
-
-
- Item {
- id: progressText
- property variant progress: Utils.prettyProgress(pkg.bytesDownloaded, pkg.bytesToDownload)
- width: parent.width / parent.children.length
- height: 16
- Text {
- text: progressText.progress.value
- font.pixelSize: 14
- anchors.right: totalSize.left
- }
- Text {
- id: totalSize
- text: " / " + progressText.progress.size + " " + progressText.progress.unit
- font.pixelSize: 14
- anchors.right: parent.right
- }
- }
- }
+ Connections {
+ target: content
+ onCurrentIndexChanged: y = content.currentItem ? content.currentItem.y : 0
+ }
+ }
+
+ delegate: SectionItem {
+ width: content.width
+ title: item.title ? item.title : item.id
+ icon: item.icon
+ progress: item.isDownloading ? Math.floor(100 * item.bytesDownloaded / item.bytesToDownload) + "%" : ""
+ onClicked: {
+ if(content.currentIndex === index) {
+ openSelected();
+ } else {
+ content.currentIndex = index;
}
}
+ property QtObject pnd: item
+ }
- Component {
- id: upgradableComponent
- Row {
- width: parent.width
- Text {
- width: parent.width / parent.children.length
- text: Utils.versionString(pkg.version) + "" + Utils.versionString(pkg.upgradeCandidate.version)
- font.pixelSize: 14
- }
- Text {
- width: parent.width / parent.children.length
- text: Utils.prettySize(pkg.upgradeCandidate.size)
- font.pixelSize: 14
- }
- Text {
- width: parent.width / parent.children.length
- text: pkg.mount
- font.pixelSize: 14
- }
+ section.property: "sect"
+ section.delegate: SectionHeader {
+ function getText() {
+ if(section == packages.sectionDownloading) {
+ return "Downloading"
+ } else if(section == packages.sectionUpgradable) {
+ return "Upgradable"
+ } else if(section == packages.sectionInstalled) {
+ return "Installed"
}
+ else return "N/A"
}
- Component {
- id: installedComponent
- Row {
- width: parent.width
- Text {
- width: parent.width / parent.children.length
- text: Utils.versionString(pkg.version)
- font.pixelSize: 14
- }
- Text {
- width: parent.width / parent.children.length
- text: Utils.prettySize(pkg.size)
- font.pixelSize: 14
- }
- Text {
- width: parent.width / parent.children.length
- text: pkg.mount
- font.pixelSize: 14
- }
+ function getIcon() {
+ if(section == packages.sectionDownloading) {
+ return "img/cloud_download_32x32.png"
+ } else if(section == packages.sectionUpgradable) {
+ return "img/arrow_up_alt1_32x32.png"
+ } else if(section == packages.sectionInstalled) {
+ return "img/download_darkgrey_24x32.png"
}
+ else return ""
}
- header: Item {
- height: 64
- width: content.width
- Row {
- spacing: 32
- anchors.centerIn: parent
+ text: getText()
+ icon: getIcon()
+ width: parent.width
+
+ Button {
+ id: upgradeAllButton
+ label: "Upgrade all"
+ color: Theme.colors.upgrade
+ control: "game-y"
+ width: 192
+ height: 32
+ radius: 4
+ onClicked: upgradeAll()
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.right: parent.right
+ anchors.margins: 8
+ visible: section == packages.sectionUpgradable
+ }
+ }
+ }
- Text {
- text: "Sorting:"
- anchors.verticalCenter: parent.verticalCenter
- font.pixelSize: 16
- }
- Rectangle {
- property bool selected: view.sortByTitle
- width: sortByTitleText.paintedWidth + 32
- height: 48
- color: selected ? "#555" : "#eee"
- radius: 8
- Text {
- anchors.centerIn: parent
- id: sortByTitleText
- text: "alphabetical"
- color: parent.selected ? "white" : "black"
- font.pixelSize: 16
- }
-
- MouseArea {
- anchors.fill: parent
- onClicked: view.sortByTitle = true
- }
- }
+ Rectangle {
+ id: info
+ width: 256
+ anchors.right: parent.right
+ anchors.top: parent.top
+ anchors.bottom: parent.bottom
- Rectangle {
- property bool selected: !view.sortByTitle
- width: sortByDateText.paintedWidth + 32
- height: 48
- color: selected ? "#555" : "#eee"
- radius: 8
- Text {
- anchors.centerIn: parent
- id: sortByDateText
- text: "last updated"
- color: parent.selected ? "white" : "black"
- font.pixelSize: 16
- }
-
- MouseArea {
- anchors.fill: parent
- onClicked: view.sortByTitle = false
- }
- }
+ property QtObject pnd: getSelected()
- GuiHint {
- control: "select"
- anchors.verticalCenter: parent.verticalCenter
- width: 32
- height: 32
+ color: "#f8f8f8"
+
+ Rectangle {
+ width: 1
+ height: parent.height
+ color: "#ccc"
+ anchors.left: parent.left
+ }
+
+ Column {
+ anchors.top: parent.top
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.margins: 8
+ height: childrenRect.height
+ spacing: 2
+
+ Text {
+ text: info.pnd ? info.pnd.title : "-"
+ font.pixelSize: 16
+ font.bold: Font.DemiBold
+ width: parent.width
+ }
+ Rectangle {
+ width: parent.width
+ height: 1
+ color: "#ddd"
+ }
+ PackageInfoText {
+ label: "Author"
+ text: info.pnd && info.pnd.author.name ? info.pnd.author.name : "-"
+ }
+ PackageInfoText {
+ label: "Rating"
+ function getRating() {
+ var s = "";
+ for(var i = 0; i < Math.ceil(info.pnd.rating/20); ++i) {
+ s += "";
}
+ return s;
}
- }
- highlightFollowsCurrentItem: false
-
- highlight: Rectangle {
+ text: info.pnd && info.pnd.rating !== 0 ? getRating() : "(not rated)"
+ }
+ PackageInfoText {
+ label: "Size"
+ text: info.pnd ? Utils.prettySize(info.pnd.size) : "-"
+ }
+ PackageInfoText {
+ label: "Version"
+ text: info.pnd ? Utils.versionString(info.pnd.version) : "-"
+ }
+ PackageInfoText {
+ label: "Location"
+ text: info.pnd ? info.pnd.mount : "-"
+ }
+ Rectangle {
+ width: parent.width
+ height: 1
color: "#ddd"
- width: content.currentItem ? content.currentItem.width : 0
- height: content.currentItem ? content.currentItem.height : 0
- visible: content.currentItem != null
+ visible: info.pnd !== null && info.pnd.upgradeCandidate !== null
+ }
+ PackageInfoText {
+ label: "Upgrade size"
+ text: visible ? Utils.prettySize(info.pnd.upgradeCandidate.size) : ""
+ visible: info.pnd !== null && info.pnd.upgradeCandidate !== null && !info.pnd.isDownloading
+ }
+ PackageInfoText {
+ label: "Upgrade version"
+ text: visible ? Utils.versionString(info.pnd.upgradeCandidate.version) : ""
+ visible: info.pnd !== null && info.pnd.upgradeCandidate !== null && !info.pnd.isDownloading
+ }
- Connections {
- target: content
- onCurrentIndexChanged: y = content.currentItem ? content.currentItem.y : 0
- }
+ Item {
+ width: parent.width
+ height: 16
+ visible: info.pnd !== null && info.pnd.isDownloading
- GuiHint {
- id: hint
- control: "game-b"
- anchors.right: parent.right
- anchors.verticalCenter: parent.verticalCenter
+ Rectangle {
+ id: progressBar
+ color: "#ddd"
+ radius: 8
+ height: 16
+
+ anchors.left: parent.left
+ anchors.right: downloadCancelButton.left
anchors.margins: 4
- }
- }
- delegate: SectionItem {
- width: content.width
- text: item.title ? item.title : item.id
- icon: item.icon
- onClicked: { content.currentIndex = index; openSelected(); }
- property QtObject pnd: item
- Loader {
- function getSource() {
- if(sect == packages.sectionDownloading) {
- return downloadingComponent;
- } else if(sect == packages.sectionUpgradable) {
- return upgradableComponent;
- } else if(sect == packages.sectionInstalled) {
- return installedComponent;
- }
+ Connections {
+ target: info.pnd
+ onDownloadCancelled: view.update()
}
- property QtObject pkg: pnd
- property bool selected: index === content.currentIndex
- sourceComponent: getSource()
- width: parent.width
+ ProgressBar {
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.margins: 4
+ height: 8
+ radius: 4
+ color: "#333"
+ minimumValue: 0
+ maximumValue: !info.pnd ? 0 : info.pnd.bytesToDownload
+ value: !info.pnd ? 0 : info.pnd.bytesDownloaded
+ }
}
- }
+ Image {
+ id: downloadCancelButton
+ source: "img/x_alt_32x32.png"
+ width: 16
+ height: 16
+ smooth: true
+ anchors.right: parent.right
+ anchors.rightMargin: 20
- section.property: "sect"
- section.delegate: SectionHeader {
- function getText() {
- if(section == packages.sectionDownloading) {
- return "Downloading"
- } else if(section == packages.sectionUpgradable) {
- return "Upgradable"
- } else if(section == packages.sectionInstalled) {
- return "Installed"
+ GuiHint {
+ control: "game-a"
+ anchors.left: parent.right
+ anchors.verticalCenter: parent.verticalCenter
+ height: parent.height
+ width: parent.width
+ anchors.margins: 4
}
- else return "N/A"
- }
- function getIcon() {
- if(section == packages.sectionDownloading) {
- return "img/cloud_download_32x32.png"
- } else if(section == packages.sectionUpgradable) {
- return "img/arrow_up_alt1_32x32.png"
- } else if(section == packages.sectionInstalled) {
- return "img/download_darkgrey_24x32.png"
+ MouseArea {
+ anchors.fill: parent
+ onClicked: cancelDownload()
}
- else return ""
}
+ }
+
+ Item {
+ id: progressText
+ visible: info.pnd !== null && info.pnd.isDownloading
+ property variant progress: !visible ? null : Utils.prettyProgress(info.pnd.bytesDownloaded, info.pnd.bytesToDownload)
+ width: parent.width
+ height: 16
+ Text {
+ text: progressText.progress ? progressText.progress.value : ""
+ font.pixelSize: 14
+ anchors.right: totalSize.left
+ }
+ Text {
+ id: totalSize
+ text: progressText.progress ? " / " + progressText.progress.size + " " + progressText.progress.unit : ""
+ font.pixelSize: 14
+ anchors.right: parent.right
+ }
+ }
- text: getText()
- icon: getIcon()
+ Rectangle {
width: parent.width
+ height: 1
+ color: "#ddd"
+ }
+ Text {
+ text: info.pnd ? info.pnd.description.split("\n")[0] : ""
+ width: parent.width
+ wrapMode: Text.WordWrap
}
}
+ Button {
+ label: "Show"
+ control: "game-b"
+ color: "#555"
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ anchors.margins: 8
+ height: 64
+ radius: 4
+ onClicked: openSelected()
+ }
}
Rectangle {
opacity: 0.8
height: 32
anchors.bottomMargin: search.text != "" ? 0 : -(height+1)
- anchors.bottom: parent.bottom
- anchors.left: parent.left
- anchors.right: parent.right
+ anchors.bottom: content.bottom
+ anchors.left: content.left
+ anchors.right: content.right
color: "#eee"
border {
color: "#444"
@@ -449,6 +480,9 @@ View {
anchors.margins: 4
font.pixelSize: 14
activeFocusOnPress: false
+ cursorVisible: true
+ Keys.onRightPressed: event.accepted = true
+ Keys.onLeftPressed: event.accepted = true
}
}
}
View
20 interfaces/PNDManager/PackageDelegate.qml
@@ -12,34 +12,30 @@ Item {
id: icon
source: pnd.icon
asynchronous: true
- height: 48
- width: 48
- x: 8
- fillMode: Image.PreserveAspectFit
- sourceSize {
- height: 48
- width: 48
- }
+ anchors.leftMargin: (48/2 - width/2) + 4
+ anchors.left: parent.left
+ sourceSize.width: 48
}
Text {
id: title
text: pnd.title
- anchors.left: icon.right
+ anchors.left: parent.left
anchors.right: parent.right
+ anchors.leftMargin: 56
+ anchors.rightMargin: 8
elide: Text.ElideRight
font.pixelSize: 16
font.underline: true
- anchors.leftMargin: 8
}
Item {
id: content
- anchors.left: icon.right
+ anchors.left: parent.left
anchors.right: parent.right
anchors.top: title.bottom
anchors.bottom: parent.bottom
- anchors.leftMargin: 8
+ anchors.leftMargin: 56
}
MouseArea {
View
2 interfaces/PNDManager/PackageInfoText.qml
@@ -4,7 +4,7 @@ Item {
property alias label: label.text
property alias text: content.text
height: childrenRect.height
-
+ width: parent.width
Text {
id: label
font.pixelSize: 14
View
101 interfaces/PNDManager/PackageView.qml
@@ -11,18 +11,29 @@ View {
Component { id: previewPictureView; PreviewPictureView {} }
Keys.forwardTo: textArea
+ Keys.priority: Keys.AfterItem
+
onOkButton: removeConfirmation.visible ? removeConfirmation.yes() : showPreviewPictures()
- onInstallRemoveButton: {
+
+ Keys.onReturnPressed: execute()
+
+ onInstallUpgradeButton: {
+ if(removeConfirmation.visible)
+ return
+ else if(pnd.hasUpgrade)
+ upgrade()
+ else if(!pnd.installed)
+ showInstallDialog()
+ }
+
+ onRemoveButton: {
if(removeConfirmation.visible)
removeConfirmation.no()
else if(pnd.isDownloading)
pnd.cancelDownload()
else if(pnd.installed)
removeConfirmation.show()
- else
- showInstallDialog()
}
- onUpgradeButton: if(!removeConfirmation.visible) upgrade()
ConfirmationDialog {
id: removeConfirmation
@@ -50,6 +61,10 @@ View {
}
}
+ function execute() {
+ pndManager.execute(pnd.path)
+ }
+
Text {
id: titleText
text: pnd.title
@@ -69,18 +84,18 @@ View {
Button {
label: "Launch"
sublabel: Utils.prettySize(pnd.size)
- //control: "game-a"
+ control: "keyboard-enter"
color: Theme.colors.install
width: 256
height: 64
radius: 4
visible: pnd.installed
- onClicked: pndManager.execute(pnd.path)
+ onClicked: execute()
}
Button {
label: "Install"
sublabel: Utils.prettySize(pnd.size)
- control: "game-a"
+ control: "game-y"
color: Theme.colors.install
width: 256
height: 64
@@ -234,14 +249,7 @@ View {
id: icon
source: pnd.icon
asynchronous: true
- smooth: true
- height: 48
- width: 48
- fillMode: Image.PreserveAspectFit
- sourceSize {
- height: 48
- width: 48
- }
+ sourceSize.width: 48
anchors.top: parent.top
anchors.topMargin: 4
}
@@ -341,13 +349,13 @@ View {
Image {
id: image
- anchors.fill: parent
+ anchors.centerIn: parent
anchors.bottomMargin: 4
anchors.topMargin: 4
source: pnd.previewPictures.length > 0 ? pnd.previewPictures[0].src : ""
asynchronous: true
- fillMode: Image.PreserveAspectFit
- smooth: true
+
+ sourceSize.width: parent.width
Text {
anchors.centerIn: parent
@@ -361,35 +369,34 @@ View {
anchors.fill: parent
onClicked: showPreviewPictures()
}
-
- Rectangle {
- anchors.top: parent.top
- anchors.right: parent.right
- anchors.margins: 8
- visible: pnd.previewPictures.length > 0
- height: 32
- width: showPreviewPicturesText.paintedWidth + showPreviewPicturesIcon.width + 16
- radius: height/4
- color: Qt.rgba(0.8, 0.8, 0.8, 0.3)
-
- Row {
- anchors.centerIn: parent
- height: 24
- spacing: 4
- Text {
- id: showPreviewPicturesText
- text: "Show more"
- font.pixelSize: 18
- style: Text.Outline
- styleColor: "#111"
- color: "#fff"
- anchors.verticalCenter: parent.verticalCenter
- }
- GuiHint {
- id: showPreviewPicturesIcon
- control: "game-b"
- anchors.verticalCenter: parent.verticalCenter
- }
+ }
+ Rectangle {
+ anchors.top: parent.top
+ anchors.right: parent.right
+ anchors.margins: 8
+ visible: pnd.previewPictures.length > 0
+ height: 32
+ width: showPreviewPicturesText.paintedWidth + showPreviewPicturesIcon.width + 16
+ radius: height/4
+ color: Qt.rgba(0.8, 0.8, 0.8, 0.3)
+
+ Row {
+ anchors.centerIn: parent
+ height: 24
+ spacing: 4
+ Text {
+ id: showPreviewPicturesText
+ text: "Show more"
+ font.pixelSize: 18
+ style: Text.Outline
+ styleColor: "#111"
+ color: "#fff"
+ anchors.verticalCenter: parent.verticalCenter
+ }
+ GuiHint {
+ id: showPreviewPicturesIcon
+ control: "game-b"
+ anchors.verticalCenter: parent.verticalCenter
}
}
}
View
7 interfaces/PNDManager/PreviewPictureView.qml
@@ -42,10 +42,11 @@ View {
Image {
id: image
- smooth: true
source: src
- height: parent.height
- fillMode: Image.PreserveAspectFit
+ sourceSize {
+ height: parent.height
+ }
+ anchors.verticalCenter: parent.verticalCenter
}
}
}
View
11 interfaces/PNDManager/SearchView.qml
@@ -49,9 +49,16 @@ View {
anchors.margins: 4
font.pixelSize: 20
activeFocusOnPress: false
+ cursorVisible: true
+ Keys.onRightPressed: event.accepted = true
+ Keys.onLeftPressed: event.accepted = true
onAccepted: {
- packageList.model = pndManager.searchPackages(text).sortedByTitle().all()
- noSearchResultsText.visible = packageList.count === 0
+ if(text) {
+ packageList.model = pndManager.searchPackages(text).sortedByTitle().all();
+ noSearchResultsText.visible = packageList.count === 0;
+ } else {
+ packageList.model = null;
+ }
}
}
View
32 interfaces/PNDManager/SectionItem.qml
@@ -4,41 +4,39 @@ Item {
id: item
height: 48
- property alias text: title.text
+ property alias title: title.text
property alias icon: icon.source
- default property alias additionalItems: additionalItemsContainer.children
+ property alias progress: progress.text
signal clicked()
MouseArea { anchors.fill: parent; onClicked: item.clicked() }
Image {
id: icon
- asynchronous: true
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
- anchors.margins: 8
- sourceSize.width: 32
- sourceSize.height: 32
- width: 32
- height: 32
+ anchors.leftMargin: (48/2 - width/2) + 4
+ sourceSize.width: 48
}
Text {
id: title
font.pixelSize: 20
- anchors.verticalCenter: parent.verticalCenter
- anchors.left: icon.right
- anchors.margins: 16
- width: 256
+ height: parent.height
+ verticalAlignment: Text.AlignVCenter
+ anchors.left: parent.left
+ anchors.right: progress.left
+ anchors.leftMargin: 52
elide: Text.ElideRight
}
- Row {
- id: additionalItemsContainer
- anchors.verticalCenter: parent.verticalCenter
- anchors.left: title.right
+ Text {
+ id: progress
+ font.pixelSize: 20
+ height: parent.height
+ verticalAlignment: Text.AlignVCenter
anchors.right: parent.right
- anchors.margins: 16
+ visible: text
}
Rectangle {
View
4 interfaces/PNDManager/View.qml
@@ -5,8 +5,8 @@ Rectangle {
property string viewTitle
signal okButton()
- signal installRemoveButton()
- signal upgradeButton()
+ signal removeButton()
+ signal installUpgradeButton()
signal selectButton()
height: parent.height
View
27 interfaces/PNDManager/ui.qml
@@ -49,6 +49,15 @@ PanoramaUI {
defaultValue: ""
}
+ Setting {
+ id: loggingVerbosity
+ section: "PNDManager"
+ key: "loggingVerbosity"
+ defaultValue: "1"
+ onValueChanged: pndManager.verbosity = value
+ Component.onCompleted: pndManager.verbosity = value
+ }
+
function init() {
pndManager.crawl();
}
@@ -72,6 +81,11 @@ PanoramaUI {
PNDUtils { id: pndUtils }
Keys.onPressed: {
+ if(!runtime.isActiveWindow) {
+ event.accepted = true;
+ return;
+ }
+
if(!Pandora.controlsActive) {
event.accepted = true;
if(event.key === Qt.Key_PageDown) {
@@ -86,10 +100,10 @@ PanoramaUI {
if(splashScreen.visible) {
splashScreen.dontShowAgain();
} else {
- views.current.current.installRemoveButton();
+ views.current.current.removeButton();
}
} else if(event.key === Qt.Key_PageUp) {
- views.current.current.upgradeButton();
+ views.current.current.installUpgradeButton();
} else if(event.key === Qt.Key_1) {
homeStack.activate();
} else if(event.key === Qt.Key_2) {
@@ -113,6 +127,11 @@ PanoramaUI {
Pandora.onPressed: {
+ if(!runtime.isActiveWindow) {
+ event.accepted = true;
+ return;
+ }
+
event.accepted = true;
if(event.key === Pandora.ButtonX) views.current.pop();
else if(event.key === Pandora.ButtonB) {
@@ -126,10 +145,10 @@ PanoramaUI {
if(splashScreen.visible) {
splashScreen.dontShowAgain();
} else {
- views.current.current.installRemoveButton();
+ views.current.current.removeButton();
}
}
- else if(event.key === Pandora.ButtonY) views.current.current.upgradeButton();
+ else if(event.key === Pandora.ButtonY) views.current.current.installUpgradeButton();
else if(event.key === Pandora.TriggerL) views.prev();
else if(event.key === Pandora.TriggerR) views.next();
else if(event.key === Pandora.ButtonStart) bottomBar.reload();
View
13 plugins/pndmanagement/src/pndmanager.cpp
@@ -122,6 +122,19 @@ void PNDManager::addCommitableDevice(QPndman::Device *device)
}
}
+int PNDManager::getVerbosity() const
+{
+ return context->getLoggingVerbosity();
+}
+
+void PNDManager::setVerbosity(int level)
+{
+ if(level != context->getLoggingVerbosity()) {
+ context->setLoggingVerbosity(level);
+ emit verbosityChanged(level);
+ }
+}
+
void PNDManager::crawl()
{
View
6 plugins/pndmanagement/src/pndmanager.h
@@ -14,6 +14,7 @@ class PNDManager : public QObject
Q_OBJECT
Q_PROPERTY(PNDFilter* packages READ getPackages NOTIFY packagesChanged)
Q_PROPERTY(QDeclarativeListProperty<QPndman::Device> devices READ getDevices NOTIFY devicesChanged)
+ Q_PROPERTY(int verbosity READ getVerbosity WRITE setVerbosity NOTIFY verbosityChanged)
Q_ENUMS(QPndman::Enum::InstallLocation QPndman::Enum::Operation QPndman::Version::Type)
public:
@@ -29,6 +30,9 @@ class PNDManager : public QObject
QPndman::Context* getContext() const;
void addCommitableDevice(QPndman::Device* device);
+ int getVerbosity() const;
+ void setVerbosity(int level);
+
public slots:
void crawl();
void sync();
@@ -45,6 +49,8 @@ public slots:
void crawling();
void crawlDone();
+ void verbosityChanged(int);
+
private:
static QString const REPOSITORY_URL;

0 comments on commit 2ea865a

Please sign in to comment.