Change some parameters to const
This commit is contained in:
@@ -149,7 +149,7 @@ CollectionModel::~CollectionModel() {
|
||||
delete root_;
|
||||
}
|
||||
|
||||
void CollectionModel::set_pretty_covers(bool use_pretty_covers) {
|
||||
void CollectionModel::set_pretty_covers(const bool use_pretty_covers) {
|
||||
|
||||
if (use_pretty_covers != use_pretty_covers_) {
|
||||
use_pretty_covers_ = use_pretty_covers;
|
||||
@@ -157,7 +157,7 @@ void CollectionModel::set_pretty_covers(bool use_pretty_covers) {
|
||||
}
|
||||
}
|
||||
|
||||
void CollectionModel::set_show_dividers(bool show_dividers) {
|
||||
void CollectionModel::set_show_dividers(const bool show_dividers) {
|
||||
|
||||
if (show_dividers != show_dividers_) {
|
||||
show_dividers_ = show_dividers;
|
||||
@@ -199,7 +199,7 @@ void CollectionModel::ReloadSettings() {
|
||||
|
||||
}
|
||||
|
||||
void CollectionModel::Init(bool async) {
|
||||
void CollectionModel::Init(const bool async) {
|
||||
|
||||
if (async) {
|
||||
// Show a loading indicator in the model.
|
||||
@@ -338,7 +338,7 @@ void CollectionModel::SongsSlightlyChanged(const SongList &songs) {
|
||||
|
||||
}
|
||||
|
||||
CollectionItem *CollectionModel::CreateCompilationArtistNode(bool signal, CollectionItem *parent) {
|
||||
CollectionItem *CollectionModel::CreateCompilationArtistNode(const bool signal, CollectionItem *parent) {
|
||||
|
||||
if (signal) beginInsertRows(ItemToIndex(parent), parent->children.count(), parent->children.count());
|
||||
|
||||
@@ -354,7 +354,7 @@ CollectionItem *CollectionModel::CreateCompilationArtistNode(bool signal, Collec
|
||||
|
||||
}
|
||||
|
||||
QString CollectionModel::DividerKey(GroupBy type, CollectionItem *item) const {
|
||||
QString CollectionModel::DividerKey(const GroupBy type, CollectionItem *item) const {
|
||||
|
||||
// Items which are to be grouped under the same divider must produce the same divider key. This will only get called for top-level items.
|
||||
|
||||
@@ -408,7 +408,7 @@ QString CollectionModel::DividerKey(GroupBy type, CollectionItem *item) const {
|
||||
|
||||
}
|
||||
|
||||
QString CollectionModel::DividerDisplayText(GroupBy type, const QString &key) const {
|
||||
QString CollectionModel::DividerDisplayText(const GroupBy type, const QString &key) const {
|
||||
|
||||
// Pretty display text for the dividers.
|
||||
|
||||
@@ -658,7 +658,7 @@ void CollectionModel::AlbumCoverLoaded(const quint64 id, const AlbumCoverLoaderR
|
||||
|
||||
}
|
||||
|
||||
QVariant CollectionModel::data(const QModelIndex &idx, int role) const {
|
||||
QVariant CollectionModel::data(const QModelIndex &idx, const int role) const {
|
||||
|
||||
const CollectionItem *item = IndexToItem(idx);
|
||||
|
||||
@@ -686,7 +686,7 @@ QVariant CollectionModel::data(const QModelIndex &idx, int role) const {
|
||||
|
||||
}
|
||||
|
||||
QVariant CollectionModel::data(const CollectionItem *item, int role) const {
|
||||
QVariant CollectionModel::data(const CollectionItem *item, const int role) const {
|
||||
|
||||
GroupBy container_type = item->type == CollectionItem::Type_Container ? group_by_[item->container_level] : GroupBy_None;
|
||||
|
||||
@@ -826,7 +826,7 @@ CollectionModel::QueryResult CollectionModel::RunQuery(CollectionItem *parent) {
|
||||
|
||||
}
|
||||
|
||||
void CollectionModel::PostQuery(CollectionItem *parent, const CollectionModel::QueryResult &result, bool signal) {
|
||||
void CollectionModel::PostQuery(CollectionItem *parent, const CollectionModel::QueryResult &result, const bool signal) {
|
||||
|
||||
// Information about what we want the children to be
|
||||
int child_level = parent == root_ ? 0 : parent->container_level + 1;
|
||||
@@ -850,7 +850,7 @@ void CollectionModel::PostQuery(CollectionItem *parent, const CollectionModel::Q
|
||||
|
||||
}
|
||||
|
||||
void CollectionModel::LazyPopulate(CollectionItem *parent, bool signal) {
|
||||
void CollectionModel::LazyPopulate(CollectionItem *parent, const bool signal) {
|
||||
|
||||
if (parent->lazy_loaded) return;
|
||||
parent->lazy_loaded = true;
|
||||
@@ -918,7 +918,7 @@ void CollectionModel::Reset() {
|
||||
|
||||
}
|
||||
|
||||
void CollectionModel::InitQuery(GroupBy type, CollectionQuery *q) {
|
||||
void CollectionModel::InitQuery(const GroupBy type, CollectionQuery *q) {
|
||||
|
||||
// Say what type of thing we want to get back from the database.
|
||||
switch (type) {
|
||||
@@ -986,7 +986,7 @@ void CollectionModel::InitQuery(GroupBy type, CollectionQuery *q) {
|
||||
|
||||
}
|
||||
|
||||
void CollectionModel::FilterQuery(GroupBy type, CollectionItem *item, CollectionQuery *q) {
|
||||
void CollectionModel::FilterQuery(const GroupBy type, CollectionItem *item, CollectionQuery *q) {
|
||||
|
||||
// Say how we want the query to be filtered. This is done once for each parent going up the tree.
|
||||
|
||||
@@ -1079,7 +1079,7 @@ void CollectionModel::FilterQuery(GroupBy type, CollectionItem *item, Collection
|
||||
|
||||
}
|
||||
|
||||
CollectionItem *CollectionModel::InitItem(GroupBy type, bool signal, CollectionItem *parent, int container_level) {
|
||||
CollectionItem *CollectionModel::InitItem(const GroupBy type, const bool signal, CollectionItem *parent, const int container_level) {
|
||||
|
||||
CollectionItem::Type item_type = type == GroupBy_None ? CollectionItem::Type_Song : CollectionItem::Type_Container;
|
||||
|
||||
@@ -1094,7 +1094,7 @@ CollectionItem *CollectionModel::InitItem(GroupBy type, bool signal, CollectionI
|
||||
|
||||
}
|
||||
|
||||
CollectionItem *CollectionModel::ItemFromQuery(GroupBy type, bool signal, bool create_divider, CollectionItem *parent, const SqlRow &row, int container_level) {
|
||||
CollectionItem *CollectionModel::ItemFromQuery(const GroupBy type, const bool signal, const bool create_divider, CollectionItem *parent, const SqlRow &row, const int container_level) {
|
||||
|
||||
CollectionItem *item = InitItem(type, signal, parent, container_level);
|
||||
|
||||
@@ -1232,7 +1232,7 @@ CollectionItem *CollectionModel::ItemFromQuery(GroupBy type, bool signal, bool c
|
||||
|
||||
}
|
||||
|
||||
CollectionItem *CollectionModel::ItemFromSong(GroupBy type, bool signal, bool create_divider, CollectionItem *parent, const Song &s, int container_level) {
|
||||
CollectionItem *CollectionModel::ItemFromSong(const GroupBy type, const bool signal, const bool create_divider, CollectionItem *parent, const Song &s, const int container_level) {
|
||||
|
||||
CollectionItem *item = InitItem(type, signal, parent, container_level);
|
||||
|
||||
@@ -1379,7 +1379,7 @@ CollectionItem *CollectionModel::ItemFromSong(GroupBy type, bool signal, bool cr
|
||||
|
||||
}
|
||||
|
||||
void CollectionModel::FinishItem(GroupBy type, bool signal, bool create_divider, CollectionItem *parent, CollectionItem *item) {
|
||||
void CollectionModel::FinishItem(const GroupBy type, const bool signal, const bool create_divider, CollectionItem *parent, CollectionItem *item) {
|
||||
|
||||
if (type == GroupBy_None) item->lazy_loaded = true;
|
||||
|
||||
@@ -1471,19 +1471,19 @@ QString CollectionModel::SortTextForArtist(QString artist) {
|
||||
|
||||
}
|
||||
|
||||
QString CollectionModel::SortTextForNumber(int number) {
|
||||
QString CollectionModel::SortTextForNumber(const int number) {
|
||||
|
||||
return QString("%1").arg(number, 4, 10, QChar('0'));
|
||||
}
|
||||
|
||||
QString CollectionModel::SortTextForYear(int year) {
|
||||
QString CollectionModel::SortTextForYear(const int year) {
|
||||
|
||||
QString str = QString::number(year);
|
||||
return QString("0").repeated(qMax(0, 4 - str.length())) + str;
|
||||
|
||||
}
|
||||
|
||||
QString CollectionModel::SortTextForBitrate(int bitrate) {
|
||||
QString CollectionModel::SortTextForBitrate(const int bitrate) {
|
||||
|
||||
QString str = QString::number(bitrate);
|
||||
return QString("0").repeated(qMax(0, 3 - str.length())) + str;
|
||||
@@ -1607,7 +1607,7 @@ SongList CollectionModel::GetChildSongs(const QModelIndex &idx) const {
|
||||
return GetChildSongs(QModelIndexList() << idx);
|
||||
}
|
||||
|
||||
void CollectionModel::SetFilterAge(int age) {
|
||||
void CollectionModel::SetFilterAge(const int age) {
|
||||
query_options_.set_max_age(age);
|
||||
ResetAsync();
|
||||
}
|
||||
@@ -1642,7 +1642,7 @@ void CollectionModel::SetGroupBy(const Grouping &g) {
|
||||
|
||||
}
|
||||
|
||||
const CollectionModel::GroupBy &CollectionModel::Grouping::operator[](int i) const {
|
||||
const CollectionModel::GroupBy &CollectionModel::Grouping::operator[](const int i) const {
|
||||
|
||||
switch (i) {
|
||||
case 0: return first;
|
||||
@@ -1654,7 +1654,7 @@ const CollectionModel::GroupBy &CollectionModel::Grouping::operator[](int i) con
|
||||
|
||||
}
|
||||
|
||||
CollectionModel::GroupBy &CollectionModel::Grouping::operator[](int i) {
|
||||
CollectionModel::GroupBy &CollectionModel::Grouping::operator[](const int i) {
|
||||
|
||||
switch (i) {
|
||||
case 0: return first;
|
||||
@@ -1668,21 +1668,21 @@ CollectionModel::GroupBy &CollectionModel::Grouping::operator[](int i) {
|
||||
}
|
||||
|
||||
|
||||
void CollectionModel::TotalSongCountUpdatedSlot(int count) {
|
||||
void CollectionModel::TotalSongCountUpdatedSlot(const int count) {
|
||||
|
||||
total_song_count_ = count;
|
||||
emit TotalSongCountUpdated(count);
|
||||
|
||||
}
|
||||
|
||||
void CollectionModel::TotalArtistCountUpdatedSlot(int count) {
|
||||
void CollectionModel::TotalArtistCountUpdatedSlot(const int count) {
|
||||
|
||||
total_artist_count_ = count;
|
||||
emit TotalArtistCountUpdated(count);
|
||||
|
||||
}
|
||||
|
||||
void CollectionModel::TotalAlbumCountUpdatedSlot(int count) {
|
||||
void CollectionModel::TotalAlbumCountUpdatedSlot(const int count) {
|
||||
|
||||
total_album_count_ = count;
|
||||
emit TotalAlbumCountUpdated(count);
|
||||
|
||||
Reference in New Issue
Block a user