Skip to content

Commit b82a084

Browse files
committed
remove Qt5 builds
1 parent 242b27a commit b82a084

29 files changed

+21
-207
lines changed

CMakeLists.txt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,8 @@ if(WIN32)
9595
set(CPACK_PACKAGE_VENDOR "razaqq")
9696
set(CPACK_PACKAGE_VERSION ${CMAKE_PROJECT_VERSION})
9797
set(CPACK_PACKAGE_HOMEPAGE_URL "https://github.com/razaqq/PotatoAlert")
98-
find_package(Qt6 QUIET)
99-
if (Qt6_FOUND)
100-
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}")
101-
else()
102-
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-win7")
103-
endif()
98+
find_package(Qt6 REQUIRED)
99+
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}")
104100
set(CPACK_WIX_UPGRADE_GUID "E3D9B068-8320-484E-9F97-0C40E264B665")
105101
set(CPACK_WIX_PRODUCT_ICON "${PROJECT_SOURCE_DIR}/Resources/potato.ico")
106102
set(CPACK_PACKAGE_ICON "${PROJECT_SOURCE_DIR}/Resources/potato.ico")

Client/CMakeLists.txt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,7 @@ target_sources(
4848
include/Client/ReplayAnalyzer.hpp
4949
)
5050

51-
find_package(Qt6 COMPONENTS Core Network Widgets QUIET)
52-
if (NOT Qt6_FOUND)
53-
find_package(Qt5 COMPONENTS Core Network Widgets REQUIRED)
54-
endif()
55-
51+
find_package(Qt6 COMPONENTS Core Network Widgets REQUIRED)
5652
find_package(ctre REQUIRED)
5753
find_package(fmt REQUIRED)
5854
find_package(tinyxml2 REQUIRED)

