Replace qSort/qStableSort/qSwap
This commit is contained in:
@@ -33,6 +33,8 @@
|
||||
|
||||
#include "settings/settingsdialog.h"
|
||||
|
||||
using std::unique_ptr;
|
||||
|
||||
class TaskManager;
|
||||
class ApplicationImpl;
|
||||
class TagReaderClient;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -57,6 +57,8 @@
|
||||
#include "playlist/playlistitem.h"
|
||||
#include "settings/settingsdialog.h"
|
||||
|
||||
using std::unique_ptr;
|
||||
|
||||
class About;
|
||||
class AlbumCoverManager;;
|
||||
class Application;
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include <taglib/fileref.h>
|
||||
#include <taglib/id3v1genres.h>
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <memory>
|
||||
#include <algorithm>
|
||||
|
||||
#ifdef HAVE_GSTREAMER
|
||||
# include <gst/gst.h>
|
||||
@@ -65,6 +66,9 @@
|
||||
#endif
|
||||
|
||||
using std::placeholders::_1;
|
||||
using std::bind;
|
||||
using std::stable_sort;
|
||||
using std::shared_ptr;
|
||||
|
||||
QSet<QString> 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,
|
||||
|
||||
Reference in New Issue
Block a user