Skip to content

Commit 8b022d2

Browse files
committed
WIP: Qt6 + CMake + Fluid + Quazip upgrade
1 parent e71673f commit 8b022d2

File tree

12 files changed

+360
-77
lines changed

12 files changed

+360
-77
lines changed

CMakeLists.txt

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
cmake_minimum_required(VERSION 3.18)
2+
3+
project(updater LANGUAGES CXX)
4+
5+
set(CMAKE_CXX_STANDARD 17)
6+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
7+
8+
set(CMAKE_AUTORCC ON)
9+
10+
# Allow building with old CMake
11+
set(QT_FORCE_MIN_CMAKE_VERSION_FOR_USING_QT 3.18)
12+
13+
# Silence warning with CMake < 3.19
14+
set(QT_QML_GENERATE_AOTSTATS OFF)
15+
16+
set(ARIA2_LIBS "${CMAKE_CURRENT_SOURCE_DIR}/aria2/src/.libs/libaria2.a" CACHE STRING "aria2 libraries")
17+
set(ARIA2_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/aria2/include" CACHE STRING "aria2 include directory")
18+
19+
find_package(Qt6 REQUIRED COMPONENTS Core Qml Quick QuickControls2 QuickDialogs2 Network Svg Gui Widgets )
20+
21+
qt_standard_project_setup(REQUIRES 6.8)
22+
23+
option(FLUID_WITH_GALLERY "" OFF)
24+
option(FLUID_WITH_DOCUMENTATION "" OFF)
25+
option(FLUID_INSTALL_ICONS "" OFF)
26+
add_subdirectory(fluid)
27+
28+
set(QUAZIP_BZIP2 OFF)
29+
set(QUAZIP_ENABLE_TESTS OFF)
30+
set(QUAZIP_FETCH_LIBS OFF)
31+
add_subdirectory(quazip)
32+
33+
set(SOURCES
34+
ariadownloader.cpp ariadownloader.h
35+
currentversionfetcher.cpp currentversionfetcher.h
36+
downloadtimecalculator.cpp downloadtimecalculator.h
37+
downloadworker.cpp downloadworker.h
38+
gamelauncher.cpp gamelauncher.h
39+
main.cpp
40+
qmldownloader.cpp qmldownloader.h
41+
settings.cpp settings.h
42+
splashcontroller.cpp splashcontroller.h
43+
system.h
44+
)
45+
46+
if(APPLE)
47+
list(APPEND SOURCES osx.cpp)
48+
elseif(WIN32)
49+
list(APPEND SOURCES win.cpp ExecInExplorer.cpp)
50+
else()
51+
list(APPEND SOURCES linux.cpp)
52+
endif()
53+
54+
qt_add_executable(updater MANUAL_FINALIZATION
55+
${SOURCES}
56+
qml.qrc
57+
)
58+
59+
60+
# target_compile_definitions(updater PRIVATE QUAZIP_STATIC )
61+
62+
target_link_libraries(updater PRIVATE
63+
Qt6::Network
64+
Qt6::Widgets
65+
)
66+
67+
target_link_libraries(updater INTERFACE
68+
Qt6::Qml
69+
Qt6::QuickDialogs2
70+
Qt6::Quick
71+
)
72+
73+
74+
# Platform-specific linking
75+
if(WIN32)
76+
target_link_libraries(updater PRIVATE
77+
crypt32
78+
secur32
79+
ole32
80+
)
81+
#
82+
target_sources(updater PRIVATE updater.rc)
83+
elseif(UNIX)
84+
target_link_libraries(updater PRIVATE
85+
z
86+
)
87+
endif()
88+
89+
90+
91+
target_link_libraries(updater PUBLIC
92+
QuaZip::QuaZip
93+
Fluid
94+
)
95+
96+
# Turn on warning errors since the warnings are hard to see in Docker
97+
if(NOT APPLE)
98+
target_compile_options(updater PRIVATE -Werror)
99+
endif()
100+
101+
# macOS app bundle icon
102+
# UNTESTED, AISLOP
103+
if(APPLE)
104+
set_target_properties(updater PROPERTIES
105+
MACOSX_BUNDLE TRUE
106+
MACOSX_BUNDLE_ICON_FILE Unvanquished.icns
107+
)
108+
set(MACOSX_BUNDLE_ICON_FILE resources/Unvanquished.icns)
109+
set_source_files_properties(${MACOSX_BUNDLE_ICON_FILE} PROPERTIES
110+
MACOSX_PACKAGE_LOCATION Resources
111+
)
112+
target_sources(updater PRIVATE ${MACOSX_BUNDLE_ICON_FILE})
113+
endif()
114+
115+
116+
qt_finalize_target(updater)
117+
118+
target_link_libraries(updater PUBLIC
119+
Qt6::Qml
120+
Qt6::Quick
121+
)
122+

DownloadInfo.qml

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@
1515
* along with this program. If not, see <https://www.gnu.org/licenses/>.
1616
*/
1717

18-
import Fluid.Controls 1.0 as FluidControls
19-
import Fluid.Material 1.0 as FluidMaterial
20-
import QmlDownloader 1.0
18+
import Fluid 2.0 as Fluid
19+
import QmlDownloader
2120
import QtQuick
2221
import QtQuick.Controls
2322
import QtQuick.Controls.Material
@@ -33,7 +32,7 @@ Item {
3332
bottomMargin: 60
3433
}
3534

36-
FluidControls.Card {
35+
Fluid.Card {
3736
anchors {
3837
right: parent.right
3938
}
@@ -50,7 +49,7 @@ Item {
5049
width: parent.width
5150
height: parent.height
5251

53-
FluidControls.BodyLabel {
52+
Fluid.BodyLabel {
5453
id: instruction
5554

5655
anchors {
@@ -85,78 +84,78 @@ Item {
8584

8685
visible: false
8786

88-
FluidControls.BodyLabel {
87+
Fluid.BodyLabel {
8988
width: 5
9089
}
9190

92-
FluidControls.BodyLabel {
91+
Fluid.BodyLabel {
9392
id: completedDownload
9493
text: Utils.humanSize(downloader.completedSize)
9594
font.pixelSize: 17
9695
}
9796

98-
FluidControls.BodyLabel {
97+
Fluid.BodyLabel {
9998
text: " / "
10099
font.pixelSize: 17
101100
}
102101

103-
FluidControls.BodyLabel {
102+
Fluid.BodyLabel {
104103
id: totalDownload
105104
text: Utils.humanSize(downloader.totalSize)
106105
font.pixelSize: 17
107106
}
108107

109-
FluidControls.BodyLabel {
108+
Fluid.BodyLabel {
110109
width: 20
111110
}
112111

113-
FluidControls.BodyLabel {
112+
Fluid.BodyLabel {
114113
id: eta
115114
text: Utils.humanTime(downloader.eta)
116115
font.pixelSize: 17
117116
}
118117

119-
FluidControls.BodyLabel {
118+
Fluid.BodyLabel {
120119
width: 20
121120
}
122121

123-
FluidControls.BodyLabel {
122+
Fluid.BodyLabel {
124123
text: "DL: "
125124
font.pixelSize: 17
126125
}
127126

128-
FluidControls.BodyLabel {
127+
Fluid.BodyLabel {
129128
id: downloadSpeed
130129
text: Utils.humanSize(downloader.downloadSpeed)
131130
font.pixelSize: 17
132131
}
133132

134-
FluidControls.BodyLabel {
133+
Fluid.BodyLabel {
135134
width: 20
136135
text: "/s"
137136
font.pixelSize: 17
138137
}
139138

140-
FluidControls.BodyLabel {
139+
Fluid.BodyLabel {
141140
text: "UL: "
142141
font.pixelSize: 17
143142
}
144143

145-
FluidControls.BodyLabel {
144+
Fluid.BodyLabel {
146145
id: uploadSpeed
147146
text: Utils.humanSize(downloader.uploadSpeed)
148147
font.pixelSize: 17
149148
}
150149

151-
FluidControls.BodyLabel {
150+
Fluid.BodyLabel {
152151
text: "/s"
153152
font.pixelSize: 17
154153
}
155154
}
156155
}
157156
}
158157

159-
FluidMaterial.ActionButton {
158+
Fluid.FloatingActionButton {
160159
id: downloadAction
161160

162161
anchors {
@@ -169,7 +168,8 @@ Item {
169168
height: 70
170169
width: 70
171170

172-
iconName: "file/file_download"
171+
icon.source: Fluid.Utils.iconUrl("file/file_download")
172+
icon.color: "white"
173173
scale: 1.2
174174

175175
Material.elevation: 1
@@ -192,13 +192,13 @@ Item {
192192
function onStateChanged(state) {
193193
downloadInfo.visible = state !== QmlDownloader.COMPLETED;
194194
if (state === QmlDownloader.DOWNLOADING) {
195-
downloadAction.iconName = "av/pause";
195+
downloadAction.icon.source = Fluid.Utils.iconUrl("av/pause");
196196
instruction.visible = false;
197197
} else if (state === QmlDownloader.PAUSED) {
198-
downloadAction.iconName = "file/file_download";
198+
downloadAction.icon.source = Fluid.Utils.iconUrl("file/file_download");
199199
instruction.visible = false;
200200
} else if (state === QmlDownloader.COMPLETED) {
201-
downloadAction.iconName = "av/play_arrow";
201+
downloadAction.icon.source = Fluid.Utils.iconUrl("av/play_arrow");
202202
instruction.visible = true;
203203
instruction.text = "Press the button to play the game";
204204
root.alert(0);

News.qml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515
* along with this program. If not, see <https://www.gnu.org/licenses/>.
1616
*/
1717

18-
import Fluid.Controls 1.0 as FluidControls
19-
import Fluid.Material 1.0 as FluidMaterial
18+
import Fluid 2.0 as Fluid
2019
import QtQuick
2120
import QtQuick.Controls
2221
import QtQuick.Controls.Material
@@ -112,6 +111,10 @@ Item {
112111

113112
Component.onCompleted: {
114113
fetchNews('https://unvanquished.net/api/get_recent_posts/');
114+
115+
// the button becomes invisible when disabled otherwise
116+
leftButton.background.color = leftButton.Material.background;
117+
rightButton.background.color = rightButton.Material.background;
115118
}
116119
}
117120

@@ -142,7 +145,7 @@ Item {
142145
}
143146
}
144147

145-
FluidMaterial.ActionButton {
148+
Fluid.FloatingActionButton {
146149
id: leftButton
147150

148151
anchors.left: parent.left
@@ -151,13 +154,14 @@ Item {
151154

152155
Material.background: Material.Teal
153156

154-
iconName: "navigation/chevron_left"
157+
icon.source: Fluid.Utils.iconUrl("navigation/chevron_left")
158+
icon.color: "white"
155159
onClicked: swipe.decrementCurrentIndex()
156160
enabled: swipe.currentIndex > 0
157161
opacity: enabled ? 1 : 0.38
158162
}
159163

160-
FluidMaterial.ActionButton {
164+
Fluid.FloatingActionButton {
161165
id: rightButton
162166

163167
anchors.right: parent.right
@@ -166,7 +170,8 @@ Item {
166170

167171
Material.background: Material.Teal
168172

169-
iconName: "navigation/chevron_right"
173+
icon.source: Fluid.Utils.iconUrl("navigation/chevron_right")
174+
icon.color: "white"
170175
onClicked: swipe.incrementCurrentIndex()
171176
enabled: swipe.currentIndex + 1 < swipe.count
172177
opacity: enabled ? 1 : 0.38

NewsCard.qml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* along with this program. If not, see <https://www.gnu.org/licenses/>.
1616
*/
1717

18-
import Fluid.Controls 1.0 as FluidControls
18+
import Fluid 2.0 as Fluid
1919
import QtQuick.Layouts
2020
import QtQuick
2121
import QtQuick.Controls
@@ -110,7 +110,7 @@ Flickable {
110110
}
111111
}
112112

113-
FluidControls.Card {
113+
Fluid.Card {
114114
anchors {
115115
right: parent.right
116116
top: parent.top
@@ -140,9 +140,9 @@ Flickable {
140140

141141
width: parent.width
142142
height: parent.height
143-
spacing: FluidControls.Units.smallSpacing * 2
143+
spacing: Fluid.Units.smallSpacing * 2
144144

145-
FluidControls.TitleLabel {
145+
Fluid.TitleLabel {
146146
id: title
147147

148148
width: parent.width
@@ -155,7 +155,7 @@ Flickable {
155155
font.bold: true
156156
}
157157

158-
FluidControls.BodyLabel {
158+
Fluid.BodyLabel {
159159
id: summary
160160

161161
width: parent.width
@@ -188,9 +188,9 @@ Flickable {
188188

189189
width: parent.width
190190
height: parent.height
191-
spacing: FluidControls.Units.smallSpacing * 2
191+
spacing: Fluid.Units.smallSpacing * 2
192192

193-
FluidControls.BodyLabel {
193+
Fluid.BodyLabel {
194194
id: link
195195

196196
width: parent.width

0 commit comments

Comments
 (0)