Client/src/Screenshot.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,9 @@ bool PotatoAlert::Client::CaptureScreenshot(QWidget* window, const fs::path& dir
7272
QPainter pixPainter(&pix);
7373
view->render(&pixPainter, pix.rect(), rect);
7474
}
75+
7576
const std::string fileName = GetFileName();
76-
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
7777
if (pix.save(QDir(dir).absoluteFilePath(fileName.c_str()), "PNG", 100))
78-
#else
79-
if (pix.save(Core::FromFilesystemPath(dir).absoluteFilePath(fileName.c_str()), "PNG", 100))
80-
#endif
8178
{
8279
LOG_TRACE("Saved screenshot {}", fileName);
8380
return true;

Client/src/StatsParser.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -217,11 +217,7 @@ struct Ship
217217
QSize iconSize((int)std::roundf(18.0f * parseOptions.FontScaling), (int)std::roundf(9.0f * parseOptions.FontScaling));
218218

219219
QLabel* shipIcon = new QLabel();
220-
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
221220
shipIcon->setPixmap(QIcon(fmt::format(":/{}.svg", Class).c_str()).pixmap(iconSize, qApp->devicePixelRatio()));
222-
#else
223-
shipIcon->setPixmap(QIcon(fmt::format(":/{}.svg", Class).c_str()).pixmap(iconSize));
224-
#endif
225221
shipIcon->setStyleSheet("background-color: transparent;");
226222
shipIcon->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
227223
shipIcon->setAlignment(Qt::AlignLeft);
@@ -237,11 +233,7 @@ struct Ship
237233
shipTier->setStyleSheet("background-color: transparent;");
238234
if (Tier == 11)
239235
{
240-
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
241236
shipTier->setPixmap(QIcon(":/Star.svg").pixmap(QSize(13, 13), qApp->devicePixelRatio()));
242-
#else
243-
shipTier->setPixmap(QIcon(":/Star.svg").pixmap(QSize(13, 13)));
244-
#endif
245237
}
246238
else
247239
{
@@ -375,11 +367,7 @@ struct Player
375367
{
376368
const int potatoSize = (int)std::roundf(12.0f * parseOptions.FontScaling);
377369
QLabel* potatoIcon = new QLabel();
378-
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
379370
potatoIcon->setPixmap(QIcon(":/potato.svg").pixmap(QSize(potatoSize, potatoSize), qApp->devicePixelRatio()));
380-
#else
381-
potatoIcon->setPixmap(QIcon(":/potato.svg").pixmap(QSize(potatoSize, potatoSize)));
382-
#endif
383371
potatoIcon->setStyleSheet("background-color: transparent;");
384372
potatoIcon->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
385373
potatoIcon->setAlignment(Qt::AlignVCenter | Qt::AlignLeft);

Core/CMakeLists.txt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,11 @@ if(UNIX)
6868
)
6969
endif(UNIX)
7070

71-
find_package(Qt6 COMPONENTS Core Widgets QUIET)
72-
if (NOT Qt6_FOUND)
73-
find_package(Qt5 COMPONENTS Core Widgets REQUIRED)
74-
endif()
75-
7671
find_package(ctre REQUIRED)
7772
find_package(date REQUIRED)
7873
find_package(fmt REQUIRED)
7974
find_package(OpenSSL REQUIRED)
75+
find_package(Qt6 COMPONENTS Core Widgets REQUIRED)
8076
find_package(RapidJSON REQUIRED)
8177
find_package(spdlog REQUIRED)
8278
find_package(SQLite3 REQUIRED)

Core/include/Core/Directory.hpp

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,37 +5,13 @@
55

66
#include <filesystem>
77

8-
#include <QtGlobal>
9-
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
10-
#include <QDir>
11-
#include <QString>
12-
#endif
13-
148

159
namespace PotatoAlert::Core {
1610

1711
Result<bool> PathExists(const std::filesystem::path& path);
1812
Result<bool> IsSubdirectory(const std::filesystem::path& path, const std::filesystem::path& root);
1913
Result<std::filesystem::path> GetModuleRootPath();
2014

21-
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
22-
inline QDir FromFilesystemPath(const std::filesystem::path& path)
23-
{
24-
#ifdef Q_OS_WIN
25-
return QString::fromStdWString(path.native());
26-
#else
27-
return QString::fromStdString(path.native());
28-
#endif
29-
}
30-
31-
inline std::filesystem::path ToFilesystemAbsolutePath(const QDir& dir)
32-
{
33-
const QString path = dir.absolutePath();
34-
return std::filesystem::path(reinterpret_cast<const char16_t*>(path.cbegin()),
35-
reinterpret_cast<const char16_t*>(path.cend()));
36-
}
37-
#endif
38-
3915
static_assert(
4016
std::is_same_v<std::filesystem::path::value_type, char> ||
4117
std::is_same_v<std::filesystem::path::value_type, wchar_t>,

Core/include/Core/StandardPaths.hpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,7 @@ inline std::filesystem::path AppDataPath(std::string_view appName)
2828
}
2929
}
3030

31-
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
3231
return appData.filesystemAbsolutePath();
33-
#else
34-
const QString abs = appData.absolutePath();
35-
return { reinterpret_cast<const char16_t*>(abs.cbegin()), reinterpret_cast<const char16_t*>(abs.cend()) };
36-
#endif
3732
}
3833

3934
} // namespace PotatoAlert::Core

Core/src/Directory.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,3 @@ Result<bool> PotatoAlert::Core::IsSubdirectory(const std::filesystem::path& path
4242
}
4343
return fs::equivalent(current, root);
4444
}
45-

Core/src/DirectoryWatcher.cpp

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,7 @@ void DirectoryWatcher::ClearDirectories()
3232

