Skip to content

Commit

Permalink
make qt5 backport runnable
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristopherHX committed Apr 17, 2024
1 parent 721cf4b commit 459ea92
Show file tree
Hide file tree
Showing 29 changed files with 80 additions and 57 deletions.
2 changes: 1 addition & 1 deletion qml/ApkImportHelper.qml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import QtQuick 2.4
import QtQuick 2.9

import QtQuick.Layouts 1.2
import QtQuick.Window 2.2
Expand Down
2 changes: 1 addition & 1 deletion qml/ApkImportWindow.qml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import QtQuick 2.4
import QtQuick 2.9

import QtQuick.Layouts 1.2
import QtQuick.Window 2.2
Expand Down
4 changes: 2 additions & 2 deletions qml/EditProfileWindow.qml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import QtQuick 2.4
import QtQuick 2.9

import QtQuick.Layouts 1.2
import QtQuick.Window 2.2
Expand Down Expand Up @@ -75,7 +75,7 @@ Window {
property var extraVersionName: null
property var hideLatest: googleLoginHelper.hideLatest
property var data: []
property var update: () => {
property var update: function() {
data = []
versionsmodel.clear()
var abis = googleLoginHelper.getAbis(launcherSettings.showUnsupported)
Expand Down
2 changes: 1 addition & 1 deletion qml/GameLogWindow.qml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import QtQuick 2.4
import QtQuick 2.9

import QtQuick.Controls 2.2
import QtQuick.Layouts 1.2
Expand Down
2 changes: 1 addition & 1 deletion qml/GamepadInputField.qml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import QtQuick 2.4
import QtQuick 2.9

import QtQuick.Controls 2.2
import QtQuick.Layouts 1.2
Expand Down
2 changes: 1 addition & 1 deletion qml/GampadTool.qml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import QtQuick 2.4
import QtQuick 2.9

import QtQuick.Controls 2.2
import QtQuick.Layouts 1.2
Expand Down
2 changes: 1 addition & 1 deletion qml/GoogleTosApprovalWindow.qml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import QtQuick 2.4
import QtQuick 2.9

import QtQuick.Controls 1.4
import QtQuick.Layouts 1.2
Expand Down
20 changes: 13 additions & 7 deletions qml/Launcher.qml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
import QtQuick 2.9
import QtQuick.Layouts 1.2
import QtQuick.Controls 2.0
import "ThemedControls"

RowLayout {
Expand All @@ -23,14 +23,14 @@ RowLayout {
iconSource: "qrc:/Resources/icon-home.png"
showText: useWideLayout
onClicked: updateIndex(0)
checked: currentIndex == 0
checked: currentIndex === 0
}
MSideBarItem {
text: qsTr("News")
iconSource: "qrc:/Resources/icon-news.png"
showText: useWideLayout
onClicked: updateIndex(1)
checked: currentIndex == 1
checked: currentIndex === 1
}
Item {
Layout.fillHeight: true
Expand All @@ -40,7 +40,7 @@ RowLayout {
iconSource: "qrc:/Resources/icon-settings.png"
showText: useWideLayout
onClicked: updateIndex(2)
checked: currentIndex == 2
checked: currentIndex === 2
}
}
}
Expand Down Expand Up @@ -83,8 +83,14 @@ RowLayout {
}

function updateIndex(index) {
if (index === currentIndex)
console.log("index=" + index)
console.log("currentIndex=" + currentIndex)
if (index === currentIndex) {
console.log("Nothing changed")
currentIndex = -1
currentIndex = index
return
}

mainStackView.pop(null)

Expand Down
2 changes: 1 addition & 1 deletion qml/LauncherLogin.qml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import QtQuick 2.0
import QtQuick 2.9
import QtQuick.Layouts 1.2
import QtQuick.Dialogs 1.2
import "ThemedControls"
Expand Down
6 changes: 3 additions & 3 deletions qml/LauncherMain.qml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ import QtQuick.Window 2.2
import QtQuick.Dialogs 1.2
import QtQuick.Layouts 1.2
import QtQuick.Controls 2.2
import Qt.labs.folderlistmodel 2.0
import "ThemedControls"
import io.mrarm.mcpelauncher 1.0

LauncherBase {
property GoogleLoginHelper googleLoginHelper
property VersionManager versionManager
property ProfileManager profileManager
property GoogleVersionChannel playVerChannelInstance
property GoogleVersionChannel playVerChannel
property GooglePlayApi playApiInstance
property bool isVersionsInitialized: false
progressbarVisible: playDownloadTask.active || apkExtractionTask.active
Expand All @@ -36,13 +37,12 @@ LauncherBase {
Layout.fillWidth: true
Layout.fillHeight: true
id: backgroundArt
anchors.fill: parent
source: wallpaperFolderModel.getRandomImage()
smooth: true
fillMode: Image.PreserveAspectCrop
Image {
id: launcherLogo
source: "qrc:/Resources/mcpelauncher-logo.svg"
source: "qrc:/Resources/mcpelauncher-logo.png"
smooth: false
y: 30
width: parent.width
Expand Down
4 changes: 2 additions & 2 deletions qml/LauncherSettingsAbout.qml
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ ColumnLayout {
updateCheckerConnectorSettings.enabled = false
if (available) {
updateInfo.text = qsTr("An Update of the Launcher is available for download") + "<br/>" + (columnlayout.updateUrl.length !== 0 ? qsTr("You can download the new Update here: %1").arg(columnlayout.updateUrl) + "<br/>" : "") + qsTr("Do you want to update now?")
updateInfo.buttons = MessageDialog.Yes | MessageDialog.No
updateInfo.standardButtons = MessageDialog.Yes | MessageDialog.No
} else {
updateInfo.text = qsTr("Your installed Launcher Version %1 (build %2) seems uptodate").arg(LAUNCHER_VERSION_NAME || '').arg(LAUNCHER_VERSION_CODE)
updateInfo.buttons = MessageDialog.Ok
updateInfo.standardButtons = MessageDialog.Ok
}
updateInfo.open()
}
Expand Down
6 changes: 3 additions & 3 deletions qml/LauncherSettingsVersions.qml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
import QtQuick 2.9
import QtQuick.Layouts 1.2
import QtQuick.Controls 2.0
import "ThemedControls"

ColumnLayout {
Expand Down
2 changes: 1 addition & 1 deletion qml/LauncherSettingsWindow.qml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import QtQuick 2.4
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
import "ThemedControls"
Expand Down
2 changes: 1 addition & 1 deletion qml/ProfileComboBox.qml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import QtQuick 2.0
import QtQuick 2.9
import QtQuick.Controls 2.2
import "ThemedControls"

Expand Down
4 changes: 2 additions & 2 deletions qml/ThemedControls/BaseHeader.qml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import QtQuick
import QtQuick.Layouts
import QtQuick 2.9
import QtQuick.Layouts 1.2

Rectangle {
property string title
Expand Down
34 changes: 25 additions & 9 deletions qml/ThemedControls/CenteredScrollView.qml
Original file line number Diff line number Diff line change
@@ -1,18 +1,34 @@
import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
import QtQuick 2.9
import QtQuick.Layouts 1.2
import QtQuick.Controls 2.2

ScrollView {
property alias content: item.data
id: scrollView
property alias content: childitem.data
Layout.fillHeight: true
Layout.fillWidth: true
contentHeight: item.height + 30
Keys.forwardTo: item.children[0]
contentHeight: childitem.height + 30
contentWidth: Math.max(childitem.width + 30, scrollView.width)
Keys.forwardTo: childitem.children[0]

Item {
id: item
anchors.centerIn: parent
width: Math.min(parent.width - 30, 760)
height: data[0].height
anchors.left: parent.left
anchors.top: parent.top
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.leftMargin: Math.max((scrollView.width - childitem.width) / 2, 15)
anchors.topMargin: 15
anchors.bottomMargin: 15
anchors.rightMargin: (function() {
var val = Math.max((scrollView.width - childitem.width) / 2, 15);
console.log("marginr=" + val);
return val;
})()
Item {
id: childitem
width: Math.min(Math.max(children[0].Layout.minimumWidth, scrollView.width - 30), 720)
height: data[0].height
}
}
}
4 changes: 2 additions & 2 deletions qml/ThemedControls/HorizontalDivider.qml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import QtQuick
import QtQuick.Layouts
import QtQuick 2.9
import QtQuick.Layouts 1.2

Rectangle {
Layout.fillWidth: true
Expand Down
2 changes: 1 addition & 1 deletion qml/ThemedControls/MBusyIndicator.qml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import QtQuick 2.0
import QtQuick 2.9
import QtQuick.Templates 2.1 as T

T.BusyIndicator {
Expand Down
2 changes: 1 addition & 1 deletion qml/ThemedControls/MButton.qml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import QtQuick 2.0
import QtQuick 2.9
import QtQuick.Templates 2.1 as T

T.Button {
Expand Down
3 changes: 2 additions & 1 deletion qml/ThemedControls/MCheckBox.qml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ T.CheckBox {
border.color: control.down ? "#888" : (control.hovered ? "#666" : "#555")

Canvas {
id: canvas
anchors.centerIn: parent
width: 10
height: 10
Expand Down Expand Up @@ -51,6 +52,6 @@ T.CheckBox {
color: "#fff"
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
leftPadding: implicitIndicatorWidth + 5
leftPadding: indicator.implicitWidth + 5
}
}
6 changes: 3 additions & 3 deletions qml/ThemedControls/MComboBox.qml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import QtQuick 2.0
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Templates 2.1 as T

Expand Down Expand Up @@ -29,7 +29,7 @@ T.ComboBox {
delegate: ItemDelegate {
width: control.width
contentItem: Text {
text: modelData
text: control.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] : model[control.textRole]) : modelData
color: "#fff"
font.pointSize: 10
elide: Text.ElideRight
Expand Down Expand Up @@ -75,7 +75,7 @@ T.ComboBox {
popup: T.Popup {
y: control.height
width: control.width
height: Math.min(contentItem.implicitHeight + topPadding + bottomPadding, control.Window.height - topMargin - bottomMargin)
height: Math.min(contentItem.implicitHeight + topPadding + bottomPadding, 200)
topMargin: 6
bottomMargin: 6
padding: 4
Expand Down
2 changes: 1 addition & 1 deletion qml/ThemedControls/MProgressBar.qml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import QtQuick 2.0
import QtQuick 2.9
import QtQuick.Templates 2.1 as T

T.ProgressBar {
Expand Down
8 changes: 4 additions & 4 deletions qml/ThemedControls/MSideBarItem.qml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import QtQuick
import QtQuick.Layouts
import QtQuick.Templates as T
import QtQuick 2.9
import QtQuick.Layouts 1.2
import QtQuick.Templates 2.1 as T

T.Button {
id: control
property alias iconSource: icon.source
property alias showText: text.visible

implicitHeight: 50
implicitWidth: implicitContentWidth
implicitWidth: control.contentItem.implicitWidth

background: Rectangle {
color: "#eee"
Expand Down
4 changes: 2 additions & 2 deletions qml/ThemedControls/MTabButton.qml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import QtQuick 2.0
import QtQuick 2.9
import QtQuick.Templates 2.1 as T

T.TabButton {
id: control
padding: 15
implicitWidth: 15 + implicitContentWidth + leftPadding + rightPadding
implicitWidth: 15 + control.contentItem.implicitWidth + leftPadding + rightPadding
implicitHeight: 40
anchors.bottom: parent.bottom

Expand Down
3 changes: 1 addition & 2 deletions qml/ThemedControls/MTextField.qml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import QtQuick 2.0
import QtQuick 2.9
import QtQuick.Templates 2.1 as T

T.TextField {
id: control

padding: 8
implicitWidth: contentItem.implicitWidth + leftPadding + rightPadding
implicitHeight: 35
verticalAlignment: TextInput.AlignVCenter
font.pointSize: 10
Expand Down
2 changes: 1 addition & 1 deletion qml/ThemedControls/PlayButton.qml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import QtQuick 2.0
import QtQuick 2.9
import QtQuick.Layouts 1.2
import QtQuick.Templates 2.1 as T

Expand Down
2 changes: 1 addition & 1 deletion qml/ThemedControls/TransparentButton.qml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import QtQuick 2.0
import QtQuick 2.9
import QtQuick.Templates 2.1 as T

T.Button {
Expand Down
2 changes: 1 addition & 1 deletion qml/TroubleshooterWindow.qml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import QtQuick 2.4
import QtQuick 2.9

import QtQuick.Controls 2.2
import QtQuick.Layouts 1.2
Expand Down
1 change: 1 addition & 0 deletions qml/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ Window {
TroubleshooterWindow {
id: troubleshooterWindow
googleLoginHelper: googleLoginHelperInstance
playVerChannel: playVerChannelInstance
}

GoogleTosApprovalWindow {
Expand Down

0 comments on commit 459ea92

Please sign in to comment.