diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 111c74203..217221577 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,13 +16,9 @@ jobs: fail-fast: false matrix: opensuse_version: [ 'tumbleweed', 'leap:15.6' ] - qt_version: [ '5', '6' ] container: image: opensuse/${{matrix.opensuse_version}} steps: - - name: Add tagparser repo - if: matrix.opensuse_version == 'tumbleweed' - run: zypper -n ar -c -f -n 'repo-tagparser' https://download.opensuse.org/repositories/home:/mkittler/openSUSE_Tumbleweed/ repo-tagparser - name: Refresh repositories run: zypper -n --gpg-auto-import-keys ref - name: Upgrade packages @@ -74,26 +70,6 @@ jobs: update-desktop-files appstream-glib hicolor-icon-theme - - name: Install Qt 5 - if: matrix.qt_version == '5' - run: > - zypper -n --gpg-auto-import-keys in - libQt5Core-devel - libQt5Gui-devel - libQt5Widgets-devel - libQt5Concurrent-devel - libQt5Network-devel - libQt5Sql-devel - libQt5DBus-devel - libQt5Test-devel - libqt5-qtbase-common-devel - libQt5Sql5-sqlite - libqt5-linguist-devel - libqt5-qtx11extras-devel - - name: Install Qt 6 - if: matrix.qt_version == '6' - run: > - zypper -n --gpg-auto-import-keys in qt6-core-devel qt6-gui-devel qt6-widgets-devel @@ -105,14 +81,8 @@ jobs: qt6-base-common-devel qt6-sql-sqlite qt6-linguist-devel - - name: Install tagparser - if: matrix.opensuse_version == 'tumbleweed' - run: zypper -n --gpg-auto-import-keys in tagparser-devel - - name: Install kdsingleapplication-devel - if: matrix.opensuse_version == 'tumbleweed' && matrix.qt_version == '5' - run: zypper -n --gpg-auto-import-keys in kdsingleapplication-devel - name: Install kdsingleapplication-qt6-devel - if: matrix.opensuse_version == 'tumbleweed' && matrix.qt_version == '6' + if: matrix.opensuse_version == 'tumbleweed' run: zypper -n --gpg-auto-import-keys in kdsingleapplication-qt6-devel - name: Checkout uses: actions/checkout@v4 @@ -124,7 +94,7 @@ jobs: - name: Create Build Environment run: cmake -E make_directory build - name: Configure CMake - run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DBUILD_WERROR=ON -DUSE_TAGLIB=ON -DQT_VERSION_MAJOR=${{matrix.qt_version}} + run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DBUILD_WERROR=ON -DUSE_TAGLIB=ON - name: Create source tarball working-directory: build run: ../dist/scripts/maketarball.sh @@ -148,14 +118,14 @@ jobs: id: set-subdir run: echo "subdir=$(echo ${{matrix.opensuse_version}} | sed 's/leap:/lp/g' | sed 's/\.//g')" > $GITHUB_OUTPUT - name: Upload source - if: matrix.opensuse_version == 'tumbleweed' && matrix.qt_version == '6' + if: matrix.opensuse_version == 'tumbleweed' uses: actions/upload-artifact@v4 with: name: source path: | /usr/src/packages/SOURCES/*.xz - name: Upload rpm - if: matrix.opensuse_version != 'tumbleweed' && matrix.qt_version == '6' + if: matrix.opensuse_version != 'tumbleweed' uses: actions/upload-artifact@v4 with: name: opensuse-${{steps.set-subdir.outputs.subdir}} @@ -460,7 +430,7 @@ jobs: strategy: fail-fast: false matrix: - debian_version: [ 'bullseye', 'bookworm', 'trixie' ] + debian_version: [ 'bookworm', 'trixie' ] container: image: debian:${{matrix.debian_version}} steps: @@ -505,16 +475,11 @@ jobs: libcdio-dev libmtp-dev libgpod-dev - - name: Install Qt 5 - if: matrix.debian_version == 'bullseye' - env: - DEBIAN_FRONTEND: noninteractive - run: apt install -y qtbase5-dev qtbase5-dev-tools qttools5-dev qttools5-dev-tools libqt5x11extras5-dev - - name: Install Qt 6 - if: matrix.debian_version != 'bullseye' - env: - DEBIAN_FRONTEND: noninteractive - run: apt install -y qt6-base-dev qt6-base-dev-tools qt6-tools-dev qt6-tools-dev-tools qt6-l10n-tools + qt6-base-dev + qt6-base-dev-tools + qt6-tools-dev + qt6-tools-dev-tools + qt6-l10n-tools - name: Checkout uses: actions/checkout@v4 with: @@ -544,7 +509,7 @@ jobs: strategy: fail-fast: false matrix: - ubuntu_version: [ 'focal', 'jammy', 'noble', 'oracular' ] + ubuntu_version: [ 'noble', 'oracular' ] container: image: ubuntu:${{matrix.ubuntu_version}} steps: @@ -592,16 +557,11 @@ jobs: libcdio-dev libmtp-dev libgpod-dev - - name: Install Qt 5 - if: matrix.ubuntu_version == 'focal' - env: - DEBIAN_FRONTEND: noninteractive - run: apt install -y qtbase5-dev qtbase5-dev-tools qttools5-dev qttools5-dev-tools libqt5x11extras5-dev - - name: Install Qt 6 - if: matrix.ubuntu_version != 'focal' - env: - DEBIAN_FRONTEND: noninteractive - run: apt install -y qt6-base-dev qt6-base-dev-tools qt6-tools-dev qt6-tools-dev-tools qt6-l10n-tools + qt6-base-dev + qt6-base-dev-tools + qt6-tools-dev + qt6-tools-dev-tools + qt6-l10n-tools - name: Checkout uses: actions/checkout@v4 with: @@ -633,7 +593,7 @@ jobs: strategy: fail-fast: false matrix: - ubuntu_version: [ 'focal', 'jammy', 'noble', 'oracular' ] + ubuntu_version: [ 'noble', 'oracular' ] container: image: ubuntu:${{matrix.ubuntu_version}} steps: @@ -678,6 +638,11 @@ jobs: libcdio-dev libmtp-dev libgpod-dev + qt6-base-dev + qt6-base-dev-tools + qt6-tools-dev + qt6-tools-dev-tools + qt6-l10n-tools gstreamer1.0-alsa gstreamer1.0-pulseaudio protobuf-compiler @@ -686,16 +651,6 @@ jobs: env: DEBIAN_FRONTEND: noninteractive run: apt install -y keyboxd - - name: Install Qt 5 - if: matrix.ubuntu_version == 'focal' - env: - DEBIAN_FRONTEND: noninteractive - run: apt install -y qtbase5-dev qtbase5-dev-tools qttools5-dev qttools5-dev-tools libqt5x11extras5-dev - - name: Install Qt 6 - if: matrix.ubuntu_version != 'focal' - env: - DEBIAN_FRONTEND: noninteractive - run: apt install -y qt6-base-dev qt6-base-dev-tools qt6-tools-dev qt6-tools-dev-tools qt6-l10n-tools - name: Checkout uses: actions/checkout@v4 with: @@ -807,7 +762,6 @@ jobs: -B build -DCMAKE_BUILD_TYPE="${{env.cmake_buildtype}}" -DCMAKE_PREFIX_PATH="${{env.prefix_path}}/lib/cmake" - -DBUILD_WITH_QT6=ON -DBUILD_WERROR=OFF -DUSE_BUNDLE=ON -DENABLE_DBUS=OFF @@ -948,7 +902,6 @@ jobs: -B build -DCMAKE_BUILD_TYPE="${{env.cmake_buildtype}}" -DCMAKE_PREFIX_PATH="${{env.prefix_path}}/lib/cmake" - -DBUILD_WITH_QT6=ON -DBUILD_WERROR=OFF -DUSE_BUNDLE=ON -DENABLE_DBUS=OFF @@ -1047,7 +1000,6 @@ jobs: -DCMAKE_TOOLCHAIN_FILE="../cmake/Toolchain-${{matrix.arch}}-w64-mingw32-shared.cmake" -DCMAKE_BUILD_TYPE="${{env.cmake_buildtype}}" -DCMAKE_PREFIX_PATH="/strawberry-mxe/usr/${{matrix.arch}}-w64-mingw32.shared/qt6" - -DBUILD_WITH_QT6=ON -DBUILD_WERROR=OFF -DARCH="${{matrix.arch}}" -DENABLE_WIN32_CONSOLE=$(test "${{matrix.buildtype}}" = "debug" && echo "ON" || echo "OFF") @@ -1336,7 +1288,6 @@ jobs: -G "Ninja" -DCMAKE_BUILD_TYPE="${{env.cmake_buildtype}}" -DCMAKE_PREFIX_PATH="${{env.prefix_path_forwardslash}}/lib/cmake" - -DBUILD_WITH_QT6=ON -DARCH="${{matrix.arch}}" -DENABLE_WIN32_CONSOLE=${{env.win32_console}} -DUSE_TAGLIB=ON diff --git a/.gitignore b/.gitignore index 3083cd8f9..1818263ae 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,5 @@ /dist/scripts/maketarball.sh /dist/unix/strawberry.spec /dist/windows/strawberry.nsi -/debian/control /debian/changelog /dist/macos/Info.plist diff --git a/CMakeLists.txt b/CMakeLists.txt index bf56fb7ff..d496dbdb1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -165,38 +165,14 @@ find_package(FFTW3) find_package(GTest) find_library(GMOCK_LIBRARY gmock) -option(BUILD_WITH_QT5 "Build with Qt 5" OFF) -option(BUILD_WITH_QT6 "Build with Qt 6" OFF) - -if(BUILD_WITH_QT6) - set(QT_VERSION_MAJOR 6) -elseif(BUILD_WITH_QT5) - set(QT_VERSION_MAJOR 5) -endif() - -if(NOT QT_VERSION_MAJOR) - message(STATUS "QT_VERSION_MAJOR, BUILD_WITH_QT5 or BUILD_WITH_QT6 not set, detecting Qt version...") - find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED) -endif() - -if(QT_VERSION_MAJOR EQUAL 6) - set(QT_MIN_VERSION 6.0) -elseif(QT_VERSION_MAJOR EQUAL 5) - set(QT_MIN_VERSION 5.12) -else() - message(FATAL_ERROR "Invalid QT_VERSION_MAJOR.") -endif() - +set(QT_VERSION_MAJOR 6) +set(QT_MIN_VERSION 6.4.0) set(QT_DEFAULT_MAJOR_VERSION ${QT_VERSION_MAJOR}) - set(QT_COMPONENTS Core Concurrent Gui Widgets Network Sql) set(QT_OPTIONAL_COMPONENTS LinguistTools Test) if(DBUS_FOUND AND NOT WIN32) list(APPEND QT_COMPONENTS DBus) endif() -if(X11_FOUND AND QT_VERSION_MAJOR EQUAL 5) - list(APPEND QT_COMPONENTS X11Extras) -endif() find_package(Qt${QT_VERSION_MAJOR} ${QT_MIN_VERSION} COMPONENTS ${QT_COMPONENTS} REQUIRED OPTIONAL_COMPONENTS ${QT_OPTIONAL_COMPONENTS}) @@ -210,24 +186,6 @@ if(Qt${QT_VERSION_MAJOR}X11Extras_FOUND) set(HAVE_X11EXTRAS ON) endif() -if(QT_VERSION_MAJOR EQUAL 5 AND Qt5Core_VERSION VERSION_LESS 5.15.0) - macro(qt_add_resources) - qt5_add_resources(${ARGN}) - endmacro() - macro(qt_wrap_cpp) - qt5_wrap_cpp(${ARGN}) - endmacro() - macro(qt_wrap_ui) - qt5_wrap_ui(${ARGN}) - endmacro() - macro(qt_add_dbus_adaptor) - qt5_add_dbus_adaptor(${ARGN}) - endmacro() - macro(qt_add_dbus_interface) - qt5_add_dbus_interface(${ARGN}) - endmacro() -endif() - if(X11_FOUND) find_path(KEYSYMDEF_H NAMES "keysymdef.h" PATHS "${X11_INCLUDE_DIR}" PATH_SUFFIXES "X11") find_path(XF86KEYSYM_H NAMES "XF86keysym.h" PATHS "${XCB_INCLUDEDIR}" PATH_SUFFIXES "X11") @@ -251,7 +209,7 @@ if(X11_FOUND) endif() # Check for QX11Application (Qt 6 compiled with XCB). - if(QT_VERSION_MAJOR EQUAL 6 AND Qt6Gui_VERSION VERSION_GREATER_EQUAL 6.2.0) + if(QT_VERSION_MAJOR EQUAL 6) set(CMAKE_REQUIRED_FLAGS "-std=c++17") set(CMAKE_REQUIRED_LIBRARIES Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Gui) check_cxx_source_compiles(" @@ -303,18 +261,10 @@ if(NOT HAVE_TAGLIB AND NOT HAVE_TAGPARSER) endif() # SingleApplication -if(QT_VERSION_MAJOR EQUAL 5) - set(KDSINGLEAPPLICATION_NAME "KDSingleApplication") -else() - set(KDSINGLEAPPLICATION_NAME "KDSingleApplication-qt${QT_VERSION_MAJOR}") -endif() +set(KDSINGLEAPPLICATION_NAME "KDSingleApplication-qt${QT_VERSION_MAJOR}") find_package(${KDSINGLEAPPLICATION_NAME} 1.1.0) if(TARGET KDAB::kdsingleapplication) - if(QT_VERSION_MAJOR EQUAL 5) - set(KDSINGLEAPPLICATION_VERSION "${KDSingleApplication_VERSION}") - elseif(QT_VERSION_MAJOR EQUAL 6) - set(KDSINGLEAPPLICATION_VERSION "${KDSingleApplication-qt6_VERSION}") - endif() + set(KDSINGLEAPPLICATION_VERSION "${KDSingleApplication-qt6_VERSION}") message(STATUS "Using system KDSingleApplication (Version ${KDSINGLEAPPLICATION_VERSION})") set(SINGLEAPPLICATION_LIBRARIES KDAB::kdsingleapplication) else() @@ -545,10 +495,6 @@ elseif(NOT HAVE_GSTREAMER) message(WARNING "GStreamer is the only engine that is fully implemented. Using other engines is possible but not recommended.") endif() -if(QT_VERSION_MAJOR EQUAL 5) - message(WARNING "It is detected that Strawberry is being built with Qt 5. There are no bugfix releases for the latest minor LTS version of Qt 5 available to open-source users, only commercial users. Therefore Strawberry should be built with Qt 6 when possible. Building with Qt 6 will also take advantage of improvements and new features not available in Qt 5. To build with Qt 6 specify -DBUILD_WITH_QT6=ON to automatically detect Qt 6, or for example -DCMAKE_PREFIX_PATH=/usr/local/lib64/cmake to manually specify the Qt 6 directory.") -endif() - if(NOT CMAKE_CROSSCOMPILING) if(NOT QT_SQLITE_TEST) message(WARNING "The Qt sqlite driver test failed.") diff --git a/README.md b/README.md index 762854b10..4c6a710b5 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,7 @@ To build Strawberry from source you need the following installed on your system * [pkg-config](https://www.freedesktop.org/wiki/Software/pkg-config/) or [pkgconf](https://github.com/pkgconf/pkgconf) * [Boost](https://www.boost.org/) * [GLib](https://developer.gnome.org/glib/) -* [Qt 6 or Qt 5.12 or higher with components Core, Gui, Widgets, Concurrent, Network and Sql](https://www.qt.io/) +* [Qt 6.4.0 or higher with components Core, Gui, Widgets, Concurrent, Network and Sql](https://www.qt.io/) * [SQLite 3.9 or newer](https://www.sqlite.org) * [Protobuf](https://developers.google.com/protocol-buffers/) * [ALSA (Required on Linux)](https://www.alsa-project.org/) @@ -107,14 +107,10 @@ You should also install the gstreamer plugins base and good, and optionally bad, cd strawberry mkdir build cd build - cmake .. -DBUILD_WITH_QT6=ON + cmake .. make -j $(nproc) sudo make install -Strawberry is backwards compatible with Qt 5, to compile with Qt 5 use: - - cmake .. -DBUILD_WITH_QT5=ON - To compile on Windows with Visual Studio 2019 or 2022, see https://github.com/strawberrymusicplayer/strawberry-msvc ### :penguin: Packaging status diff --git a/debian/CMakeLists.txt b/debian/CMakeLists.txt index 9cbe25751..f7a9c2cf0 100644 --- a/debian/CMakeLists.txt +++ b/debian/CMakeLists.txt @@ -4,19 +4,7 @@ if(LSB_RELEASE_EXEC AND DPKG_BUILDPACKAGE) execute_process(COMMAND /bin/sh "-c" "${LSB_RELEASE_EXEC} -cs" OUTPUT_VARIABLE DEB_CODENAME OUTPUT_STRIP_TRAILING_WHITESPACE) if(DEB_CODENAME AND DEB_DATE) - - if(QT_VERSION_MAJOR EQUAL 5) - set(DEBIAN_BUILD_DEPENDS_QT_PACKAGES qtbase5-dev,qtbase5-dev-tools,qttools5-dev,qttools5-dev-tools,libqt5x11extras5-dev) - set(DEBIAN_DEPENDS_QT_PACKAGES libqt5sql5-sqlite) - endif() - if(QT_VERSION_MAJOR EQUAL 6) - set(DEBIAN_BUILD_DEPENDS_QT_PACKAGES qt6-base-dev,qt6-base-dev-tools,qt6-tools-dev,qt6-tools-dev-tools,qt6-l10n-tools) - set(DEBIAN_DEPENDS_QT_PACKAGES libqt6sql6-sqlite,qt6-qpa-plugins) - endif() - - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/control.in ${CMAKE_CURRENT_SOURCE_DIR}/control @ONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/changelog.in ${CMAKE_CURRENT_SOURCE_DIR}/changelog) - endif() endif() diff --git a/debian/control.in b/debian/control similarity index 91% rename from debian/control.in rename to debian/control index c8d838f3d..52f9a384d 100644 --- a/debian/control.in +++ b/debian/control @@ -18,7 +18,11 @@ Build-Depends: debhelper (>= 11), libpulse-dev, libtag1-dev, libicu-dev, - @DEBIAN_BUILD_DEPENDS_QT_PACKAGES@, + qt6-base-dev, + qt6-base-dev-tools, + qt6-tools-dev, + qt6-tools-dev-tools, + qt6-l10n-tools, libgstreamer1.0-dev, libgstreamer-plugins-base1.0-dev, libcdio-dev, @@ -33,7 +37,8 @@ Package: strawberry Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, - @DEBIAN_DEPENDS_QT_PACKAGES@, + libqt6sql6-sqlite, + qt6-qpa-plugins, gstreamer1.0-plugins-base, gstreamer1.0-plugins-good, gstreamer1.0-alsa, diff --git a/ext/libstrawberry-common/core/logging.cpp b/ext/libstrawberry-common/core/logging.cpp index da7c818de..26ee8531e 100644 --- a/ext/libstrawberry-common/core/logging.cpp +++ b/ext/libstrawberry-common/core/logging.cpp @@ -329,11 +329,7 @@ QString LinuxDemangle(const QString &symbol) { QString DarwinDemangle(const QString &symbol); QString DarwinDemangle(const QString &symbol) { -# if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) - QStringList split = symbol.split(QLatin1Char(' '), Qt::SkipEmptyParts); -# else - QStringList split = symbol.split(QLatin1Char(' '), QString::SkipEmptyParts); -# endif + const QStringList split = symbol.split(QLatin1Char(' '), Qt::SkipEmptyParts); QString mangled_function = split[3]; return CXXDemangle(mangled_function); diff --git a/ext/libstrawberry-tagreader/tagreadergme.cpp b/ext/libstrawberry-tagreader/tagreadergme.cpp index 02e312dc1..606556aba 100644 --- a/ext/libstrawberry-tagreader/tagreadergme.cpp +++ b/ext/libstrawberry-tagreader/tagreadergme.cpp @@ -238,11 +238,7 @@ TagReaderBase::Result GME::VGM::Read(const QFileInfo &fileinfo, spb::tagreader:: QByteArray gd3Data = file.read(gd3_length); QTextStream fileTagStream(gd3Data, QIODevice::ReadOnly); // Stored as 16 bit UTF string, two bytes per letter. -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) fileTagStream.setEncoding(QStringConverter::Utf16); -#else - fileTagStream.setCodec("UTF-16"); -#endif QStringList strings = fileTagStream.readLine(0).split(QLatin1Char('\0')); if (strings.count() < 10) { return TagReaderBase::Result::ErrorCode::FileParseError; diff --git a/src/analyzer/analyzercontainer.cpp b/src/analyzer/analyzercontainer.cpp index 6e1e36963..7d9e9e912 100644 --- a/src/analyzer/analyzercontainer.cpp +++ b/src/analyzer/analyzercontainer.cpp @@ -116,11 +116,7 @@ void AnalyzerContainer::mouseReleaseEvent(QMouseEvent *e) { } if (e->button() == Qt::RightButton) { -#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) context_menu_->popup(e->globalPosition().toPoint()); -#else - context_menu_->popup(e->globalPos()); -#endif } } diff --git a/src/collection/collection.cpp b/src/collection/collection.cpp index 297a00112..2cfde0b37 100644 --- a/src/collection/collection.cpp +++ b/src/collection/collection.cpp @@ -192,11 +192,7 @@ void SCollection::ReloadSettings() { void SCollection::SyncPlaycountAndRatingToFilesAsync() { -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) (void)QtConcurrent::run(&SCollection::SyncPlaycountAndRatingToFiles, this); -#else - (void)QtConcurrent::run(this, &SCollection::SyncPlaycountAndRatingToFiles); -#endif } diff --git a/src/collection/collectionfilter.cpp b/src/collection/collectionfilter.cpp index 651bfce00..b43d3a8b9 100644 --- a/src/collection/collectionfilter.cpp +++ b/src/collection/collectionfilter.cpp @@ -60,11 +60,7 @@ bool CollectionFilter::filterAcceptsRow(const int source_row, const QModelIndex return item->type == CollectionItem::Type::LoadingIndicator; } -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) size_t hash = qHash(filter_string_); -#else - uint hash = qHash(filter_string_); -#endif if (hash != query_hash_) { FilterParser p(filter_string_); filter_tree_.reset(p.parse()); diff --git a/src/collection/collectionfilter.h b/src/collection/collectionfilter.h index 667345ffc..e30ad1e4b 100644 --- a/src/collection/collectionfilter.h +++ b/src/collection/collectionfilter.h @@ -51,11 +51,7 @@ class CollectionFilter : public QSortFilterProxyModel { private: mutable QScopedPointer filter_tree_; -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) mutable size_t query_hash_; -#else - mutable uint query_hash_; -#endif QString filter_string_; }; diff --git a/src/collection/collectionmodel.cpp b/src/collection/collectionmodel.cpp index 9ffd8d71c..a3cd67522 100644 --- a/src/collection/collectionmodel.cpp +++ b/src/collection/collectionmodel.cpp @@ -813,11 +813,7 @@ CollectionItem *CollectionModel::CreateCompilationArtistNode(CollectionItem *par void CollectionModel::LoadSongsFromSqlAsync() { -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) QFuture future = QtConcurrent::run(&CollectionModel::LoadSongsFromSql, this, options_active_.filter_options); -#else - QFuture future = QtConcurrent::run(this, &CollectionModel::LoadSongsFromSql, options_active_.filter_options); -#endif QFutureWatcher *watcher = new QFutureWatcher(); QObject::connect(watcher, &QFutureWatcher::finished, this, &CollectionModel::LoadSongsFromSqlAsyncFinished); watcher->setFuture(future); @@ -1435,17 +1431,15 @@ QString CollectionModel::DividerDisplayText(const GroupBy group_by, const QStrin bool CollectionModel::CompareItems(const CollectionItem *a, const CollectionItem *b) const { - QVariant left(data(a, CollectionModel::Role_SortText)); - QVariant right(data(b, CollectionModel::Role_SortText)); + QVariant left = data(a, CollectionModel::Role_SortText); + QVariant right = data(b, CollectionModel::Role_SortText); -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) - if (left.metaType().id() == QMetaType::Int) -#else - if (left.type() == QVariant::Int) -#endif + if (left.metaType().id() == QMetaType::Int) { return left.toInt() < right.toInt(); - else + } + else { return left.toString() < right.toString(); + } } diff --git a/src/collection/collectionquery.cpp b/src/collection/collectionquery.cpp index 449ffa789..6a993ba64 100644 --- a/src/collection/collectionquery.cpp +++ b/src/collection/collectionquery.cpp @@ -76,20 +76,10 @@ void CollectionQuery::AddWhere(const QString &column, const QVariant &value, con } else { // Do integers inline - sqlite seems to get confused when you pass integers to bound parameters -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) if (value.metaType().id() == QMetaType::Int) { -#else - if (value.type() == QVariant::Int) { -#endif where_clauses_ << QStringLiteral("%1 %2 %3").arg(column, op, value.toString()); } - else if ( -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) - value.metaType().id() == QMetaType::QString -#else - value.type() == QVariant::String -#endif - && value.toString().isNull()) { + else if (value.metaType().id() == QMetaType::QString && value.toString().isNull()) { where_clauses_ << QStringLiteral("%1 %2 ?").arg(column, op); bound_values_ << QLatin1String(""); } diff --git a/src/collection/collectionview.cpp b/src/collection/collectionview.cpp index 10acf23ed..6d95c9a21 100644 --- a/src/collection/collectionview.cpp +++ b/src/collection/collectionview.cpp @@ -459,11 +459,7 @@ void CollectionView::contextMenuEvent(QContextMenuEvent *e) { action_copy_to_device_->setVisible(regular_elements == regular_editable); #endif -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) action_delete_files_->setVisible(delete_files_); -#else - action_delete_files_->setVisible(false); -#endif action_show_in_various_->setVisible(songs_selected > 0); action_no_show_in_various_->setVisible(songs_selected > 0); @@ -474,11 +470,7 @@ void CollectionView::contextMenuEvent(QContextMenuEvent *e) { action_copy_to_device_->setEnabled(regular_elements == regular_editable); #endif -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) action_delete_files_->setEnabled(delete_files_); -#else - action_delete_files_->setEnabled(false); -#endif context_menu_->popup(e->globalPos()); @@ -523,11 +515,7 @@ void CollectionView::SetShowInVarious(const bool on) { } } -#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)) const QSet albums_set = QSet(albums.keyBegin(), albums.keyEnd()); -#else - const QSet albums_set = QSet::fromList(albums.keys()); -#endif for (const QString &album : albums_set) { app_->collection_backend()->ForceCompilation(album, albums.values(album), on); } diff --git a/src/context/contextview.cpp b/src/context/contextview.cpp index f70f54722..f60b1628a 100644 --- a/src/context/contextview.cpp +++ b/src/context/contextview.cpp @@ -295,11 +295,7 @@ void ContextView::AddActions() { void ContextView::ReloadSettings() { QString default_font; -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) if (QFontDatabase::families().contains(QLatin1String(ContextSettingsPage::kDefaultFontFamily))) { -#else - if (QFontDatabase().families().contains(QLatin1String(ContextSettingsPage::kDefaultFontFamily))) { -#endif default_font = QLatin1String(ContextSettingsPage::kDefaultFontFamily); } else { diff --git a/src/core/database.cpp b/src/core/database.cpp index 4222ff1b5..1287f7101 100644 --- a/src/core/database.cpp +++ b/src/core/database.cpp @@ -63,9 +63,6 @@ QMutex Database::sNextConnectionIdMutex; Database::Database(Application *app, QObject *parent, const QString &database_name) : QObject(parent), app_(app), -#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) - mutex_(QMutex::Recursive), -#endif injected_database_name_(database_name), query_hash_(0), startup_schema_version_(-1), diff --git a/src/core/database.h b/src/core/database.h index b4535e576..99aa9b91a 100644 --- a/src/core/database.h +++ b/src/core/database.h @@ -34,9 +34,7 @@ #include #include #include -#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) -# include -#endif +#include #include "sqlquery.h" @@ -67,11 +65,7 @@ class Database : public QObject { void Close(); void ReportErrors(const SqlQuery &query); -#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) QRecursiveMutex *Mutex() { return &mutex_; } -#else - QMutex *Mutex() { return &mutex_; } -#endif void RecreateAttachedDb(const QString &database_name); void ExecSchemaCommands(QSqlDatabase &db, const QString &schema, int schema_version, bool in_transaction = false); @@ -115,11 +109,7 @@ class Database : public QObject { QString directory_; QMutex connect_mutex_; -#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) QRecursiveMutex mutex_; -#else - QMutex mutex_; -#endif // This ID makes the QSqlDatabase name unique to the object as well as the thread int connection_id_; diff --git a/src/core/filesystemmusicstorage.cpp b/src/core/filesystemmusicstorage.cpp index 7e65c6c7c..dcefdd85c 100644 --- a/src/core/filesystemmusicstorage.cpp +++ b/src/core/filesystemmusicstorage.cpp @@ -114,11 +114,7 @@ bool FilesystemMusicStorage::DeleteFromStorage(const DeleteJob &job) { QFileInfo fileInfo(path); if (job.use_trash_) { -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) return QFile::moveToTrash(path); -#else - return false; -#endif } if (fileInfo.isDir()) { diff --git a/src/core/mainwindow.cpp b/src/core/mainwindow.cpp index 3995d5bf9..314d50e05 100644 --- a/src/core/mainwindow.cpp +++ b/src/core/mainwindow.cpp @@ -217,11 +217,7 @@ #endif #ifdef HAVE_QTSPARKLE -# if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) -# include -# else -# include -# endif +# include #endif // HAVE_QTSPARKLE using std::make_unique; @@ -2044,9 +2040,7 @@ void MainWindow::PlaylistRightClick(const QPoint global_pos, const QModelIndex & playlist_copy_to_device_->setVisible(local_songs > 0); #endif -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) playlist_delete_->setVisible(delete_files_ && local_songs > 0); -#endif // Remove old item actions, if any. for (QAction *action : std::as_const(playlistitem_actions_)) { @@ -2966,11 +2960,7 @@ void MainWindow::Raise() { } #ifdef Q_OS_WIN -# if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) bool MainWindow::nativeEvent(const QByteArray &eventType, void *message, qintptr *result) { -# else -bool MainWindow::nativeEvent(const QByteArray &eventType, void *message, long *result) { -# endif if (exit_count_ == 0 && message) { MSG *msg = static_cast(message); diff --git a/src/core/mainwindow.h b/src/core/mainwindow.h index 11a0255db..03bea14b7 100644 --- a/src/core/mainwindow.h +++ b/src/core/mainwindow.h @@ -120,11 +120,7 @@ class MainWindow : public QMainWindow, public PlatformInterface { void closeEvent(QCloseEvent *e) override; void keyPressEvent(QKeyEvent *e) override; #ifdef Q_OS_WIN -# if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) bool nativeEvent(const QByteArray &eventType, void *message, qintptr *result) override; -# else - bool nativeEvent(const QByteArray &eventType, void *message, long *result) override; -# endif #endif // PlatformInterface diff --git a/src/core/metatypes.cpp b/src/core/metatypes.cpp index a0b45869b..8f500c7f6 100644 --- a/src/core/metatypes.cpp +++ b/src/core/metatypes.cpp @@ -96,10 +96,6 @@ void RegisterMetaTypes() { qRegisterMetaType("QItemSelection"); qRegisterMetaType>("ColumnAlignmentMap"); qRegisterMetaType>("ColumnAlignmentIntMap"); -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) - qRegisterMetaTypeStreamOperators>("ColumnAlignmentMap"); - qRegisterMetaTypeStreamOperators>("ColumnAlignmentIntMap"); -#endif qRegisterMetaType("Song"); qRegisterMetaType("SongList"); qRegisterMetaType("SongMap"); @@ -133,10 +129,6 @@ void RegisterMetaTypes() { qRegisterMetaType("Equalizer::Params"); -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) - qRegisterMetaTypeStreamOperators("Equalizer::Params"); -#endif - #ifdef HAVE_DBUS qDBusRegisterMetaType(); qDBusRegisterMetaType(); diff --git a/src/core/multisortfilterproxy.cpp b/src/core/multisortfilterproxy.cpp index 706c227e8..fb135d96a 100644 --- a/src/core/multisortfilterproxy.cpp +++ b/src/core/multisortfilterproxy.cpp @@ -69,7 +69,6 @@ int MultiSortFilterProxy::Compare(const QVariant &left, const QVariant &right) c // Copied from the QSortFilterProxyModel::lessThan implementation, but returns -1, 0 or 1 instead of true or false. switch (left.userType()) { -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) case QMetaType::UnknownType: return (right.metaType().id() != QMetaType::UnknownType) ? -1 : 0; case QMetaType::Int: return DoCompare(left.toInt(), right.toInt()); case QMetaType::UInt: return DoCompare(left.toUInt(), right.toUInt()); @@ -82,20 +81,6 @@ int MultiSortFilterProxy::Compare(const QVariant &left, const QVariant &right) c case QMetaType::QTime: return DoCompare(left.toTime(), right.toTime()); case QMetaType::QDateTime: return DoCompare(left.toDateTime(), right.toDateTime()); case QMetaType::QString: -#else - case QVariant::Invalid: return (right.type() != QVariant::Invalid) ? -1 : 0; - case QVariant::Int: return DoCompare(left.toInt(), right.toInt()); - case QVariant::UInt: return DoCompare(left.toUInt(), right.toUInt()); - case QVariant::LongLong: return DoCompare(left.toLongLong(), right.toLongLong()); - case QVariant::ULongLong: return DoCompare(left.toULongLong(), right.toULongLong()); - case QMetaType::Float: return DoCompare(left.toFloat(), right.toFloat()); - case QVariant::Double: return DoCompare(left.toDouble(), right.toDouble()); - case QVariant::Char: return DoCompare(left.toChar(), right.toChar()); - case QVariant::Date: return DoCompare(left.toDate(), right.toDate()); - case QVariant::Time: return DoCompare(left.toTime(), right.toTime()); - case QVariant::DateTime: return DoCompare(left.toDateTime(), right.toDateTime()); - case QVariant::String: -#endif default: if (isSortLocaleAware()) { return left.toString().localeAwareCompare(right.toString()); diff --git a/src/core/song.cpp b/src/core/song.cpp index 0b4c59387..f19ff0ee0 100644 --- a/src/core/song.cpp +++ b/src/core/song.cpp @@ -1938,11 +1938,7 @@ QString Song::AlbumKey() const { return QStringLiteral("%1|%2|%3").arg(is_compilation() ? QStringLiteral("_compilation") : effective_albumartist(), has_cue() ? cue_path() : QLatin1String(""), effective_album()); } -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) size_t qHash(const Song &song) { -#else -uint qHash(const Song &song) { -#endif // Should compare the same fields as operator== return qHash(song.url().toString()) ^ qHash(song.beginning_nanosec()); } diff --git a/src/core/song.h b/src/core/song.h index f17045d73..383058aae 100644 --- a/src/core/song.h +++ b/src/core/song.h @@ -482,11 +482,7 @@ Q_DECLARE_METATYPE(SongMap) Q_DECLARE_METATYPE(Song::Source) Q_DECLARE_METATYPE(Song::FileType) -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) size_t qHash(const Song &song); -#else -uint qHash(const Song &song); -#endif // Hash function using field checked in IsSimilar function size_t HashSimilar(const Song &song); diff --git a/src/core/sqlquery.cpp b/src/core/sqlquery.cpp index 4fa5f5b91..068dc15a1 100644 --- a/src/core/sqlquery.cpp +++ b/src/core/sqlquery.cpp @@ -28,9 +28,7 @@ void SqlQuery::BindValue(const QString &placeholder, const QVariant &value) { -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) bound_values_.insert(placeholder, value); -#endif bindValue(placeholder, value); @@ -95,18 +93,10 @@ bool SqlQuery::Exec() { bool success = exec(); last_query_ = executedQuery(); -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) for (QMap::const_iterator it = bound_values_.constBegin(); it != bound_values_.constEnd(); ++it) { last_query_.replace(it.key(), it.value().toString()); } bound_values_.clear(); -#else - QMapIterator it(boundValues()); - while (it.hasNext()) { - it.next(); - last_query_.replace(it.key(), it.value().toString()); - } -#endif return success; diff --git a/src/core/sqlquery.h b/src/core/sqlquery.h index f9b36e6dd..576e6a1d1 100644 --- a/src/core/sqlquery.h +++ b/src/core/sqlquery.h @@ -53,11 +53,8 @@ class SqlQuery : public QSqlQuery { QString LastQuery() const; private: -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) QMap bound_values_; -#endif QString last_query_; - }; #endif // SQLQUERY_H diff --git a/src/core/standarditemiconloader.cpp b/src/core/standarditemiconloader.cpp index cc48638a8..99f4aa9b1 100644 --- a/src/core/standarditemiconloader.cpp +++ b/src/core/standarditemiconloader.cpp @@ -92,11 +92,7 @@ void StandardItemIconLoader::RowsAboutToBeRemoved(const QModelIndex &parent, int void StandardItemIconLoader::ModelReset() { -#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)) cover_loader_->CancelTasks(QSet(pending_covers_.keyBegin(), pending_covers_.keyEnd())); -#else - cover_loader_->CancelTasks(QSet::fromList(pending_covers_.keys())); -#endif pending_covers_.clear(); } diff --git a/src/covermanager/albumcoverchoicecontroller.cpp b/src/covermanager/albumcoverchoicecontroller.cpp index 626d9704f..996614901 100644 --- a/src/covermanager/albumcoverchoicecontroller.cpp +++ b/src/covermanager/albumcoverchoicecontroller.cpp @@ -507,11 +507,7 @@ void AlbumCoverChoiceController::ShowCover(const Song &song, const QPixmap &pixm } dialog->setWindowTitle(title_text); -#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)) dialog->setFixedSize(label->pixmap(Qt::ReturnByValue).size() / pixmap.devicePixelRatioF()); -#else - dialog->setFixedSize(label->pixmap()->size() / pixmap.devicePixelRatioF()); -#endif dialog->show(); } @@ -721,11 +717,7 @@ void AlbumCoverChoiceController::SaveCoverEmbeddedToCollectionSongs(const Song & void AlbumCoverChoiceController::SaveCoverEmbeddedToCollectionSongs(const QString &effective_albumartist, const QString &effective_album, const QString &cover_filename, const QByteArray &image_data, const QString &mime_type) { -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) QFuture future = QtConcurrent::run(&CollectionBackend::GetAlbumSongs, app_->collection_backend(), effective_albumartist, effective_album, CollectionFilterOptions()); -#else - QFuture future = QtConcurrent::run(&*app_->collection_backend(), &CollectionBackend::GetAlbumSongs, effective_albumartist, effective_album, CollectionFilterOptions()); -#endif QFutureWatcher *watcher = new QFutureWatcher(); QObject::connect(watcher, &QFutureWatcher::finished, this, [this, watcher, cover_filename, image_data, mime_type]() { const SongList collection_songs = watcher->result(); diff --git a/src/covermanager/albumcoverloader.cpp b/src/covermanager/albumcoverloader.cpp index d6664075b..839786c98 100644 --- a/src/covermanager/albumcoverloader.cpp +++ b/src/covermanager/albumcoverloader.cpp @@ -408,11 +408,7 @@ void AlbumCoverLoader::LoadRemoteImageFinished(QNetworkReply *reply, TaskPtr tas reply->deleteLater(); QVariant redirect = reply->attribute(QNetworkRequest::RedirectionTargetAttribute); -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) if (redirect.isValid() && redirect.metaType().id() == QMetaType::QUrl) { -#else - if (redirect.isValid() && redirect.type() == QVariant::Url) { -#endif if (task->redirects++ >= kMaxRedirects) { ProcessTask(task); return; diff --git a/src/covermanager/albumcovermanager.cpp b/src/covermanager/albumcovermanager.cpp index b7e94e69a..bf8fc45e6 100644 --- a/src/covermanager/albumcovermanager.cpp +++ b/src/covermanager/albumcovermanager.cpp @@ -319,11 +319,7 @@ void AlbumCoverManager::SaveSettings() { void AlbumCoverManager::CancelRequests() { -#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)) app_->album_cover_loader()->CancelTasks(QSet(cover_loading_tasks_.keyBegin(), cover_loading_tasks_.keyEnd())); -#else - app_->album_cover_loader()->CancelTasks(QSet::fromList(cover_loading_tasks_.keys())); -#endif cover_loading_pending_.clear(); cover_loading_tasks_.clear(); cover_save_tasks_.clear(); diff --git a/src/covermanager/albumcovermanagerlist.cpp b/src/covermanager/albumcovermanagerlist.cpp index cef1cb016..e5e3488be 100644 --- a/src/covermanager/albumcovermanagerlist.cpp +++ b/src/covermanager/albumcovermanagerlist.cpp @@ -42,11 +42,7 @@ AlbumCoverManagerList::AlbumCoverManagerList(QWidget *parent) : QListWidget(parent), manager_(nullptr) {} -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) QMimeData *AlbumCoverManagerList::mimeData(const QList &items) const { -#else -QMimeData *AlbumCoverManagerList::mimeData(const QList items) const { -#endif // Get songs SongList songs; diff --git a/src/covermanager/albumcovermanagerlist.h b/src/covermanager/albumcovermanagerlist.h index 129a21553..7bf9b132c 100644 --- a/src/covermanager/albumcovermanagerlist.h +++ b/src/covermanager/albumcovermanagerlist.h @@ -44,11 +44,7 @@ class AlbumCoverManagerList : public QListWidget { void set_cover_manager(AlbumCoverManager *manager) { manager_ = manager; } protected: -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) QMimeData *mimeData(const QList &items) const override; -#else - QMimeData *mimeData(const QList items) const override; -#endif void dropEvent(QDropEvent*) override {} diff --git a/src/device/devicemanager.cpp b/src/device/devicemanager.cpp index d5637cf03..6a68d1f21 100644 --- a/src/device/devicemanager.cpp +++ b/src/device/devicemanager.cpp @@ -107,11 +107,7 @@ DeviceManager::DeviceManager(Application *app, QObject *parent) QObject::connect(this, &DeviceManager::DeviceCreatedFromDB, this, &DeviceManager::AddDeviceFromDB); // This reads from the database and contents on the database mutex, which can be very slow on startup. -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) (void)QtConcurrent::run(&thread_pool_, &DeviceManager::LoadAllDevices, this); -#else - (void)QtConcurrent::run(&thread_pool_, this, &DeviceManager::LoadAllDevices); -#endif // This proxy model only shows connected devices connected_devices_model_ = new DeviceStateFilterModel(this); diff --git a/src/device/deviceproperties.cpp b/src/device/deviceproperties.cpp index b6e7bb7d4..41de0d838 100644 --- a/src/device/deviceproperties.cpp +++ b/src/device/deviceproperties.cpp @@ -243,11 +243,7 @@ void DeviceProperties::UpdateFormats() { // Get the device's supported formats list. This takes a long time and it blocks, so do it in the background. supported_formats_.clear(); -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) QFuture future = QtConcurrent::run(&ConnectedDevice::GetSupportedFiletypes, device, &supported_formats_); -#else - QFuture future = QtConcurrent::run(std::bind(&ConnectedDevice::GetSupportedFiletypes, device, &supported_formats_)); -#endif QFutureWatcher *watcher = new QFutureWatcher(); QObject::connect(watcher, &QFutureWatcher::finished, this, &DeviceProperties::UpdateFormatsFinished); watcher->setFuture(future); diff --git a/src/device/macosdevicelister.h b/src/device/macosdevicelister.h index 9f54b5530..f13944662 100644 --- a/src/device/macosdevicelister.h +++ b/src/device/macosdevicelister.h @@ -111,11 +111,8 @@ class MacOsDeviceLister : public DeviceLister { static QSet sMTPDeviceList; }; -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) size_t qHash(const MacOsDeviceLister::MTPDevice &device); -#else -uint qHash(const MacOsDeviceLister::MTPDevice &device); -#endif + inline bool operator==(const MacOsDeviceLister::MTPDevice &a, const MacOsDeviceLister::MTPDevice &b) { return (a.vendor_id == b.vendor_id) && (a.product_id == b.product_id); } diff --git a/src/device/macosdevicelister.mm b/src/device/macosdevicelister.mm index 80d2010bc..75b42301f 100644 --- a/src/device/macosdevicelister.mm +++ b/src/device/macosdevicelister.mm @@ -101,11 +101,7 @@ class ScopedIOObject { QSet MacOsDeviceLister::sMTPDeviceList; -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) size_t qHash(const MacOsDeviceLister::MTPDevice &d) { -#else -uint qHash(const MacOsDeviceLister::MTPDevice &d) { -#endif return qHash(d.vendor_id) ^ qHash(d.product_id); } diff --git a/src/dialogs/edittagdialog.cpp b/src/dialogs/edittagdialog.cpp index 3a5aa06cb..3a43c8fa6 100644 --- a/src/dialogs/edittagdialog.cpp +++ b/src/dialogs/edittagdialog.cpp @@ -326,11 +326,7 @@ bool EditTagDialog::eventFilter(QObject *o, QEvent *e) { case QEvent::MouseButtonRelease:{ QMouseEvent *mouse_event = static_cast(e); if (mouse_event && mouse_event->button() == Qt::RightButton) { -#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) cover_menu_->popup(mouse_event->globalPosition().toPoint()); -#else - cover_menu_->popup(mouse_event->globalPos()); -#endif } break; } diff --git a/src/dialogs/messagedialog.cpp b/src/dialogs/messagedialog.cpp index 1084e681a..5badef2b5 100644 --- a/src/dialogs/messagedialog.cpp +++ b/src/dialogs/messagedialog.cpp @@ -54,11 +54,7 @@ void MessageDialog::ShowMessage(const QString &title, const QString &message, co setWindowTitle(title); if (!icon.isNull()) { -#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) const QPixmap pixmap = icon.pixmap(QSize(64, 64), devicePixelRatioF()); -#else - const QPixmap pixmap = icon.pixmap(QSize(64, 64)); -#endif ui_->label_logo->setPixmap(pixmap); } diff --git a/src/dialogs/snapdialog.cpp b/src/dialogs/snapdialog.cpp index da4d55a6d..f73f334f1 100644 --- a/src/dialogs/snapdialog.cpp +++ b/src/dialogs/snapdialog.cpp @@ -30,11 +30,7 @@ SnapDialog::SnapDialog(QWidget *parent) : MessageDialog(parent) { setWindowTitle(tr("Strawberry is running as a Snap")); const QIcon icon = IconLoader::Load(QStringLiteral("dialog-warning")); -#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) const QPixmap pixmap = icon.pixmap(QSize(64, 64), devicePixelRatioF()); -#else - const QPixmap pixmap = icon.pixmap(QSize(64, 64)); -#endif ui_->label_logo->setPixmap(pixmap); QString text; diff --git a/src/engine/gstenginepipeline.cpp b/src/engine/gstenginepipeline.cpp index 528cdcaaf..4a60cd41d 100644 --- a/src/engine/gstenginepipeline.cpp +++ b/src/engine/gstenginepipeline.cpp @@ -485,16 +485,8 @@ bool GstEnginePipeline::InitAudioBin(QString &error) { if (device_.isValid()) { if (g_object_class_find_property(G_OBJECT_GET_CLASS(audiosink_), "device")) { -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) switch (device_.metaType().id()) { -#else - switch (device_.type()) { -#endif -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) case QMetaType::QString:{ -#else - case QVariant::String:{ -#endif const QString device = device_.toString(); if (!device.isEmpty()) { qLog(Debug) << "Setting device" << device << "for" << output_; @@ -505,11 +497,7 @@ bool GstEnginePipeline::InitAudioBin(QString &error) { } break; } -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) case QMetaType::QByteArray:{ -#else - case QVariant::ByteArray:{ -#endif QByteArray device = device_.toByteArray(); if (!device.isEmpty()) { qLog(Debug) << "Setting device" << device_ << "for" << output_; @@ -517,31 +505,19 @@ bool GstEnginePipeline::InitAudioBin(QString &error) { } break; } -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) case QMetaType::LongLong:{ -#else - case QVariant::LongLong:{ -#endif qint64 device = device_.toLongLong(); qLog(Debug) << "Setting device" << device << "for" << output_; g_object_set(G_OBJECT(audiosink_), "device", device, nullptr); break; } -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) case QMetaType::Int:{ -#else - case QVariant::Int:{ -#endif int device = device_.toInt(); qLog(Debug) << "Setting device" << device << "for" << output_; g_object_set(G_OBJECT(audiosink_), "device", device, nullptr); break; } -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) case QMetaType::QUuid:{ -#else - case QVariant::Uuid:{ -#endif QUuid device = device_.toUuid(); qLog(Debug) << "Setting device" << device << "for" << output_; g_object_set(G_OBJECT(audiosink_), "device", device, nullptr); @@ -553,16 +529,8 @@ bool GstEnginePipeline::InitAudioBin(QString &error) { } } else if (g_object_class_find_property(G_OBJECT_GET_CLASS(audiosink_), "device-clsid")) { -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) switch (device_.metaType().id()) { -#else - switch (device_.type()) { -#endif -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) case QMetaType::QString:{ -#else - case QVariant::String:{ -#endif QString device = device_.toString(); if (!device.isEmpty()) { qLog(Debug) << "Setting device-clsid" << device << "for" << output_; @@ -570,11 +538,7 @@ bool GstEnginePipeline::InitAudioBin(QString &error) { } break; } -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) case QMetaType::QByteArray:{ -#else - case QVariant::ByteArray:{ -#endif QByteArray device = device_.toByteArray(); if (!device.isEmpty()) { qLog(Debug) << "Setting device-clsid" << device_ << "for" << output_; @@ -588,16 +552,8 @@ bool GstEnginePipeline::InitAudioBin(QString &error) { } } else if (g_object_class_find_property(G_OBJECT_GET_CLASS(audiosink_), "port-pattern")) { -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) switch (device_.metaType().id()) { -#else - switch (device_.type()) { -#endif -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) case QMetaType::QString:{ -#else - case QVariant::String:{ -#endif QString port_pattern = device_.toString(); if (!port_pattern.isEmpty()) { qLog(Debug) << "Setting port pattern" << port_pattern << "for" << output_; @@ -606,11 +562,7 @@ bool GstEnginePipeline::InitAudioBin(QString &error) { break; } -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) case QMetaType::QByteArray:{ -#else - case QVariant::ByteArray:{ -#endif QByteArray port_pattern = device_.toByteArray(); if (!port_pattern.isEmpty()) { qLog(Debug) << "Setting port pattern" << port_pattern << "for" << output_; diff --git a/src/engine/vlcengine.cpp b/src/engine/vlcengine.cpp index 7d6fd1467..aa18758ae 100644 --- a/src/engine/vlcengine.cpp +++ b/src/engine/vlcengine.cpp @@ -137,13 +137,7 @@ bool VLCEngine::Play(const bool pause, const quint64 offset_nanosec) { } // Set audio device - if (device_.isValid() && -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) - device_.metaType().id() == QMetaType::QString -#else - device_.type() == QVariant::String -#endif - && !device_.toString().isEmpty()) { + if (device_.isValid() && device_.metaType().id() == QMetaType::QString && !device_.toString().isEmpty()) { libvlc_audio_output_device_set(player_, nullptr, device_.toString().toLocal8Bit().data()); } diff --git a/src/globalshortcuts/globalshortcut-win.cpp b/src/globalshortcuts/globalshortcut-win.cpp index fd90961d9..eea4a2702 100644 --- a/src/globalshortcuts/globalshortcut-win.cpp +++ b/src/globalshortcuts/globalshortcut-win.cpp @@ -91,11 +91,7 @@ bool GlobalShortcut::unregisterShortcut(const int native_key, const int native_m } -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) bool GlobalShortcut::nativeEventFilter(const QByteArray &eventtype, void *message, qintptr *result) { -#else -bool GlobalShortcut::nativeEventFilter(const QByteArray &eventtype, void *message, long *result) { -#endif Q_UNUSED(eventtype); Q_UNUSED(result); diff --git a/src/globalshortcuts/globalshortcut-x11.cpp b/src/globalshortcuts/globalshortcut-x11.cpp index 050ade648..259a68d5c 100644 --- a/src/globalshortcuts/globalshortcut-x11.cpp +++ b/src/globalshortcuts/globalshortcut-x11.cpp @@ -170,11 +170,7 @@ bool GlobalShortcut::unregisterShortcut(const int native_key, const int native_m } -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) bool GlobalShortcut::nativeEventFilter(const QByteArray &eventtype, void *message, qintptr *result) { -#else -bool GlobalShortcut::nativeEventFilter(const QByteArray &eventtype, void *message, long *result) { -#endif Q_UNUSED(eventtype); Q_UNUSED(result); diff --git a/src/globalshortcuts/globalshortcut.cpp b/src/globalshortcuts/globalshortcut.cpp index 379350848..5c18a0641 100644 --- a/src/globalshortcuts/globalshortcut.cpp +++ b/src/globalshortcuts/globalshortcut.cpp @@ -26,9 +26,7 @@ #include #include #include -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) -# include -#endif +#include #include "core/logging.h" @@ -85,15 +83,9 @@ bool GlobalShortcut::setShortcut(const QKeySequence &shortcut) { if (shortcut.isEmpty()) return false; shortcut_ = shortcut; -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) - QKeyCombination key_combination(shortcut[0]); + const QKeyCombination key_combination = shortcut[0]; qt_key_ = key_combination.key(); qt_mods_ = key_combination.keyboardModifiers(); -#else - Qt::KeyboardModifiers all_mods = Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt::MetaModifier; - qt_key_ = Qt::Key((shortcut[0] ^ all_mods) & shortcut[0]); - qt_mods_ = Qt::KeyboardModifiers(shortcut[0] & all_mods); -#endif native_key_ = nativeKeycode(qt_key_.value()); if (native_key_ == 0) return false; diff --git a/src/globalshortcuts/globalshortcut.h b/src/globalshortcuts/globalshortcut.h index 551e112ab..3542986a5 100644 --- a/src/globalshortcuts/globalshortcut.h +++ b/src/globalshortcuts/globalshortcut.h @@ -64,11 +64,7 @@ class GlobalShortcut : public QObject, QAbstractNativeEventFilter { static bool registerShortcut(const int native_key, const int native_mods); static bool unregisterShortcut(const int native_key, const int native_mods); -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) bool nativeEventFilter(const QByteArray &eventtype, void *message, qintptr *result) override; -#else - bool nativeEventFilter(const QByteArray &eventtype, void *message, long *result) override; -#endif static GlobalShortcut *initialized_; static QHash, GlobalShortcut*> internal_shortcuts_; diff --git a/src/globalshortcuts/globalshortcutsbackend-kde.cpp b/src/globalshortcuts/globalshortcutsbackend-kde.cpp index f93b19683..3c6d99f8b 100644 --- a/src/globalshortcuts/globalshortcutsbackend-kde.cpp +++ b/src/globalshortcuts/globalshortcutsbackend-kde.cpp @@ -29,9 +29,7 @@ #include #include #include -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) -# include -#endif +#include #include "core/logging.h" @@ -190,11 +188,7 @@ QList GlobalShortcutsBackendKDE::ToIntList(const QList &seque QList ret; ret.reserve(sequence_list.count()); for (const QKeySequence &sequence : sequence_list) { -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) ret.append(sequence[0].toCombined()); -#else - ret.append(sequence[0]); -#endif } return ret; diff --git a/src/main.cpp b/src/main.cpp index 9f82cffd3..ecc0580cc 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -76,11 +76,7 @@ #include #ifdef HAVE_QTSPARKLE -# if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) -# include -# else -# include -# endif +# include #endif // HAVE_QTSPARKLE #ifdef Q_OS_MACOS @@ -136,11 +132,6 @@ int main(int argc, char *argv[]) { QCoreApplication::setApplicationVersion(QStringLiteral(STRAWBERRY_VERSION_DISPLAY)); QCoreApplication::setOrganizationDomain(QStringLiteral("strawberrymusicplayer.org")); -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) - QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); - QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); -#endif - // This makes us show up nicely in gnome-volume-control g_set_application_name("Strawberry"); g_setenv("PULSE_PROP_application.icon_name", "strawberry", TRUE); @@ -273,11 +264,7 @@ int main(int argc, char *argv[]) { ScopedPtr translations(new Translations); -# if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) translations->LoadTranslation(QStringLiteral("qt"), QLibraryInfo::path(QLibraryInfo::TranslationsPath), language); -# else - translations->LoadTranslation(QStringLiteral("qt"), QLibraryInfo::location(QLibraryInfo::TranslationsPath), language); -# endif translations->LoadTranslation(QStringLiteral("strawberry"), QStringLiteral(":/translations"), language); translations->LoadTranslation(QStringLiteral("strawberry"), QStringLiteral(TRANSLATIONS_DIR), language); translations->LoadTranslation(QStringLiteral("strawberry"), QCoreApplication::applicationDirPath(), language); diff --git a/src/musicbrainz/musicbrainzclient.cpp b/src/musicbrainz/musicbrainzclient.cpp index 16b09cfae..c08114b0c 100644 --- a/src/musicbrainz/musicbrainzclient.cpp +++ b/src/musicbrainz/musicbrainzclient.cpp @@ -500,11 +500,7 @@ MusicBrainzClient::ResultList MusicBrainzClient::UniqueResults(const ResultList ResultList ret; if (opt == UniqueResultsSortOption::SortResults) { -#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)) ret = QSet(results.begin(), results.end()).values(); -#else - ret = QSet::fromList(results).values(); -#endif std::sort(ret.begin(), ret.end()); } else { // KeepOriginalOrder diff --git a/src/musicbrainz/musicbrainzclient.h b/src/musicbrainz/musicbrainzclient.h index 6ddbc52a5..1bb5eab97 100644 --- a/src/musicbrainz/musicbrainzclient.h +++ b/src/musicbrainz/musicbrainzclient.h @@ -212,11 +212,7 @@ class MusicBrainzClient : public QObject { }; -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) inline size_t qHash(const MusicBrainzClient::Result &result) { -#else -inline uint qHash(const MusicBrainzClient::Result &result) { -#endif return qHash(result.album_) ^ qHash(result.artist_) ^ result.duration_msec_ ^ qHash(result.title_) ^ result.track_ ^ result.year_; } diff --git a/src/osd/osdpretty.cpp b/src/osd/osdpretty.cpp index aed365bcf..f9746b844 100644 --- a/src/osd/osdpretty.cpp +++ b/src/osd/osdpretty.cpp @@ -464,11 +464,8 @@ void OSDPretty::Reposition() { } -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) void OSDPretty::enterEvent(QEnterEvent*) { -#else -void OSDPretty::enterEvent(QEvent*) { -#endif + if (mode_ == Mode::Popup) { setWindowOpacity(0.25); } @@ -486,11 +483,7 @@ void OSDPretty::mousePressEvent(QMouseEvent *e) { } else { original_window_pos_ = pos(); -#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) drag_start_pos_ = e->globalPosition().toPoint(); -#else - drag_start_pos_ = e->globalPos(); -#endif } } @@ -498,19 +491,11 @@ void OSDPretty::mousePressEvent(QMouseEvent *e) { void OSDPretty::mouseMoveEvent(QMouseEvent *e) { if (mode_ == Mode::Draggable) { -#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) QPoint delta = e->globalPosition().toPoint() - drag_start_pos_; -#else - QPoint delta = e->globalPos() - drag_start_pos_; -#endif QPoint new_pos = original_window_pos_ + delta; // Keep it to the bounds of the desktop -#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) QScreen *screen = current_screen(e->globalPosition().toPoint()); -#else - QScreen *screen = current_screen(e->globalPos()); -#endif if (!screen) return; QRect geometry = screen->availableGeometry(); diff --git a/src/osd/osdpretty.h b/src/osd/osdpretty.h index 78212e14b..a7f661552 100644 --- a/src/osd/osdpretty.h +++ b/src/osd/osdpretty.h @@ -114,11 +114,7 @@ class OSDPretty : public QWidget { protected: void paintEvent(QPaintEvent *e) override; -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) void enterEvent(QEnterEvent*) override; -#else - void enterEvent(QEvent*) override; -#endif void leaveEvent(QEvent*) override; void mousePressEvent(QMouseEvent *e) override; void showEvent(QShowEvent *e) override; diff --git a/src/playlist/playlist.cpp b/src/playlist/playlist.cpp index a032beaaf..286f66158 100644 --- a/src/playlist/playlist.cpp +++ b/src/playlist/playlist.cpp @@ -744,15 +744,9 @@ void Playlist::set_current_row(const int i, const AutoScroll autoscroll, const b if (current_item_index_.isValid()) { last_played_item_index_ = current_item_index_; played_indexes_.append(current_item_index_); -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) if (played_indexes_.count() > kMaxPlayedIndexes) { played_indexes_.remove(0, played_indexes_.count() - kMaxPlayedIndexes); } -#else - while (played_indexes_.count() > kMaxPlayedIndexes) { - played_indexes_.removeFirst(); - } -#endif ScheduleSave(); } @@ -1563,11 +1557,7 @@ void Playlist::Restore() { collection_items_by_id_.clear(); cancel_restore_ = false; -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) QFuture future = QtConcurrent::run(&PlaylistBackend::GetPlaylistItems, backend_, id_); -#else - QFuture future = QtConcurrent::run(&*backend_, &PlaylistBackend::GetPlaylistItems, id_); -#endif QFutureWatcher *watcher = new QFutureWatcher(); QObject::connect(watcher, &QFutureWatcher::finished, this, &Playlist::ItemsLoaded); watcher->setFuture(future); @@ -1626,11 +1616,7 @@ void Playlist::ItemsLoaded() { // Should we gray out deleted songs asynchronously on startup? if (greyout) { -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) (void)QtConcurrent::run(&Playlist::InvalidateDeletedSongs, this); -#else - (void)QtConcurrent::run(this, &Playlist::InvalidateDeletedSongs); -#endif } Q_EMIT PlaylistLoaded(); diff --git a/src/playlist/playlistdelegates.cpp b/src/playlist/playlistdelegates.cpp index 0b1799bf5..a3981c405 100644 --- a/src/playlist/playlistdelegates.cpp +++ b/src/playlist/playlistdelegates.cpp @@ -172,11 +172,7 @@ QString PlaylistDelegateBase::displayText(const QVariant &value, const QLocale&) QString text; -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) switch (value.metaType().id()) { -#else - switch (static_cast(value.type())) { -#endif case QMetaType::Int:{ int v = value.toInt(); if (v > 0) text = QString::number(v); @@ -441,11 +437,7 @@ QString NativeSeparatorsDelegate::displayText(const QVariant &value, const QLoca const QString string_value = value.toString(); QUrl url; -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) if (value.metaType().id() == QMetaType::QUrl) { -#else - if (value.type() == QVariant::Url) { -#endif url = value.toUrl(); } else if (string_value.contains(QLatin1String("://"))) { @@ -478,11 +470,7 @@ QPixmap SongSourceDelegate::LookupPixmap(const Song::Source source, const QSize } QIcon icon(Song::IconForSource(source)); -#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) pixmap = icon.pixmap(size, device_pixel_ratio); -#else - pixmap = icon.pixmap(size); -#endif QPixmapCache::insert(pixmap_cache_key, pixmap); return pixmap; diff --git a/src/playlist/playlistfilter.cpp b/src/playlist/playlistfilter.cpp index 21507506d..7bbba9f7a 100644 --- a/src/playlist/playlistfilter.cpp +++ b/src/playlist/playlistfilter.cpp @@ -57,11 +57,7 @@ bool PlaylistFilter::filterAcceptsRow(const int source_row, const QModelIndex &s if (filter_string_.isEmpty()) return true; -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) size_t hash = qHash(filter_string_); -#else - uint hash = qHash(filter_string_); -#endif if (hash != query_hash_) { FilterParser p(filter_string_); filter_tree_.reset(p.parse()); diff --git a/src/playlist/playlistfilter.h b/src/playlist/playlistfilter.h index 1312e2080..98557a741 100644 --- a/src/playlist/playlistfilter.h +++ b/src/playlist/playlistfilter.h @@ -50,11 +50,7 @@ class PlaylistFilter : public QSortFilterProxyModel { private: // Mutable because they're modified from filterAcceptsRow() const mutable QScopedPointer filter_tree_; -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) mutable size_t query_hash_; -#else - mutable uint query_hash_; -#endif QString filter_string_; }; diff --git a/src/playlist/playlistheader.cpp b/src/playlist/playlistheader.cpp index 067a3fd77..c4ea58a33 100644 --- a/src/playlist/playlistheader.cpp +++ b/src/playlist/playlistheader.cpp @@ -164,11 +164,7 @@ void PlaylistHeader::ToggleVisible(const int section) { Q_EMIT SectionVisibilityChanged(section, !isSectionHidden(section)); } -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) void PlaylistHeader::enterEvent(QEnterEvent*) { -#else -void PlaylistHeader::enterEvent(QEvent*) { -#endif Q_EMIT MouseEntered(); } diff --git a/src/playlist/playlistheader.h b/src/playlist/playlistheader.h index 08247989d..18080b67c 100644 --- a/src/playlist/playlistheader.h +++ b/src/playlist/playlistheader.h @@ -32,7 +32,6 @@ class QMenu; class QAction; -class QEvent; class QContextMenuEvent; class QEnterEvent; @@ -46,11 +45,7 @@ class PlaylistHeader : public StretchHeaderView { // QWidget void contextMenuEvent(QContextMenuEvent *e) override; -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) void enterEvent(QEnterEvent*) override; -#else - void enterEvent(QEvent*) override; -#endif Q_SIGNALS: void SectionVisibilityChanged(const int logical_index, const bool visible); diff --git a/src/playlist/playlistlistmodel.cpp b/src/playlist/playlistlistmodel.cpp index 29b2c9a58..62b4e2240 100644 --- a/src/playlist/playlistlistmodel.cpp +++ b/src/playlist/playlistlistmodel.cpp @@ -164,12 +164,7 @@ QStandardItem *PlaylistListModel::FolderByPath(const QString &path) { // inefficient but maintaining a path -> item map is difficult. QStandardItem *parent = invisibleRootItem(); -#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) const QStringList parts = path.split(QLatin1Char('/'), Qt::SkipEmptyParts); -#else - const QStringList parts = path.split(QLatin1Char('/'), QString::SkipEmptyParts); -#endif - for (const QString &part : parts) { QStandardItem *matching_child = nullptr; diff --git a/src/playlist/playlistlistview.cpp b/src/playlist/playlistlistview.cpp index fd1f1b6ab..0b63c1fa1 100644 --- a/src/playlist/playlistlistview.cpp +++ b/src/playlist/playlistlistview.cpp @@ -84,11 +84,7 @@ void PlaylistListView::dragEnterEvent(QDragEnterEvent *e) { void PlaylistListView::dragMoveEvent(QDragMoveEvent *e) { -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) - QModelIndex drag_hover_tab_ = indexAt(e->position().toPoint()); -#else - QModelIndex drag_hover_tab_ = indexAt(e->pos()); -#endif + QModelIndex drag_hover_tab_ = indexAt(e->position().toPoint()); if (e->mimeData()->hasFormat(QLatin1String(Playlist::kRowsMimetype))) { if (drag_hover_tab_ != currentIndex()) { diff --git a/src/playlist/playlistmanager.cpp b/src/playlist/playlistmanager.cpp index 222dadc75..790d39392 100644 --- a/src/playlist/playlistmanager.cpp +++ b/src/playlist/playlistmanager.cpp @@ -224,11 +224,7 @@ void PlaylistManager::Save(const int id, const QString &filename, const Playlist } else { // Playlist is not in the playlist manager: probably save action was triggered from the left sidebar and the playlist isn't loaded. -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) QFuture future = QtConcurrent::run(&PlaylistBackend::GetPlaylistSongs, playlist_backend_, id); -#else - QFuture future = QtConcurrent::run(&*playlist_backend_, &PlaylistBackend::GetPlaylistSongs, id); -#endif QFutureWatcher *watcher = new QFutureWatcher(); QObject::connect(watcher, &QFutureWatcher::finished, this, [this, watcher, filename, path_type]() { ItemsLoadedForSavePlaylist(watcher->result(), filename, path_type); diff --git a/src/playlist/playlisttabbar.cpp b/src/playlist/playlisttabbar.cpp index 56f66277f..99c6b31a9 100644 --- a/src/playlist/playlisttabbar.cpp +++ b/src/playlist/playlisttabbar.cpp @@ -390,11 +390,7 @@ void PlaylistTabBar::dragEnterEvent(QDragEnterEvent *e) { void PlaylistTabBar::dragMoveEvent(QDragMoveEvent *e) { -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) drag_hover_tab_ = tabAt(e->position().toPoint()); -#else - drag_hover_tab_ = tabAt(e->pos()); -#endif if (drag_hover_tab_ != -1) { e->setDropAction(Qt::CopyAction); diff --git a/src/playlist/playlistview.cpp b/src/playlist/playlistview.cpp index ba86ffb09..f636fea18 100644 --- a/src/playlist/playlistview.cpp +++ b/src/playlist/playlistview.cpp @@ -91,11 +91,7 @@ constexpr int kDropIndicatorGradientWidth = 5; PlaylistView::PlaylistView(QWidget *parent) : QTreeView(parent), app_(nullptr), -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) style_(new PlaylistProxyStyle(QApplication::style()->name())), -#else - style_(new PlaylistProxyStyle(QApplication::style()->objectName())), -#endif playlist_(nullptr), header_(new PlaylistHeader(Qt::Horizontal, this, this)), background_image_type_(AppearanceSettingsPage::BackgroundImageType::Default), @@ -1130,11 +1126,7 @@ void PlaylistView::dragMoveEvent(QDragMoveEvent *event) { QTreeView::dragMoveEvent(event); -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) QModelIndex idx(indexAt(event->position().toPoint())); -#else - QModelIndex idx(indexAt(event->pos())); -#endif drop_indicator_row_ = idx.isValid() ? idx.row() : 0; @@ -1385,11 +1377,7 @@ void PlaylistView::CopyCurrentSongToClipboard() const { } const QVariant var_data = model()->data(currentIndex().sibling(currentIndex().row(), i)); -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) if (var_data.metaType().id() == QMetaType::QString) { -#else - if (var_data.type() == QVariant::String) { -#endif columns << var_data.toString(); } } diff --git a/src/playlist/songloaderinserter.cpp b/src/playlist/songloaderinserter.cpp index 05dfce69c..92a7ed8c0 100644 --- a/src/playlist/songloaderinserter.cpp +++ b/src/playlist/songloaderinserter.cpp @@ -87,11 +87,7 @@ void SongLoaderInserter::Load(Playlist *destination, int row, bool play_now, boo deleteLater(); } else { -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) (void)QtConcurrent::run(&SongLoaderInserter::AsyncLoad, this); -#else - (void)QtConcurrent::run(this, &SongLoaderInserter::AsyncLoad); -#endif } } diff --git a/src/playlistparsers/asxiniparser.cpp b/src/playlistparsers/asxiniparser.cpp index 27e634925..7624834fc 100644 --- a/src/playlistparsers/asxiniparser.cpp +++ b/src/playlistparsers/asxiniparser.cpp @@ -33,12 +33,6 @@ class CollectionBackendInterface; -#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) -constexpr auto qt_endl = Qt::endl; -#else -constexpr auto qt_endl = endl; -#endif - AsxIniParser::AsxIniParser(SharedPtr collection_backend, QObject *parent) : ParserBase(collection_backend, parent) {} @@ -73,11 +67,11 @@ SongList AsxIniParser::Load(QIODevice *device, const QString &playlist_path, con void AsxIniParser::Save(const SongList &songs, QIODevice *device, const QDir &dir, const PlaylistSettingsPage::PathType path_type) const { QTextStream s(device); - s << "[Reference]" << qt_endl; + s << "[Reference]" << Qt::endl; int n = 1; for (const Song &song : songs) { - s << "Ref" << n << "=" << URLOrFilename(song.url(), dir, path_type) << qt_endl; + s << "Ref" << n << "=" << URLOrFilename(song.url(), dir, path_type) << Qt::endl; ++n; } diff --git a/src/playlistparsers/cueparser.cpp b/src/playlistparsers/cueparser.cpp index 43f54433e..6601c7f82 100644 --- a/src/playlistparsers/cueparser.cpp +++ b/src/playlistparsers/cueparser.cpp @@ -30,11 +30,7 @@ #include #include #include -#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) -# include -#else -# include -#endif +#include #include "core/shared_ptr.h" #include "core/logging.h" @@ -76,7 +72,6 @@ SongList CueParser::Load(QIODevice *device, const QString &playlist_path, const const QByteArray data_chunk = device->peek(1024); -#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) std::optional encoding = QStringConverter::encodingForData(data_chunk); if (encoding.has_value()) { text_stream.setEncoding(encoding.value()); @@ -90,12 +85,6 @@ SongList CueParser::Load(QIODevice *device, const QString &playlist_path, const } } } -#else - const QByteArray encoding_name = Utilities::TextEncodingFromData(data_chunk); - if (!encoding_name.isEmpty()) { - text_stream.setCodec(encoding_name.constData()); - } -#endif QString dir_path = dir.absolutePath(); // Read the first line already diff --git a/src/playlistparsers/plsparser.cpp b/src/playlistparsers/plsparser.cpp index f9815ee9d..ba2d50568 100644 --- a/src/playlistparsers/plsparser.cpp +++ b/src/playlistparsers/plsparser.cpp @@ -36,12 +36,6 @@ class CollectionBackendInterface; -#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) -constexpr auto qt_endl = Qt::endl; -#else -constexpr auto qt_endl = endl; -#endif - PLSParser::PLSParser(SharedPtr collection_backend, QObject *parent) : ParserBase(collection_backend, parent) {} @@ -90,15 +84,15 @@ SongList PLSParser::Load(QIODevice *device, const QString &playlist_path, const void PLSParser::Save(const SongList &songs, QIODevice *device, const QDir &dir, const PlaylistSettingsPage::PathType path_type) const { QTextStream s(device); - s << "[playlist]" << qt_endl; - s << "Version=2" << qt_endl; - s << "NumberOfEntries=" << songs.count() << qt_endl; + s << "[playlist]" << Qt::endl; + s << "Version=2" << Qt::endl; + s << "NumberOfEntries=" << songs.count() << Qt::endl; int n = 1; for (const Song &song : songs) { - s << "File" << n << "=" << URLOrFilename(song.url(), dir, path_type) << qt_endl; - s << "Title" << n << "=" << song.title() << qt_endl; - s << "Length" << n << "=" << song.length_nanosec() / kNsecPerSec << qt_endl; + s << "File" << n << "=" << URLOrFilename(song.url(), dir, path_type) << Qt::endl; + s << "Title" << n << "=" << song.title() << Qt::endl; + s << "Length" << n << "=" << song.length_nanosec() / kNsecPerSec << Qt::endl; ++n; } diff --git a/src/radios/radiomodel.cpp b/src/radios/radiomodel.cpp index 498468511..34ca72b1b 100644 --- a/src/radios/radiomodel.cpp +++ b/src/radios/radiomodel.cpp @@ -198,11 +198,7 @@ bool RadioModel::CompareItems(const RadioItem *a, const RadioItem *b) const { QVariant left(data(a, RadioModel::Role_SortText)); QVariant right(data(b, RadioModel::Role_SortText)); -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) if (left.metaType().id() == QMetaType::Int) -#else - if (left.type() == QVariant::Int) -#endif return left.toInt() < right.toInt(); else return left.toString() < right.toString(); diff --git a/src/scrobbler/scrobblercache.cpp b/src/scrobbler/scrobblercache.cpp index 1d8228a06..ee9a35a17 100644 --- a/src/scrobbler/scrobblercache.cpp +++ b/src/scrobbler/scrobblercache.cpp @@ -71,11 +71,7 @@ void ScrobblerCache::ReadCache() { if (!result) return; QTextStream stream(&file); -#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) stream.setEncoding(QStringConverter::Encoding::Utf8); -#else - stream.setCodec("UTF-8"); -#endif QString data = stream.readAll(); file.close(); @@ -238,11 +234,7 @@ void ScrobblerCache::WriteCache() { return; } QTextStream stream(&file); -#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) stream.setEncoding(QStringConverter::Encoding::Utf8); -#else - stream.setCodec("UTF-8"); -#endif stream << doc.toJson(); file.close(); diff --git a/src/settings/backendsettingspage.cpp b/src/settings/backendsettingspage.cpp index d84df2a2e..bbb7165c5 100644 --- a/src/settings/backendsettingspage.cpp +++ b/src/settings/backendsettingspage.cpp @@ -449,13 +449,7 @@ void BackendSettingsPage::Load_Device(const QString &output, const QVariant &dev } // This allows a custom ALSA device string ie: "hw:0,0" even if it is not listed. - if (engine()->CustomDeviceSupport(output) && -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) - device.metaType().id() == QMetaType::QString -#else - device.type() == QVariant::String -#endif - && !device.toString().isEmpty()) { + if (engine()->CustomDeviceSupport(output) && device.metaType().id() == QMetaType::QString && !device.toString().isEmpty()) { ui_->lineedit_device->setText(device.toString()); if (!found) { for (int i = 0; i < ui_->combobox_device->count(); ++i) { @@ -600,11 +594,7 @@ void BackendSettingsPage::DeviceSelectionChanged(int index) { if (engine()->CustomDeviceSupport(output.name)) { ui_->lineedit_device->setEnabled(true); if (ui_->combobox_device->currentText() != QLatin1String(kOutputCustom)) { -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) if (device.metaType().id() == QMetaType::QString) -#else - if (device.type() == QVariant::String) -#endif ui_->lineedit_device->setText(device.toString()); else ui_->lineedit_device->clear(); } @@ -644,11 +634,7 @@ void BackendSettingsPage::DeviceStringChanged() { for (int i = 0; i < ui_->combobox_device->count(); ++i) { QVariant device = ui_->combobox_device->itemData(i).value(); -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) if (device.metaType().id() != QMetaType::QString) continue; -#else - if (device.type() != QVariant::String) continue; -#endif QString device_str = device.toString(); if (device_str.isEmpty()) continue; if (ui_->combobox_device->itemText(i) == QLatin1String(kOutputCustom)) continue; @@ -831,11 +817,7 @@ void BackendSettingsPage::SelectDevice(const QString &device_new) { QListView *view = qobject_cast(ui_->combobox_device->view()); if (view && view->isRowHidden(i)) continue; QVariant device = ui_->combobox_device->itemData(i).value(); -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) if (device.metaType().id() != QMetaType::QString) continue; -#else - if (device.type() != QVariant::String) continue; -#endif QString device_str = device.toString(); if (device_str.isEmpty()) continue; if (device_str == device_new) { diff --git a/src/settings/collectionsettingspage.cpp b/src/settings/collectionsettingspage.cpp index 516f70598..64677e7dc 100644 --- a/src/settings/collectionsettingspage.cpp +++ b/src/settings/collectionsettingspage.cpp @@ -171,12 +171,7 @@ void CollectionSettingsPage::Load() { ui_->checkbox_overwrite_playcount->setChecked(s.value("overwrite_playcount", false).toBool()); ui_->checkbox_overwrite_rating->setChecked(s.value("overwrite_rating", false).toBool()); -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) ui_->checkbox_delete_files->setChecked(s.value("delete_files", false).toBool()); -#else - ui_->checkbox_delete_files->setChecked(false); - ui_->checkbox_delete_files->hide(); -#endif s.endGroup(); @@ -208,11 +203,7 @@ void CollectionSettingsPage::Save() { QString filter_text = ui_->cover_art_patterns->text(); -#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) - QStringList filters = filter_text.split(QLatin1Char(','), Qt::SkipEmptyParts); -#else - QStringList filters = filter_text.split(QLatin1Char(','), QString::SkipEmptyParts); -#endif + const QStringList filters = filter_text.split(QLatin1Char(','), Qt::SkipEmptyParts); s.setValue("cover_art_patterns", filters); diff --git a/src/settings/playlistsettingspage.cpp b/src/settings/playlistsettingspage.cpp index 80c27dc81..18417a1b1 100644 --- a/src/settings/playlistsettingspage.cpp +++ b/src/settings/playlistsettingspage.cpp @@ -95,12 +95,7 @@ void PlaylistSettingsPage::Load() { ui_->checkbox_editmetadatainline->setChecked(s.value("editmetadatainline", false).toBool()); ui_->checkbox_writemetadata->setChecked(s.value("write_metadata", false).toBool()); -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) ui_->checkbox_delete_files->setChecked(s.value("delete_files", false).toBool()); -#else - ui_->checkbox_delete_files->setChecked(false); - ui_->checkbox_delete_files->hide(); -#endif s.endGroup(); diff --git a/src/settings/subsonicsettingspage.cpp b/src/settings/subsonicsettingspage.cpp index c3756224d..9296c47de 100644 --- a/src/settings/subsonicsettingspage.cpp +++ b/src/settings/subsonicsettingspage.cpp @@ -60,11 +60,7 @@ SubsonicSettingsPage::SubsonicSettingsPage(SettingsDialog *dialog, QWidget *pare dialog->installEventFilter(this); -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) ui_->checkbox_http2->show(); -#else - ui_->checkbox_http2->hide(); -#endif } diff --git a/src/smartplaylists/smartplaylistsearchtermwidget.cpp b/src/smartplaylists/smartplaylistsearchtermwidget.cpp index 8ee71d6a7..47c498c54 100644 --- a/src/smartplaylists/smartplaylistsearchtermwidget.cpp +++ b/src/smartplaylists/smartplaylistsearchtermwidget.cpp @@ -231,11 +231,7 @@ void SmartPlaylistSearchTermWidget::SetActive(bool active) { } -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) void SmartPlaylistSearchTermWidget::enterEvent(QEnterEvent *e) { -#else -void SmartPlaylistSearchTermWidget::enterEvent(QEvent *e) { -#endif Q_UNUSED(e) diff --git a/src/smartplaylists/smartplaylistsearchtermwidget.h b/src/smartplaylists/smartplaylistsearchtermwidget.h index d1e185770..7e164727b 100644 --- a/src/smartplaylists/smartplaylistsearchtermwidget.h +++ b/src/smartplaylists/smartplaylistsearchtermwidget.h @@ -63,14 +63,10 @@ class SmartPlaylistSearchTermWidget : public QWidget { void Changed(); protected: - void showEvent(QShowEvent*) override; -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) - void enterEvent(QEnterEvent*) override; -#else - void enterEvent(QEvent*) override; -#endif - void leaveEvent(QEvent*) override; - void resizeEvent(QResizeEvent*) override; + void showEvent(QShowEvent *e) override; + void enterEvent(QEnterEvent *e) override; + void leaveEvent(QEvent *e) override; + void resizeEvent(QResizeEvent *e) override; private Q_SLOTS: void FieldChanged(const int index); diff --git a/src/spotify/spotifyfavoriterequest.cpp b/src/spotify/spotifyfavoriterequest.cpp index ed9c7d80d..e4e6834b6 100644 --- a/src/spotify/spotifyfavoriterequest.cpp +++ b/src/spotify/spotifyfavoriterequest.cpp @@ -249,11 +249,7 @@ void SpotifyFavoriteRequest::RemoveFavoritesRequest(const FavoriteType type, con url.setQuery(url_query); } QNetworkRequest req(url); -#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0) req.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::NoLessSafeRedirectPolicy); -#else - req.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true); -#endif req.setHeader(QNetworkRequest::ContentTypeHeader, QStringLiteral("application/x-www-form-urlencoded")); if (!access_token().isEmpty()) req.setRawHeader("authorization", "Bearer " + access_token().toUtf8()); QNetworkReply *reply = nullptr; diff --git a/src/streaming/streamingsearchmodel.h b/src/streaming/streamingsearchmodel.h index 42dc04585..c61f1293a 100644 --- a/src/streaming/streamingsearchmodel.h +++ b/src/streaming/streamingsearchmodel.h @@ -96,11 +96,7 @@ class StreamingSearchModel : public QStandardItemModel { QMap containers_; }; -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) inline size_t qHash(const StreamingSearchModel::ContainerKey &key) { -#else -inline uint qHash(const StreamingSearchModel::ContainerKey &key) { -#endif return qHash(key.group_[0]) ^ qHash(key.group_[1]) ^ qHash(key.group_[2]); } diff --git a/src/subsonic/subsonicbaserequest.cpp b/src/subsonic/subsonicbaserequest.cpp index f48d4ecf4..f00c65075 100644 --- a/src/subsonic/subsonicbaserequest.cpp +++ b/src/subsonic/subsonicbaserequest.cpp @@ -107,10 +107,7 @@ QNetworkReply *SubsonicBaseRequest::CreateGetRequest(const QString &ressource_na req.setHeader(QNetworkRequest::ContentTypeHeader, QStringLiteral("application/x-www-form-urlencoded")); req.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::NoLessSafeRedirectPolicy); - -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) req.setAttribute(QNetworkRequest::Http2AllowedAttribute, http2()); -#endif QNetworkReply *reply = network_->get(req); QObject::connect(reply, &QNetworkReply::sslErrors, this, &SubsonicBaseRequest::HandleSSLErrors); diff --git a/src/subsonic/subsonicrequest.cpp b/src/subsonic/subsonicrequest.cpp index 0e89be0bb..59aa230f9 100644 --- a/src/subsonic/subsonicrequest.cpp +++ b/src/subsonic/subsonicrequest.cpp @@ -742,10 +742,7 @@ void SubsonicRequest::FlushAlbumCoverRequests() { QNetworkRequest req(request.url); req.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::NoLessSafeRedirectPolicy); - -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) req.setAttribute(QNetworkRequest::Http2AllowedAttribute, http2()); -#endif if (!verify_certificate()) { QSslConfiguration sslconfig = QSslConfiguration::defaultConfiguration(); diff --git a/src/subsonic/subsonicservice.cpp b/src/subsonic/subsonicservice.cpp index 476a7c757..32d8d1e41 100644 --- a/src/subsonic/subsonicservice.cpp +++ b/src/subsonic/subsonicservice.cpp @@ -195,10 +195,7 @@ void SubsonicService::SendPingWithCredentials(QUrl url, const QString &username, req.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::NoLessSafeRedirectPolicy); req.setHeader(QNetworkRequest::ContentTypeHeader, QStringLiteral("application/x-www-form-urlencoded")); - -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) req.setAttribute(QNetworkRequest::Http2AllowedAttribute, http2_); -#endif errors_.clear(); QNetworkReply *reply = network_->get(req); diff --git a/src/transcoder/transcodedialog.cpp b/src/transcoder/transcodedialog.cpp index f2cccfea1..709a0f267 100644 --- a/src/transcoder/transcodedialog.cpp +++ b/src/transcoder/transcodedialog.cpp @@ -349,13 +349,8 @@ void TranscodeDialog::Import() { QStringList filenames; -#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) - QStringList audioTypes = QString::fromLatin1(FileView::kFileFilter).split(QLatin1Char(' '), Qt::SkipEmptyParts); -#else - QStringList audioTypes = QString::fromLatin1(FileView::kFileFilter).split(QLatin1Char(' '), QString::SkipEmptyParts); -#endif - - QDirIterator files(path, audioTypes, QDir::Files | QDir::Readable, QDirIterator::Subdirectories); + const QStringList audio_types = QString::fromLatin1(FileView::kFileFilter).split(QLatin1Char(' '), Qt::SkipEmptyParts); + QDirIterator files(path, audio_types, QDir::Files | QDir::Readable, QDirIterator::Subdirectories); while (files.hasNext()) { filenames << files.next(); diff --git a/src/utilities/filemanagerutils.cpp b/src/utilities/filemanagerutils.cpp index 13c2e42d7..9d920e124 100644 --- a/src/utilities/filemanagerutils.cpp +++ b/src/utilities/filemanagerutils.cpp @@ -43,11 +43,7 @@ void OpenInFileManager(const QString &path, const QUrl &url) { if (!url.isLocalFile()) return; QProcess proc; -#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) proc.startCommand(QStringLiteral("xdg-mime query default inode/directory")); -#else - proc.start(QStringLiteral("xdg-mime"), QStringList() << QStringLiteral("query") << QStringLiteral("default") << QStringLiteral("inode/directory")); -#endif proc.waitForFinished(); QString desktop_file = QString::fromUtf8(proc.readLine()).simplified(); QString xdg_data_dirs = QString::fromUtf8(qgetenv("XDG_DATA_DIRS")); @@ -68,11 +64,7 @@ void OpenInFileManager(const QString &path, const QUrl &url) { if (cmd.isEmpty()) break; static const QRegularExpression regex(QStringLiteral("[%][a-zA-Z]*( |$)"), QRegularExpression::CaseInsensitiveOption); cmd = cmd.remove(regex); -# if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) command_params = cmd.split(QLatin1Char(' '), Qt::SkipEmptyParts); -# else - command_params = cmd.split(QLatin1Char(' '), QString::SkipEmptyParts); -# endif command = command_params.first(); command_params.removeFirst(); } diff --git a/src/utilities/screenutils.cpp b/src/utilities/screenutils.cpp index 0afd839c9..39f50d5dd 100644 --- a/src/utilities/screenutils.cpp +++ b/src/utilities/screenutils.cpp @@ -28,13 +28,7 @@ namespace Utilities { QScreen *GetScreen(QWidget *widget) { -#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)) - QScreen *screen = widget->screen(); -#else - QScreen *screen = (widget->window() && widget->window()->windowHandle() ? widget->window()->windowHandle()->screen() : nullptr); -#endif - - return screen; + return widget->screen(); } diff --git a/src/utilities/winutils.cpp b/src/utilities/winutils.cpp index 50772bb19..f6236a9ae 100644 --- a/src/utilities/winutils.cpp +++ b/src/utilities/winutils.cpp @@ -34,33 +34,6 @@ HRGN qt_RectToHRGN(const QRect &rc) { return CreateRectRgn(rc.left(), rc.top(), rc.right() + 1, rc.bottom() + 1); } -HRGN toHRGN(const QRegion ®ion); -HRGN toHRGN(const QRegion ®ion) { - -# if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) - return region.toHRGN(); -# else - - const int rect_count = region.rectCount(); - if (rect_count == 0) { - return nullptr; - } - - HRGN resultRgn = nullptr; - QRegion::const_iterator rects = region.begin(); - resultRgn = qt_RectToHRGN(rects[0]); - for (int i = 1; i < rect_count; ++i) { - HRGN tmpRgn = qt_RectToHRGN(rects[i]); - const int res = CombineRgn(resultRgn, resultRgn, tmpRgn, RGN_OR); - if (res == ERROR) qWarning("Error combining HRGNs."); - DeleteObject(tmpRgn); - } - - return resultRgn; - -# endif // Qt 6 -} - void enableBlurBehindWindow(QWindow *window, const QRegion ®ion) { DWM_BLURBEHIND dwmbb = { 0, 0, nullptr, 0 }; @@ -68,7 +41,7 @@ void enableBlurBehindWindow(QWindow *window, const QRegion ®ion) { dwmbb.fEnable = TRUE; HRGN rgn = nullptr; if (!region.isNull()) { - rgn = toHRGN(region); + rgn = region.toHRGN(); if (rgn) { dwmbb.hRgnBlur = rgn; dwmbb.dwFlags |= DWM_BB_BLURREGION; diff --git a/src/widgets/favoritewidget.cpp b/src/widgets/favoritewidget.cpp index 29d4b9c61..8c5508bed 100644 --- a/src/widgets/favoritewidget.cpp +++ b/src/widgets/favoritewidget.cpp @@ -63,21 +63,12 @@ void FavoriteWidget::paintEvent(QPaintEvent *e) { QStylePainter p(this); -#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) if (favorite_) { p.drawPixmap(rect_, on_.pixmap(rect_.size(), devicePixelRatioF())); } else { p.drawPixmap(rect_, off_.pixmap(rect_.size(), devicePixelRatioF())); } -#else - if (favorite_) { - p.drawPixmap(rect_, on_.pixmap(rect_.size())); - } - else { - p.drawPixmap(rect_, off_.pixmap(rect_.size())); - } -#endif } diff --git a/src/widgets/fileview.cpp b/src/widgets/fileview.cpp index b48678845..d5089ef66 100644 --- a/src/widgets/fileview.cpp +++ b/src/widgets/fileview.cpp @@ -245,12 +245,7 @@ void FileView::Delete(const QStringList &filenames) { if (DeleteConfirmationDialog::warning(filenames) != QDialogButtonBox::Yes) return; - bool use_trash = false; -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) - use_trash = true; -#endif - - DeleteFiles *delete_files = new DeleteFiles(task_manager_, storage_, use_trash); + DeleteFiles *delete_files = new DeleteFiles(task_manager_, storage_, true); QObject::connect(delete_files, &DeleteFiles::Finished, this, &FileView::DeleteFinished); delete_files->Start(filenames); diff --git a/src/widgets/groupediconview.cpp b/src/widgets/groupediconview.cpp index 71911a7ba..f8a140150 100644 --- a/src/widgets/groupediconview.cpp +++ b/src/widgets/groupediconview.cpp @@ -242,11 +242,7 @@ void GroupedIconView::paintEvent(QPaintEvent *e) { // This code was adapted from QListView::paintEvent(), changed to use the visualRect() of items, and to draw headers. QStyleOptionViewItem option; -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) initViewItemOption(&option); -#else - option = viewOptions(); -#endif if (isWrapping()) { option.features = QStyleOptionViewItem::WrapText; } diff --git a/src/widgets/tracksliderslider.cpp b/src/widgets/tracksliderslider.cpp index b8d48ec36..4ef94aaf8 100644 --- a/src/widgets/tracksliderslider.cpp +++ b/src/widgets/tracksliderslider.cpp @@ -71,11 +71,7 @@ void TrackSliderSlider::mousePressEvent(QMouseEvent *e) { } } -#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) QMouseEvent new_event(e->type(), e->pos(), e->globalPosition(), new_button, new_button, e->modifiers()); -#else - QMouseEvent new_event(e->type(), e->pos(), e->globalPos(), new_button, new_button, e->modifiers()); -#endif QSlider::mousePressEvent(&new_event); if (new_event.isAccepted()) { @@ -137,11 +133,7 @@ void TrackSliderSlider::wheelEvent(QWheelEvent *e) { } -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) void TrackSliderSlider::enterEvent(QEnterEvent *e) { -#else -void TrackSliderSlider::enterEvent(QEvent *e) { -#endif QSlider::enterEvent(e); #ifndef Q_OS_MACOS diff --git a/src/widgets/tracksliderslider.h b/src/widgets/tracksliderslider.h index d6becdbce..ebeafee98 100644 --- a/src/widgets/tracksliderslider.h +++ b/src/widgets/tracksliderslider.h @@ -54,11 +54,7 @@ class TrackSliderSlider : public QSlider { void mouseReleaseEvent(QMouseEvent *e) override; void mouseMoveEvent(QMouseEvent *e) override; void wheelEvent(QWheelEvent *e) override; -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) void enterEvent(QEnterEvent *e) override; -#else - void enterEvent(QEvent *e) override; -#endif void leaveEvent(QEvent *e) override; void keyPressEvent(QKeyEvent *event) override; diff --git a/src/widgets/volumeslider.cpp b/src/widgets/volumeslider.cpp index 26e1b0453..2b0ccaec8 100644 --- a/src/widgets/volumeslider.cpp +++ b/src/widgets/volumeslider.cpp @@ -40,11 +40,7 @@ #include #include #include -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) -# include -#else -# include -#endif +#include #include #include #include @@ -233,11 +229,7 @@ void VolumeSlider::drawVolumeSliderHandle() { } -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) void VolumeSlider::enterEvent(QEnterEvent*) { -#else -void VolumeSlider::enterEvent(QEvent*) { -#endif anim_enter_ = true; anim_count_ = 0; diff --git a/src/widgets/volumeslider.h b/src/widgets/volumeslider.h index 47b146d75..2eaebbebd 100644 --- a/src/widgets/volumeslider.h +++ b/src/widgets/volumeslider.h @@ -32,15 +32,12 @@ #include "sliderslider.h" class QTimer; -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) class QEnterEvent; -#else -class QEvent; -#endif class QPaintEvent; class QMouseEvent; class QWheelEvent; class QContextMenuEvent; +class QEvent; class VolumeSlider : public SliderSlider { Q_OBJECT @@ -51,11 +48,7 @@ class VolumeSlider : public SliderSlider { void HandleWheel(const int delta); protected: -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) void enterEvent(QEnterEvent*) override; -#else - void enterEvent(QEvent*) override; -#endif void leaveEvent(QEvent*) override; void paintEvent(QPaintEvent*) override; virtual void paletteChange(const QPalette&);