3333
void DirectoryWatcher::WatchDirectory(const std::filesystem::path& dir)
3434
{
35-
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
3635
const QDir directory(dir);
37-
#else
38-
const QDir directory = Core::FromFilesystemPath(dir);
39-
#endif
4036
m_watcher.addPath(directory.absolutePath());
4137

4238
const QFileInfoList watchedList = directory.entryInfoList(QDir::NoDotAndDotDot | QDir::Files);
@@ -73,11 +69,7 @@ void DirectoryWatcher::ForceFileChanged(std::string_view file)
7369
{
7470
for (const QString& dir : m_watcher.directories())
7571
{
76-
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
7772
emit FileChanged(QDir(dir + QDir::separator() + file.data()).filesystemAbsolutePath());
78-
#else
79-
emit FileChanged(ToFilesystemAbsolutePath(dir + QDir::separator() + file.data()));
80-
#endif
8173
}
8274
}
8375

@@ -101,11 +93,7 @@ void DirectoryWatcher::OnDirectoryChanged(const QString& path)
10193
if (!m_lastModified.contains(filePath) || m_lastModified[filePath] < lastModified)
10294
{
10395
m_lastModified[filePath] = lastModified;
104-
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
10596
emit FileChanged(QDir(filePath).filesystemAbsolutePath());
106-
#else
107-
emit FileChanged(ToFilesystemAbsolutePath(filePath));
108-
#endif
10997
}
11098

11199
// remove it from the list if it still exists
@@ -119,10 +107,6 @@ void DirectoryWatcher::OnDirectoryChanged(const QString& path)
119107
for (const QString& file : beforeFiles)
120108
{
121109
m_lastModified.erase(file);
122-
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
123110
emit FileChanged(QDir(file).filesystemAbsolutePath());
124-
#else
125-
emit FileChanged(ToFilesystemAbsolutePath(file));
126-
#endif
127111
}
128112
}

Gui/CMakeLists.txt

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -84,18 +84,9 @@ if(UNIX)
8484
)
8585
endif()
8686

87-
find_package(Qt6 COMPONENTS SvgWidgets Widgets QUIET)
88-
if (NOT Qt6_FOUND)
89-
find_package(Qt5 COMPONENTS Svg Widgets REQUIRED)
90-
endif()
91-
92-
if (Qt6_FOUND)
93-
set(QT_SVG_TARGET_NAME "Qt::SvgWidgets")
94-
else()
95-
set(QT_SVG_TARGET_NAME "Qt::Svg")
96-
endif()
87+
find_package(Qt6 COMPONENTS SvgWidgets Widgets REQUIRED)
9788

98-
target_link_libraries(Gui PRIVATE QWKWidgets ${QT_SVG_TARGET_NAME} Qt::WidgetsPrivate)
89+
target_link_libraries(Gui PRIVATE QWKWidgets Qt::SvgWidgets Qt::WidgetsPrivate)
9990
target_link_libraries(Gui PUBLIC Qt::Widgets)
10091
include(CompilerFlags)
10192
SetCompilerFlags(Gui)

Gui/include/Gui/FramelessDialog.hpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,7 @@ class FramelessDialog : public QDialog
2020

2121
private:
2222
void showEvent(QShowEvent* event) override;
23-
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
2423
bool nativeEvent(const QByteArray& eventType, void* message, qintptr* result) override;
25-
#else
26-
bool nativeEvent(const QByteArray& eventType, void* message, long* result) override;
27-
#endif
2824
};
2925

3026
} // namespace PotatoAlert::Gui

Gui/include/Gui/IconButton.hpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,7 @@ class IconButton : public QToolButton
5353
}
5454
}
5555

56-
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
5756
void enterEvent([[maybe_unused]] QEnterEvent* event) override
58-
#else
59-
void enterEvent([[maybe_unused]] QEvent* event) override
60-
#endif
6157
{
6258
if (m_showIcons && isEnabled())
6359
{

Gui/include/Gui/NativeWindow.hpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,7 @@ class NativeWindow : public QWidget
2424

2525
void hideEvent(QHideEvent* event) override;
2626
void showEvent(QShowEvent* event) override;
27-
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
2827
bool nativeEvent(const QByteArray& eventType, void* message, qintptr* result) override;
29-
#else
30-
bool nativeEvent(const QByteArray& eventType, void* message, long* result) override;
31-
#endif
3228

3329
private:
3430
const Client::ServiceProvider& m_services;

Gui/include/Gui/SettingsWidget/SettingsSlider.hpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,7 @@ class SettingsSlider : public QWidget
4343
emit ValueChanged(m_slider->value());
4444
});
4545

