cmake: drop support for Qt 5

This commit is contained in:
tobtoht 2023-10-13 00:12:42 +02:00
parent 5a24c7acfb
commit dabe88340f
No known key found for this signature in database
GPG key ID: E45B10DD027D2472
6 changed files with 7 additions and 47 deletions

View file

@ -9,6 +9,7 @@ set(QT_COMPONENTS
Network Network
Svg Svg
WebSockets WebSockets
SvgWidgets
) )
if (WITH_SCANNER) if (WITH_SCANNER)
@ -17,10 +18,7 @@ if (WITH_SCANNER)
MultimediaWidgets) MultimediaWidgets)
endif() endif()
find_package(Qt6 COMPONENTS ${QT_COMPONENTS} SvgWidgets) find_package(Qt6 REQUIRED COMPONENTS ${QT_COMPONENTS})
if (NOT Qt6_FOUND)
find_package(Qt5 5.15 REQUIRED COMPONENTS ${QT_COMPONENTS})
endif()
set(QAPPLICATION_CLASS QApplication CACHE STRING "Inheritance class for SingleApplication") set(QAPPLICATION_CLASS QApplication CACHE STRING "Inheritance class for SingleApplication")
add_subdirectory(third-party/singleapplication) add_subdirectory(third-party/singleapplication)
@ -85,7 +83,7 @@ if (WITH_SCANNER)
"qrcode/utils/*.cpp") "qrcode/utils/*.cpp")
endif() endif()
if (WITH_SCANNER AND Qt6_FOUND) if (WITH_SCANNER)
file(GLOB SCANNER_FILES file(GLOB SCANNER_FILES
"qrcode/scanner/*.h" "qrcode/scanner/*.h"
"qrcode/scanner/*.cpp") "qrcode/scanner/*.cpp")
@ -185,7 +183,7 @@ if(XMRIG)
target_compile_definitions(feather PRIVATE HAS_XMRIG=1) target_compile_definitions(feather PRIVATE HAS_XMRIG=1)
endif() endif()
if(WITH_SCANNER AND Qt6_FOUND) if(WITH_SCANNER)
target_compile_definitions(feather PRIVATE WITH_SCANNER=1) target_compile_definitions(feather PRIVATE WITH_SCANNER=1)
endif() endif()
@ -248,6 +246,7 @@ target_link_libraries(feather
Qt::Network Qt::Network
Qt::Svg Qt::Svg
Qt::WebSockets Qt::WebSockets
Qt::SvgWidgets
Threads::Threads Threads::Threads
${QRENCODE_LIBRARY} ${QRENCODE_LIBRARY}
${POLYSEED_LIBRARY} ${POLYSEED_LIBRARY}
@ -265,10 +264,6 @@ if(DEPENDS)
target_link_libraries(feather ${ICONV_LIBRARIES}) target_link_libraries(feather ${ICONV_LIBRARIES})
endif() endif()
if(Qt6_FOUND)
target_link_libraries(feather Qt::SvgWidgets)
endif()
if(DEVICE_TREZOR_READY) if(DEVICE_TREZOR_READY)
target_link_libraries(feather ${TREZOR_DEP_LIBS}) target_link_libraries(feather ${TREZOR_DEP_LIBS})
endif() endif()
@ -281,15 +276,7 @@ if (WITH_SCANNER)
) )
endif() endif()
if(UNIX AND NOT APPLE AND STATIC AND NOT Qt6_FOUND) if(STATIC AND UNIX AND NOT APPLE)
target_link_libraries(feather
Qt5::QSvgIconPlugin
Qt5::QSvgPlugin
Qt5::QXcbIntegrationPlugin
)
endif()
if(STATIC AND UNIX AND NOT APPLE AND Qt6_FOUND)
target_link_libraries(feather Qt6::QComposePlatformInputContextPlugin) target_link_libraries(feather Qt6::QComposePlatformInputContextPlugin)
endif() endif()

View file

@ -120,18 +120,7 @@ void SendWidget::fillAddress(const QString &address) {
} }
void SendWidget::scanClicked() { void SendWidget::scanClicked() {
#if defined(WITH_SCANNER) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0) #if defined(WITH_SCANNER)
auto cameras = QCameraInfo::availableCameras();
if (cameras.count() < 1) {
Utils::showError(this, "Can't open QR scanner", "No available cameras found");
return;
}
auto *dialog = new QrCodeScanDialog(this);
dialog->exec();
ui->lineAddress->setText(dialog->decodedString);
dialog->deleteLater();
#elif defined(WITH_SCANNER)
auto cameras = QMediaDevices::videoInputs(); auto cameras = QMediaDevices::videoInputs();
if (cameras.empty()) { if (cameras.empty()) {
Utils::showError(this, "Can't open QR scanner", "No available cameras found"); Utils::showError(this, "Can't open QR scanner", "No available cameras found");

View file

@ -52,11 +52,7 @@ void HelpLabel::mouseReleaseEvent(QMouseEvent *event)
Utils::showInfo(this, m_text, m_informativeText, {}, m_doc); Utils::showInfo(this, m_text, m_informativeText, {}, m_doc);
} }
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
void HelpLabel::enterEvent(QEvent *event)
#else
void HelpLabel::enterEvent(QEnterEvent *event) void HelpLabel::enterEvent(QEnterEvent *event)
#endif
{ {
font.setUnderline(true); font.setUnderline(true);
setFont(font); setFont(font);

View file

@ -49,11 +49,7 @@ public:
protected: protected:
void mouseReleaseEvent(QMouseEvent *event) override; void mouseReleaseEvent(QMouseEvent *event) override;
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
void enterEvent(QEvent *event) override;
#else
void enterEvent(QEnterEvent *event) override; void enterEvent(QEnterEvent *event) override;
#endif
void leaveEvent(QEvent *event) override; void leaveEvent(QEvent *event) override;
private: private:

View file

@ -45,11 +45,7 @@ TransactionInfo* TransactionHistory::transaction(int index)
void TransactionHistory::refresh(quint32 accountIndex) void TransactionHistory::refresh(quint32 accountIndex)
{ {
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
QDateTime firstDateTime = QDate(2014, 4, 18).startOfDay(); QDateTime firstDateTime = QDate(2014, 4, 18).startOfDay();
#else
QDateTime firstDateTime = QDateTime(QDate(2014, 4, 18)); // the genesis block
#endif
QDateTime lastDateTime = QDateTime::currentDateTime().addDays(1); // tomorrow (guard against jitter and timezones) QDateTime lastDateTime = QDateTime::currentDateTime().addDays(1); // tomorrow (guard against jitter and timezones)
emit refreshStarted(); emit refreshStarted();

View file

@ -125,10 +125,6 @@ if (AttachConsole(ATTACH_PARENT_PROCESS)) {
constants::networkType = NetworkType::MAINNET; constants::networkType = NetworkType::MAINNET;
// Setup QApplication // Setup QApplication
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QApplication::setAttribute(Qt::AA_DisableWindowContextHelpButton);
#endif
QApplication::setDesktopSettingsAware(true); // use system font QApplication::setDesktopSettingsAware(true); // use system font
QApplication::setApplicationVersion(FEATHER_VERSION); QApplication::setApplicationVersion(FEATHER_VERSION);