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:
@@ -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();
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user