46-
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
4746
connect(m_spinBox, &QSpinBox::valueChanged, [this](int value)
48-
#else
49-
connect(m_spinBox, QOverload<int>::of(&QSpinBox::valueChanged), [this](int value)
50-
#endif
5147
{
5248
m_slider->setValue(value);
5349
});

Gui/src/FramelessDialog.linux.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,7 @@ void FramelessDialog::showEvent(QShowEvent* event)
1414
QDialog::showEvent(event);
1515
}
1616

17-
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
1817
bool FramelessDialog::nativeEvent(const QByteArray& eventType, void* message, qintptr* result)
19-
#else
20-
bool FramelessDialog::nativeEvent(const QByteArray& eventType, void* message, long* result)
21-
#endif
2218
{
2319
return QDialog::nativeEvent(eventType, message, result);
2420
}

Gui/src/FramelessDialog.win32.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,7 @@ void FramelessDialog::showEvent(QShowEvent* event)
3737
QDialog::showEvent(event);
3838
}
3939

40-
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
4140
bool FramelessDialog::nativeEvent(const QByteArray& eventType, void* message, qintptr* result)
42-
#else
43-
bool FramelessDialog::nativeEvent(const QByteArray& eventType, void* message, long* result)
44-
#endif
4541
{
4642
MSG* msg = static_cast<MSG*>(message);
4743
if (msg->message == WM_NCCALCSIZE)

Gui/src/MainWindow.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -103,28 +103,17 @@ void MainWindow::SwitchTab(MenuEntry i)
103103
const bool doBlur = m_activeWidget == m_statsWidget && m_services.Get<Config>().Get<ConfigKey::AnonymizePlayers>();
104104
const fs::path screenshotDir = m_services.Get<Client::AppDirectories>().ScreenshotsDir;
105105
Client::CaptureScreenshot(window(), screenshotDir, doBlur ? m_statsWidget->GetPlayerColumnRects(dynamic_cast<QWidget*>(parent())) : QList<QRect>());
106-
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
107106
QDesktopServices::openUrl(QUrl::fromLocalFile(QDir(screenshotDir).absolutePath()));
108-
#else
109-
#endif
110107
return;
111108
}
112109
case MenuEntry::CSV:
113110
{
114-
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
115111
QDesktopServices::openUrl(QUrl::fromLocalFile(QDir(m_services.Get<Client::AppDirectories>().MatchesDir).absolutePath()));
116-
#else
117-
QDesktopServices::openUrl(QUrl::fromLocalFile(Core::FromFilesystemPath(m_services.Get<Client::AppDirectories>().MatchesDir).absolutePath()));
118-
#endif
119112
return;
120113
}
121114
case MenuEntry::Log:
122115
{
123-
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
124116
QDesktopServices::openUrl(QUrl::fromLocalFile(QDir(m_services.Get<Client::AppDirectories>().AppDir).absolutePath()));
125-
#else
126-
QDesktopServices::openUrl(QUrl::fromLocalFile(Core::FromFilesystemPath(m_services.Get<Client::AppDirectories>().AppDir).absolutePath()));
127-
#endif
128117
return;
129118
}
130119
case MenuEntry::Github:

Gui/src/MatchHistory/MatchHistoryFilter.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,7 @@ FilterList::FilterList(Client::StringTable::StringTableKey key, QWidget* parent)
6767
buttonLayout->addWidget(m_toggle);
6868
layout->addLayout(buttonLayout);
6969

