Convert uses of QtAlgorithms to std:: algorithms
This commit is contained in:
parent
1504d8be1c
commit
107e945872
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
#include "analyzerbase.h"
|
#include "analyzerbase.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
|
@ -87,9 +88,9 @@ void Analyzer::Base::transform(Scope& scope) {
|
||||||
|
|
||||||
QVector<float> aux(fht_->size());
|
QVector<float> aux(fht_->size());
|
||||||
if (aux.size() >= scope.size()) {
|
if (aux.size() >= scope.size()) {
|
||||||
qCopy(scope.begin(), scope.end(), aux.begin());
|
std::copy(scope.begin(), scope.end(), aux.begin());
|
||||||
} else {
|
} else {
|
||||||
qCopy(scope.begin(), scope.begin() + aux.size(), aux.begin());
|
std::copy(scope.begin(), scope.begin() + aux.size(), aux.begin());
|
||||||
}
|
}
|
||||||
|
|
||||||
fht_->logSpectrum(scope.data(), aux.data());
|
fht_->logSpectrum(scope.data(), aux.data());
|
||||||
|
|
|
@ -20,6 +20,8 @@
|
||||||
#ifndef CORE_CACHEDLIST_H_
|
#ifndef CORE_CACHEDLIST_H_
|
||||||
#define CORE_CACHEDLIST_H_
|
#define CORE_CACHEDLIST_H_
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
|
|
||||||
|
@ -81,7 +83,7 @@ class CachedList {
|
||||||
cache_duration_secs_;
|
cache_duration_secs_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sort() { qSort(data_); }
|
void Sort() { std::sort(data_.begin(), data_.end()); }
|
||||||
|
|
||||||
const ListType& Data() const { return data_; }
|
const ListType& Data() const { return data_; }
|
||||||
operator ListType() const { return data_; }
|
operator ListType() const { return data_; }
|
||||||
|
|
|
@ -486,7 +486,7 @@ int CompareSongsName(const Song& song1, const Song& song2) {
|
||||||
|
|
||||||
void Song::SortSongsListAlphabetically(SongList* songs) {
|
void Song::SortSongsListAlphabetically(SongList* songs) {
|
||||||
Q_ASSERT(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,
|
void Song::Init(const QString& title, const QString& artist,
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
|
|
||||||
#include "songloader.h"
|
#include "songloader.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include <QBuffer>
|
#include <QBuffer>
|
||||||
|
@ -311,7 +312,7 @@ void SongLoader::LoadLocalDirectory(const QString& filename) {
|
||||||
LoadLocalPartial(it.next());
|
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
|
// Load the first song: all songs will be loaded async, but we want the first
|
||||||
// one in our list to be fully loaded, so if the user has the "Start playing
|
// one in our list to be fully loaded, so if the user has the "Start playing
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
#include "albumcoverfetchersearch.h"
|
#include "albumcoverfetchersearch.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
#include <QMutexLocker>
|
#include <QMutexLocker>
|
||||||
|
@ -133,7 +134,7 @@ void AlbumCoverFetcherSearch::AllProvidersFinished() {
|
||||||
// from each category and use some heuristics to score them. If no 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
|
// are good enough we'll keep loading more images until we find one that is
|
||||||
// or we run out of results.
|
// or we run out of results.
|
||||||
qStableSort(results_.begin(), results_.end(), CompareProviders);
|
std::stable_sort(results_.begin(), results_.end(), CompareProviders);
|
||||||
FetchMoreImages();
|
FetchMoreImages();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,8 @@
|
||||||
#include "ui_coversearchstatisticsdialog.h"
|
#include "ui_coversearchstatisticsdialog.h"
|
||||||
#include "core/utilities.h"
|
#include "core/utilities.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
CoverSearchStatisticsDialog::CoverSearchStatisticsDialog(QWidget* parent)
|
CoverSearchStatisticsDialog::CoverSearchStatisticsDialog(QWidget* parent)
|
||||||
: QDialog(parent), ui_(new Ui_CoverSearchStatisticsDialog) {
|
: QDialog(parent), ui_(new Ui_CoverSearchStatisticsDialog) {
|
||||||
ui_->setupUi(this);
|
ui_->setupUi(this);
|
||||||
|
@ -47,7 +49,7 @@ CoverSearchStatisticsDialog::~CoverSearchStatisticsDialog() { delete ui_; }
|
||||||
void CoverSearchStatisticsDialog::Show(
|
void CoverSearchStatisticsDialog::Show(
|
||||||
const CoverSearchStatistics& statistics) {
|
const CoverSearchStatistics& statistics) {
|
||||||
QStringList providers(statistics.total_images_by_provider_.keys());
|
QStringList providers(statistics.total_images_by_provider_.keys());
|
||||||
qSort(providers);
|
std::sort(providers.begin(), providers.end());
|
||||||
|
|
||||||
ui_->summary->setText(
|
ui_->summary->setText(
|
||||||
tr("Got %1 covers out of %2 (%3 failed)")
|
tr("Got %1 covers out of %2 (%3 failed)")
|
||||||
|
|
|
@ -22,6 +22,8 @@
|
||||||
#include "ui/settingsdialog.h"
|
#include "ui/settingsdialog.h"
|
||||||
#include "ui_globalsearchsettingspage.h"
|
#include "ui_globalsearchsettingspage.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
|
|
||||||
GlobalSearchSettingsPage::GlobalSearchSettingsPage(SettingsDialog* dialog)
|
GlobalSearchSettingsPage::GlobalSearchSettingsPage(SettingsDialog* dialog)
|
||||||
|
@ -57,7 +59,7 @@ void GlobalSearchSettingsPage::Load() {
|
||||||
|
|
||||||
// Sort the list of providers alphabetically (by id) initially, so any that
|
// Sort the list of providers alphabetically (by id) initially, so any that
|
||||||
// aren't in the provider_order list will take this order.
|
// aren't in the provider_order list will take this order.
|
||||||
qSort(providers.begin(), providers.end(), CompareProviderId);
|
std::sort(providers.begin(), providers.end(), CompareProviderId);
|
||||||
|
|
||||||
// Add the ones in the configured list first
|
// Add the ones in the configured list first
|
||||||
ui_->sources->clear();
|
ui_->sources->clear();
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include <QStandardItem>
|
#include <QStandardItem>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
#include "globalsearch.h"
|
#include "globalsearch.h"
|
||||||
|
@ -224,8 +225,8 @@ void GlobalSearchView::ReloadSettings() {
|
||||||
if (show_providers_) {
|
if (show_providers_) {
|
||||||
// Sort the list of providers
|
// Sort the list of providers
|
||||||
QList<SearchProvider*> providers = engine_->providers();
|
QList<SearchProvider*> providers = engine_->providers();
|
||||||
qSort(providers.begin(), providers.end(),
|
std::sort(providers.begin(), providers.end(),
|
||||||
std::bind(&CompareProvider, std::cref(provider_order), _1, _2));
|
std::bind(&CompareProvider, std::cref(provider_order), _1, _2));
|
||||||
|
|
||||||
bool any_disabled = false;
|
bool any_disabled = false;
|
||||||
|
|
||||||
|
@ -307,8 +308,8 @@ void GlobalSearchView::AddResults(int id,
|
||||||
void GlobalSearchView::SwapModels() {
|
void GlobalSearchView::SwapModels() {
|
||||||
art_requests_.clear();
|
art_requests_.clear();
|
||||||
|
|
||||||
qSwap(front_model_, back_model_);
|
std::swap(front_model_, back_model_);
|
||||||
qSwap(front_proxy_, back_proxy_);
|
std::swap(front_proxy_, back_proxy_);
|
||||||
|
|
||||||
ui_->results->setModel(front_proxy_);
|
ui_->results->setModel(front_proxy_);
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,8 @@
|
||||||
|
|
||||||
#include "digitallyimportedservicebase.h"
|
#include "digitallyimportedservicebase.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
|
@ -112,7 +114,7 @@ void DigitallyImportedServiceBase::RefreshStreamsFinished(QNetworkReply* reply,
|
||||||
// Parse the list and sort by name
|
// Parse the list and sort by name
|
||||||
DigitallyImportedClient::ChannelList channels =
|
DigitallyImportedClient::ChannelList channels =
|
||||||
api_client_->ParseChannelList(reply);
|
api_client_->ParseChannelList(reply);
|
||||||
qSort(channels);
|
std::sort(channels.begin(), channels.end());
|
||||||
|
|
||||||
saved_channels_.Update(channels);
|
saved_channels_.Update(channels);
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,8 @@
|
||||||
|
|
||||||
#include "lastfmservice.h"
|
#include "lastfmservice.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#include <QCryptographicHash>
|
#include <QCryptographicHash>
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
|
@ -138,7 +140,7 @@ bool LastFMService::IsSubscriber() const {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
QByteArray SignApiRequest(QList<QPair<QString, QString>> params) {
|
QByteArray SignApiRequest(QList<QPair<QString, QString>> params) {
|
||||||
qSort(params);
|
std::sort(params.begin(), params.end());
|
||||||
QString to_sign;
|
QString to_sign;
|
||||||
for (const auto& p : params) {
|
for (const auto& p : params) {
|
||||||
to_sign += p.first;
|
to_sign += p.first;
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
#include "librarymodel.h"
|
#include "librarymodel.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
#include <QFuture>
|
#include <QFuture>
|
||||||
|
@ -658,7 +659,7 @@ QVariant LibraryModel::data(const LibraryItem* item, int role) const {
|
||||||
return item->SortText();
|
return item->SortText();
|
||||||
|
|
||||||
case Role_DisplayText:
|
case Role_DisplayText:
|
||||||
return item->DisplayText();
|
return item->DisplayText();
|
||||||
}
|
}
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
@ -1268,8 +1269,8 @@ void LibraryModel::GetChildSongs(LibraryItem* item, QList<QUrl>* urls,
|
||||||
const_cast<LibraryModel*>(this)->LazyPopulate(item);
|
const_cast<LibraryModel*>(this)->LazyPopulate(item);
|
||||||
|
|
||||||
QList<LibraryItem*> children = item->children;
|
QList<LibraryItem*> children = item->children;
|
||||||
qSort(children.begin(), children.end(),
|
std::sort(children.begin(), children.end(),
|
||||||
std::bind(&LibraryModel::CompareItems, this, _1, _2));
|
std::bind(&LibraryModel::CompareItems, this, _1, _2));
|
||||||
|
|
||||||
for (LibraryItem* child : children)
|
for (LibraryItem* child : children)
|
||||||
GetChildSongs(child, urls, songs, song_ids);
|
GetChildSongs(child, urls, songs, song_ids);
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
|
|
||||||
#include "acoustidclient.h"
|
#include "acoustidclient.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
@ -131,7 +133,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<QString> id_list;
|
QList<QString> id_list;
|
||||||
for (const IdSource& is : id_source_list) {
|
for (const IdSource& is : id_source_list) {
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
|
|
||||||
#include "musicbrainzclient.h"
|
#include "musicbrainzclient.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
#include <QSet>
|
#include <QSet>
|
||||||
|
@ -207,7 +209,7 @@ void MusicBrainzClient::RequestFinished(QNetworkReply* reply, int id,
|
||||||
// Merge the results we have
|
// Merge the results we have
|
||||||
ResultList ret;
|
ResultList ret;
|
||||||
QList<PendingResults> result_list_list = pending_results_.take(id);
|
QList<PendingResults> 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) {
|
for (const PendingResults& result_list : result_list_list) {
|
||||||
ret << result_list.results_;
|
ret << result_list.results_;
|
||||||
}
|
}
|
||||||
|
@ -312,7 +314,7 @@ MusicBrainzClient::ResultList MusicBrainzClient::ParseTrack(
|
||||||
if (releases.isEmpty()) {
|
if (releases.isEmpty()) {
|
||||||
ret << result;
|
ret << result;
|
||||||
} else {
|
} else {
|
||||||
qStableSort(releases);
|
std::stable_sort(releases.begin(), releases.end());
|
||||||
for (const Release& release : releases) {
|
for (const Release& release : releases) {
|
||||||
ret << release.CopyAndMergeInto(result);
|
ret << release.CopyAndMergeInto(result);
|
||||||
}
|
}
|
||||||
|
@ -381,7 +383,7 @@ MusicBrainzClient::ResultList MusicBrainzClient::UniqueResults(
|
||||||
ResultList ret;
|
ResultList ret;
|
||||||
if (opt == SortResults) {
|
if (opt == SortResults) {
|
||||||
ret = QSet<Result>::fromList(results).toList();
|
ret = QSet<Result>::fromList(results).toList();
|
||||||
qSort(ret);
|
std::sort(ret.begin(), ret.end());
|
||||||
} else { // KeepOriginalOrder
|
} else { // KeepOriginalOrder
|
||||||
// Qt doesn't provide a ordered set (QSet "stores values in an unspecified
|
// Qt doesn't provide a ordered set (QSet "stores values in an unspecified
|
||||||
// order" according to Qt documentation).
|
// order" according to Qt documentation).
|
||||||
|
|
|
@ -812,7 +812,8 @@ bool Playlist::dropMimeData(const QMimeData* data, Qt::DropAction action,
|
||||||
pid = !own_pid;
|
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) {
|
if (source_playlist == this) {
|
||||||
// Dragged from this playlist - rearrange the items
|
// Dragged from this playlist - rearrange the items
|
||||||
|
@ -1464,25 +1465,25 @@ void Playlist::sort(int column, Qt::SortOrder order) {
|
||||||
|
|
||||||
if (column == Column_Album) {
|
if (column == Column_Album) {
|
||||||
// When sorting by album, also take into account discs and tracks.
|
// When sorting by album, also take into account discs and tracks.
|
||||||
qStableSort(begin, new_items.end(),
|
std::stable_sort(begin, new_items.end(),
|
||||||
std::bind(&Playlist::CompareItems, Column_Track, order, _1, _2,
|
std::bind(&Playlist::CompareItems, Column_Track, order, _1,
|
||||||
prefixes));
|
_2, prefixes));
|
||||||
qStableSort(begin, new_items.end(),
|
std::stable_sort(begin, new_items.end(),
|
||||||
std::bind(&Playlist::CompareItems, Column_Disc, order, _1, _2,
|
std::bind(&Playlist::CompareItems, Column_Disc, order, _1,
|
||||||
prefixes));
|
_2, prefixes));
|
||||||
qStableSort(begin, new_items.end(),
|
std::stable_sort(begin, new_items.end(),
|
||||||
std::bind(&Playlist::CompareItems, Column_Album, order, _1, _2,
|
std::bind(&Playlist::CompareItems, Column_Album, order, _1,
|
||||||
prefixes));
|
_2, prefixes));
|
||||||
} else if (column == Column_Filename) {
|
} else if (column == Column_Filename) {
|
||||||
// When sorting by full paths we also expect a hierarchical order. This
|
// When sorting by full paths we also expect a hierarchical order. This
|
||||||
// returns a breath-first ordering of paths.
|
// returns a breath-first ordering of paths.
|
||||||
qStableSort(begin, new_items.end(),
|
std::stable_sort(begin, new_items.end(),
|
||||||
std::bind(&Playlist::CompareItems, Column_Filename, order, _1,
|
std::bind(&Playlist::CompareItems, Column_Filename, order,
|
||||||
_2, prefixes));
|
_1, _2, prefixes));
|
||||||
qStableSort(begin, new_items.end(),
|
std::stable_sort(begin, new_items.end(),
|
||||||
std::bind(&Playlist::ComparePathDepths, order, _1, _2));
|
std::bind(&Playlist::ComparePathDepths, order, _1, _2));
|
||||||
} else {
|
} else {
|
||||||
qStableSort(
|
std::stable_sort(
|
||||||
begin, new_items.end(),
|
begin, new_items.end(),
|
||||||
std::bind(&Playlist::CompareItems, column, order, _1, _2, prefixes));
|
std::bind(&Playlist::CompareItems, column, order, _1, _2, prefixes));
|
||||||
}
|
}
|
||||||
|
@ -1618,7 +1619,7 @@ void Playlist::RemoveItemsWithoutUndo(const QList<int>& indicesIn) {
|
||||||
// Sort the indices descending because removing elements 'backwards'
|
// Sort the indices descending because removing elements 'backwards'
|
||||||
// is easier - indices don't 'move' in the process.
|
// is easier - indices don't 'move' in the process.
|
||||||
QList<int> indices = indicesIn;
|
QList<int> indices = indicesIn;
|
||||||
qSort(indices.begin(), indices.end(), DescendingIntLessThan);
|
std::sort(indices.begin(), indices.end(), DescendingIntLessThan);
|
||||||
|
|
||||||
for (int j = 0; j < indices.count(); j++) {
|
for (int j = 0; j < indices.count(); j++) {
|
||||||
int beginning = indices[j], end = indices[j];
|
int beginning = indices[j], end = indices[j];
|
||||||
|
@ -1661,7 +1662,7 @@ bool Playlist::removeRows(QList<int>& rows) {
|
||||||
|
|
||||||
// start from the end to be sure that indices won't 'move' during
|
// start from the end to be sure that indices won't 'move' during
|
||||||
// the removal process
|
// the removal process
|
||||||
qSort(rows.begin(), rows.end(), qGreater<int>());
|
std::sort(rows.begin(), rows.end(), std::greater<int>());
|
||||||
|
|
||||||
QList<int> part;
|
QList<int> part;
|
||||||
while (!rows.isEmpty()) {
|
while (!rows.isEmpty()) {
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
#include <QTimeLine>
|
#include <QTimeLine>
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#ifdef HAVE_MOODBAR
|
#ifdef HAVE_MOODBAR
|
||||||
#include "moodbar/moodbaritemdelegate.h"
|
#include "moodbar/moodbaritemdelegate.h"
|
||||||
|
@ -655,7 +656,7 @@ void PlaylistView::RemoveSelected(bool deleting_from_disk) {
|
||||||
|
|
||||||
// Sort the selection so we remove the items at the *bottom* first, ensuring
|
// Sort the selection so we remove the items at the *bottom* first, ensuring
|
||||||
// we don't have to mess around with changing row numbers
|
// 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) {
|
for (const QItemSelectionRange& range : selection) {
|
||||||
if (range.top() < last_row) rows_removed += range.height();
|
if (range.top() < last_row) rows_removed += range.height();
|
||||||
|
@ -698,7 +699,7 @@ QList<int> PlaylistView::GetEditableColumns() {
|
||||||
QModelIndex index = model()->index(0, col);
|
QModelIndex index = model()->index(0, col);
|
||||||
if (index.flags() & Qt::ItemIsEditable) columns << h->visualIndex(col);
|
if (index.flags() & Qt::ItemIsEditable) columns << h->visualIndex(col);
|
||||||
}
|
}
|
||||||
qSort(columns);
|
std::sort(columns.begin(), columns.end());
|
||||||
return columns;
|
return columns;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
|
|
||||||
#include "queue.h"
|
#include "queue.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#include <QBuffer>
|
#include <QBuffer>
|
||||||
#include <QMimeData>
|
#include <QMimeData>
|
||||||
#include <QtDebug>
|
#include <QtDebug>
|
||||||
|
@ -317,7 +319,8 @@ bool Queue::dropMimeData(const QMimeData* data, Qt::DropAction action, int row,
|
||||||
QList<int> proxy_rows;
|
QList<int> proxy_rows;
|
||||||
QDataStream stream(data->data(kRowsMimetype));
|
QDataStream stream(data->data(kRowsMimetype));
|
||||||
stream >> proxy_rows;
|
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);
|
Move(proxy_rows, row);
|
||||||
} else if (data->hasFormat(Playlist::kRowsMimetype)) {
|
} else if (data->hasFormat(Playlist::kRowsMimetype)) {
|
||||||
|
@ -388,7 +391,7 @@ QVariant Queue::headerData(int section, Qt::Orientation orientation,
|
||||||
|
|
||||||
void Queue::Remove(QList<int>& proxy_rows) {
|
void Queue::Remove(QList<int>& proxy_rows) {
|
||||||
// order the rows
|
// order the rows
|
||||||
qStableSort(proxy_rows);
|
std::stable_sort(proxy_rows.begin(), proxy_rows.end());
|
||||||
|
|
||||||
// reflects immediately changes in the playlist
|
// reflects immediately changes in the playlist
|
||||||
layoutAboutToBeChanged();
|
layoutAboutToBeChanged();
|
||||||
|
|
|
@ -23,6 +23,8 @@
|
||||||
#include "ui_queuemanager.h"
|
#include "ui_queuemanager.h"
|
||||||
#include "ui/iconloader.h"
|
#include "ui/iconloader.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#include <QKeySequence>
|
#include <QKeySequence>
|
||||||
#include <QShortcut>
|
#include <QShortcut>
|
||||||
|
|
||||||
|
@ -105,7 +107,7 @@ void QueueManager::CurrentPlaylistChanged(Playlist* playlist) {
|
||||||
|
|
||||||
void QueueManager::MoveUp() {
|
void QueueManager::MoveUp() {
|
||||||
QModelIndexList indexes = ui_->list->selectionModel()->selectedRows();
|
QModelIndexList indexes = ui_->list->selectionModel()->selectedRows();
|
||||||
qStableSort(indexes);
|
std::stable_sort(indexes.begin(), indexes.end());
|
||||||
|
|
||||||
if (indexes.isEmpty() || indexes.first().row() == 0) return;
|
if (indexes.isEmpty() || indexes.first().row() == 0) return;
|
||||||
|
|
||||||
|
@ -116,7 +118,7 @@ void QueueManager::MoveUp() {
|
||||||
|
|
||||||
void QueueManager::MoveDown() {
|
void QueueManager::MoveDown() {
|
||||||
QModelIndexList indexes = ui_->list->selectionModel()->selectedRows();
|
QModelIndexList indexes = ui_->list->selectionModel()->selectedRows();
|
||||||
qStableSort(indexes);
|
std::stable_sort(indexes.begin(), indexes.end());
|
||||||
|
|
||||||
if (indexes.isEmpty() ||
|
if (indexes.isEmpty() ||
|
||||||
indexes.last().row() == current_playlist_->queue()->rowCount() - 1)
|
indexes.last().row() == current_playlist_->queue()->rowCount() - 1)
|
||||||
|
|
|
@ -25,6 +25,8 @@
|
||||||
#include "xspfparser.h"
|
#include "xspfparser.h"
|
||||||
#include "core/logging.h"
|
#include "core/logging.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#include <QtDebug>
|
#include <QtDebug>
|
||||||
|
|
||||||
const int PlaylistParser::kMagicSize = 512;
|
const int PlaylistParser::kMagicSize = 512;
|
||||||
|
@ -49,7 +51,7 @@ QStringList PlaylistParser::file_extensions() const {
|
||||||
ret << parser->file_extensions();
|
ret << parser->file_extensions();
|
||||||
}
|
}
|
||||||
|
|
||||||
qStableSort(ret);
|
std::stable_sort(ret.begin(), ret.end());
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,7 +62,7 @@ QStringList PlaylistParser::mime_types() const {
|
||||||
if (!parser->mime_type().isEmpty()) ret << parser->mime_type();
|
if (!parser->mime_type().isEmpty()) ret << parser->mime_type();
|
||||||
}
|
}
|
||||||
|
|
||||||
qStableSort(ret);
|
std::stable_sort(ret.begin(), ret.end());
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
|
|
||||||
#include "ripper/ripcddialog.h"
|
#include "ripper/ripcddialog.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
#include <QCloseEvent>
|
#include <QCloseEvent>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
|
@ -107,7 +109,7 @@ RipCDDialog::RipCDDialog(QWidget* parent)
|
||||||
|
|
||||||
// Get presets
|
// Get presets
|
||||||
QList<TranscoderPreset> presets = Transcoder::GetAllPresets();
|
QList<TranscoderPreset> presets = Transcoder::GetAllPresets();
|
||||||
qSort(presets.begin(), presets.end(), ComparePresetsByName);
|
std::sort(presets.begin(), presets.end(), ComparePresetsByName);
|
||||||
for (const TranscoderPreset& preset : presets) {
|
for (const TranscoderPreset& preset : presets) {
|
||||||
ui_->format->addItem(
|
ui_->format->addItem(
|
||||||
QString("%1 (.%2)").arg(preset.name_).arg(preset.extension_),
|
QString("%1 (.%2)").arg(preset.name_).arg(preset.extension_),
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
|
|
||||||
#include "songinfo/songinfoview.h"
|
#include "songinfo/songinfoview.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#include <QFuture>
|
#include <QFuture>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QtConcurrentRun>
|
#include <QtConcurrentRun>
|
||||||
|
@ -159,6 +161,6 @@ QList<const UltimateLyricsProvider*> SongInfoView::lyric_providers() const {
|
||||||
ret << lyrics;
|
ret << lyrics;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
qSort(ret.begin(), ret.end(), CompareLyricProviders);
|
std::sort(ret.begin(), ret.end(), CompareLyricProviders);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,8 @@
|
||||||
#include "ui/mainwindow.h"
|
#include "ui/mainwindow.h"
|
||||||
#include "widgets/fileview.h"
|
#include "widgets/fileview.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QDirIterator>
|
#include <QDirIterator>
|
||||||
|
@ -63,7 +65,7 @@ TranscodeDialog::TranscodeDialog(QWidget* parent)
|
||||||
|
|
||||||
// Get presets
|
// Get presets
|
||||||
QList<TranscoderPreset> presets = Transcoder::GetAllPresets();
|
QList<TranscoderPreset> presets = Transcoder::GetAllPresets();
|
||||||
qSort(presets.begin(), presets.end(), ComparePresetsByName);
|
std::sort(presets.begin(), presets.end(), ComparePresetsByName);
|
||||||
for (const TranscoderPreset& preset : presets) {
|
for (const TranscoderPreset& preset : presets) {
|
||||||
ui_->format->addItem(
|
ui_->format->addItem(
|
||||||
QString("%1 (.%2)").arg(preset.name_, preset.extension_),
|
QString("%1 (.%2)").arg(preset.name_, preset.extension_),
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
#include "transcoder.h"
|
#include "transcoder.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
|
@ -138,7 +139,7 @@ GstElement* Transcoder::CreateElementForMimeType(const QString& element_type,
|
||||||
if (suitable_elements_.isEmpty()) return nullptr;
|
if (suitable_elements_.isEmpty()) return nullptr;
|
||||||
|
|
||||||
// Sort by rank
|
// Sort by rank
|
||||||
qSort(suitable_elements_);
|
std::sort(suitable_elements_.begin(), suitable_elements_.end());
|
||||||
const SuitableElement& best = suitable_elements_.last();
|
const SuitableElement& best = suitable_elements_.last();
|
||||||
|
|
||||||
LogLine(QString("Using '%1' (rank %2)").arg(best.name_).arg(best.rank_));
|
LogLine(QString("Using '%1' (rank %2)").arg(best.name_).arg(best.rank_));
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "ui_about.h"
|
#include "ui_about.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
|
||||||
|
@ -53,8 +55,8 @@ About::About(QWidget* parent) : QDialog(parent) {
|
||||||
<< Person("Andreas Muttscheller", "asfa194@gmail.com")
|
<< Person("Andreas Muttscheller", "asfa194@gmail.com")
|
||||||
<< Person("Mark Furneaux", "mark@furneaux.ca");
|
<< Person("Mark Furneaux", "mark@furneaux.ca");
|
||||||
|
|
||||||
qSort(authors_);
|
std::sort(authors_.begin(), authors_.end());
|
||||||
qSort(thanks_to_);
|
std::sort(thanks_to_.begin(), thanks_to_.end());
|
||||||
|
|
||||||
ui_.content->setHtml(MakeHtml());
|
ui_.content->setHtml(MakeHtml());
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,8 @@
|
||||||
#include "ui/albumcoverexport.h"
|
#include "ui/albumcoverexport.h"
|
||||||
#include "ui/iconloader.h"
|
#include "ui/iconloader.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#include <QActionGroup>
|
#include <QActionGroup>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QContextMenuEvent>
|
#include <QContextMenuEvent>
|
||||||
|
@ -265,7 +267,7 @@ void AlbumCoverManager::Reset() {
|
||||||
Various_Artists);
|
Various_Artists);
|
||||||
|
|
||||||
QStringList artists(library_backend_->GetAllArtistsWithAlbums());
|
QStringList artists(library_backend_->GetAllArtistsWithAlbums());
|
||||||
qStableSort(artists.begin(), artists.end(), CompareNocase);
|
std::stable_sort(artists.begin(), artists.end(), CompareNocase);
|
||||||
|
|
||||||
for (const QString& artist : artists) {
|
for (const QString& artist : artists) {
|
||||||
if (artist.isEmpty()) continue;
|
if (artist.isEmpty()) continue;
|
||||||
|
@ -313,7 +315,7 @@ void AlbumCoverManager::ArtistChanged(QListWidgetItem* current) {
|
||||||
|
|
||||||
// Sort by album name. The list is already sorted by sqlite but it was done
|
// Sort by album name. The list is already sorted by sqlite but it was done
|
||||||
// case sensitively.
|
// case sensitively.
|
||||||
qStableSort(albums.begin(), albums.end(), CompareAlbumNameNocase);
|
std::stable_sort(albums.begin(), albums.end(), CompareAlbumNameNocase);
|
||||||
|
|
||||||
for (const LibraryBackend::Album& info : albums) {
|
for (const LibraryBackend::Album& info : albums) {
|
||||||
// Don't show songs without an album, obviously
|
// Don't show songs without an album, obviously
|
||||||
|
|
|
@ -22,6 +22,8 @@
|
||||||
#include "playlist/playlist.h"
|
#include "playlist/playlist.h"
|
||||||
#include "playlist/playlisttabbar.h"
|
#include "playlist/playlisttabbar.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QSystemTrayIcon>
|
#include <QSystemTrayIcon>
|
||||||
|
|
||||||
|
@ -91,7 +93,7 @@ BehaviourSettingsPage::BehaviourSettingsPage(SettingsDialog* dialog)
|
||||||
|
|
||||||
// Sort the names and show them in the UI
|
// Sort the names and show them in the UI
|
||||||
QStringList names = language_map_.keys();
|
QStringList names = language_map_.keys();
|
||||||
qStableSort(names.begin(), names.end(), LocaleAwareCompare);
|
std::stable_sort(names.begin(), names.end(), LocaleAwareCompare);
|
||||||
ui_->language->addItems(names);
|
ui_->language->addItems(names);
|
||||||
|
|
||||||
#ifdef Q_OS_DARWIN
|
#ifdef Q_OS_DARWIN
|
||||||
|
|
|
@ -148,6 +148,7 @@
|
||||||
#include "moodbar/moodbarproxystyle.h"
|
#include "moodbar/moodbarproxystyle.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
#ifdef Q_OS_DARWIN
|
#ifdef Q_OS_DARWIN
|
||||||
|
@ -1962,7 +1963,7 @@ void MainWindow::RenumberTracks() {
|
||||||
int track = 1;
|
int track = 1;
|
||||||
|
|
||||||
// Get the index list in order
|
// 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 first selected song has a track number set, start from that offset
|
||||||
if (!indexes.isEmpty()) {
|
if (!indexes.isEmpty()) {
|
||||||
|
@ -2187,7 +2188,7 @@ void MainWindow::CommandlineOptionsReceived(
|
||||||
|
|
||||||
void MainWindow::CommandlineOptionsReceived(const CommandlineOptions& options) {
|
void MainWindow::CommandlineOptionsReceived(const CommandlineOptions& options) {
|
||||||
qLog(Debug) << "command line options received";
|
qLog(Debug) << "command line options received";
|
||||||
|
|
||||||
switch (options.player_action()) {
|
switch (options.player_action()) {
|
||||||
case CommandlineOptions::Player_Play:
|
case CommandlineOptions::Player_Play:
|
||||||
if (options.urls().empty()) {
|
if (options.urls().empty()) {
|
||||||
|
@ -2269,21 +2270,21 @@ void MainWindow::CommandlineOptionsReceived(const CommandlineOptions& options) {
|
||||||
|
|
||||||
qLog(Debug) << options.delete_current_track();
|
qLog(Debug) << options.delete_current_track();
|
||||||
|
|
||||||
// Just pass the url of the currently playing
|
// Just pass the url of the currently playing
|
||||||
if (options.delete_current_track()) {
|
if (options.delete_current_track()) {
|
||||||
qLog(Debug) << "deleting current track";
|
qLog(Debug) << "deleting current track";
|
||||||
|
|
||||||
Playlist* activePlaylist = app_->playlist_manager()->active();
|
Playlist* activePlaylist = app_->playlist_manager()->active();
|
||||||
PlaylistItemPtr playlistItemPtr = activePlaylist->current_item();
|
PlaylistItemPtr playlistItemPtr = activePlaylist->current_item();
|
||||||
|
|
||||||
if (playlistItemPtr) {
|
if (playlistItemPtr) {
|
||||||
const QUrl& url = playlistItemPtr->Url();
|
const QUrl& url = playlistItemPtr->Url();
|
||||||
qLog(Debug) << url;
|
qLog(Debug) << url;
|
||||||
|
|
||||||
std::shared_ptr<MusicStorage> storage(new FilesystemMusicStorage("/"));
|
std::shared_ptr<MusicStorage> storage(new FilesystemMusicStorage("/"));
|
||||||
|
|
||||||
app_->player()->Next();
|
app_->player()->Next();
|
||||||
|
|
||||||
DeleteFiles* delete_files = new DeleteFiles(app_->task_manager(), storage);
|
DeleteFiles* delete_files = new DeleteFiles(app_->task_manager(), storage);
|
||||||
connect(delete_files, SIGNAL(Finished(SongList)),
|
connect(delete_files, SIGNAL(Finished(SongList)),
|
||||||
SLOT(DeleteFinished(SongList)));
|
SLOT(DeleteFinished(SongList)));
|
||||||
|
@ -2293,7 +2294,7 @@ void MainWindow::CommandlineOptionsReceived(const CommandlineOptions& options) {
|
||||||
qLog(Debug) << "no currently playing track to delete";
|
qLog(Debug) << "no currently playing track to delete";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.show_osd()) app_->player()->ShowOSD();
|
if (options.show_osd()) app_->player()->ShowOSD();
|
||||||
|
|
||||||
if (options.toggle_pretty_osd()) app_->player()->TogglePrettyOSD();
|
if (options.toggle_pretty_osd()) app_->player()->TogglePrettyOSD();
|
||||||
|
@ -2509,9 +2510,9 @@ void MainWindow::DeleteFinished(const SongList& songs_with_errors) {
|
||||||
activePlaylist->RemoveUnavailableSongs();
|
activePlaylist->RemoveUnavailableSongs();
|
||||||
qLog(Debug) << "Found active playlist and removed unavailable songs";
|
qLog(Debug) << "Found active playlist and removed unavailable songs";
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
OrganiseErrorDialog* dialog = new OrganiseErrorDialog(this);
|
OrganiseErrorDialog* dialog = new OrganiseErrorDialog(this);
|
||||||
dialog->Show(OrganiseErrorDialog::Type_Delete, songs_with_errors);
|
dialog->Show(OrganiseErrorDialog::Type_Delete, songs_with_errors);
|
||||||
|
|
|
@ -18,6 +18,8 @@
|
||||||
#include "networkremotesettingspage.h"
|
#include "networkremotesettingspage.h"
|
||||||
#include "ui_networkremotesettingspage.h"
|
#include "ui_networkremotesettingspage.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QHostInfo>
|
#include <QHostInfo>
|
||||||
|
@ -52,7 +54,7 @@ NetworkRemoteSettingsPage::NetworkRemoteSettingsPage(SettingsDialog* dialog)
|
||||||
|
|
||||||
// Get presets
|
// Get presets
|
||||||
QList<TranscoderPreset> presets = Transcoder::GetAllPresets();
|
QList<TranscoderPreset> presets = Transcoder::GetAllPresets();
|
||||||
qSort(presets.begin(), presets.end(), ComparePresetsByName);
|
std::sort(presets.begin(), presets.end(), ComparePresetsByName);
|
||||||
for (const TranscoderPreset& preset : presets) {
|
for (const TranscoderPreset& preset : presets) {
|
||||||
ui_->format->addItem(
|
ui_->format->addItem(
|
||||||
QString("%1 (.%2)").arg(preset.name_, preset.extension_),
|
QString("%1 (.%2)").arg(preset.name_, preset.extension_),
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include "organisedialog.h"
|
#include "organisedialog.h"
|
||||||
#include "ui_organisedialog.h"
|
#include "ui_organisedialog.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
@ -93,7 +94,7 @@ OrganiseDialog::OrganiseDialog(
|
||||||
|
|
||||||
// Get the titles of the tags to put in the insert menu
|
// Get the titles of the tags to put in the insert menu
|
||||||
QStringList tag_titles = tags.keys();
|
QStringList tag_titles = tags.keys();
|
||||||
qStableSort(tag_titles);
|
std::stable_sort(tag_titles.begin(), tag_titles.end());
|
||||||
|
|
||||||
// Build the insert menu
|
// Build the insert menu
|
||||||
QMenu* tag_menu = new QMenu(this);
|
QMenu* tag_menu = new QMenu(this);
|
||||||
|
|
|
@ -18,6 +18,8 @@
|
||||||
#include "organiseerrordialog.h"
|
#include "organiseerrordialog.h"
|
||||||
#include "ui_organiseerrordialog.h"
|
#include "ui_organiseerrordialog.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
|
||||||
OrganiseErrorDialog::OrganiseErrorDialog(QWidget* parent)
|
OrganiseErrorDialog::OrganiseErrorDialog(QWidget* parent)
|
||||||
|
@ -45,7 +47,7 @@ void OrganiseErrorDialog::Show(OperationType type,
|
||||||
void OrganiseErrorDialog::Show(OperationType type,
|
void OrganiseErrorDialog::Show(OperationType type,
|
||||||
const QStringList& files_with_errors) {
|
const QStringList& files_with_errors) {
|
||||||
QStringList sorted_files = files_with_errors;
|
QStringList sorted_files = files_with_errors;
|
||||||
qStableSort(sorted_files);
|
std::stable_sort(sorted_files.begin(), sorted_files.end());
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case Type_Copy:
|
case Type_Copy:
|
||||||
|
|
Loading…
Reference in New Issue