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:
Jonas Kvinge
2024-09-07 00:12:56 +02:00
parent eb30c654c5
commit e3e6a22172
91 changed files with 76 additions and 760 deletions

View File

@@ -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
}

View File

@@ -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());

View File

@@ -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_;
};

View File

@@ -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();
}
}

View File

@@ -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("");
}

View File

@@ -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);
}