70-
#if QT_VERSION >= QT_VERSION_CHECK(6, 0 ,0)
7170
connect(m_model, &FilterModel::dataChanged, [this]([[maybe_unused]] const QModelIndex& topLeft, [[maybe_unused]] const QModelIndex& bottomRight, [[maybe_unused]] const QList<int>& roles)
72-
#else
73-
connect(m_model, &FilterModel::dataChanged, [this](const QModelIndex& topLeft, const QModelIndex& bottomRight, const QVector<int>& roles)
74-
#endif
7571
{
7672
emit FilterChanged();
7773
});

Gui/src/NativeWindow.linux.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,7 @@ void NativeWindow::RequestFocus()
1818
socket.connectToServer(QString(g_sockPath.data()), QLocalSocket::WriteOnly);
1919
}
2020

21-
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
2221
bool NativeWindow::nativeEvent(const QByteArray& eventType, void* message, qintptr* result)
23-
#else
24-
bool NativeWindow::nativeEvent(const QByteArray& eventType, void* message, long* result)
25-
#endif
2622
{
2723
if (!g_server.isListening())
2824
{

Gui/src/NativeWindow.win32.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,7 @@ void NativeWindow::RequestFocus()
2323
PostMessageA(HWND_BROADCAST, WmShowMe(), 0, 0);
2424
}
2525

26-
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
2726
bool NativeWindow::nativeEvent(const QByteArray& eventType, void* message, qintptr* result)
28-
#else
29-
bool NativeWindow::nativeEvent(const QByteArray& eventType, void* message, long* result)
30-
#endif
3127
{
3228
const MSG* msg = static_cast<MSG*>(message);
3329
if (msg->message == WmShowMe())

Gui/src/SettingsWidget/SettingsWidget.cpp

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,7 @@ void SettingsWidget::Init()
119119
if (dir != "")
120120
{
121121
auto gameInstalls = config.Get<ConfigKey::GameDirectories>();
122-
123-
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
124122
gameInstalls.emplace(QDir(dir).filesystemAbsolutePath().make_preferred());
125-
#else
126-
gameInstalls.emplace(ToFilesystemAbsolutePath(QDir(dir)).make_preferred());
127-
#endif
128123
config.Set<ConfigKey::GameDirectories>(gameInstalls);
129124
potatoClient.UpdateGameInstalls();
130125
}
@@ -299,11 +294,8 @@ void SettingsWidget::AddSetting(QGridLayout* layout, SettingType* form, StringTa
299294
static_assert(always_false<>, "Unsupported config type");
300295
}
301296
});
302-
#if QT_VERSION > QT_VERSION_CHECK(6, 0, 0)
297+
303298
connect(form, &SettingsComboBox::currentIndexChanged, [this, onChange, form](int id)
304-
#else
305-
connect(form, qOverload<int>(&SettingsComboBox::currentIndexChanged), [this, &onChange, form](int id)
306-
#endif
307299
{
308300
if constexpr (std::is_same_v<ConfigType, int>)
309301
{

Gui/src/StatsWidget/StatsHeader.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,8 @@ void StatsHeaderFriendly::Init()
3232
qApp->installEventFilter(this);
3333

3434
m_loading = new QSvgWidget(":/Loading.svg");
35-
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
3635
m_ready = QIcon(":/Ready.svg").pixmap(QSize(20, 20), window()->devicePixelRatio());
3736
m_error = QIcon(":/Error.svg").pixmap(QSize(20, 20), window()->devicePixelRatio());
38-
#else
39-
m_ready = QIcon(":/Ready.svg").pixmap(QSize(20, 20));
40-
m_error = QIcon(":/Error.svg").pixmap(QSize(20, 20));
41-
#endif
4237

4338
QHBoxLayout* iconLayout = new QHBoxLayout();
4439
iconLayout->setContentsMargins(0, 0, 0, 0);

0 commit comments

Comments
 (0)