diff options
Diffstat (limited to 'qml')
-rw-r--r-- | qml/mw-ui.qml | 270 |
1 files changed, 134 insertions, 136 deletions
diff --git a/qml/mw-ui.qml b/qml/mw-ui.qml index 787e410..7383b41 100644 --- a/qml/mw-ui.qml +++ b/qml/mw-ui.qml @@ -545,7 +545,7 @@ Rectangle { Column { Rectangle { - // Bandeau avertissement + // warning banner id: warning width: view.width height: warnText.height @@ -567,11 +567,11 @@ Rectangle { height: 200 Row { id: row - // Under the warning + // Under the warning - // Software categories + // Software categories - Component { //The hightlight + Component { //The hightlight id: catHighlight Rectangle { width: categoriesList.width @@ -620,160 +620,158 @@ Rectangle { } } - - Rectangle { - // Software list - id: softListRect - height: view.height - width: view.width - categoriesList.width - color: "transparent" - // the width of install and Launch button will be calculated then updated. We give here a minimal size - property real installwidth: Qt.application.font.pixelSize * 2 - - DelegateModel { - id: appListDM - model: AppList {id: appList} - groups: [ - DelegateModelGroup { - includeByDefault: false - name: "group" + Rectangle { + // Software list + id: softListRect + height: view.height + width: view.width - categoriesList.width + color: "transparent" + // the width of install and Launch button will be calculated then updated. We give here a minimal size + property real installwidth: Qt.application.font.pixelSize * 2 + + DelegateModel { + id: appListDM + model: AppList {id: appList} + groups: [ + DelegateModelGroup { + includeByDefault: false + name: "group" + } + ] + filterOnGroup: "group" + Component.onCompleted: { + var rowCount = appList.count; + items.remove(0,rowCount); + for( var i = 0;i < rowCount;i++ ) + { + var entry = appList.get(i); + var pattern = /featured/g; + if(pattern.test(entry.group) && !pyinstallable.other(entry.name, entry.repo) ) { + items.insert(entry, "group"); } - ] - filterOnGroup: "group" - Component.onCompleted: { - var rowCount = appList.count; - items.remove(0,rowCount); - for( var i = 0;i < rowCount;i++ ) - { - var entry = appList.get(i); - var pattern = /featured/g; - if(pattern.test(entry.group) && !pyinstallable.other(entry.name, entry.repo) ) { - items.insert(entry, "group"); } - } - // The lsit has to be painted first for buttons width evaluation - applicationsListView.forceLayout() - for(var child in applicationsListView.contentItem.children) { - if (applicationsListView.contentItem.children[child].naturalwidth > softListRect.installwidth ) { - softListRect.installwidth = applicationsListView.contentItem.children[child].naturalwidth + // The lsit has to be painted first for buttons width evaluation + applicationsListView.forceLayout() + for(var child in applicationsListView.contentItem.children) { + if (applicationsListView.contentItem.children[child].naturalwidth > softListRect.installwidth ) { + softListRect.installwidth = applicationsListView.contentItem.children[child].naturalwidth + } } + console.log("Screen: ", Screen.devicePixelRatio, Screen.pixelDensity) } - console.log("Screen: ", Screen.devicePixelRatio, Screen.pixelDensity) - } - delegate: Row { - spacing: 10 - property int naturalwidth : optButton.item.implicitWidth - Image { - source: icon - width: 32 - height: 32 - } - //CheckBox{ enabled: installable - //} - Column{ - Label { - text: title - font.weight: Font.DemiBold - color: "white" - } - Label { - text: description - font.italic: true - font.pixelSize: Qt.application.font.pixelSize * .9 - width: view.width - (190 + 44 +38 + softListRect.installwidth + tag.width ) - wrapMode: Text.WordWrap - color: "white" - } + delegate: Row { + spacing: 10 + property int naturalwidth : optButton.item.implicitWidth + Image { + source: icon + width: 32 + height: 32 } + //CheckBox{ enabled: installable + //} + Column{ + Label { + text: title + font.weight: Font.DemiBold + color: "white" + } + Label { + text: description + font.italic: true + font.pixelSize: Qt.application.font.pixelSize * .9 + width: view.width - (190 + 44 +38 + softListRect.installwidth + tag.width ) + wrapMode: Text.WordWrap + color: "white" + } + } - Loader { - id: optButton - Component { id: button; - Button { - width: softListRect.installwidth; - height: Qt.application.font.pixelSize * 1.3 - objectName: "launch" - onClicked: { - launch.command(["gurpmi",name,])} - style: ButtonStyle { - label: Label { - horizontalAlignment: TextInput.AlignHCenter - verticalAlignment: TextInput.AlignVCenter - text: qsTr("Install"); - font.pixelSize: Qt.application.font.pixelSize * .8 - color: "black" + Loader { + id: optButton + Component { id: button; + Button { + width: softListRect.installwidth; + height: Qt.application.font.pixelSize * 1.3 + objectName: "launch" + onClicked: { + launch.command(["gurpmi",name,])} + style: ButtonStyle { + label: Label { + horizontalAlignment: TextInput.AlignHCenter + verticalAlignment: TextInput.AlignVCenter + text: qsTr("Install"); + font.pixelSize: Qt.application.font.pixelSize * .8 + color: "black" + } } } } - - } - Component { id: launcher; - Button { - width: softListRect.installwidth; - height: Qt.application.font.pixelSize * 1.3 - objectName: "launch" - onClicked: { - launch.command([command,])} - style: ButtonStyle { - label: Label { - horizontalAlignment: TextInput.AlignHCenter - verticalAlignment: TextInput.AlignVCenter - text: qsTr("Launch"); - font.pixelSize: Qt.application.font.pixelSize * .8 - color: "black" + Component { id: launcher; + Button { + width: softListRect.installwidth; + height: Qt.application.font.pixelSize * 1.3 + objectName: "launch" + onClicked: { + launch.command([command,])} + style: ButtonStyle { + label: Label { + horizontalAlignment: TextInput.AlignHCenter + verticalAlignment: TextInput.AlignVCenter + text: qsTr("Launch"); + font.pixelSize: Qt.application.font.pixelSize * .8 + color: "black" + } } } } - } - Component { id: dummy;Label {text: qsTr("Installed") - padding: 2 - horizontalAlignment: TextInput.AlignHCenter - font.pixelSize: Qt.application.font.pixelSize * .8 - width: softListRect.installwidth - color: "white" + Component { id: dummy;Label {text: qsTr("Installed") + padding: 2 + horizontalAlignment: TextInput.AlignHCenter + font.pixelSize: Qt.application.font.pixelSize * .8 + width: softListRect.installwidth + color: "white" + } } + sourceComponent: ( pyinstallable.installable(name, repo)) ? button : (command === "" ? dummy : launcher) } - sourceComponent: ( pyinstallable.installable(name, repo)) ? button : (command === "" ? dummy : launcher) - } - Loader { - id: tag - Component { - id: repotag - Rectangle { - color: "#FF4C4C" - radius: 3 - width: Qt.application.font.pixelSize * 3.5; height: Qt.application.font.pixelSize * 1.3 - Label { - anchors.centerIn: parent - text: repo - font.pixelSize: Qt.application.font.pixelSize * .8 - color: "white" + Loader { + id: tag + Component { + id: repotag + Rectangle { + color: "#FF4C4C" + radius: 3 + width: Qt.application.font.pixelSize * 3.5; height: Qt.application.font.pixelSize * 1.3 + Label { + anchors.centerIn: parent + text: repo + font.pixelSize: Qt.application.font.pixelSize * .8 + color: "white" + } } } + Component { id: dumm; + Label { + width: Qt.application.font.pixelSize * 3.5; + text: " "}} + sourceComponent: repo == "" ? dumm : repotag } - Component { id: dumm; - Label { - width: Qt.application.font.pixelSize * 3.5; - text: " "}} - sourceComponent: repo == "" ? dumm : repotag } + } + Rectangle { + height: view.height-warning.height + width: view.width-200 + color: "transparent" + ListView { + id: applicationsListView + anchors.fill: parent + clip: true + model: appListDM + spacing: 5 } - - } - Rectangle { - height: view.height-warning.height - width: view.width-200 - color: "transparent" - ListView { - id: applicationsListView - anchors.fill: parent - clip: true - model: appListDM - spacing: 5 } } - }} + } } } } |