Fix code style and errors
This commit is contained in:
parent
0ce5b50950
commit
9be161d165
2
3rdparty/taglib/asf/asffile.cpp
vendored
2
3rdparty/taglib/asf/asffile.cpp
vendored
@ -113,7 +113,7 @@ class ASF::File::FilePrivate::UnknownObject : public ASF::File::FilePrivate::Bas
|
||||
{
|
||||
ByteVector myGuid;
|
||||
public:
|
||||
UnknownObject(const ByteVector &guid);
|
||||
explicit UnknownObject(const ByteVector &guid);
|
||||
ByteVector guid() const;
|
||||
};
|
||||
|
||||
|
6
3rdparty/taglib/dsf/dsffile.cpp
vendored
6
3rdparty/taglib/dsf/dsffile.cpp
vendored
@ -40,8 +40,10 @@ class DSF::File::FilePrivate
|
||||
{
|
||||
public:
|
||||
FilePrivate() :
|
||||
properties(0),
|
||||
tag(0)
|
||||
fileSize(0),
|
||||
metadataOffset(0),
|
||||
properties(nullptr),
|
||||
tag(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
|
2
3rdparty/taglib/flac/flacfile.cpp
vendored
2
3rdparty/taglib/flac/flacfile.cpp
vendored
@ -60,7 +60,7 @@ namespace
|
||||
class FLAC::File::FilePrivate
|
||||
{
|
||||
public:
|
||||
FilePrivate(const ID3v2::FrameFactory *frameFactory = ID3v2::FrameFactory::instance()) :
|
||||
explicit FilePrivate(const ID3v2::FrameFactory *frameFactory = ID3v2::FrameFactory::instance()) :
|
||||
ID3v2FrameFactory(frameFactory),
|
||||
ID3v2Location(-1),
|
||||
ID3v2OriginalSize(0),
|
||||
|
2
3rdparty/taglib/it/itfile.cpp
vendored
2
3rdparty/taglib/it/itfile.cpp
vendored
@ -36,7 +36,7 @@ using namespace IT;
|
||||
class IT::File::FilePrivate
|
||||
{
|
||||
public:
|
||||
FilePrivate(AudioProperties::ReadStyle propertiesStyle)
|
||||
explicit FilePrivate(AudioProperties::ReadStyle propertiesStyle)
|
||||
: tag(), properties(propertiesStyle)
|
||||
{
|
||||
}
|
||||
|
2
3rdparty/taglib/mod/modfile.cpp
vendored
2
3rdparty/taglib/mod/modfile.cpp
vendored
@ -36,7 +36,7 @@ using namespace Mod;
|
||||
class Mod::File::FilePrivate
|
||||
{
|
||||
public:
|
||||
FilePrivate(AudioProperties::ReadStyle propertiesStyle)
|
||||
explicit FilePrivate(AudioProperties::ReadStyle propertiesStyle)
|
||||
: properties(propertiesStyle)
|
||||
{
|
||||
}
|
||||
|
4
3rdparty/taglib/mpeg/mpegfile.cpp
vendored
4
3rdparty/taglib/mpeg/mpegfile.cpp
vendored
@ -47,7 +47,7 @@ namespace
|
||||
class MPEG::File::FilePrivate
|
||||
{
|
||||
public:
|
||||
FilePrivate(const ID3v2::FrameFactory *frameFactory = ID3v2::FrameFactory::instance()) :
|
||||
explicit FilePrivate(const ID3v2::FrameFactory *frameFactory = ID3v2::FrameFactory::instance()) :
|
||||
ID3v2FrameFactory(frameFactory),
|
||||
ID3v2Location(-1),
|
||||
ID3v2OriginalSize(0),
|
||||
@ -87,7 +87,7 @@ namespace
|
||||
class AdapterFile : public TagLib::File
|
||||
{
|
||||
public:
|
||||
AdapterFile(IOStream *stream) : File(stream) {}
|
||||
explicit AdapterFile(IOStream *stream) : File(stream) {}
|
||||
|
||||
Tag *tag() const { return 0; }
|
||||
AudioProperties *audioProperties() const { return 0; }
|
||||
|
1
3rdparty/taglib/ogg/oggfile.cpp
vendored
1
3rdparty/taglib/ogg/oggfile.cpp
vendored
@ -50,6 +50,7 @@ class Ogg::File::FilePrivate
|
||||
{
|
||||
public:
|
||||
FilePrivate() :
|
||||
streamSerialNumber(0),
|
||||
firstPageHeader(0),
|
||||
lastPageHeader(0)
|
||||
{
|
||||
|
2
3rdparty/taglib/riff/rifffile.cpp
vendored
2
3rdparty/taglib/riff/rifffile.cpp
vendored
@ -46,7 +46,7 @@ struct Chunk
|
||||
class RIFF::File::FilePrivate
|
||||
{
|
||||
public:
|
||||
FilePrivate(Endianness endianness) :
|
||||
explicit FilePrivate(Endianness endianness) :
|
||||
endianness(endianness),
|
||||
size(0),
|
||||
sizeOffset(0) {}
|
||||
|
2
3rdparty/taglib/s3m/s3mfile.cpp
vendored
2
3rdparty/taglib/s3m/s3mfile.cpp
vendored
@ -38,7 +38,7 @@ using namespace S3M;
|
||||
class S3M::File::FilePrivate
|
||||
{
|
||||
public:
|
||||
FilePrivate(AudioProperties::ReadStyle propertiesStyle)
|
||||
explicit FilePrivate(AudioProperties::ReadStyle propertiesStyle)
|
||||
: properties(propertiesStyle)
|
||||
{
|
||||
}
|
||||
|
53
3rdparty/taglib/tag.cpp
vendored
53
3rdparty/taglib/tag.cpp
vendored
@ -34,7 +34,8 @@ class Tag::TagPrivate
|
||||
|
||||
};
|
||||
|
||||
Tag::Tag()
|
||||
Tag::Tag() :
|
||||
d(nullptr)
|
||||
{
|
||||
|
||||
}
|
||||
@ -58,19 +59,19 @@ bool Tag::isEmpty() const
|
||||
PropertyMap Tag::properties() const
|
||||
{
|
||||
PropertyMap map;
|
||||
if(!(title().isEmpty()))
|
||||
if (!(title().isEmpty()))
|
||||
map["TITLE"].append(title());
|
||||
if(!(artist().isEmpty()))
|
||||
if (!(artist().isEmpty()))
|
||||
map["ARTIST"].append(artist());
|
||||
if(!(album().isEmpty()))
|
||||
if (!(album().isEmpty()))
|
||||
map["ALBUM"].append(album());
|
||||
if(!(comment().isEmpty()))
|
||||
if (!(comment().isEmpty()))
|
||||
map["COMMENT"].append(comment());
|
||||
if(!(genre().isEmpty()))
|
||||
if (!(genre().isEmpty()))
|
||||
map["GENRE"].append(genre());
|
||||
if(!(year() == 0))
|
||||
if (!(year() == 0))
|
||||
map["DATE"].append(String::number(year()));
|
||||
if(!(track() == 0))
|
||||
if (!(track() == 0))
|
||||
map["TRACKNUMBER"].append(String::number(track()));
|
||||
return map;
|
||||
}
|
||||
@ -85,40 +86,40 @@ PropertyMap Tag::setProperties(const PropertyMap &origProps)
|
||||
properties.removeEmpty();
|
||||
StringList oneValueSet;
|
||||
// can this be simplified by using some preprocessor defines / function pointers?
|
||||
if(properties.contains("TITLE")) {
|
||||
if (properties.contains("TITLE")) {
|
||||
setTitle(properties["TITLE"].front());
|
||||
oneValueSet.append("TITLE");
|
||||
} else
|
||||
setTitle(String());
|
||||
|
||||
if(properties.contains("ARTIST")) {
|
||||
if (properties.contains("ARTIST")) {
|
||||
setArtist(properties["ARTIST"].front());
|
||||
oneValueSet.append("ARTIST");
|
||||
} else
|
||||
setArtist(String());
|
||||
|
||||
if(properties.contains("ALBUM")) {
|
||||
if (properties.contains("ALBUM")) {
|
||||
setAlbum(properties["ALBUM"].front());
|
||||
oneValueSet.append("ALBUM");
|
||||
} else
|
||||
setAlbum(String());
|
||||
|
||||
if(properties.contains("COMMENT")) {
|
||||
if (properties.contains("COMMENT")) {
|
||||
setComment(properties["COMMENT"].front());
|
||||
oneValueSet.append("COMMENT");
|
||||
} else
|
||||
setComment(String());
|
||||
|
||||
if(properties.contains("GENRE")) {
|
||||
if (properties.contains("GENRE")) {
|
||||
setGenre(properties["GENRE"].front());
|
||||
oneValueSet.append("GENRE");
|
||||
} else
|
||||
setGenre(String());
|
||||
|
||||
if(properties.contains("DATE")) {
|
||||
if (properties.contains("DATE")) {
|
||||
bool ok;
|
||||
int date = properties["DATE"].front().toInt(&ok);
|
||||
if(ok) {
|
||||
if (ok) {
|
||||
setYear(date);
|
||||
oneValueSet.append("DATE");
|
||||
} else
|
||||
@ -127,10 +128,10 @@ PropertyMap Tag::setProperties(const PropertyMap &origProps)
|
||||
else
|
||||
setYear(0);
|
||||
|
||||
if(properties.contains("TRACKNUMBER")) {
|
||||
if (properties.contains("TRACKNUMBER")) {
|
||||
bool ok;
|
||||
int track = properties["TRACKNUMBER"].front().toInt(&ok);
|
||||
if(ok) {
|
||||
if (ok) {
|
||||
setTrack(track);
|
||||
oneValueSet.append("TRACKNUMBER");
|
||||
} else
|
||||
@ -142,7 +143,7 @@ PropertyMap Tag::setProperties(const PropertyMap &origProps)
|
||||
// for each tag that has been set above, remove the first entry in the corresponding
|
||||
// value list. The others will be returned as unsupported by this format.
|
||||
for(StringList::ConstIterator it = oneValueSet.begin(); it != oneValueSet.end(); ++it) {
|
||||
if(properties[*it].size() == 1)
|
||||
if (properties[*it].size() == 1)
|
||||
properties.erase(*it);
|
||||
else
|
||||
properties[*it].erase( properties[*it].begin() );
|
||||
@ -152,7 +153,7 @@ PropertyMap Tag::setProperties(const PropertyMap &origProps)
|
||||
|
||||
void Tag::duplicate(const Tag *source, Tag *target, bool overwrite) // static
|
||||
{
|
||||
if(overwrite) {
|
||||
if (overwrite) {
|
||||
target->setTitle(source->title());
|
||||
target->setArtist(source->artist());
|
||||
target->setAlbum(source->album());
|
||||
@ -162,19 +163,19 @@ void Tag::duplicate(const Tag *source, Tag *target, bool overwrite) // static
|
||||
target->setTrack(source->track());
|
||||
}
|
||||
else {
|
||||
if(target->title().isEmpty())
|
||||
if (target->title().isEmpty())
|
||||
target->setTitle(source->title());
|
||||
if(target->artist().isEmpty())
|
||||
if (target->artist().isEmpty())
|
||||
target->setArtist(source->artist());
|
||||
if(target->album().isEmpty())
|
||||
if (target->album().isEmpty())
|
||||
target->setAlbum(source->album());
|
||||
if(target->comment().isEmpty())
|
||||
if (target->comment().isEmpty())
|
||||
target->setComment(source->comment());
|
||||
if(target->genre().isEmpty())
|
||||
if (target->genre().isEmpty())
|
||||
target->setGenre(source->genre());
|
||||
if(target->year() <= 0)
|
||||
if (target->year() == 0)
|
||||
target->setYear(source->year());
|
||||
if(target->track() <= 0)
|
||||
if (target->track() == 0)
|
||||
target->setTrack(source->track());
|
||||
}
|
||||
}
|
||||
|
4
3rdparty/taglib/toolkit/tbytevectorlist.cpp
vendored
4
3rdparty/taglib/toolkit/tbytevectorlist.cpp
vendored
@ -70,7 +70,9 @@ ByteVectorList ByteVectorList::split(const ByteVector &v, const ByteVector &patt
|
||||
// public members
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ByteVectorList::ByteVectorList() : List<ByteVector>()
|
||||
ByteVectorList::ByteVectorList() :
|
||||
List<ByteVector>(),
|
||||
d(nullptr)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ using namespace TagLib;
|
||||
class ByteVectorStream::ByteVectorStreamPrivate
|
||||
{
|
||||
public:
|
||||
ByteVectorStreamPrivate(const ByteVector &data);
|
||||
explicit ByteVectorStreamPrivate(const ByteVector &data);
|
||||
|
||||
ByteVector data;
|
||||
long position;
|
||||
|
2
3rdparty/taglib/toolkit/tfile.cpp
vendored
2
3rdparty/taglib/toolkit/tfile.cpp
vendored
@ -91,7 +91,7 @@ public:
|
||||
// public members
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
File::File(FileName fileName) :
|
||||
File::File(const FileName fileName) :
|
||||
d(new FilePrivate(new FileStream(fileName), true))
|
||||
{
|
||||
}
|
||||
|
4
3rdparty/taglib/toolkit/tfilestream.cpp
vendored
4
3rdparty/taglib/toolkit/tfilestream.cpp
vendored
@ -90,7 +90,7 @@ namespace
|
||||
|
||||
struct FileNameHandle : public std::string
|
||||
{
|
||||
FileNameHandle(FileName name) : std::string(name) {}
|
||||
explicit FileNameHandle(FileName name) : std::string(name) {}
|
||||
operator FileName () const { return c_str(); }
|
||||
};
|
||||
|
||||
@ -129,7 +129,7 @@ namespace
|
||||
class FileStream::FileStreamPrivate
|
||||
{
|
||||
public:
|
||||
FileStreamPrivate(const FileName &fileName)
|
||||
explicit FileStreamPrivate(const FileName &fileName)
|
||||
: file(InvalidFileHandle)
|
||||
, name(fileName)
|
||||
, readOnly(true)
|
||||
|
12
3rdparty/taglib/toolkit/tstringlist.cpp
vendored
12
3rdparty/taglib/toolkit/tstringlist.cpp
vendored
@ -55,17 +55,23 @@ StringList StringList::split(const String &s, const String &pattern)
|
||||
// public members
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
StringList::StringList() : List<String>()
|
||||
StringList::StringList() :
|
||||
List<String>(),
|
||||
d(nullptr)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
StringList::StringList(const StringList &l) : List<String>(l)
|
||||
StringList::StringList(const StringList &l) :
|
||||
List<String>(l),
|
||||
d(nullptr)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
StringList::StringList(const String &s) : List<String>()
|
||||
StringList::StringList(const String &s) :
|
||||
List<String>(),
|
||||
d(nullptr)
|
||||
{
|
||||
append(s);
|
||||
}
|
||||
|
2
3rdparty/taglib/trueaudio/trueaudiofile.cpp
vendored
2
3rdparty/taglib/trueaudio/trueaudiofile.cpp
vendored
@ -50,7 +50,7 @@ namespace
|
||||
class TrueAudio::File::FilePrivate
|
||||
{
|
||||
public:
|
||||
FilePrivate(const ID3v2::FrameFactory *frameFactory = ID3v2::FrameFactory::instance()) :
|
||||
explicit FilePrivate(const ID3v2::FrameFactory *frameFactory = ID3v2::FrameFactory::instance()) :
|
||||
ID3v2FrameFactory(frameFactory),
|
||||
ID3v2Location(-1),
|
||||
ID3v2OriginalSize(0),
|
||||
|
@ -160,7 +160,6 @@ void TrueAudio::Properties::read(const ByteVector &data, long streamLength)
|
||||
pos += 4;
|
||||
|
||||
d->sampleFrames = data.toUInt(pos, false);
|
||||
pos += 4;
|
||||
|
||||
if(d->sampleFrames > 0 && d->sampleRate > 0) {
|
||||
const double length = d->sampleFrames * 1000.0 / d->sampleRate;
|
||||
|
8
3rdparty/taglib/xm/xmfile.cpp
vendored
8
3rdparty/taglib/xm/xmfile.cpp
vendored
@ -86,7 +86,7 @@ public:
|
||||
class SkipReader : public Reader
|
||||
{
|
||||
public:
|
||||
SkipReader(unsigned int size) : m_size(size)
|
||||
explicit SkipReader(unsigned int size) : m_size(size)
|
||||
{
|
||||
}
|
||||
|
||||
@ -110,7 +110,7 @@ template<typename T>
|
||||
class ValueReader : public Reader
|
||||
{
|
||||
public:
|
||||
ValueReader(T &value) : value(value)
|
||||
explicit ValueReader(T &value) : value(value)
|
||||
{
|
||||
}
|
||||
|
||||
@ -151,7 +151,7 @@ private:
|
||||
class ByteReader : public ValueReader<unsigned char>
|
||||
{
|
||||
public:
|
||||
ByteReader(unsigned char &byte) : ValueReader<unsigned char>(byte) {}
|
||||
explicit ByteReader(unsigned char &byte) : ValueReader<unsigned char>(byte) {}
|
||||
|
||||
unsigned int read(TagLib::File &file, unsigned int limit)
|
||||
{
|
||||
@ -346,7 +346,7 @@ private:
|
||||
class XM::File::FilePrivate
|
||||
{
|
||||
public:
|
||||
FilePrivate(AudioProperties::ReadStyle propertiesStyle)
|
||||
explicit FilePrivate(AudioProperties::ReadStyle propertiesStyle)
|
||||
: tag(), properties(propertiesStyle)
|
||||
{
|
||||
}
|
||||
|
@ -56,7 +56,9 @@ BlockAnalyzer::BlockAnalyzer(QWidget *parent)
|
||||
store_(1 << 8, 0),
|
||||
fade_bars_(kFadeSize),
|
||||
fade_pos_(1 << 8, 50),
|
||||
fade_intensity_(1 << 8, 32) {
|
||||
fade_intensity_(1 << 8, 32),
|
||||
step_(0)
|
||||
{
|
||||
|
||||
setMinimumSize(kMinColumns * (kWidth + 1) - 1, kMinRows * (kHeight + 1) - 1); //-1 is padding, no drawing takes place there
|
||||
setMaximumWidth(kMaxColumns * (kWidth + 1) - 1);
|
||||
|
@ -116,7 +116,7 @@ void SCollection::Stopped() {
|
||||
CurrentSongChanged(Song());
|
||||
}
|
||||
|
||||
void SCollection::CurrentSongChanged(const Song &song) {
|
||||
void SCollection::CurrentSongChanged(const Song &song) { // FIXME
|
||||
|
||||
TagReaderReply *reply = nullptr;
|
||||
|
||||
|
@ -49,9 +49,9 @@
|
||||
|
||||
const char *CollectionBackend::kSettingsGroup = "Collection";
|
||||
|
||||
CollectionBackend::CollectionBackend(QObject *parent)
|
||||
: CollectionBackendInterface(parent)
|
||||
{}
|
||||
CollectionBackend::CollectionBackend(QObject *parent) :
|
||||
CollectionBackendInterface(parent),
|
||||
db_(nullptr) {}
|
||||
|
||||
void CollectionBackend::Init(Database *db, const QString &songs_table, const QString &dirs_table, const QString &subdirs_table, const QString &fts_table) {
|
||||
db_ = db;
|
||||
@ -1095,7 +1095,6 @@ void CollectionBackend::IncrementPlayCount(int id) {
|
||||
void CollectionBackend::IncrementSkipCount(int id, float progress) {
|
||||
|
||||
if (id == -1) return;
|
||||
progress = qBound(0.0f, progress, 1.0f);
|
||||
|
||||
QMutexLocker l(db_->Mutex());
|
||||
QSqlDatabase db(db_->Connect());
|
||||
|
@ -161,13 +161,10 @@ bool CollectionItemDelegate::helpEvent(QHelpEvent *event, QAbstractItemView *vie
|
||||
|
||||
switch (event->type()) {
|
||||
case QEvent::ToolTip: {
|
||||
QRect displayed_text;
|
||||
QSize real_text;
|
||||
bool is_elided = false;
|
||||
|
||||
real_text = sizeHint(option, index);
|
||||
displayed_text = view->visualRect(index);
|
||||
is_elided = displayed_text.width() < real_text.width();
|
||||
QSize real_text = sizeHint(option, index);
|
||||
QRect displayed_text = view->visualRect(index);
|
||||
bool is_elided = displayed_text.width() < real_text.width();
|
||||
|
||||
if (is_elided) {
|
||||
QToolTip::showText(he->globalPos(), text, view);
|
||||
@ -361,7 +358,7 @@ void CollectionView::SetFilter(CollectionFilterWidget *filter) { filter_ = filte
|
||||
|
||||
void CollectionView::TotalSongCountUpdated(int count) {
|
||||
|
||||
bool old = total_song_count_;
|
||||
int old = total_song_count_;
|
||||
total_song_count_ = count;
|
||||
if (old != total_song_count_) update();
|
||||
|
||||
@ -376,7 +373,7 @@ void CollectionView::TotalSongCountUpdated(int count) {
|
||||
|
||||
void CollectionView::TotalArtistCountUpdated(int count) {
|
||||
|
||||
bool old = total_artist_count_;
|
||||
int old = total_artist_count_;
|
||||
total_artist_count_ = count;
|
||||
if (old != total_artist_count_) update();
|
||||
|
||||
@ -391,7 +388,7 @@ void CollectionView::TotalArtistCountUpdated(int count) {
|
||||
|
||||
void CollectionView::TotalAlbumCountUpdated(int count) {
|
||||
|
||||
bool old = total_album_count_;
|
||||
int old = total_album_count_;
|
||||
total_album_count_ = count;
|
||||
if (old != total_album_count_) update();
|
||||
|
||||
|
@ -167,13 +167,10 @@ bool ContextItemDelegate::helpEvent(QHelpEvent *event, QAbstractItemView *view,
|
||||
|
||||
switch (event->type()) {
|
||||
case QEvent::ToolTip: {
|
||||
QRect displayed_text;
|
||||
QSize real_text;
|
||||
bool is_elided = false;
|
||||
|
||||
real_text = sizeHint(option, index);
|
||||
displayed_text = view->visualRect(index);
|
||||
is_elided = displayed_text.width() < real_text.width();
|
||||
QSize real_text = sizeHint(option, index);
|
||||
QRect displayed_text = view->visualRect(index);
|
||||
bool is_elided = displayed_text.width() < real_text.width();
|
||||
|
||||
if (is_elided) {
|
||||
QToolTip::showText(he->globalPos(), text, view);
|
||||
|
@ -72,7 +72,7 @@ bool Application::kIsPortable = false;
|
||||
|
||||
class ApplicationImpl {
|
||||
public:
|
||||
ApplicationImpl(Application *app) :
|
||||
explicit ApplicationImpl(Application *app) :
|
||||
tag_reader_client_([=]() {
|
||||
TagReaderClient *client = new TagReaderClient(app);
|
||||
app->MoveToNewThread(client);
|
||||
|
@ -312,8 +312,8 @@ bool CommandlineOptions::is_empty() const {
|
||||
seek_to_ == -1 &&
|
||||
seek_by_ == 0 &&
|
||||
play_track_at_ == -1 &&
|
||||
show_osd_ == false &&
|
||||
toggle_pretty_osd_ == false &&
|
||||
!show_osd_ &&
|
||||
!toggle_pretty_osd_ &&
|
||||
urls_.isEmpty();
|
||||
}
|
||||
|
||||
|
@ -1321,7 +1321,7 @@ void MainWindow::AddToPlaylist(QAction *action) {
|
||||
}
|
||||
|
||||
SongList songs;
|
||||
for (PlaylistItemPtr item : items) {
|
||||
for (const PlaylistItemPtr &item : items) {
|
||||
songs << item->Metadata();
|
||||
}
|
||||
|
||||
@ -1587,7 +1587,7 @@ void MainWindow::EditTracks() {
|
||||
|
||||
void MainWindow::EditTagDialogAccepted() {
|
||||
|
||||
for (PlaylistItemPtr item : edit_tag_dialog_->playlist_items()) {
|
||||
for (const PlaylistItemPtr &item : edit_tag_dialog_->playlist_items()) {
|
||||
item->Reload();
|
||||
}
|
||||
|
||||
@ -2256,7 +2256,7 @@ void MainWindow::AutoCompleteTags() {
|
||||
|
||||
void MainWindow::AutoCompleteTagsAccepted() {
|
||||
|
||||
for (PlaylistItemPtr item : autocomplete_tag_items_) {
|
||||
for (const PlaylistItemPtr &item : autocomplete_tag_items_) {
|
||||
item->Reload();
|
||||
}
|
||||
|
||||
|
@ -81,6 +81,8 @@ const char *Player::kSettingsGroup = "Player";
|
||||
Player::Player(Application *app, QObject *parent)
|
||||
: PlayerInterface(parent),
|
||||
app_(app),
|
||||
analyzer_(nullptr),
|
||||
equalizer_(nullptr),
|
||||
stream_change_type_(Engine::First),
|
||||
last_state_(Engine::Empty),
|
||||
nb_errors_received_(0),
|
||||
|
@ -257,7 +257,7 @@ void SongLoader::LoadLocalAsync(const QString &filename) {
|
||||
cue.open(QIODevice::ReadOnly);
|
||||
|
||||
SongList song_list = cue_parser_->Load(&cue, matching_cue, QDir(filename.section('/', 0, -2)));
|
||||
for (Song song: song_list){
|
||||
for (const Song &song : song_list) {
|
||||
if (song.is_valid()) songs_ << song;
|
||||
}
|
||||
return;
|
||||
|
@ -263,7 +263,7 @@ bool RemoveRecursive(const QString &path) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!dir.rmdir(path)) return false;
|
||||
return dir.rmdir(path);
|
||||
|
||||
return true;
|
||||
|
||||
|
@ -422,10 +422,7 @@ bool AlbumCoverChoiceController::CanAcceptDrag(const QDragEnterEvent *e) {
|
||||
const QString suffix = QFileInfo(url.toLocalFile()).suffix().toLower();
|
||||
if (IsKnownImageExtension(suffix)) return true;
|
||||
}
|
||||
if (e->mimeData()->hasImage()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return e->mimeData()->hasImage();
|
||||
|
||||
}
|
||||
|
||||
|
@ -31,8 +31,9 @@
|
||||
#include "core/tagreaderclient.h"
|
||||
#include "coverexportrunnable.h"
|
||||
|
||||
CoverExportRunnable::CoverExportRunnable(const AlbumCoverExport::DialogResult &dialog_result, const Song &song)
|
||||
: dialog_result_(dialog_result), song_(song) {}
|
||||
CoverExportRunnable::CoverExportRunnable(const AlbumCoverExport::DialogResult &dialog_result, const Song &song) :
|
||||
dialog_result_(dialog_result),
|
||||
song_(song) {}
|
||||
|
||||
void CoverExportRunnable::run() {
|
||||
|
||||
|
@ -55,7 +55,7 @@ signals:
|
||||
|
||||
AlbumCoverExport::DialogResult dialog_result_;
|
||||
Song song_;
|
||||
AlbumCoverExporter* album_cover_exporter_;
|
||||
|
||||
};
|
||||
|
||||
#endif // COVEREXPORTRUNNABLE_H
|
||||
|
@ -197,7 +197,7 @@ void CddaSongLoader::AudioCDTagsLoaded(const QString &artist, const QString &alb
|
||||
MusicBrainzClient *musicbrainz_client = qobject_cast<MusicBrainzClient*>(sender());
|
||||
musicbrainz_client->deleteLater();
|
||||
SongList songs;
|
||||
if (results.size() == 0) return;
|
||||
if (results.empty()) return;
|
||||
int track_number = 1;
|
||||
for (const MusicBrainzClient::Result &ret : results) {
|
||||
Song song;
|
||||
|
@ -36,8 +36,10 @@
|
||||
|
||||
const int DeviceDatabaseBackend::kDeviceSchemaVersion = 0;
|
||||
|
||||
DeviceDatabaseBackend::DeviceDatabaseBackend(QObject *parent)
|
||||
: QObject(parent) {}
|
||||
DeviceDatabaseBackend::DeviceDatabaseBackend(QObject *parent) :
|
||||
QObject(parent),
|
||||
db_(nullptr)
|
||||
{}
|
||||
|
||||
void DeviceDatabaseBackend::Init(Database* db) { db_ = db; }
|
||||
|
||||
|
@ -37,7 +37,9 @@
|
||||
|
||||
#include "core/logging.h"
|
||||
|
||||
DeviceLister::DeviceLister() : thread_(nullptr) {}
|
||||
DeviceLister::DeviceLister() :
|
||||
thread_(nullptr),
|
||||
next_mount_request_id_(0) {}
|
||||
|
||||
DeviceLister::~DeviceLister() {
|
||||
|
||||
|
@ -686,7 +686,7 @@ void DeviceManager::Forget(QModelIndex idx) {
|
||||
backend_->RemoveDevice(info->database_id_);
|
||||
info->database_id_ = -1;
|
||||
|
||||
if (!info->BestBackend() || (info->BestBackend() && !info->BestBackend()->lister_)) { // It's not attached any more so remove it from the list
|
||||
if (!info->BestBackend() || !info->BestBackend()->lister_) { // It's not attached any more so remove it from the list
|
||||
beginRemoveRows(ItemToIndex(root_), idx.row(), idx.row());
|
||||
devices_.removeAll(info);
|
||||
root_->Delete(info->row);
|
||||
|
@ -36,7 +36,8 @@ MtpLoader::MtpLoader(const QUrl &url, TaskManager *task_manager, CollectionBacke
|
||||
device_(device),
|
||||
url_(url),
|
||||
task_manager_(task_manager),
|
||||
backend_(backend) {
|
||||
backend_(backend),
|
||||
connection_(nullptr) {
|
||||
original_thread_ = thread();
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,6 @@ AlsaDeviceFinder::AlsaDeviceFinder()
|
||||
QList<DeviceFinder::Device> AlsaDeviceFinder::ListDevices() {
|
||||
|
||||
QList<Device> ret;
|
||||
int result = -1;
|
||||
|
||||
snd_pcm_stream_name(SND_PCM_STREAM_PLAYBACK);
|
||||
|
||||
@ -50,7 +49,7 @@ QList<DeviceFinder::Device> AlsaDeviceFinder::ListDevices() {
|
||||
snd_ctl_card_info_alloca(&cardinfo);
|
||||
while (true) {
|
||||
|
||||
result = snd_card_next(&card);
|
||||
int result = snd_card_next(&card);
|
||||
if (result < 0) {
|
||||
qLog(Error) << "Unable to get soundcard:" << snd_strerror(result);
|
||||
break;
|
||||
|
@ -52,6 +52,7 @@ Engine::Base::Base()
|
||||
crossfade_enabled_(true),
|
||||
autocrossfade_enabled_(false),
|
||||
crossfade_same_album_(false),
|
||||
fadeout_pause_enabled_(false),
|
||||
fadeout_duration_(2),
|
||||
fadeout_duration_nanosec_(2 * kNsecPerSec),
|
||||
about_to_end_emitted_(false) {}
|
||||
|
@ -367,10 +367,10 @@ EngineBase::OutputDetailsList GstEngine::GetOutputsList() const {
|
||||
output.name = plugin.name;
|
||||
output.description = plugin.description;
|
||||
if (plugin.name == kAutoSink) output.iconname = "soundcard";
|
||||
else if ((plugin.name == kALSASink) || (plugin.name == kOSS4Sink) || (plugin.name == kOSS4Sink)) output.iconname = "alsa";
|
||||
else if (plugin.name== kJackAudioSink) output.iconname = "jack";
|
||||
else if (plugin.name == kALSASink || plugin.name == kOSS4Sink) output.iconname = "alsa";
|
||||
else if (plugin.name == kJackAudioSink) output.iconname = "jack";
|
||||
else if (plugin.name == kPulseSink) output.iconname = "pulseaudio";
|
||||
else if ((plugin.name == kA2DPSink) || (plugin.name == kAVDTPSink)) output.iconname = "bluetooth";
|
||||
else if (plugin.name == kA2DPSink || plugin.name == kAVDTPSink) output.iconname = "bluetooth";
|
||||
else output.iconname = "soundcard";
|
||||
ret.append(output);
|
||||
}
|
||||
|
@ -89,6 +89,7 @@ GstEnginePipeline::GstEnginePipeline(GstEngine *engine)
|
||||
next_uri_set_(false),
|
||||
volume_percent_(100),
|
||||
volume_modifier_(1.0),
|
||||
use_fudge_timer_(false),
|
||||
pipeline_(nullptr),
|
||||
audiobin_(nullptr),
|
||||
queue_(nullptr),
|
||||
|
@ -183,7 +183,6 @@ EngineBase::OutputDetailsList PhononEngine::GetOutputsList() const {
|
||||
bool PhononEngine::ValidOutput(const QString &output) {
|
||||
|
||||
return (output == "auto" || output == "" || output == DefaultOutput());
|
||||
return(false);
|
||||
|
||||
}
|
||||
|
||||
|
@ -861,7 +861,7 @@ void Playlist::InsertItems(const PlaylistItemList &itemsIn, int pos, bool play_n
|
||||
// exercise vetoes
|
||||
SongList songs;
|
||||
|
||||
for (PlaylistItemPtr item : items) {
|
||||
for (const PlaylistItemPtr &item : items) {
|
||||
songs << item->Metadata();
|
||||
}
|
||||
|
||||
@ -1432,13 +1432,11 @@ PlaylistItemList Playlist::RemoveItemsWithoutUndo(int row, int count) {
|
||||
endRemoveRows();
|
||||
|
||||
QList<int>::iterator it = virtual_items_.begin();
|
||||
int i = 0;
|
||||
while (it != virtual_items_.end()) {
|
||||
if (*it >= items_.count())
|
||||
it = virtual_items_.erase(it);
|
||||
else
|
||||
++it;
|
||||
++i;
|
||||
}
|
||||
|
||||
// Reset current_virtual_index_
|
||||
@ -1738,7 +1736,7 @@ QSortFilterProxyModel *Playlist::proxy() const { return proxy_; }
|
||||
|
||||
SongList Playlist::GetAllSongs() const {
|
||||
SongList ret;
|
||||
for (PlaylistItemPtr item : items_) {
|
||||
for (const PlaylistItemPtr &item : items_) {
|
||||
ret << item->Metadata();
|
||||
}
|
||||
return ret;
|
||||
@ -1748,7 +1746,7 @@ PlaylistItemList Playlist::GetAllItems() const { return items_; }
|
||||
|
||||
quint64 Playlist::GetTotalLength() const {
|
||||
quint64 ret = 0;
|
||||
for (PlaylistItemPtr item : items_) {
|
||||
for (const PlaylistItemPtr &item : items_) {
|
||||
quint64 length = item->Metadata().length_nanosec();
|
||||
if (length > 0) ret += length;
|
||||
}
|
||||
|
@ -291,7 +291,7 @@ void PlaylistBackend::SavePlaylist(int playlist, const PlaylistItemList &items,
|
||||
if (db_->CheckErrors(clear)) return;
|
||||
|
||||
// Save the new ones
|
||||
for (PlaylistItemPtr item : items) {
|
||||
for (const PlaylistItemPtr &item : items) {
|
||||
insert.bindValue(":playlist", playlist);
|
||||
item->BindToQuery(&insert);
|
||||
|
||||
|
@ -262,13 +262,9 @@ bool PlaylistDelegateBase::helpEvent(QHelpEvent *event, QAbstractItemView *view,
|
||||
|
||||
switch (event->type()) {
|
||||
case QEvent::ToolTip: {
|
||||
QRect displayed_text;
|
||||
QSize real_text;
|
||||
bool is_elided = false;
|
||||
|
||||
real_text = sizeHint(option, index);
|
||||
displayed_text = view->visualRect(index);
|
||||
is_elided = displayed_text.width() < real_text.width();
|
||||
QSize real_text = sizeHint(option, index);
|
||||
QRect displayed_text = view->visualRect(index);
|
||||
bool is_elided = displayed_text.width() < real_text.width();
|
||||
if (is_elided) {
|
||||
QToolTip::showText(he->globalPos(), text, view);
|
||||
}
|
||||
|
@ -296,7 +296,8 @@ FilterTree *FilterParser::parseAndGroup() {
|
||||
break;
|
||||
}
|
||||
checkAnd(); // if there's no 'AND', we'll add the term anyway...
|
||||
} while (iter_ != end_);
|
||||
}
|
||||
while (iter_ != end_);
|
||||
return group;
|
||||
}
|
||||
|
||||
@ -304,13 +305,13 @@ bool FilterParser::checkAnd() {
|
||||
if (iter_ != end_) {
|
||||
if (*iter_ == QChar('A')) {
|
||||
buf_ += *iter_;
|
||||
iter_++;
|
||||
++iter_;
|
||||
if (iter_ != end_ && *iter_ == QChar('N')) {
|
||||
buf_ += *iter_;
|
||||
iter_++;
|
||||
++iter_;
|
||||
if (iter_ != end_ && *iter_ == QChar('D')) {
|
||||
buf_ += *iter_;
|
||||
iter_++;
|
||||
++iter_;
|
||||
if (iter_ != end_ && (iter_->isSpace() || *iter_ == QChar('-') || *iter_ == '(')) {
|
||||
advance();
|
||||
buf_.clear();
|
||||
@ -337,10 +338,10 @@ bool FilterParser::checkOr(bool step_over) {
|
||||
if (iter_ != end_) {
|
||||
if (*iter_ == 'O') {
|
||||
buf_ += *iter_;
|
||||
iter_++;
|
||||
++iter_;
|
||||
if (iter_ != end_ && *iter_ == 'R') {
|
||||
buf_ += *iter_;
|
||||
iter_++;
|
||||
++iter_;
|
||||
if (iter_ != end_ && (iter_->isSpace() || *iter_ == '-' || *iter_ == '(')) {
|
||||
if (step_over) {
|
||||
buf_.clear();
|
||||
@ -359,7 +360,7 @@ FilterTree *FilterParser::parseSearchExpression() {
|
||||
advance();
|
||||
if (iter_ == end_) return new NopFilter;
|
||||
if (*iter_ == '(') {
|
||||
iter_++;
|
||||
++iter_;
|
||||
advance();
|
||||
FilterTree *tree = parseOrGroup();
|
||||
advance();
|
||||
@ -375,7 +376,8 @@ FilterTree *FilterParser::parseSearchExpression() {
|
||||
FilterTree *tree = parseSearchExpression();
|
||||
if (tree->type() != FilterTree::Nop) return new NotFilter(tree);
|
||||
return tree;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
return parseSearchTerm();
|
||||
}
|
||||
}
|
||||
@ -401,10 +403,10 @@ FilterTree *FilterParser::parseSearchTerm() {
|
||||
buf_.clear();
|
||||
prefix.clear(); // prefix isn't allowed here - let's ignore it
|
||||
}
|
||||
else if (iter_->isSpace() || *iter_ == '(' || *iter_ == ')' ||
|
||||
*iter_ == '-') {
|
||||
else if (iter_->isSpace() || *iter_ == '(' || *iter_ == ')' || *iter_ == '-') {
|
||||
break;
|
||||
} else if (buf_.isEmpty()) {
|
||||
}
|
||||
else if (buf_.isEmpty()) {
|
||||
// we don't know whether there is a column part in this search term thus we assume the latter and just try and read a prefix
|
||||
if (prefix.isEmpty() && (*iter_ == '>' || *iter_ == '<' || *iter_ == '=' || *iter_ == '!')) {
|
||||
prefix += *iter_;
|
||||
@ -428,8 +430,8 @@ FilterTree *FilterParser::parseSearchTerm() {
|
||||
return createSearchTermTreeNode(col, prefix, search);
|
||||
}
|
||||
|
||||
FilterTree *FilterParser::createSearchTermTreeNode(
|
||||
const QString &col, const QString &prefix, const QString &search) const {
|
||||
FilterTree *FilterParser::createSearchTermTreeNode(const QString &col, const QString &prefix, const QString &search) const {
|
||||
|
||||
if (search.isEmpty() && prefix != "=") {
|
||||
return new NopFilter;
|
||||
}
|
||||
|
@ -451,7 +451,7 @@ void PlaylistManager::SongsDiscovered(const SongList &songs) {
|
||||
for (const Song &song : songs) {
|
||||
for (const Data &data : playlists_) {
|
||||
PlaylistItemList items = data.p->collection_items_by_id(song.id());
|
||||
for (PlaylistItemPtr item : items) {
|
||||
for (PlaylistItemPtr &item : items) {
|
||||
if (item->Metadata().directory_id() != song.directory_id()) continue;
|
||||
static_cast<CollectionPlaylistItem*>(item.get())->SetMetadata(song);
|
||||
data.p->ItemChanged(item);
|
||||
|
@ -411,14 +411,10 @@ bool PlaylistTabBar::event(QEvent *e) {
|
||||
case QEvent::ToolTip: {
|
||||
QHelpEvent *he = static_cast<QHelpEvent*>(e);
|
||||
|
||||
QRect displayed_tab;
|
||||
QSize real_tab;
|
||||
bool is_elided = false;
|
||||
|
||||
real_tab = tabSizeHint(tabAt(he->pos()));
|
||||
displayed_tab = tabRect(tabAt(he->pos()));
|
||||
QSize real_tab = tabSizeHint(tabAt(he->pos()));
|
||||
QRect displayed_tab = tabRect(tabAt(he->pos()));
|
||||
// Check whether the tab is elided or not
|
||||
is_elided = displayed_tab.width() < real_tab.width();
|
||||
bool is_elided = displayed_tab.width() < real_tab.width();
|
||||
if (!is_elided) {
|
||||
// If it's not elided, don't show the tooltip
|
||||
QToolTip::hideText();
|
||||
|
@ -38,6 +38,7 @@ SongLoaderInserter::SongLoaderInserter(TaskManager *task_manager, CollectionBack
|
||||
row_(-1),
|
||||
play_now_(true),
|
||||
enqueue_(false),
|
||||
enqueue_next_(false),
|
||||
collection_(collection),
|
||||
player_(player) {}
|
||||
|
||||
|
@ -225,7 +225,7 @@ void Queue::UpdateTotalLength() {
|
||||
|
||||
quint64 total = 0;
|
||||
|
||||
for (QPersistentModelIndex row : source_indexes_) {
|
||||
for (const QPersistentModelIndex &row : source_indexes_) {
|
||||
int id = row.row();
|
||||
|
||||
Q_ASSERT(playlist_->has_item_at(id));
|
||||
|
@ -291,12 +291,11 @@ QByteArray ListenBrainzScrobbler::GetReplyData(QNetworkReply *reply) {
|
||||
data = reply->readAll();
|
||||
QJsonParseError error;
|
||||
QJsonDocument json_doc = QJsonDocument::fromJson(data, &error);
|
||||
int error_code = -1;
|
||||
QString error_reason;
|
||||
if (error.error == QJsonParseError::NoError && !json_doc.isNull() && !json_doc.isEmpty() && json_doc.isObject()) {
|
||||
QJsonObject json_obj = json_doc.object();
|
||||
if (json_obj.contains("code") && json_obj.contains("error")) {
|
||||
error_code = json_obj["code"].toInt();
|
||||
int error_code = json_obj["code"].toInt();
|
||||
QString error_message = json_obj["error"].toString();
|
||||
error_reason = QString("%1 (%2)").arg(error_message).arg(error_code);
|
||||
}
|
||||
|
@ -342,7 +342,7 @@ void NotificationsSettingsPage::NotificationTypeChanged() {
|
||||
#ifdef Q_OS_MACOS
|
||||
ui_->notifications_options->setEnabled(pretty);
|
||||
#endif
|
||||
ui_->notifications_duration->setEnabled(!pretty || (pretty && !ui_->notifications_disable_duration->isChecked()));
|
||||
ui_->notifications_duration->setEnabled(!pretty || !ui_->notifications_disable_duration->isChecked());
|
||||
ui_->notifications_disable_duration->setEnabled(pretty);
|
||||
|
||||
}
|
||||
|
@ -641,7 +641,6 @@ void TidalService::AlbumsReceived(QNetworkReply *reply, int search_id, int artis
|
||||
}
|
||||
|
||||
int limit = 0;
|
||||
int offset = 0;
|
||||
int total_albums = 0;
|
||||
if (artist_search_) { // This was a list of albums by artist
|
||||
if (!json_obj.contains("limit") ||
|
||||
@ -653,7 +652,7 @@ void TidalService::AlbumsReceived(QNetworkReply *reply, int search_id, int artis
|
||||
return;
|
||||
}
|
||||
limit = json_obj["limit"].toInt();
|
||||
offset = json_obj["offset"].toInt();
|
||||
int offset = json_obj["offset"].toInt();
|
||||
total_albums = json_obj["totalNumberOfItems"].toInt();
|
||||
if (offset != offset_requested) {
|
||||
AlbumsFinished(artist_id, offset_requested, total_albums, limit);
|
||||
|
@ -420,7 +420,7 @@ void FancyTabWidget::paintEvent(QPaintEvent *pe) {
|
||||
QColor baseColor = StyleHelper::baseColor();
|
||||
|
||||
QRect backgroundRect = rect();
|
||||
backgroundRect.setWidth(((FancyTabBar*)tabBar())->width());
|
||||
backgroundRect.setWidth(tabBar()->width());
|
||||
p.fillRect(backgroundRect, baseColor);
|
||||
|
||||
// Horizontal gradient over the sidebar from transparent to dark
|
||||
|
@ -54,6 +54,7 @@ ExtendedEditor::ExtendedEditor(QWidget *widget, int extra_right_padding, bool dr
|
||||
draw_hint_(draw_hint),
|
||||
font_point_size_(widget->font().pointSizeF() - 1),
|
||||
is_rtl_(false) {
|
||||
|
||||
clear_button_->setIcon(IconLoader::Load("edit-clear-locationbar-ltr"));
|
||||
clear_button_->setIconSize(QSize(16, 16));
|
||||
clear_button_->setCursor(Qt::ArrowCursor);
|
||||
@ -76,6 +77,7 @@ ExtendedEditor::ExtendedEditor(QWidget *widget, int extra_right_padding, bool dr
|
||||
widget->connect(clear_button_, SIGNAL(clicked()), widget, SLOT(setFocus()));
|
||||
|
||||
UpdateButtonGeometry();
|
||||
|
||||
}
|
||||
|
||||
void ExtendedEditor::set_hint(const QString& hint) {
|
||||
|
@ -45,6 +45,7 @@ const int MultiLoadingIndicator::kSpacing = 6;
|
||||
|
||||
MultiLoadingIndicator::MultiLoadingIndicator(QWidget *parent)
|
||||
: QWidget(parent),
|
||||
task_manager_(nullptr),
|
||||
spinner_(new BusyIndicator(this))
|
||||
{
|
||||
spinner_->move(kHorizontalPadding, kVerticalPadding);
|
||||
|
@ -160,7 +160,7 @@ void OSD::CallFinished(QDBusPendingCallWatcher *watcher) {
|
||||
|
||||
std::unique_ptr<QDBusPendingCallWatcher> w(watcher);
|
||||
|
||||
QDBusPendingReply<uint> reply = *watcher;
|
||||
QDBusPendingReply<uint> reply = *w.get();
|
||||
if (reply.isError()) {
|
||||
qLog(Warning) << "Error sending notification" << reply.error().name();
|
||||
return;
|
||||
|
@ -217,12 +217,7 @@ void PlayingWidget::SetMode(int mode) {
|
||||
|
||||
mode_ = Mode(mode);
|
||||
|
||||
if (mode_ == SmallSongDetails) {
|
||||
fit_cover_width_action_->setEnabled(false);
|
||||
}
|
||||
else {
|
||||
fit_cover_width_action_->setEnabled(true);
|
||||
}
|
||||
fit_cover_width_action_->setEnabled(mode_ != SmallSongDetails);
|
||||
|
||||
UpdateHeight();
|
||||
UpdateDetailsText();
|
||||
|
Loading…
x
Reference in New Issue
Block a user