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