diff --git a/src/collection/collectionmodel.cpp b/src/collection/collectionmodel.cpp index 62138255b..9c6deaab9 100644 --- a/src/collection/collectionmodel.cpp +++ b/src/collection/collectionmodel.cpp @@ -21,6 +21,7 @@ #include "config.h" #include +#include #include #include @@ -61,6 +62,8 @@ #include "playlist/songmimedata.h" #include "covermanager/albumcoverloader.h" +using std::bind; +using std::sort; using std::placeholders::_1; using std::placeholders::_2; @@ -1312,7 +1315,7 @@ void CollectionModel::GetChildSongs(CollectionItem *item, QList *urls, Son const_cast(this)->LazyPopulate(item); QList children = item->children; - qSort(children.begin(), children.end(), std::bind(&CollectionModel::CompareItems, this, _1, _2)); + std::sort(children.begin(), children.end(), std::bind(&CollectionModel::CompareItems, this, _1, _2)); for (CollectionItem *child : children) GetChildSongs(child, urls, songs, song_ids); diff --git a/src/context/contextalbumsmodel.cpp b/src/context/contextalbumsmodel.cpp index 770bc9b6a..056d42109 100644 --- a/src/context/contextalbumsmodel.cpp +++ b/src/context/contextalbumsmodel.cpp @@ -22,6 +22,7 @@ #include "config.h" #include +#include #include #include @@ -55,6 +56,8 @@ #include "contextalbumsmodel.h" +using std::bind; +using std::sort; using std::placeholders::_1; using std::placeholders::_2; @@ -479,7 +482,7 @@ void ContextAlbumsModel::GetChildSongs(CollectionItem *item, QList *urls, const_cast(this)->LazyPopulate(item); QList children = item->children; - qSort(children.begin(), children.end(), std::bind(&ContextAlbumsModel::CompareItems, this, _1, _2)); + std::sort(children.begin(), children.end(), std::bind(&ContextAlbumsModel::CompareItems, this, _1, _2)); for (CollectionItem *child : children) GetChildSongs(child, urls, songs, song_ids); diff --git a/src/core/application.h b/src/core/application.h index c9ce20a59..a7bd9bade 100644 --- a/src/core/application.h +++ b/src/core/application.h @@ -33,6 +33,8 @@ #include "settings/settingsdialog.h" +using std::unique_ptr; + class TaskManager; class ApplicationImpl; class TagReaderClient; diff --git a/src/core/mainwindow.cpp b/src/core/mainwindow.cpp index 3eec31d3f..6c2aed03f 100644 --- a/src/core/mainwindow.cpp +++ b/src/core/mainwindow.cpp @@ -152,6 +152,10 @@ # include "core/macsystemtrayicon.h" #endif +using std::bind; +using std::floor; +using std::stable_sort; + #ifdef Q_OS_MACOS // Non exported mac-specific function. void qt_mac_set_dock_menu(QMenu*); @@ -1547,6 +1551,7 @@ void MainWindow::EditTracks() { } void MainWindow::EditTagDialogAccepted() { + for (PlaylistItemPtr item : edit_tag_dialog_->playlist_items()) { item->Reload(); } @@ -1555,14 +1560,16 @@ void MainWindow::EditTagDialogAccepted() { ui_->playlist->view()->update(); app_->playlist_manager()->current()->Save(); + } void MainWindow::RenumberTracks() { + QModelIndexList indexes =ui_->playlist->view()->selectionModel()->selection().indexes(); int track = 1; // Get the index list in order - qStableSort(indexes); + std::stable_sort(indexes.begin(), indexes.end()); // if first selected song has a track number set, start from that offset if (!indexes.isEmpty()) { @@ -1587,6 +1594,7 @@ void MainWindow::RenumberTracks() { } track++; } + } void MainWindow::SongSaveComplete(TagReaderReply *reply,const QPersistentModelIndex &index) { diff --git a/src/core/mainwindow.h b/src/core/mainwindow.h index 3f7a956fd..89158fde4 100644 --- a/src/core/mainwindow.h +++ b/src/core/mainwindow.h @@ -57,6 +57,8 @@ #include "playlist/playlistitem.h" #include "settings/settingsdialog.h" +using std::unique_ptr; + class About; class AlbumCoverManager;; class Application; diff --git a/src/core/song.cpp b/src/core/song.cpp index 8958decfd..35aa3cdcc 100644 --- a/src/core/song.cpp +++ b/src/core/song.cpp @@ -21,6 +21,8 @@ #include "config.h" +#include + #include #include @@ -66,6 +68,8 @@ #include "covermanager/albumcoverloader.h" #include "tagreadermessages.pb.h" +using std::sort; + const QStringList Song::kColumns = QStringList() << "title" << "album" << "artist" @@ -495,7 +499,7 @@ int CompareSongsName(const Song &song1, const Song &song2) { void Song::SortSongsListAlphabetically(SongList *songs) { Q_ASSERT(songs); - qSort(songs->begin(), songs->end(), CompareSongsName); + std::sort(songs->begin(), songs->end(), CompareSongsName); } void Song::Init(const QString &title, const QString &artist, const QString &album, qint64 length_nanosec) { diff --git a/src/core/songloader.cpp b/src/core/songloader.cpp index 24f545fac..d81fafba5 100644 --- a/src/core/songloader.cpp +++ b/src/core/songloader.cpp @@ -22,6 +22,7 @@ #include #include +#include #ifdef HAVE_GSTREAMER # include @@ -65,6 +66,9 @@ #endif using std::placeholders::_1; +using std::bind; +using std::stable_sort; +using std::shared_ptr; QSet SongLoader::sRawUriSchemes; const int SongLoader::kDefaultTimeout = 5000; @@ -323,7 +327,7 @@ void SongLoader::LoadLocalDirectory(const QString &filename) { LoadLocalPartial(it.next()); } - qStableSort(songs_.begin(), songs_.end(), CompareSongs); + std::stable_sort(songs_.begin(), songs_.end(), CompareSongs); // Load the first song: // all songs will be loaded async, but we want the first one in our list to be fully loaded, diff --git a/src/covermanager/albumcoverfetchersearch.cpp b/src/covermanager/albumcoverfetchersearch.cpp index 1d81c8934..2ebd9fab0 100644 --- a/src/covermanager/albumcoverfetchersearch.cpp +++ b/src/covermanager/albumcoverfetchersearch.cpp @@ -43,6 +43,8 @@ #include "coverprovider.h" #include "coverproviders.h" +using std::stable_sort; + const int AlbumCoverFetcherSearch::kSearchTimeoutMs = 12000; const int AlbumCoverFetcherSearch::kImageLoadTimeoutMs = 3000; const int AlbumCoverFetcherSearch::kTargetSize = 500; @@ -148,7 +150,7 @@ void AlbumCoverFetcherSearch::AllProvidersFinished() { // Now we have to load some images and figure out which one is the best. // We'll sort the list of results by category, then load the first few images from each category and use some heuristics to score them. // If no images are good enough we'll keep loading more images until we find one that is or we run out of results. - qStableSort(results_.begin(), results_.end(), CompareProviders); + std::stable_sort(results_.begin(), results_.end(), CompareProviders); FetchMoreImages(); } diff --git a/src/covermanager/albumcovermanager.cpp b/src/covermanager/albumcovermanager.cpp index c6ad989c9..4c041bb0c 100644 --- a/src/covermanager/albumcovermanager.cpp +++ b/src/covermanager/albumcovermanager.cpp @@ -21,6 +21,7 @@ #include "config.h" #include +#include #include #include @@ -81,6 +82,8 @@ #include "ui_albumcovermanager.h" +using std::stable_sort; + const char *AlbumCoverManager::kSettingsGroup = "CoverManager"; AlbumCoverManager::AlbumCoverManager(Application *app, CollectionBackend *collection_backend, QWidget *parent, QNetworkAccessManager *network) @@ -286,7 +289,7 @@ void AlbumCoverManager::Reset() { new QListWidgetItem(artist_icon_, tr("Various artists"), ui_->artists, Various_Artists); QStringList artists(collection_backend_->GetAllArtistsWithAlbums()); - qStableSort(artists.begin(), artists.end(), CompareNocase); + std::stable_sort(artists.begin(), artists.end(), CompareNocase); for (const QString &artist : artists) { if (artist.isEmpty()) continue; @@ -326,7 +329,7 @@ void AlbumCoverManager::ArtistChanged(QListWidgetItem *current) { } // Sort by album name. The list is already sorted by sqlite but it was done case sensitively. - qStableSort(albums.begin(), albums.end(), CompareAlbumNameNocase); + std::stable_sort(albums.begin(), albums.end(), CompareAlbumNameNocase); for (const CollectionBackend::Album &info : albums) { // Don't show songs without an album, obviously diff --git a/src/covermanager/coversearchstatisticsdialog.cpp b/src/covermanager/coversearchstatisticsdialog.cpp index 1d4cc5c3f..b9a7353cc 100644 --- a/src/covermanager/coversearchstatisticsdialog.cpp +++ b/src/covermanager/coversearchstatisticsdialog.cpp @@ -20,6 +20,8 @@ #include "config.h" +#include + #include #include #include @@ -34,6 +36,8 @@ #include "coversearchstatisticsdialog.h" #include "ui_coversearchstatisticsdialog.h" +using std::sort; + CoverSearchStatisticsDialog::CoverSearchStatisticsDialog(QWidget *parent) : QDialog(parent), ui_(new Ui_CoverSearchStatisticsDialog) { @@ -61,7 +65,7 @@ CoverSearchStatisticsDialog::~CoverSearchStatisticsDialog() { delete ui_; } void CoverSearchStatisticsDialog::Show(const CoverSearchStatistics &statistics) { QStringList providers(statistics.total_images_by_provider_.keys()); - qSort(providers); + std::sort(providers.begin(), providers.end()); ui_->summary->setText(tr("Got %1 covers out of %2 (%3 failed)") .arg(statistics.chosen_images_) diff --git a/src/dialogs/organisedialog.cpp b/src/dialogs/organisedialog.cpp index 1fc90bbe3..5a5488cf8 100644 --- a/src/dialogs/organisedialog.cpp +++ b/src/dialogs/organisedialog.cpp @@ -21,6 +21,7 @@ #include "config.h" #include +#include #include #include @@ -63,6 +64,9 @@ #include "organiseerrordialog.h" #include "ui_organisedialog.h" +using std::shared_ptr; +using std::stable_sort; + const char *OrganiseDialog::kDefaultFormat = "%artist/%album{ (Disc %disc)}/{%track - }%title.%extension"; const char *OrganiseDialog::kSettingsGroup = "OrganiseDialog"; @@ -111,7 +115,7 @@ OrganiseDialog::OrganiseDialog(TaskManager *task_manager, QWidget *parent) // Get the titles of the tags to put in the insert menu QStringList tag_titles = tags.keys(); - qStableSort(tag_titles); + std::stable_sort(tag_titles.begin(), tag_titles.end()); // Build the insert menu QMenu *tag_menu = new QMenu(this); diff --git a/src/dialogs/organiseerrordialog.cpp b/src/dialogs/organiseerrordialog.cpp index c39cd7652..55e5fe430 100644 --- a/src/dialogs/organiseerrordialog.cpp +++ b/src/dialogs/organiseerrordialog.cpp @@ -20,6 +20,8 @@ #include "config.h" +#include + #include #include #include @@ -33,6 +35,8 @@ #include "organiseerrordialog.h" #include "ui_organiseerrordialog.h" +using std::stable_sort; + OrganiseErrorDialog::OrganiseErrorDialog(QWidget *parent) : QDialog(parent), ui_(new Ui_OrganiseErrorDialog) { ui_->setupUi(this); @@ -61,7 +65,7 @@ void OrganiseErrorDialog::Show(OperationType type, const SongList &songs_with_er void OrganiseErrorDialog::Show(OperationType type, const QStringList &files_with_errors) { QStringList sorted_files = files_with_errors; - qStableSort(sorted_files); + std::stable_sort(sorted_files.begin(), sorted_files.end()); switch (type) { case Type_Copy: diff --git a/src/engine/gstenginepipeline.h b/src/engine/gstenginepipeline.h index d07737996..f7ecf8597 100644 --- a/src/engine/gstenginepipeline.h +++ b/src/engine/gstenginepipeline.h @@ -45,6 +45,8 @@ #include #include +using std::unique_ptr; + class GstEngine; class GstBufferConsumer; class GstElementDeleter; diff --git a/src/internet/internetsearch.cpp b/src/internet/internetsearch.cpp index 71683f08b..f4dab7806 100644 --- a/src/internet/internetsearch.cpp +++ b/src/internet/internetsearch.cpp @@ -50,6 +50,8 @@ #include "internetservice.h" #include "internetmodel.h" +using std::advance; + const int InternetSearch::kDelayedSearchTimeoutMs = 200; const int InternetSearch::kMaxResultsPerEmission = 2000; const int InternetSearch::kArtHeight = 32; diff --git a/src/internet/internetsearchview.cpp b/src/internet/internetsearchview.cpp index c31183a71..1fbbd888b 100644 --- a/src/internet/internetsearchview.cpp +++ b/src/internet/internetsearchview.cpp @@ -22,6 +22,7 @@ #include "config.h" #include +#include #include #include diff --git a/src/musicbrainz/acoustidclient.cpp b/src/musicbrainz/acoustidclient.cpp index ae016c82a..98d7aa500 100644 --- a/src/musicbrainz/acoustidclient.cpp +++ b/src/musicbrainz/acoustidclient.cpp @@ -21,6 +21,7 @@ #include "config.h" #include +#include #include #include @@ -46,6 +47,8 @@ #include "core/network.h" #include "core/timeconstants.h" +using std::stable_sort; + const char *AcoustidClient::kClientId = "0qjUoxbowg"; const char *AcoustidClient::kUrl = "http://api.acoustid.org/v2/lookup"; const int AcoustidClient::kDefaultTimeout = 5000; // msec @@ -153,7 +156,7 @@ void AcoustidClient::RequestFinished(QNetworkReply *reply, int request_id) { } } - qStableSort(id_source_list); + std::stable_sort(id_source_list.begin(), id_source_list.end()); QList id_list; for (const IdSource& is : id_source_list) { diff --git a/src/musicbrainz/musicbrainzclient.cpp b/src/musicbrainz/musicbrainzclient.cpp index 60749024b..86b4fdf13 100644 --- a/src/musicbrainz/musicbrainzclient.cpp +++ b/src/musicbrainz/musicbrainzclient.cpp @@ -20,6 +20,8 @@ #include "config.h" +#include + #include #include #include @@ -44,6 +46,9 @@ #include "core/utilities.h" #include "musicbrainzclient.h" +using std::sort; +using std::stable_sort; + const char *MusicBrainzClient::kTrackUrl = "http://musicbrainz.org/ws/2/recording/"; const char *MusicBrainzClient::kDiscUrl = "http://musicbrainz.org/ws/2/discid/"; const char *MusicBrainzClient::kDateRegex = "^[12]\\d{3}"; @@ -220,7 +225,7 @@ void MusicBrainzClient::RequestFinished(QNetworkReply *reply, int id, int reques // Merge the results we have ResultList ret; QList result_list_list = pending_results_.take(id); - qSort(result_list_list); + std::sort(result_list_list.begin(), result_list_list.end()); for (const PendingResults &result_list : result_list_list) { ret << result_list.results_; } @@ -242,6 +247,7 @@ bool MusicBrainzClient::MediumHasDiscid(const QString &discid, QXmlStreamReader } qLog(Debug) << "Reached end of xml stream without encountering "; return false; + } MusicBrainzClient::ResultList MusicBrainzClient::ParseMedium(QXmlStreamReader *reader) { @@ -330,7 +336,7 @@ MusicBrainzClient::ResultList MusicBrainzClient::ParseTrack(QXmlStreamReader *re ret << result; } else { - qStableSort(releases); + std::stable_sort(releases.begin(), releases.end()); for (const Release &release : releases) { ret << release.CopyAndMergeInto(result); } @@ -401,7 +407,7 @@ MusicBrainzClient::ResultList MusicBrainzClient::UniqueResults(const ResultList& ResultList ret; if (opt == SortResults) { ret = QSet::fromList(results).toList(); - qSort(ret); + std::sort(ret.begin(), ret.end()); } else { // KeepOriginalOrder // Qt doesn't provide a ordered set (QSet "stores values in an unspecified order" according to Qt documentation). diff --git a/src/playlist/playlist.cpp b/src/playlist/playlist.cpp index 542f70fb2..d9db1bc34 100644 --- a/src/playlist/playlist.cpp +++ b/src/playlist/playlist.cpp @@ -94,6 +94,10 @@ using std::placeholders::_1; using std::placeholders::_2; using std::shared_ptr; using std::unordered_map; +using std::sort; +using std::stable_sort; +using std::greater; +using std::swap; const char *Playlist::kCddaMimeType = "x-content/audio-cdda"; const char *Playlist::kRowsMimetype = "application/x-strawberry-playlist-rows"; @@ -684,7 +688,7 @@ bool Playlist::dropMimeData(const QMimeData *data, Qt::DropAction action, int ro pid = !own_pid; } - qStableSort(source_rows); // Make sure we take them in order + std::stable_sort(source_rows.begin(), source_rows.end()); // Make sure we take them in order if (source_playlist == this) { // Dragged from this playlist - rearrange the items @@ -1194,17 +1198,17 @@ void Playlist::sort(int column, Qt::SortOrder order) { if (column == Column_Album) { // When sorting by album, also take into account discs and tracks. - qStableSort(begin, new_items.end(), std::bind(&Playlist::CompareItems, Column_Track, order, _1, _2)); - qStableSort(begin, new_items.end(), std::bind(&Playlist::CompareItems, Column_Disc, order, _1, _2)); - qStableSort(begin, new_items.end(), std::bind(&Playlist::CompareItems, Column_Album, order, _1, _2)); + std::stable_sort(begin, new_items.end(), std::bind(&Playlist::CompareItems, Column_Track, order, _1, _2)); + std::stable_sort(begin, new_items.end(), std::bind(&Playlist::CompareItems, Column_Disc, order, _1, _2)); + std::stable_sort(begin, new_items.end(), std::bind(&Playlist::CompareItems, Column_Album, order, _1, _2)); } else if (column == Column_Filename) { // When sorting by full paths we also expect a hierarchical order. This returns a breath-first ordering of paths. - qStableSort(begin, new_items.end(), std::bind(&Playlist::CompareItems, Column_Filename, order, _1, _2)); - qStableSort(begin, new_items.end(), std::bind(&Playlist::ComparePathDepths, order, _1, _2)); + std::stable_sort(begin, new_items.end(), std::bind(&Playlist::CompareItems, Column_Filename, order, _1, _2)); + std::stable_sort(begin, new_items.end(), std::bind(&Playlist::ComparePathDepths, order, _1, _2)); } else { - qStableSort(begin, new_items.end(), std::bind(&Playlist::CompareItems, column, order, _1, _2)); + std::stable_sort(begin, new_items.end(), std::bind(&Playlist::CompareItems, column, order, _1, _2)); } undo_stack_->push(new PlaylistUndoCommands::SortItems(this, column, order, new_items)); @@ -1321,7 +1325,7 @@ void Playlist::RemoveItemsWithoutUndo(const QList &indicesIn) { // Sort the indices descending because removing elements 'backwards' is easier - indices don't 'move' in the process. QList indices = indicesIn; - qSort(indices.begin(), indices.end(), DescendingIntLessThan); + std::sort(indices.begin(), indices.end(), DescendingIntLessThan); for (int j = 0; j < indices.count(); j++) { int beginning = indices[j], end = indices[j]; @@ -1367,7 +1371,7 @@ bool Playlist::removeRows(QList &rows) { } // Start from the end to be sure that indices won't 'move' during the removal process - qSort(rows.begin(), rows.end(), qGreater()); + std::sort(rows.begin(), rows.end(), std::greater()); QList part; while (!rows.isEmpty()) { diff --git a/src/playlist/playlistview.cpp b/src/playlist/playlistview.cpp index 6efd38bea..dbee48e5c 100644 --- a/src/playlist/playlistview.cpp +++ b/src/playlist/playlistview.cpp @@ -21,6 +21,7 @@ #include "config.h" #include +#include #include #include @@ -77,6 +78,8 @@ #include "settings/playbacksettingspage.h" #include "settings/playlistsettingspage.h" +using std::sort; + const int PlaylistView::kStateVersion = 6; const int PlaylistView::kGlowIntensitySteps = 24; const int PlaylistView::kAutoscrollGraceTimeout = 30; // seconds @@ -572,7 +575,7 @@ void PlaylistView::RemoveSelected(bool deleting_from_disk) { int last_row = selection.last().top(); // Sort the selection so we remove the items at the *bottom* first, ensuring we don't have to mess around with changing row numbers - qSort(selection.begin(), selection.end(), CompareSelectionRanges); + std::sort(selection.begin(), selection.end(), CompareSelectionRanges); for (const QItemSelectionRange &range : selection) { if (range.top() < last_row) rows_removed += range.height(); @@ -613,7 +616,7 @@ QList PlaylistView::GetEditableColumns() { QModelIndex index = model()->index(0, col); if (index.flags() & Qt::ItemIsEditable) columns << h->visualIndex(col); } - qSort(columns); + std::sort(columns.begin(), columns.end()); return columns; } diff --git a/src/playlist/queue.cpp b/src/playlist/queue.cpp index 8ea8a0669..7cd0fb981 100644 --- a/src/playlist/queue.cpp +++ b/src/playlist/queue.cpp @@ -20,6 +20,8 @@ #include "config.h" +#include + #include #include #include @@ -39,6 +41,8 @@ #include "playlist.h" #include "queue.h" +using std::stable_sort; + const char *Queue::kRowsMimetype = "application/x-strawberry-queue-rows"; Queue::Queue(QObject *parent) : QAbstractProxyModel(parent) {} @@ -279,7 +283,9 @@ bool Queue::dropMimeData(const QMimeData *data, Qt::DropAction action, int row, QList proxy_rows; QDataStream stream(data->data(kRowsMimetype)); stream >> proxy_rows; - qStableSort(proxy_rows); // Make sure we take them in order + + // Make sure we take them in order + std::stable_sort(proxy_rows.begin(), proxy_rows.end()); Move(proxy_rows, row); } @@ -355,7 +361,7 @@ QVariant Queue::headerData(int section, Qt::Orientation orientation, int role) c void Queue::Remove(QList &proxy_rows) { // Order the rows - qStableSort(proxy_rows); + std::stable_sort(proxy_rows.begin(), proxy_rows.end()); // Reflects immediately changes in the playlist layoutAboutToBeChanged(); diff --git a/src/playlist/queuemanager.cpp b/src/playlist/queuemanager.cpp index 83ff8b931..e0f220538 100644 --- a/src/playlist/queuemanager.cpp +++ b/src/playlist/queuemanager.cpp @@ -19,6 +19,7 @@ */ #include +#include #include #include @@ -39,6 +40,8 @@ #include "queuemanager.h" #include "ui_queuemanager.h" +using std::stable_sort; + QueueManager::QueueManager(QWidget *parent) : QDialog(parent), ui_(new Ui_QueueManager), @@ -105,7 +108,7 @@ void QueueManager::CurrentPlaylistChanged(Playlist *playlist) { void QueueManager::MoveUp() { QModelIndexList indexes = ui_->list->selectionModel()->selectedRows(); - qStableSort(indexes); + std::stable_sort(indexes.begin(), indexes.end()); if (indexes.isEmpty() || indexes.first().row() == 0) return; @@ -118,7 +121,7 @@ void QueueManager::MoveUp() { void QueueManager::MoveDown() { QModelIndexList indexes = ui_->list->selectionModel()->selectedRows(); - qStableSort(indexes); + std::stable_sort(indexes.begin(), indexes.end()); if (indexes.isEmpty() || indexes.last().row() == current_playlist_->queue()->rowCount()-1) return; diff --git a/src/playlistparsers/playlistparser.cpp b/src/playlistparsers/playlistparser.cpp index 8265dcdc5..4971c9be2 100644 --- a/src/playlistparsers/playlistparser.cpp +++ b/src/playlistparsers/playlistparser.cpp @@ -41,6 +41,8 @@ #include "wplparser.h" #include "xspfparser.h" +using std::stable_sort; + const int PlaylistParser::kMagicSize = 512; PlaylistParser::PlaylistParser(CollectionBackendInterface *collection, QObject *parent) @@ -66,7 +68,7 @@ QStringList PlaylistParser::file_extensions() const { ret << parser->file_extensions(); } - qStableSort(ret); + std::stable_sort(ret.begin(), ret.end()); return ret; } @@ -79,7 +81,7 @@ QStringList PlaylistParser::mime_types() const { if (!parser->mime_type().isEmpty()) ret << parser->mime_type(); } - qStableSort(ret); + std::stable_sort(ret.begin(), ret.end()); return ret; } diff --git a/src/transcoder/transcodedialog.cpp b/src/transcoder/transcodedialog.cpp index e36985c97..e70646192 100644 --- a/src/transcoder/transcodedialog.cpp +++ b/src/transcoder/transcodedialog.cpp @@ -20,6 +20,8 @@ #include "config.h" +#include + #include #include #include @@ -62,6 +64,8 @@ #undef AddJob #endif +using std::sort; + const char *TranscodeDialog::kSettingsGroup = "Transcoder"; const int TranscodeDialog::kProgressInterval = 500; const int TranscodeDialog::kMaxDestinationItems = 10; @@ -89,7 +93,7 @@ TranscodeDialog::TranscodeDialog(QWidget *parent) // Get presets QList presets = Transcoder::GetAllPresets(); - qSort(presets.begin(), presets.end(), ComparePresetsByName); + std::sort(presets.begin(), presets.end(), ComparePresetsByName); for (const TranscoderPreset &preset : presets) { ui_->format->addItem(QString("%1 (.%2)").arg(preset.name_, preset.extension_), QVariant::fromValue(preset)); } diff --git a/src/transcoder/transcoder.cpp b/src/transcoder/transcoder.cpp index 5e4ba092a..aee7d7480 100644 --- a/src/transcoder/transcoder.cpp +++ b/src/transcoder/transcoder.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -47,10 +48,10 @@ #include "transcoder.h" using std::shared_ptr; +using std::sort; int Transcoder::JobFinishedEvent::sEventType = -1; - TranscoderPreset::TranscoderPreset(Song::FileType type, const QString &name, const QString &extension, const QString &codec_mimetype, const QString &muxer_mimetype) : type_(type), name_(name), @@ -145,7 +146,7 @@ GstElement *Transcoder::CreateElementForMimeType(const QString &element_type, co if (suitable_elements_.isEmpty()) return nullptr; // Sort by rank - qSort(suitable_elements_); + std::sort(suitable_elements_.begin(), suitable_elements_.end()); const SuitableElement &best = suitable_elements_.last(); LogLine(QString("Using '%1' (rank %2)").arg(best.name_).arg(best.rank_));