Drop Qt 5 support
Qt 6 has been available for almost 4 years. Qt 5 is no longer officially supported by Qt for opensource, it's time to drop Qt 5.
This commit is contained in:
parent
eb30c654c5
commit
e3e6a22172
|
@ -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
|
||||
|
|
|
@ -13,6 +13,5 @@
|
|||
/dist/scripts/maketarball.sh
|
||||
/dist/unix/strawberry.spec
|
||||
/dist/windows/strawberry.nsi
|
||||
/debian/control
|
||||
/debian/changelog
|
||||
/dist/macos/Info.plist
|
||||
|
|
|
@ -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.")
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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,
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -51,11 +51,7 @@ class CollectionFilter : public QSortFilterProxyModel {
|
|||
|
||||
private:
|
||||
mutable QScopedPointer<FilterTree> 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_;
|
||||
};
|
||||
|
||||
|
|
|
@ -813,11 +813,7 @@ CollectionItem *CollectionModel::CreateCompilationArtistNode(CollectionItem *par
|
|||
|
||||
void CollectionModel::LoadSongsFromSqlAsync() {
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
QFuture<SongList> future = QtConcurrent::run(&CollectionModel::LoadSongsFromSql, this, options_active_.filter_options);
|
||||
#else
|
||||
QFuture<SongList> future = QtConcurrent::run(this, &CollectionModel::LoadSongsFromSql, options_active_.filter_options);
|
||||
#endif
|
||||
QFutureWatcher<SongList> *watcher = new QFutureWatcher<SongList>();
|
||||
QObject::connect(watcher, &QFutureWatcher<void>::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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -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("");
|
||||
}
|
||||
|
|
|
@ -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<QString> albums_set = QSet<QString>(albums.keyBegin(), albums.keyEnd());
|
||||
#else
|
||||
const QSet<QString> albums_set = QSet<QString>::fromList(albums.keys());
|
||||
#endif
|
||||
for (const QString &album : albums_set) {
|
||||
app_->collection_backend()->ForceCompilation(album, albums.values(album), on);
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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),
|
||||
|
|
|
@ -34,9 +34,7 @@
|
|||
#include <QSqlQuery>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
|
||||
# include <QRecursiveMutex>
|
||||
#endif
|
||||
#include <QRecursiveMutex>
|
||||
|
||||
#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_;
|
||||
|
|
|
@ -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()) {
|
||||
|
|
|
@ -217,11 +217,7 @@
|
|||
#endif
|
||||
|
||||
#ifdef HAVE_QTSPARKLE
|
||||
# if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
# include <qtsparkle-qt6/Updater>
|
||||
# else
|
||||
# include <qtsparkle-qt5/Updater>
|
||||
# endif
|
||||
# include <qtsparkle-qt6/Updater>
|
||||
#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<MSG*>(message);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -96,10 +96,6 @@ void RegisterMetaTypes() {
|
|||
qRegisterMetaType<QItemSelection>("QItemSelection");
|
||||
qRegisterMetaType<QMap<int, Qt::Alignment>>("ColumnAlignmentMap");
|
||||
qRegisterMetaType<QMap<int, int>>("ColumnAlignmentIntMap");
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
qRegisterMetaTypeStreamOperators<QMap<int, Qt::Alignment>>("ColumnAlignmentMap");
|
||||
qRegisterMetaTypeStreamOperators<QMap<int, int>>("ColumnAlignmentIntMap");
|
||||
#endif
|
||||
qRegisterMetaType<Song>("Song");
|
||||
qRegisterMetaType<SongList>("SongList");
|
||||
qRegisterMetaType<SongMap>("SongMap");
|
||||
|
@ -133,10 +129,6 @@ void RegisterMetaTypes() {
|
|||
|
||||
qRegisterMetaType<Equalizer::Params>("Equalizer::Params");
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
qRegisterMetaTypeStreamOperators<Equalizer::Params>("Equalizer::Params");
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DBUS
|
||||
qDBusRegisterMetaType<QByteArrayList>();
|
||||
qDBusRegisterMetaType<QImage>();
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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<QString, QVariant>::const_iterator it = bound_values_.constBegin(); it != bound_values_.constEnd(); ++it) {
|
||||
last_query_.replace(it.key(), it.value().toString());
|
||||
}
|
||||
bound_values_.clear();
|
||||
#else
|
||||
QMapIterator<QString, QVariant> it(boundValues());
|
||||
while (it.hasNext()) {
|
||||
it.next();
|
||||
last_query_.replace(it.key(), it.value().toString());
|
||||
}
|
||||
#endif
|
||||
|
||||
return success;
|
||||
|
||||
|
|
|
@ -53,11 +53,8 @@ class SqlQuery : public QSqlQuery {
|
|||
QString LastQuery() const;
|
||||
|
||||
private:
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
QMap<QString, QVariant> bound_values_;
|
||||
#endif
|
||||
QString last_query_;
|
||||
|
||||
};
|
||||
|
||||
#endif // SQLQUERY_H
|
||||
|
|
|
@ -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<quint64>(pending_covers_.keyBegin(), pending_covers_.keyEnd()));
|
||||
#else
|
||||
cover_loader_->CancelTasks(QSet<quint64>::fromList(pending_covers_.keys()));
|
||||
#endif
|
||||
pending_covers_.clear();
|
||||
|
||||
}
|
||||
|
|
|
@ -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<SongList> future = QtConcurrent::run(&CollectionBackend::GetAlbumSongs, app_->collection_backend(), effective_albumartist, effective_album, CollectionFilterOptions());
|
||||
#else
|
||||
QFuture<SongList> future = QtConcurrent::run(&*app_->collection_backend(), &CollectionBackend::GetAlbumSongs, effective_albumartist, effective_album, CollectionFilterOptions());
|
||||
#endif
|
||||
QFutureWatcher<SongList> *watcher = new QFutureWatcher<SongList>();
|
||||
QObject::connect(watcher, &QFutureWatcher<SongList>::finished, this, [this, watcher, cover_filename, image_data, mime_type]() {
|
||||
const SongList collection_songs = watcher->result();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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<quint64>(cover_loading_tasks_.keyBegin(), cover_loading_tasks_.keyEnd()));
|
||||
#else
|
||||
app_->album_cover_loader()->CancelTasks(QSet<quint64>::fromList(cover_loading_tasks_.keys()));
|
||||
#endif
|
||||
cover_loading_pending_.clear();
|
||||
cover_loading_tasks_.clear();
|
||||
cover_save_tasks_.clear();
|
||||
|
|
|
@ -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<QListWidgetItem*> &items) const {
|
||||
#else
|
||||
QMimeData *AlbumCoverManagerList::mimeData(const QList<QListWidgetItem*> items) const {
|
||||
#endif
|
||||
|
||||
// Get songs
|
||||
SongList songs;
|
||||
|
|
|
@ -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<QListWidgetItem*> &items) const override;
|
||||
#else
|
||||
QMimeData *mimeData(const QList<QListWidgetItem*> items) const override;
|
||||
#endif
|
||||
|
||||
void dropEvent(QDropEvent*) override {}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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<bool> future = QtConcurrent::run(&ConnectedDevice::GetSupportedFiletypes, device, &supported_formats_);
|
||||
#else
|
||||
QFuture<bool> future = QtConcurrent::run(std::bind(&ConnectedDevice::GetSupportedFiletypes, device, &supported_formats_));
|
||||
#endif
|
||||
QFutureWatcher<bool> *watcher = new QFutureWatcher<bool>();
|
||||
QObject::connect(watcher, &QFutureWatcher<bool>::finished, this, &DeviceProperties::UpdateFormatsFinished);
|
||||
watcher->setFuture(future);
|
||||
|
|
|
@ -111,11 +111,8 @@ class MacOsDeviceLister : public DeviceLister {
|
|||
static QSet<MTPDevice> 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);
|
||||
}
|
||||
|
|
|
@ -101,11 +101,7 @@ class ScopedIOObject {
|
|||
|
||||
QSet<MacOsDeviceLister::MTPDevice> 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);
|
||||
}
|
||||
|
||||
|
|
|
@ -326,11 +326,7 @@ bool EditTagDialog::eventFilter(QObject *o, QEvent *e) {
|
|||
case QEvent::MouseButtonRelease:{
|
||||
QMouseEvent *mouse_event = static_cast<QMouseEvent*>(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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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_;
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -26,9 +26,7 @@
|
|||
#include <QHash>
|
||||
#include <QFlags>
|
||||
#include <QKeySequence>
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
# include <QKeyCombination>
|
||||
#endif
|
||||
#include <QKeyCombination>
|
||||
|
||||
#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;
|
||||
|
|
|
@ -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<QPair<quint32, quint32>, GlobalShortcut*> internal_shortcuts_;
|
||||
|
|
|
@ -29,9 +29,7 @@
|
|||
#include <QDBusObjectPath>
|
||||
#include <QDBusPendingCallWatcher>
|
||||
#include <QKeySequence>
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
# include <QKeyCombination>
|
||||
#endif
|
||||
#include <QKeyCombination>
|
||||
|
||||
#include "core/logging.h"
|
||||
|
||||
|
@ -190,11 +188,7 @@ QList<int> GlobalShortcutsBackendKDE::ToIntList(const QList<QKeySequence> &seque
|
|||
QList<int> 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;
|
||||
|
|
15
src/main.cpp
15
src/main.cpp
|
@ -76,11 +76,7 @@
|
|||
#include <kdsingleapplication.h>
|
||||
|
||||
#ifdef HAVE_QTSPARKLE
|
||||
# if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
# include <qtsparkle-qt6/Updater>
|
||||
# else
|
||||
# include <qtsparkle-qt5/Updater>
|
||||
# endif
|
||||
# include <qtsparkle-qt6/Updater>
|
||||
#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> 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);
|
||||
|
|
|
@ -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<Result>(results.begin(), results.end()).values();
|
||||
#else
|
||||
ret = QSet<Result>::fromList(results).values();
|
||||
#endif
|
||||
std::sort(ret.begin(), ret.end());
|
||||
}
|
||||
else { // KeepOriginalOrder
|
||||
|
|
|
@ -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_;
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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<PlaylistItemPtrList> future = QtConcurrent::run(&PlaylistBackend::GetPlaylistItems, backend_, id_);
|
||||
#else
|
||||
QFuture<PlaylistItemPtrList> future = QtConcurrent::run(&*backend_, &PlaylistBackend::GetPlaylistItems, id_);
|
||||
#endif
|
||||
QFutureWatcher<PlaylistItemPtrList> *watcher = new QFutureWatcher<PlaylistItemPtrList>();
|
||||
QObject::connect(watcher, &QFutureWatcher<PlaylistItemPtrList>::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();
|
||||
|
|
|
@ -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<QMetaType::Type>(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;
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -50,11 +50,7 @@ class PlaylistFilter : public QSortFilterProxyModel {
|
|||
private:
|
||||
// Mutable because they're modified from filterAcceptsRow() const
|
||||
mutable QScopedPointer<FilterTree> 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_;
|
||||
};
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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()) {
|
||||
|
|
|
@ -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<SongList> future = QtConcurrent::run(&PlaylistBackend::GetPlaylistSongs, playlist_backend_, id);
|
||||
#else
|
||||
QFuture<SongList> future = QtConcurrent::run(&*playlist_backend_, &PlaylistBackend::GetPlaylistSongs, id);
|
||||
#endif
|
||||
QFutureWatcher<SongList> *watcher = new QFutureWatcher<SongList>();
|
||||
QObject::connect(watcher, &QFutureWatcher<SongList>::finished, this, [this, watcher, filename, path_type]() {
|
||||
ItemsLoadedForSavePlaylist(watcher->result(), filename, path_type);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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<CollectionBackendInterface> 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;
|
||||
}
|
||||
|
||||
|
|
|
@ -30,11 +30,7 @@
|
|||
#include <QStringList>
|
||||
#include <QRegularExpression>
|
||||
#include <QTextStream>
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
# include <QStringConverter>
|
||||
#else
|
||||
# include <QTextCodec>
|
||||
#endif
|
||||
#include <QStringConverter>
|
||||
|
||||
#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<QStringConverter::Encoding> 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
|
||||
|
|
|
@ -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<CollectionBackendInterface> 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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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<QVariant>();
|
||||
#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<QListView*>(ui_->combobox_device->view());
|
||||
if (view && view->isRowHidden(i)) continue;
|
||||
QVariant device = ui_->combobox_device->itemData(i).value<QVariant>();
|
||||
#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) {
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -96,11 +96,7 @@ class StreamingSearchModel : public QStandardItemModel {
|
|||
QMap<ContainerKey, QStandardItem*> 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]);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -40,11 +40,7 @@
|
|||
#include <QAction>
|
||||
#include <QLinearGradient>
|
||||
#include <QStyleOptionViewItem>
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
# include <QEnterEvent>
|
||||
#else
|
||||
# include <QEvent>
|
||||
#endif
|
||||
#include <QEnterEvent>
|
||||
#include <QPaintEvent>
|
||||
#include <QContextMenuEvent>
|
||||
#include <QMouseEvent>
|
||||
|
@ -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;
|
||||
|
|
|
@ -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&);
|
||||
|
|
Loading…
Reference in New Issue