Fix compile warnings
This commit is contained in:
parent
a303850341
commit
8da4c88fd3
|
@ -273,6 +273,8 @@ static T CreateLogger(Level level, const QString &class_name, int line, const ch
|
|||
return ret.space();
|
||||
}
|
||||
|
||||
QString CXXDemangle(const QString &mangled_function);
|
||||
|
||||
QString CXXDemangle(const QString &mangled_function) {
|
||||
|
||||
int status;
|
||||
|
@ -286,6 +288,8 @@ QString CXXDemangle(const QString &mangled_function) {
|
|||
|
||||
}
|
||||
|
||||
QString DarwinDemangle(const QString &symbol);
|
||||
|
||||
QString DarwinDemangle(const QString &symbol) {
|
||||
|
||||
QStringList split = symbol.split(' ', QString::SkipEmptyParts);
|
||||
|
@ -294,6 +298,8 @@ QString DarwinDemangle(const QString &symbol) {
|
|||
|
||||
}
|
||||
|
||||
QString LinuxDemangle(const QString &symbol);
|
||||
|
||||
QString LinuxDemangle(const QString &symbol) {
|
||||
|
||||
QRegExp regex("\\(([^+]+)");
|
||||
|
@ -305,6 +311,8 @@ QString LinuxDemangle(const QString &symbol) {
|
|||
|
||||
}
|
||||
|
||||
QString DemangleSymbol(const QString &symbol);
|
||||
|
||||
QString DemangleSymbol(const QString &symbol) {
|
||||
#ifdef Q_OS_MACOS
|
||||
return DarwinDemangle(symbol);
|
||||
|
|
|
@ -47,13 +47,13 @@ void _MessageHandlerBase::SetDevice(QIODevice *device) {
|
|||
connect(device, SIGNAL(readyRead()), SLOT(DeviceReadyRead()));
|
||||
|
||||
// Yeah I know.
|
||||
if (QAbstractSocket *socket = qobject_cast<QAbstractSocket*>(device)) {
|
||||
if (QAbstractSocket *abstractsocket = qobject_cast<QAbstractSocket*>(device)) {
|
||||
flush_abstract_socket_ = &QAbstractSocket::flush;
|
||||
connect(socket, SIGNAL(disconnected()), SLOT(DeviceClosed()));
|
||||
connect(abstractsocket, SIGNAL(disconnected()), SLOT(DeviceClosed()));
|
||||
}
|
||||
else if (QLocalSocket* socket = qobject_cast<QLocalSocket*>(device)) {
|
||||
else if (QLocalSocket *localsocket = qobject_cast<QLocalSocket*>(device)) {
|
||||
flush_local_socket_ = &QLocalSocket::flush;
|
||||
connect(socket, SIGNAL(disconnected()), SLOT(DeviceClosed()));
|
||||
connect(localsocket, SIGNAL(disconnected()), SLOT(DeviceClosed()));
|
||||
}
|
||||
else {
|
||||
qFatal("Unsupported device type passed to _MessageHandlerBase");
|
||||
|
|
|
@ -26,13 +26,16 @@ _MessageReplyBase::_MessageReplyBase(QObject *parent)
|
|||
: QObject(parent), finished_(false), success_(false) {}
|
||||
|
||||
bool _MessageReplyBase::WaitForFinished() {
|
||||
|
||||
qLog(Debug) << "Waiting on ID" << id();
|
||||
semaphore_.acquire();
|
||||
qLog(Debug) << "Acquired ID" << id();
|
||||
return success_;
|
||||
|
||||
}
|
||||
|
||||
void _MessageReplyBase::Abort() {
|
||||
|
||||
Q_ASSERT(!finished_);
|
||||
finished_ = true;
|
||||
success_ = false;
|
||||
|
@ -40,4 +43,5 @@ void _MessageReplyBase::Abort() {
|
|||
emit Finished(success_);
|
||||
qLog(Debug) << "Releasing ID" << id() << "(aborted)";
|
||||
semaphore_.release();
|
||||
|
||||
}
|
||||
|
|
|
@ -212,46 +212,46 @@ void TagReader::ReadFile(const QString &filename, pb::tagreader::SongMetadata *s
|
|||
|
||||
// Handle all the files which have VorbisComments (Ogg, OPUS, ...) in the same way;
|
||||
// apart, so we keep specific behavior for some formats by adding another "else if" block below.
|
||||
if (TagLib::Ogg::XiphComment *tag = dynamic_cast<TagLib::Ogg::XiphComment*>(fileref->file()->tag())) {
|
||||
ParseOggTag(tag->fieldListMap(), nullptr, &disc, &compilation, song);
|
||||
if (!tag->pictureList().isEmpty()) {
|
||||
if (TagLib::Ogg::XiphComment *tag_ogg = dynamic_cast<TagLib::Ogg::XiphComment*>(fileref->file()->tag())) {
|
||||
ParseOggTag(tag_ogg->fieldListMap(), nullptr, &disc, &compilation, song);
|
||||
if (!tag_ogg->pictureList().isEmpty()) {
|
||||
song->set_art_automatic(kEmbeddedCover);
|
||||
}
|
||||
}
|
||||
|
||||
if (TagLib::FLAC::File *file = dynamic_cast<TagLib::FLAC::File *>(fileref->file())) {
|
||||
if (TagLib::FLAC::File *file_flac = dynamic_cast<TagLib::FLAC::File *>(fileref->file())) {
|
||||
|
||||
song->set_bitdepth(file->audioProperties()->bitsPerSample());
|
||||
song->set_bitdepth(file_flac->audioProperties()->bitsPerSample());
|
||||
|
||||
if (file->xiphComment()) {
|
||||
ParseOggTag(file->xiphComment()->fieldListMap(), nullptr, &disc, &compilation, song);
|
||||
if (!file->pictureList().isEmpty()) {
|
||||
if (file_flac->xiphComment()) {
|
||||
ParseOggTag(file_flac->xiphComment()->fieldListMap(), nullptr, &disc, &compilation, song);
|
||||
if (!file_flac->pictureList().isEmpty()) {
|
||||
song->set_art_automatic(kEmbeddedCover);
|
||||
}
|
||||
}
|
||||
if (tag) Decode(tag->comment(), nullptr, song->mutable_comment());
|
||||
}
|
||||
|
||||
else if (TagLib::WavPack::File *file = dynamic_cast<TagLib::WavPack::File *>(fileref->file())) {
|
||||
song->set_bitdepth(file->audioProperties()->bitsPerSample());
|
||||
if (file->tag()) {
|
||||
ParseAPETag(file->APETag()->itemListMap(), nullptr, &disc, &compilation, song);
|
||||
else if (TagLib::WavPack::File *file_wavpack = dynamic_cast<TagLib::WavPack::File *>(fileref->file())) {
|
||||
song->set_bitdepth(file_wavpack->audioProperties()->bitsPerSample());
|
||||
if (file_wavpack->tag()) {
|
||||
ParseAPETag(file_wavpack->APETag()->itemListMap(), nullptr, &disc, &compilation, song);
|
||||
}
|
||||
if (tag) Decode(tag->comment(), nullptr, song->mutable_comment());
|
||||
}
|
||||
|
||||
else if (TagLib::APE::File *file = dynamic_cast<TagLib::APE::File*>(fileref->file())) {
|
||||
if (file->tag()) {
|
||||
ParseAPETag(file->APETag()->itemListMap(), nullptr, &disc, &compilation, song);
|
||||
else if (TagLib::APE::File *file_ape = dynamic_cast<TagLib::APE::File*>(fileref->file())) {
|
||||
if (file_ape->tag()) {
|
||||
ParseAPETag(file_ape->APETag()->itemListMap(), nullptr, &disc, &compilation, song);
|
||||
}
|
||||
song->set_bitdepth(file->audioProperties()->bitsPerSample());
|
||||
song->set_bitdepth(file_ape->audioProperties()->bitsPerSample());
|
||||
if (tag) Decode(tag->comment(), nullptr, song->mutable_comment());
|
||||
}
|
||||
|
||||
else if (TagLib::MPEG::File *file = dynamic_cast<TagLib::MPEG::File*>(fileref->file())) {
|
||||
else if (TagLib::MPEG::File *file_mpeg = dynamic_cast<TagLib::MPEG::File*>(fileref->file())) {
|
||||
|
||||
if (file->ID3v2Tag()) {
|
||||
const TagLib::ID3v2::FrameListMap &map = file->ID3v2Tag()->frameListMap();
|
||||
if (file_mpeg->ID3v2Tag()) {
|
||||
const TagLib::ID3v2::FrameListMap &map = file_mpeg->ID3v2Tag()->frameListMap();
|
||||
|
||||
if (!map["TPOS"].isEmpty()) disc = TStringToQString(map["TPOS"].front()->toString()).trimmed();
|
||||
if (!map["TCOM"].isEmpty()) Decode(map["TCOM"].front()->toString(), nullptr, song->mutable_composer());
|
||||
|
@ -309,12 +309,12 @@ void TagReader::ReadFile(const QString &filename, pb::tagreader::SongMetadata *s
|
|||
}
|
||||
}
|
||||
|
||||
else if (TagLib::MP4::File *file = dynamic_cast<TagLib::MP4::File*>(fileref->file())) {
|
||||
else if (TagLib::MP4::File *file_mp4 = dynamic_cast<TagLib::MP4::File*>(fileref->file())) {
|
||||
|
||||
song->set_bitdepth(file->audioProperties()->bitsPerSample());
|
||||
song->set_bitdepth(file_mp4->audioProperties()->bitsPerSample());
|
||||
|
||||
if (file->tag()) {
|
||||
TagLib::MP4::Tag *mp4_tag = file->tag();
|
||||
if (file_mp4->tag()) {
|
||||
TagLib::MP4::Tag *mp4_tag = file_mp4->tag();
|
||||
|
||||
// Find album artists
|
||||
if (mp4_tag->item("aART").isValid()) {
|
||||
|
@ -348,11 +348,11 @@ void TagReader::ReadFile(const QString &filename, pb::tagreader::SongMetadata *s
|
|||
}
|
||||
}
|
||||
|
||||
else if (TagLib::ASF::File *file = dynamic_cast<TagLib::ASF::File*>(fileref->file())) {
|
||||
else if (TagLib::ASF::File *file_asf = dynamic_cast<TagLib::ASF::File*>(fileref->file())) {
|
||||
|
||||
song->set_bitdepth(file->audioProperties()->bitsPerSample());
|
||||
song->set_bitdepth(file_asf->audioProperties()->bitsPerSample());
|
||||
|
||||
const TagLib::ASF::AttributeListMap &attributes_map = file->tag()->attributeListMap();
|
||||
const TagLib::ASF::AttributeListMap &attributes_map = file_asf->tag()->attributeListMap();
|
||||
|
||||
if (attributes_map.contains(kASF_OriginalDate_ID)) {
|
||||
const TagLib::ASF::AttributeList &attributes = attributes_map[kASF_OriginalDate_ID];
|
||||
|
@ -368,9 +368,9 @@ void TagReader::ReadFile(const QString &filename, pb::tagreader::SongMetadata *s
|
|||
}
|
||||
}
|
||||
|
||||
else if (TagLib::MPC::File* file = dynamic_cast<TagLib::MPC::File*>(fileref->file())) {
|
||||
if (file->tag()) {
|
||||
ParseAPETag(file->APETag()->itemListMap(), nullptr, &disc, &compilation, song);
|
||||
else if (TagLib::MPC::File* file_mpc = dynamic_cast<TagLib::MPC::File*>(fileref->file())) {
|
||||
if (file_mpc->tag()) {
|
||||
ParseAPETag(file_mpc->APETag()->itemListMap(), nullptr, &disc, &compilation, song);
|
||||
}
|
||||
if (tag) Decode(tag->comment(), nullptr, song->mutable_comment());
|
||||
}
|
||||
|
@ -578,26 +578,26 @@ bool TagReader::SaveFile(const QString &filename, const pb::tagreader::SongMetad
|
|||
SetVorbisComments(tag, song);
|
||||
}
|
||||
|
||||
else if (TagLib::WavPack::File *file = dynamic_cast<TagLib::WavPack::File*>(fileref->file())) {
|
||||
TagLib::APE::Tag *tag = file->APETag(true);
|
||||
else if (TagLib::WavPack::File *file_wavpack = dynamic_cast<TagLib::WavPack::File*>(fileref->file())) {
|
||||
TagLib::APE::Tag *tag = file_wavpack->APETag(true);
|
||||
if (!tag) return false;
|
||||
SaveAPETag(tag, song);
|
||||
}
|
||||
|
||||
else if (TagLib::APE::File *file = dynamic_cast<TagLib::APE::File*>(fileref->file())) {
|
||||
TagLib::APE::Tag *tag = file->APETag(true);
|
||||
else if (TagLib::APE::File *file_ape = dynamic_cast<TagLib::APE::File*>(fileref->file())) {
|
||||
TagLib::APE::Tag *tag = file_ape->APETag(true);
|
||||
if (!tag) return false;
|
||||
SaveAPETag(tag, song);
|
||||
}
|
||||
|
||||
else if (TagLib::MPC::File *file = dynamic_cast<TagLib::MPC::File*>(fileref->file())) {
|
||||
TagLib::APE::Tag *tag = file->APETag(true);
|
||||
else if (TagLib::MPC::File *file_mpc = dynamic_cast<TagLib::MPC::File*>(fileref->file())) {
|
||||
TagLib::APE::Tag *tag = file_mpc->APETag(true);
|
||||
if (!tag) return false;
|
||||
SaveAPETag(tag, song);
|
||||
}
|
||||
|
||||
else if (TagLib::MPEG::File *file = dynamic_cast<TagLib::MPEG::File*>(fileref->file())) {
|
||||
TagLib::ID3v2::Tag *tag = file->ID3v2Tag(true);
|
||||
else if (TagLib::MPEG::File *file_mpeg = dynamic_cast<TagLib::MPEG::File*>(fileref->file())) {
|
||||
TagLib::ID3v2::Tag *tag = file_mpeg->ID3v2Tag(true);
|
||||
if (!tag) return false;
|
||||
SetTextFrame("TPOS", song.disc() <= 0 -1 ? QString() : QString::number(song.disc()), tag);
|
||||
SetTextFrame("TCOM", song.composer(), tag);
|
||||
|
@ -609,8 +609,8 @@ bool TagReader::SaveFile(const QString &filename, const pb::tagreader::SongMetad
|
|||
SetUnsyncLyricsFrame(song.lyrics(), tag);
|
||||
}
|
||||
|
||||
else if (TagLib::MP4::File *file = dynamic_cast<TagLib::MP4::File*>(fileref->file())) {
|
||||
TagLib::MP4::Tag *tag = file->tag();
|
||||
else if (TagLib::MP4::File *file_mp4 = dynamic_cast<TagLib::MP4::File*>(fileref->file())) {
|
||||
TagLib::MP4::Tag *tag = file_mp4->tag();
|
||||
tag->setItem("disk", TagLib::MP4::Item(song.disc() <= 0 -1 ? 0 : song.disc(), 0));
|
||||
tag->setItem("\251wrt", TagLib::StringList(song.composer().c_str()));
|
||||
tag->setItem("\251grp", TagLib::StringList(song.grouping().c_str()));
|
||||
|
|
|
@ -185,8 +185,8 @@ void BlockAnalyzer::analyze(QPainter &p, const Analyzer::Scope &s, bool new_fram
|
|||
|
||||
if (fade_intensity_[x] > 0) {
|
||||
const uint offset = --fade_intensity_[x];
|
||||
const uint y = y_ + (fade_pos_[x] * (kHeight + 1));
|
||||
canvas_painter.drawPixmap(x * (kWidth + 1), y, fade_bars_[offset], 0, 0, kWidth, height() - y);
|
||||
const uint y2 = y_ + (fade_pos_[x] * (kHeight + 1));
|
||||
canvas_painter.drawPixmap(x * (kWidth + 1), y2, fade_bars_[offset], 0, 0, kWidth, height() - y2);
|
||||
}
|
||||
|
||||
if (fade_intensity_[x] == 0) fade_pos_[x] = rows_;
|
||||
|
@ -237,7 +237,8 @@ static inline void adjustToLimits(int &b, int &f, uint &amount) {
|
|||
* It won't modify the hue of fg unless absolutely necessary
|
||||
* @return the adjusted form of fg
|
||||
*/
|
||||
QColor ensureContrast(const QColor &bg, const QColor &fg, uint amount = 150) {
|
||||
QColor ensureContrast(const QColor &bg, const QColor &fg, uint amount = 150);
|
||||
QColor ensureContrast(const QColor &bg, const QColor &fg, uint amount) {
|
||||
|
||||
class OutputOnExit {
|
||||
public:
|
||||
|
@ -344,18 +345,18 @@ void BlockAnalyzer::paletteChange(const QPalette&) {
|
|||
p.fillRect(0, y * (kHeight + 1), kWidth, kHeight, QColor(r + static_cast<int>(dr * y), g + static_cast<int>(dg * y), b + static_cast<int>(db * y)));
|
||||
|
||||
{
|
||||
const QColor bg = palette().color(QPalette::Background).darker(112);
|
||||
const QColor bg2 = palette().color(QPalette::Background).darker(112);
|
||||
|
||||
// make a complimentary fadebar colour
|
||||
// TODO dark is not always correct, dumbo!
|
||||
int h, s, v;
|
||||
palette().color(QPalette::Background).darker(150).getHsv(&h, &s, &v);
|
||||
const QColor fg(QColor::fromHsv(h + 120, s, v));
|
||||
const QColor fg2(QColor::fromHsv(h + 120, s, v));
|
||||
|
||||
const double dr = fg.red() - bg.red();
|
||||
const double dg = fg.green() - bg.green();
|
||||
const double db = fg.blue() - bg.blue();
|
||||
const int r = bg.red(), g = bg.green(), b = bg.blue();
|
||||
const double dr2 = fg2.red() - bg2.red();
|
||||
const double dg2 = fg2.green() - bg2.green();
|
||||
const double db2 = fg2.blue() - bg2.blue();
|
||||
const int r2 = bg2.red(), g2 = bg2.green(), b2 = bg2.blue();
|
||||
|
||||
// Precalculate all fade-bar pixmaps
|
||||
for (uint y = 0; y < kFadeSize; ++y) {
|
||||
|
@ -363,7 +364,7 @@ void BlockAnalyzer::paletteChange(const QPalette&) {
|
|||
QPainter f(&fade_bars_[y]);
|
||||
for (int z = 0; static_cast<uint>(z) < rows_; ++z) {
|
||||
const double Y = 1.0 - (log10(kFadeSize - y) / log10(kFadeSize));
|
||||
f.fillRect(0, z * (kHeight + 1), kWidth, kHeight, QColor(r + static_cast<int>(dr * Y), g + static_cast<int>(dg * Y), b + static_cast<int>(db * Y)));
|
||||
f.fillRect(0, z * (kHeight + 1), kWidth, kHeight, QColor(r2 + static_cast<int>(dr2 * Y), g2 + static_cast<int>(dg2 * Y), b2 + static_cast<int>(db2 * Y)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,20 +75,20 @@ class RainbowAnalyzer : public Analyzer::Base {
|
|||
|
||||
static RainbowType rainbowtype;
|
||||
|
||||
inline QRect SourceRect(RainbowType rainbowtype) const {
|
||||
return QRect(0, kHeight[rainbowtype] * frame_, kWidth[rainbowtype], kHeight[rainbowtype]);
|
||||
inline QRect SourceRect(RainbowType _rainbowtype) const {
|
||||
return QRect(0, kHeight[_rainbowtype] * frame_, kWidth[_rainbowtype], kHeight[_rainbowtype]);
|
||||
}
|
||||
|
||||
inline QRect SleepingSourceRect(RainbowType rainbowtype) const {
|
||||
return QRect(0, kHeight[rainbowtype] * kFrameCount[rainbowtype], kWidth[rainbowtype], kSleepingHeight[rainbowtype]);
|
||||
inline QRect SleepingSourceRect(RainbowType _rainbowtype) const {
|
||||
return QRect(0, kHeight[_rainbowtype] * kFrameCount[_rainbowtype], kWidth[_rainbowtype], kSleepingHeight[_rainbowtype]);
|
||||
}
|
||||
|
||||
inline QRect DestRect(RainbowType rainbowtype) const {
|
||||
return QRect(width() - kWidth[rainbowtype], (height() - kHeight[rainbowtype]) / 2, kWidth[rainbowtype], kHeight[rainbowtype]);
|
||||
inline QRect DestRect(RainbowType _rainbowtype) const {
|
||||
return QRect(width() - kWidth[_rainbowtype], (height() - kHeight[_rainbowtype]) / 2, kWidth[_rainbowtype], kHeight[_rainbowtype]);
|
||||
}
|
||||
|
||||
inline QRect SleepingDestRect(RainbowType rainbowtype) const {
|
||||
return QRect(width() - kWidth[rainbowtype], (height() - kSleepingHeight[rainbowtype]) / 2, kWidth[rainbowtype], kSleepingHeight[rainbowtype]);
|
||||
inline QRect SleepingDestRect(RainbowType _rainbowtype) const {
|
||||
return QRect(width() - kWidth[_rainbowtype], (height() - kSleepingHeight[_rainbowtype]) / 2, kWidth[_rainbowtype], kSleepingHeight[_rainbowtype]);
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
@ -995,7 +995,7 @@ void CollectionBackend::UpdateCompilations(QSqlQuery &find_song, QSqlQuery &upda
|
|||
|
||||
}
|
||||
|
||||
CollectionBackend::AlbumList CollectionBackend::GetAlbums(const QString &artist, bool compilation, const QueryOptions &opt) {
|
||||
CollectionBackend::AlbumList CollectionBackend::GetAlbums(const QString &artist, const bool compilation_required, const QueryOptions &opt) {
|
||||
|
||||
AlbumList ret;
|
||||
|
||||
|
@ -1003,7 +1003,7 @@ CollectionBackend::AlbumList CollectionBackend::GetAlbums(const QString &artist,
|
|||
query.SetColumnSpec("album, artist, albumartist, compilation, compilation_detected, art_automatic, art_manual, url");
|
||||
query.SetOrderBy("album");
|
||||
|
||||
if (compilation) {
|
||||
if (compilation_required) {
|
||||
query.AddCompilationRequirement(true);
|
||||
}
|
||||
else if (!artist.isEmpty()) {
|
||||
|
@ -1020,11 +1020,11 @@ CollectionBackend::AlbumList CollectionBackend::GetAlbums(const QString &artist,
|
|||
QString last_artist;
|
||||
QString last_album_artist;
|
||||
while (query.Next()) {
|
||||
bool compilation = query.Value(3).toBool() | query.Value(4).toBool();
|
||||
bool is_compilation = query.Value(3).toBool() | query.Value(4).toBool();
|
||||
|
||||
Album info;
|
||||
info.artist = compilation ? QString() : query.Value(1).toString();
|
||||
info.album_artist = compilation ? QString() : query.Value(2).toString();
|
||||
info.artist = is_compilation ? QString() : query.Value(1).toString();
|
||||
info.album_artist = is_compilation ? QString() : query.Value(2).toString();
|
||||
info.album_name = query.Value(0).toString();
|
||||
info.first_url = QUrl::fromEncoded(query.Value(7).toByteArray());
|
||||
|
||||
|
|
|
@ -141,10 +141,10 @@ class CollectionBackend : public CollectionBackendInterface {
|
|||
void UpdateTotalArtistCountAsync();
|
||||
void UpdateTotalAlbumCountAsync();
|
||||
|
||||
SongList FindSongsInDirectory(int id);
|
||||
SubdirectoryList SubdirsInDirectory(int id);
|
||||
SongList FindSongsInDirectory(const int id);
|
||||
SubdirectoryList SubdirsInDirectory(const int id);
|
||||
DirectoryList GetAllDirectories();
|
||||
void ChangeDirPath(int id, const QString &old_path, const QString &new_path);
|
||||
void ChangeDirPath(const int id, const QString &old_path, const QString &new_path);
|
||||
|
||||
QStringList GetAll(const QString &column, const QueryOptions &opt = QueryOptions());
|
||||
QStringList GetAllArtists(const QueryOptions &opt = QueryOptions());
|
||||
|
@ -161,7 +161,7 @@ class CollectionBackend : public CollectionBackendInterface {
|
|||
void UpdateManualAlbumArtAsync(const QString &artist, const QString &albumartist, const QString &album, const QUrl &cover_url);
|
||||
Album GetAlbumArt(const QString &artist, const QString &albumartist, const QString &album);
|
||||
|
||||
Song GetSongById(int id);
|
||||
Song GetSongById(const int id);
|
||||
SongList GetSongsById(const QList<int> &ids);
|
||||
SongList GetSongsById(const QStringList &ids);
|
||||
SongList GetSongsByForeignId(const QStringList &ids, const QString &table, const QString &column);
|
||||
|
@ -175,9 +175,9 @@ class CollectionBackend : public CollectionBackendInterface {
|
|||
bool ExecQuery(CollectionQuery *q);
|
||||
SongList ExecCollectionQuery(CollectionQuery *query);
|
||||
|
||||
void IncrementPlayCountAsync(int id);
|
||||
void IncrementSkipCountAsync(int id, float progress);
|
||||
void ResetStatisticsAsync(int id);
|
||||
void IncrementPlayCountAsync(const int id);
|
||||
void IncrementSkipCountAsync(const int id, const float progress);
|
||||
void ResetStatisticsAsync(const int id);
|
||||
|
||||
void DeleteAll();
|
||||
|
||||
|
@ -199,10 +199,10 @@ class CollectionBackend : public CollectionBackendInterface {
|
|||
void AddOrUpdateSubdirs(const SubdirectoryList &subdirs);
|
||||
void UpdateCompilations();
|
||||
void UpdateManualAlbumArt(const QString &artist, const QString &albumartist, const QString &album, const QUrl &cover_url);
|
||||
void ForceCompilation(const QString &album, const QList<QString> &artists, bool on);
|
||||
void IncrementPlayCount(int id);
|
||||
void IncrementSkipCount(int id, float progress);
|
||||
void ResetStatistics(int id);
|
||||
void ForceCompilation(const QString &album, const QList<QString> &artists, const bool on);
|
||||
void IncrementPlayCount(const int id);
|
||||
void IncrementSkipCount(const int id, const float progress);
|
||||
void ResetStatistics(const int id);
|
||||
void SongPathChanged(const Song &song, const QFileInfo &new_file);
|
||||
|
||||
signals:
|
||||
|
@ -215,9 +215,9 @@ class CollectionBackend : public CollectionBackendInterface {
|
|||
|
||||
void DatabaseReset();
|
||||
|
||||
void TotalSongCountUpdated(int total);
|
||||
void TotalArtistCountUpdated(int total);
|
||||
void TotalAlbumCountUpdated(int total);
|
||||
void TotalSongCountUpdated(const int total);
|
||||
void TotalArtistCountUpdated(const int total);
|
||||
void TotalAlbumCountUpdated(const int total);
|
||||
|
||||
void ExitFinished();
|
||||
|
||||
|
@ -233,11 +233,11 @@ class CollectionBackend : public CollectionBackendInterface {
|
|||
};
|
||||
|
||||
void UpdateCompilations(QSqlQuery &find_song, QSqlQuery &update_song, SongList &deleted_songs, SongList &added_songs, const QUrl &url, const bool compilation_detected);
|
||||
AlbumList GetAlbums(const QString &artist, const QString &album_artist, bool compilation = false, const QueryOptions &opt = QueryOptions());
|
||||
AlbumList GetAlbums(const QString &artist, bool compilation, const QueryOptions &opt = QueryOptions());
|
||||
SubdirectoryList SubdirsInDirectory(int id, QSqlDatabase &db);
|
||||
AlbumList GetAlbums(const QString &artist, const QString &album_artist, const bool compilation_required = false, const QueryOptions &opt = QueryOptions());
|
||||
AlbumList GetAlbums(const QString &artist, const bool compilation_required, const QueryOptions &opt = QueryOptions());
|
||||
SubdirectoryList SubdirsInDirectory(const int id, QSqlDatabase &db);
|
||||
|
||||
Song GetSongById(int id, QSqlDatabase &db);
|
||||
Song GetSongById(const int id, QSqlDatabase &db);
|
||||
SongList GetSongsById(const QStringList &ids, QSqlDatabase &db);
|
||||
|
||||
Song GetSongBySongId(const QString &song_id, QSqlDatabase &db);
|
||||
|
|
|
@ -37,13 +37,13 @@ class CollectionItem : public SimpleTreeItem<CollectionItem> {
|
|||
Type_LoadingIndicator,
|
||||
};
|
||||
|
||||
explicit CollectionItem(SimpleTreeModel<CollectionItem> *model)
|
||||
: SimpleTreeItem<CollectionItem>(Type_Root, model),
|
||||
explicit CollectionItem(SimpleTreeModel<CollectionItem> *_model)
|
||||
: SimpleTreeItem<CollectionItem>(Type_Root, _model),
|
||||
container_level(-1),
|
||||
compilation_artist_node_(nullptr) {}
|
||||
|
||||
explicit CollectionItem(Type type, CollectionItem *parent = nullptr)
|
||||
: SimpleTreeItem<CollectionItem>(type, parent),
|
||||
explicit CollectionItem(Type _type, CollectionItem *_parent = nullptr)
|
||||
: SimpleTreeItem<CollectionItem>(_type, _parent),
|
||||
container_level(-1),
|
||||
compilation_artist_node_(nullptr) {}
|
||||
|
||||
|
|
|
@ -587,10 +587,10 @@ QVariant CollectionModel::AlbumIcon(const QModelIndex &idx) {
|
|||
if (use_disk_cache_) {
|
||||
std::unique_ptr<QIODevice> cache(sIconCache->data(QUrl(cache_key)));
|
||||
if (cache) {
|
||||
QImage cached_pixmap;
|
||||
if (cached_pixmap.load(cache.get(), "XPM")) {
|
||||
QPixmapCache::insert(cache_key, QPixmap::fromImage(cached_pixmap));
|
||||
return QPixmap::fromImage(cached_pixmap);
|
||||
QImage cached_image;
|
||||
if (cached_image.load(cache.get(), "XPM")) {
|
||||
QPixmapCache::insert(cache_key, QPixmap::fromImage(cached_image));
|
||||
return QPixmap::fromImage(cached_image);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -461,11 +461,11 @@ void CollectionView::ShowInVarious(bool on) {
|
|||
|
||||
void CollectionView::Load() {
|
||||
|
||||
QMimeData *data = model()->mimeData(selectedIndexes());
|
||||
if (MimeData *mime_data = qobject_cast<MimeData*>(data)) {
|
||||
mime_data->clear_first_ = true;
|
||||
QMimeData *q_mimedata = model()->mimeData(selectedIndexes());
|
||||
if (MimeData *mimedata = qobject_cast<MimeData*>(q_mimedata)) {
|
||||
mimedata->clear_first_ = true;
|
||||
}
|
||||
emit AddToPlaylistSignal(data);
|
||||
emit AddToPlaylistSignal(q_mimedata);
|
||||
|
||||
}
|
||||
|
||||
|
@ -477,31 +477,31 @@ void CollectionView::AddToPlaylist() {
|
|||
|
||||
void CollectionView::AddToPlaylistEnqueue() {
|
||||
|
||||
QMimeData *data = model()->mimeData(selectedIndexes());
|
||||
if (MimeData* mime_data = qobject_cast<MimeData*>(data)) {
|
||||
mime_data->enqueue_now_ = true;
|
||||
QMimeData *q_mimedata = model()->mimeData(selectedIndexes());
|
||||
if (MimeData* mimedata = qobject_cast<MimeData*>(q_mimedata)) {
|
||||
mimedata->enqueue_now_ = true;
|
||||
}
|
||||
emit AddToPlaylistSignal(data);
|
||||
emit AddToPlaylistSignal(q_mimedata);
|
||||
|
||||
}
|
||||
|
||||
void CollectionView::AddToPlaylistEnqueueNext() {
|
||||
|
||||
QMimeData *data = model()->mimeData(selectedIndexes());
|
||||
if (MimeData *mime_data = qobject_cast<MimeData*>(data)) {
|
||||
mime_data->enqueue_next_now_ = true;
|
||||
QMimeData *q_mimedata = model()->mimeData(selectedIndexes());
|
||||
if (MimeData *mimedata = qobject_cast<MimeData*>(q_mimedata)) {
|
||||
mimedata->enqueue_next_now_ = true;
|
||||
}
|
||||
emit AddToPlaylistSignal(data);
|
||||
emit AddToPlaylistSignal(q_mimedata);
|
||||
|
||||
}
|
||||
|
||||
void CollectionView::OpenInNewPlaylist() {
|
||||
|
||||
QMimeData *data = model()->mimeData(selectedIndexes());
|
||||
if (MimeData* mime_data = qobject_cast<MimeData*>(data)) {
|
||||
mime_data->open_in_new_playlist_ = true;
|
||||
QMimeData *q_mimedata = model()->mimeData(selectedIndexes());
|
||||
if (MimeData* mimedata = qobject_cast<MimeData*>(q_mimedata)) {
|
||||
mimedata->open_in_new_playlist_ = true;
|
||||
}
|
||||
emit AddToPlaylistSignal(data);
|
||||
emit AddToPlaylistSignal(q_mimedata);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -321,11 +321,11 @@ void ContextAlbumsView::contextMenuEvent(QContextMenuEvent *e) {
|
|||
|
||||
void ContextAlbumsView::Load() {
|
||||
|
||||
QMimeData *data = model()->mimeData(selectedIndexes());
|
||||
if (MimeData *mime_data = qobject_cast<MimeData*>(data)) {
|
||||
mime_data->clear_first_ = true;
|
||||
QMimeData *q_mimedata = model()->mimeData(selectedIndexes());
|
||||
if (MimeData *mimedata = qobject_cast<MimeData*>(q_mimedata)) {
|
||||
mimedata->clear_first_ = true;
|
||||
}
|
||||
emit AddToPlaylistSignal(data);
|
||||
emit AddToPlaylistSignal(q_mimedata);
|
||||
|
||||
}
|
||||
|
||||
|
@ -337,21 +337,21 @@ void ContextAlbumsView::AddToPlaylist() {
|
|||
|
||||
void ContextAlbumsView::AddToPlaylistEnqueue() {
|
||||
|
||||
QMimeData *data = model()->mimeData(selectedIndexes());
|
||||
if (MimeData* mime_data = qobject_cast<MimeData*>(data)) {
|
||||
mime_data->enqueue_now_ = true;
|
||||
QMimeData *q_mimedata = model()->mimeData(selectedIndexes());
|
||||
if (MimeData *mimedata = qobject_cast<MimeData*>(q_mimedata)) {
|
||||
mimedata->enqueue_now_ = true;
|
||||
}
|
||||
emit AddToPlaylistSignal(data);
|
||||
emit AddToPlaylistSignal(q_mimedata);
|
||||
|
||||
}
|
||||
|
||||
void ContextAlbumsView::OpenInNewPlaylist() {
|
||||
|
||||
QMimeData *data = model()->mimeData(selectedIndexes());
|
||||
if (MimeData* mime_data = qobject_cast<MimeData*>(data)) {
|
||||
mime_data->open_in_new_playlist_ = true;
|
||||
QMimeData *q_mimedata = model()->mimeData(selectedIndexes());
|
||||
if (MimeData *mimedata = qobject_cast<MimeData*>(q_mimedata)) {
|
||||
mimedata->open_in_new_playlist_ = true;
|
||||
}
|
||||
emit AddToPlaylistSignal(data);
|
||||
emit AddToPlaylistSignal(q_mimedata);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -114,8 +114,8 @@ class ApplicationImpl {
|
|||
CoverProviders *cover_providers = new CoverProviders(app);
|
||||
// Initialize the repository of cover providers.
|
||||
cover_providers->AddProvider(new LastFmCoverProvider(app, app));
|
||||
cover_providers->AddProvider(new DiscogsCoverProvider(app, app));
|
||||
cover_providers->AddProvider(new MusicbrainzCoverProvider(app, app));
|
||||
cover_providers->AddProvider(new DiscogsCoverProvider(app, app));
|
||||
cover_providers->AddProvider(new DeezerCoverProvider(app, app));
|
||||
cover_providers->AddProvider(new QobuzCoverProvider(app, app));
|
||||
#ifdef HAVE_TIDAL
|
||||
|
|
|
@ -1400,71 +1400,71 @@ void MainWindow::UpdateTrackSliderPosition() {
|
|||
|
||||
}
|
||||
|
||||
void MainWindow::ApplyAddBehaviour(BehaviourSettingsPage::AddBehaviour b, MimeData *data) const {
|
||||
void MainWindow::ApplyAddBehaviour(BehaviourSettingsPage::AddBehaviour b, MimeData *mimedata) const {
|
||||
|
||||
switch (b) {
|
||||
case BehaviourSettingsPage::AddBehaviour_Append:
|
||||
data->clear_first_ = false;
|
||||
data->enqueue_now_ = false;
|
||||
mimedata->clear_first_ = false;
|
||||
mimedata->enqueue_now_ = false;
|
||||
break;
|
||||
|
||||
case BehaviourSettingsPage::AddBehaviour_Enqueue:
|
||||
data->clear_first_ = false;
|
||||
data->enqueue_now_ = true;
|
||||
mimedata->clear_first_ = false;
|
||||
mimedata->enqueue_now_ = true;
|
||||
break;
|
||||
|
||||
case BehaviourSettingsPage::AddBehaviour_Load:
|
||||
data->clear_first_ = true;
|
||||
data->enqueue_now_ = false;
|
||||
mimedata->clear_first_ = true;
|
||||
mimedata->enqueue_now_ = false;
|
||||
break;
|
||||
|
||||
case BehaviourSettingsPage::AddBehaviour_OpenInNew:
|
||||
data->open_in_new_playlist_ = true;
|
||||
mimedata->open_in_new_playlist_ = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::ApplyPlayBehaviour(BehaviourSettingsPage::PlayBehaviour b, MimeData *data) const {
|
||||
void MainWindow::ApplyPlayBehaviour(BehaviourSettingsPage::PlayBehaviour b, MimeData *mimedata) const {
|
||||
|
||||
switch (b) {
|
||||
case BehaviourSettingsPage::PlayBehaviour_Always:
|
||||
data->play_now_ = true;
|
||||
mimedata->play_now_ = true;
|
||||
break;
|
||||
|
||||
case BehaviourSettingsPage::PlayBehaviour_Never:
|
||||
data->play_now_ = false;
|
||||
mimedata->play_now_ = false;
|
||||
break;
|
||||
|
||||
case BehaviourSettingsPage::PlayBehaviour_IfStopped:
|
||||
data->play_now_ = !(app_->player()->GetState() == Engine::Playing);
|
||||
mimedata->play_now_ = !(app_->player()->GetState() == Engine::Playing);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::AddToPlaylist(QMimeData *data) {
|
||||
void MainWindow::AddToPlaylist(QMimeData *q_mimedata) {
|
||||
|
||||
if (!data) return;
|
||||
if (!q_mimedata) return;
|
||||
|
||||
if (MimeData *mime_data = qobject_cast<MimeData*>(data)) {
|
||||
if (MimeData *mimedata = qobject_cast<MimeData*>(q_mimedata)) {
|
||||
// Should we replace the flags with the user's preference?
|
||||
if (mime_data->override_user_settings_) {
|
||||
if (mimedata->override_user_settings_) {
|
||||
// Do nothing
|
||||
}
|
||||
else if (mime_data->from_doubleclick_) {
|
||||
ApplyAddBehaviour(doubleclick_addmode_, mime_data);
|
||||
ApplyPlayBehaviour(doubleclick_playmode_, mime_data);
|
||||
else if (mimedata->from_doubleclick_) {
|
||||
ApplyAddBehaviour(doubleclick_addmode_, mimedata);
|
||||
ApplyPlayBehaviour(doubleclick_playmode_, mimedata);
|
||||
}
|
||||
else {
|
||||
ApplyPlayBehaviour(menu_playmode_, mime_data);
|
||||
ApplyPlayBehaviour(menu_playmode_, mimedata);
|
||||
}
|
||||
|
||||
// Should we create a new playlist for the songs?
|
||||
if (mime_data->open_in_new_playlist_) {
|
||||
app_->playlist_manager()->New(mime_data->get_name_for_new_playlist());
|
||||
if (mimedata->open_in_new_playlist_) {
|
||||
app_->playlist_manager()->New(mimedata->get_name_for_new_playlist());
|
||||
}
|
||||
}
|
||||
app_->playlist_manager()->current()->dropMimeData(data, Qt::CopyAction, -1, 0, QModelIndex());
|
||||
delete data;
|
||||
app_->playlist_manager()->current()->dropMimeData(q_mimedata, Qt::CopyAction, -1, 0, QModelIndex());
|
||||
delete q_mimedata;
|
||||
|
||||
}
|
||||
|
||||
|
@ -1892,9 +1892,9 @@ void MainWindow::AddFile() {
|
|||
urls << QUrl::fromLocalFile(QFileInfo(path).canonicalFilePath());
|
||||
}
|
||||
|
||||
MimeData *data = new MimeData;
|
||||
data->setUrls(urls);
|
||||
AddToPlaylist(data);
|
||||
MimeData *mimedata = new MimeData;
|
||||
mimedata->setUrls(urls);
|
||||
AddToPlaylist(mimedata);
|
||||
|
||||
}
|
||||
|
||||
|
@ -1911,19 +1911,19 @@ void MainWindow::AddFolder() {
|
|||
settings_.setValue("add_folder_path", directory);
|
||||
|
||||
// Add media
|
||||
MimeData *data = new MimeData;
|
||||
data->setUrls(QList<QUrl>() << QUrl::fromLocalFile(QFileInfo(directory).canonicalFilePath()));
|
||||
AddToPlaylist(data);
|
||||
MimeData *mimedata = new MimeData;
|
||||
mimedata->setUrls(QList<QUrl>() << QUrl::fromLocalFile(QFileInfo(directory).canonicalFilePath()));
|
||||
AddToPlaylist(mimedata);
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::AddCDTracks() {
|
||||
|
||||
MimeData *data = new MimeData;
|
||||
MimeData *mimedata = new MimeData;
|
||||
// We are putting empty data, but we specify cdda mimetype to indicate that we want to load audio cd tracks
|
||||
data->open_in_new_playlist_ = true;
|
||||
data->setData(Playlist::kCddaMimeType, QByteArray());
|
||||
AddToPlaylist(data);
|
||||
mimedata->open_in_new_playlist_ = true;
|
||||
mimedata->setData(Playlist::kCddaMimeType, QByteArray());
|
||||
AddToPlaylist(mimedata);
|
||||
|
||||
}
|
||||
|
||||
|
@ -1931,9 +1931,9 @@ void MainWindow::AddStream() { add_stream_dialog_->show(); }
|
|||
|
||||
void MainWindow::AddStreamAccepted() {
|
||||
|
||||
MimeData* data = new MimeData;
|
||||
data->setUrls(QList<QUrl>() << add_stream_dialog_->url());
|
||||
AddToPlaylist(data);
|
||||
MimeData *mimedata = new MimeData;
|
||||
mimedata->setUrls(QList<QUrl>() << add_stream_dialog_->url());
|
||||
AddToPlaylist(mimedata);
|
||||
|
||||
}
|
||||
|
||||
|
@ -2046,31 +2046,31 @@ void MainWindow::CommandlineOptionsReceived(const CommandlineOptions &options) {
|
|||
}
|
||||
}
|
||||
#endif
|
||||
MimeData *data = new MimeData;
|
||||
data->setUrls(options.urls());
|
||||
MimeData *mimedata = new MimeData;
|
||||
mimedata->setUrls(options.urls());
|
||||
// Behaviour depends on command line options, so set it here
|
||||
data->override_user_settings_ = true;
|
||||
mimedata->override_user_settings_ = true;
|
||||
|
||||
if (options.player_action() == CommandlineOptions::Player_Play) data->play_now_ = true;
|
||||
else ApplyPlayBehaviour(doubleclick_playmode_, data);
|
||||
if (options.player_action() == CommandlineOptions::Player_Play) mimedata->play_now_ = true;
|
||||
else ApplyPlayBehaviour(doubleclick_playmode_, mimedata);
|
||||
|
||||
switch (options.url_list_action()) {
|
||||
case CommandlineOptions::UrlList_Load:
|
||||
data->clear_first_ = true;
|
||||
mimedata->clear_first_ = true;
|
||||
break;
|
||||
case CommandlineOptions::UrlList_Append:
|
||||
// Nothing to do
|
||||
break;
|
||||
case CommandlineOptions::UrlList_None:
|
||||
ApplyAddBehaviour(doubleclick_addmode_, data);
|
||||
ApplyAddBehaviour(doubleclick_addmode_, mimedata);
|
||||
break;
|
||||
case CommandlineOptions::UrlList_CreateNew:
|
||||
data->name_for_new_playlist_ = options.playlist_name();
|
||||
ApplyAddBehaviour(BehaviourSettingsPage::AddBehaviour_OpenInNew, data);
|
||||
mimedata->name_for_new_playlist_ = options.playlist_name();
|
||||
ApplyAddBehaviour(BehaviourSettingsPage::AddBehaviour_OpenInNew, mimedata);
|
||||
break;
|
||||
}
|
||||
|
||||
AddToPlaylist(data);
|
||||
AddToPlaylist(mimedata);
|
||||
}
|
||||
|
||||
if (options.set_volume() != -1) app_->player()->SetVolume(options.set_volume());
|
||||
|
@ -2113,9 +2113,9 @@ bool MainWindow::LoadUrl(const QString &url) {
|
|||
|
||||
if (!QFile::exists(url)) return false;
|
||||
|
||||
MimeData *data = new MimeData;
|
||||
data->setUrls(QList<QUrl>() << QUrl::fromLocalFile(url));
|
||||
AddToPlaylist(data);
|
||||
MimeData *mimedata = new MimeData;
|
||||
mimedata->setUrls(QList<QUrl>() << QUrl::fromLocalFile(url));
|
||||
AddToPlaylist(mimedata);
|
||||
|
||||
return true;
|
||||
|
||||
|
|
|
@ -189,7 +189,7 @@ class MainWindow : public QMainWindow, public PlatformInterface {
|
|||
void CopyFilesToDevice(const QList<QUrl>& urls);
|
||||
void EditFileTags(const QList<QUrl>& urls);
|
||||
|
||||
void AddToPlaylist(QMimeData *data);
|
||||
void AddToPlaylist(QMimeData *q_mimedata);
|
||||
void AddToPlaylist(QAction *action);
|
||||
|
||||
void VolumeWheelEvent(const int delta);
|
||||
|
@ -266,8 +266,8 @@ class MainWindow : public QMainWindow, public PlatformInterface {
|
|||
|
||||
void SaveSettings();
|
||||
|
||||
void ApplyAddBehaviour(BehaviourSettingsPage::AddBehaviour b, MimeData *data) const;
|
||||
void ApplyPlayBehaviour(BehaviourSettingsPage::PlayBehaviour b, MimeData *data) const;
|
||||
void ApplyAddBehaviour(BehaviourSettingsPage::AddBehaviour b, MimeData *mimedata) const;
|
||||
void ApplyPlayBehaviour(BehaviourSettingsPage::PlayBehaviour b, MimeData *mimedata) const;
|
||||
|
||||
void CheckFullRescanRevisions();
|
||||
|
||||
|
|
|
@ -109,7 +109,7 @@ void RegisterMetaTypes() {
|
|||
#ifdef HAVE_DBUS
|
||||
qDBusRegisterMetaType<QList<QByteArray>>();
|
||||
qDBusRegisterMetaType<TrackMetadata>();
|
||||
qDBusRegisterMetaType<TrackIds>();
|
||||
qDBusRegisterMetaType<Track_Ids>();
|
||||
qDBusRegisterMetaType<MprisPlaylist>();
|
||||
qDBusRegisterMetaType<MprisPlaylistList>();
|
||||
qDBusRegisterMetaType<MaybePlaylist>();
|
||||
|
|
|
@ -500,14 +500,14 @@ void Mpris2::OpenUri(const QString &uri) {
|
|||
app_->playlist_manager()->active()->InsertUrls(QList<QUrl>() << QUrl(uri), -1, true);
|
||||
}
|
||||
|
||||
TrackIds Mpris2::Tracks() const {
|
||||
Track_Ids Mpris2::Tracks() const {
|
||||
// TODO
|
||||
return TrackIds();
|
||||
return Track_Ids();
|
||||
}
|
||||
|
||||
bool Mpris2::CanEditTracks() const { return false; }
|
||||
|
||||
TrackMetadata Mpris2::GetTracksMetadata(const TrackIds &tracks) const {
|
||||
TrackMetadata Mpris2::GetTracksMetadata(const Track_Ids &tracks) const {
|
||||
|
||||
Q_UNUSED(tracks);
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ class Song;
|
|||
class Playlist;
|
||||
|
||||
typedef QList<QVariantMap> TrackMetadata;
|
||||
typedef QList<QDBusObjectPath> TrackIds;
|
||||
typedef QList<QDBusObjectPath> Track_Ids;
|
||||
Q_DECLARE_METATYPE(TrackMetadata)
|
||||
|
||||
struct MprisPlaylist {
|
||||
|
@ -112,7 +112,7 @@ class Mpris2 : public QObject {
|
|||
Q_PROPERTY(bool CanControl READ CanControl)
|
||||
|
||||
// org.mpris.MediaPlayer2.TrackList MPRIS 2.0 Player interface
|
||||
Q_PROPERTY(TrackIds Tracks READ Tracks)
|
||||
Q_PROPERTY(Track_Ids Tracks READ Tracks)
|
||||
Q_PROPERTY(bool CanEditTracks READ CanEditTracks)
|
||||
|
||||
// org.mpris.MediaPlayer2.Playlists MPRIS 2.1 Playlists interface
|
||||
|
@ -171,11 +171,11 @@ class Mpris2 : public QObject {
|
|||
void OpenUri(const QString &uri);
|
||||
|
||||
// TrackList Properties
|
||||
TrackIds Tracks() const;
|
||||
Track_Ids Tracks() const;
|
||||
bool CanEditTracks() const;
|
||||
|
||||
// Methods
|
||||
TrackMetadata GetTracksMetadata(const TrackIds &tracks) const;
|
||||
TrackMetadata GetTracksMetadata(const Track_Ids &tracks) const;
|
||||
void AddTrack(const QString &uri, const QDBusObjectPath &afterTrack, bool setAsCurrent);
|
||||
void RemoveTrack(const QDBusObjectPath &trackId);
|
||||
void GoTo(const QDBusObjectPath &trackId);
|
||||
|
@ -194,7 +194,7 @@ signals:
|
|||
void Seeked(qlonglong position);
|
||||
|
||||
// TrackList
|
||||
void TrackListReplaced(const TrackIds &Tracks, QDBusObjectPath CurrentTrack);
|
||||
void TrackListReplaced(const Track_Ids &Tracks, QDBusObjectPath CurrentTrack);
|
||||
void TrackAdded(const TrackMetadata &Metadata, QDBusObjectPath AfterTrack);
|
||||
void TrackRemoved(const QDBusObjectPath &trackId);
|
||||
void TrackMetadataChanged(const QDBusObjectPath &trackId, const TrackMetadata &metadata);
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include <QtDebug>
|
||||
|
||||
#include "core/logging.h"
|
||||
#include "scangiomodulepath.h"
|
||||
|
||||
void ScanGIOModulePath() {
|
||||
|
||||
|
|
|
@ -151,9 +151,9 @@ void SimpleTreeItem<T>::Delete(int child_row) {
|
|||
}
|
||||
|
||||
template <typename T>
|
||||
T* SimpleTreeItem<T>::ChildByKey(const QString& key) const {
|
||||
T* SimpleTreeItem<T>::ChildByKey(const QString &_key) const {
|
||||
for (T* child : children) {
|
||||
if (child->key == key) return child;
|
||||
if (child->key == _key) return child;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -681,7 +681,7 @@ QString Song::ImageCacheDir(const Song::Source source) {
|
|||
|
||||
}
|
||||
|
||||
int CompareSongsName(const Song &song1, const Song &song2) {
|
||||
int Song::CompareSongsName(const Song &song1, const Song &song2) {
|
||||
return song1.PrettyTitleWithArtist().localeAwareCompare(song2.PrettyTitleWithArtist()) < 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -150,6 +150,7 @@ class Song {
|
|||
static QString ImageCacheDir(const Song::Source source);
|
||||
|
||||
// Sort songs alphabetically using their pretty title
|
||||
static int CompareSongsName(const Song &song1, const Song &song2);
|
||||
static void SortSongsListAlphabetically(QList<Song> *songs);
|
||||
|
||||
// Constructors
|
||||
|
|
|
@ -296,20 +296,20 @@ void StyleHelper::drawArrow(QStyle::PrimitiveElement element, QPainter *painter,
|
|||
if (!QPixmapCache::find(pixmapName, &pixmap)) {
|
||||
QImage image(size * devicePixelRatio, size * devicePixelRatio, QImage::Format_ARGB32_Premultiplied);
|
||||
image.fill(Qt::transparent);
|
||||
QPainter painter(&image);
|
||||
QPainter p(&image);
|
||||
|
||||
QStyleOption tweakedOption(*option);
|
||||
tweakedOption.state = QStyle::State_Enabled;
|
||||
|
||||
auto drawCommonStyleArrow = [&tweakedOption, element, &painter](const QRect &rect, const QColor &color) -> void
|
||||
auto drawCommonStyleArrow = [&tweakedOption, element, &p](const QRect &rect, const QColor &color) -> void
|
||||
{
|
||||
static const QCommonStyle* const style = qobject_cast<QCommonStyle*>(QApplication::style());
|
||||
if (!style)
|
||||
return;
|
||||
tweakedOption.palette.setColor(QPalette::ButtonText, color.rgb());
|
||||
tweakedOption.rect = rect;
|
||||
painter.setOpacity(color.alphaF());
|
||||
style->QCommonStyle::drawPrimitive(element, &tweakedOption, &painter);
|
||||
p.setOpacity(color.alphaF());
|
||||
style->QCommonStyle::drawPrimitive(element, &tweakedOption, &p);
|
||||
};
|
||||
|
||||
if (!enabled) {
|
||||
|
@ -319,7 +319,7 @@ void StyleHelper::drawArrow(QStyle::PrimitiveElement element, QPainter *painter,
|
|||
drawCommonStyleArrow(image.rect().translated(0, devicePixelRatio), toolBarDropShadowColor());
|
||||
drawCommonStyleArrow(image.rect(), m_IconsBaseColor);
|
||||
}
|
||||
painter.end();
|
||||
p.end();
|
||||
pixmap = QPixmap::fromImage(image);
|
||||
pixmap.setDevicePixelRatio(devicePixelRatio);
|
||||
QPixmapCache::insert(pixmapName, pixmap);
|
||||
|
|
|
@ -332,6 +332,7 @@ QString ColorToRgba(const QColor &c) {
|
|||
}
|
||||
|
||||
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
|
||||
void OpenInFileManager(const QString &path);
|
||||
void OpenInFileManager(const QString &path) {
|
||||
|
||||
QProcess proc;
|
||||
|
|
|
@ -799,19 +799,19 @@ SongMimeData *AlbumCoverManager::GetMimeDataForAlbums(const QModelIndexList &ind
|
|||
SongList songs = GetSongsInAlbums(indexes);
|
||||
if (songs.isEmpty()) return nullptr;
|
||||
|
||||
SongMimeData *data = new SongMimeData;
|
||||
data->backend = collection_backend_;
|
||||
data->songs = songs;
|
||||
return data;
|
||||
SongMimeData *mimedata = new SongMimeData;
|
||||
mimedata->backend = collection_backend_;
|
||||
mimedata->songs = songs;
|
||||
return mimedata;
|
||||
|
||||
}
|
||||
|
||||
void AlbumCoverManager::AlbumDoubleClicked(const QModelIndex &index) {
|
||||
|
||||
SongMimeData *data = GetMimeDataForAlbums(QModelIndexList() << index);
|
||||
if (data) {
|
||||
data->from_doubleclick_ = true;
|
||||
emit AddToPlaylist(data);
|
||||
SongMimeData *mimedata = GetMimeDataForAlbums(QModelIndexList() << index);
|
||||
if (mimedata) {
|
||||
mimedata->from_doubleclick_ = true;
|
||||
emit AddToPlaylist(mimedata);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -822,10 +822,10 @@ void AlbumCoverManager::AddSelectedToPlaylist() {
|
|||
|
||||
void AlbumCoverManager::LoadSelectedToPlaylist() {
|
||||
|
||||
SongMimeData *data = GetMimeDataForAlbums(ui_->albums->selectionModel()->selectedIndexes());
|
||||
if (data) {
|
||||
data->clear_first_ = true;
|
||||
emit AddToPlaylist(data);
|
||||
SongMimeData *mimedata = GetMimeDataForAlbums(ui_->albums->selectionModel()->selectedIndexes());
|
||||
if (mimedata) {
|
||||
mimedata->clear_first_ = true;
|
||||
emit AddToPlaylist(mimedata);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -220,20 +220,20 @@ void AlbumCoverSearcher::SearchFinished(const quint64 id, const CoverSearchResul
|
|||
for (const CoverSearchResult &result : results) {
|
||||
if (result.image_url.isEmpty()) continue;
|
||||
|
||||
quint64 id = app_->album_cover_loader()->LoadImageAsync(options_, result.image_url, QUrl());
|
||||
quint64 new_id = app_->album_cover_loader()->LoadImageAsync(options_, result.image_url, QUrl());
|
||||
|
||||
QStandardItem *item = new QStandardItem;
|
||||
item->setIcon(no_cover_icon_);
|
||||
item->setText(result.artist + " - " + result.album);
|
||||
item->setData(result.image_url, Role_ImageURL);
|
||||
item->setData(id, Role_ImageRequestId);
|
||||
item->setData(new_id, Role_ImageRequestId);
|
||||
item->setData(false, Role_ImageFetchFinished);
|
||||
item->setData(QVariant(Qt::AlignTop | Qt::AlignHCenter), Qt::TextAlignmentRole);
|
||||
item->setData(result.provider, GroupedIconView::Role_Group);
|
||||
|
||||
model_->appendRow(item);
|
||||
|
||||
cover_loading_tasks_[id] = item;
|
||||
cover_loading_tasks_[new_id] = item;
|
||||
}
|
||||
|
||||
if (cover_loading_tasks_.isEmpty()) ui_->busy->hide();
|
||||
|
|
|
@ -60,8 +60,8 @@ class DeviceInfo : public SimpleTreeItem<DeviceInfo> {
|
|||
Type_Device,
|
||||
};
|
||||
|
||||
explicit DeviceInfo(SimpleTreeModel<DeviceInfo> *model)
|
||||
: SimpleTreeItem<DeviceInfo>(Type_Root, model),
|
||||
explicit DeviceInfo(SimpleTreeModel<DeviceInfo> *_model)
|
||||
: SimpleTreeItem<DeviceInfo>(Type_Root, _model),
|
||||
database_id_(-1),
|
||||
size_(0),
|
||||
transcode_mode_(MusicStorage::Transcode_Unsupported),
|
||||
|
@ -70,8 +70,8 @@ class DeviceInfo : public SimpleTreeItem<DeviceInfo> {
|
|||
unmount_(false),
|
||||
forget_(false) {}
|
||||
|
||||
explicit DeviceInfo(Type type, DeviceInfo *parent = nullptr)
|
||||
: SimpleTreeItem<DeviceInfo>(type, parent),
|
||||
explicit DeviceInfo(const Type _type, DeviceInfo *_parent = nullptr)
|
||||
: SimpleTreeItem<DeviceInfo>(_type, _parent),
|
||||
database_id_(-1),
|
||||
size_(0),
|
||||
transcode_mode_(MusicStorage::Transcode_Unsupported),
|
||||
|
|
|
@ -482,7 +482,7 @@ void DeviceManager::PhysicalDeviceAdded(const QString &id) {
|
|||
}
|
||||
else {
|
||||
// It's a completely new device
|
||||
DeviceInfo *info = new DeviceInfo(DeviceInfo::Type_Device, root_);
|
||||
info = new DeviceInfo(DeviceInfo::Type_Device, root_);
|
||||
info->backends_ << DeviceInfo::Backend(lister, id);
|
||||
info->friendly_name_ = lister->MakeFriendlyName(id);
|
||||
info->size_ = lister->DeviceCapacity(id);
|
||||
|
|
|
@ -376,11 +376,12 @@ SongList DeviceView::GetSelectedSongs() const {
|
|||
|
||||
void DeviceView::Load() {
|
||||
|
||||
QMimeData *data = model()->mimeData(selectedIndexes());
|
||||
if (MimeData *mime_data = qobject_cast<MimeData*>(data)) {
|
||||
mime_data->clear_first_ = true;
|
||||
QMimeData *q_mimedata = model()->mimeData(selectedIndexes());
|
||||
if (MimeData *mimedata = qobject_cast<MimeData*>(q_mimedata)) {
|
||||
mimedata->clear_first_ = true;
|
||||
}
|
||||
emit AddToPlaylistSignal(data);
|
||||
emit AddToPlaylistSignal(q_mimedata);
|
||||
|
||||
}
|
||||
|
||||
void DeviceView::AddToPlaylist() {
|
||||
|
@ -388,11 +389,13 @@ void DeviceView::AddToPlaylist() {
|
|||
}
|
||||
|
||||
void DeviceView::OpenInNewPlaylist() {
|
||||
QMimeData *data = model()->mimeData(selectedIndexes());
|
||||
if (MimeData *mime_data = qobject_cast<MimeData*>(data)) {
|
||||
mime_data->open_in_new_playlist_ = true;
|
||||
|
||||
QMimeData *q_mimedata = model()->mimeData(selectedIndexes());
|
||||
if (MimeData *mimedata = qobject_cast<MimeData*>(q_mimedata)) {
|
||||
mimedata->open_in_new_playlist_ = true;
|
||||
}
|
||||
emit AddToPlaylistSignal(data);
|
||||
emit AddToPlaylistSignal(q_mimedata);
|
||||
|
||||
}
|
||||
|
||||
void DeviceView::Delete() {
|
||||
|
|
|
@ -49,18 +49,18 @@ QString GioLister::DeviceInfo::unique_id() const {
|
|||
|
||||
if (!volume_root_uri.isEmpty()) return volume_root_uri;
|
||||
|
||||
if (mount)
|
||||
if (mount_ptr)
|
||||
return QString("Gio/%1/%2/%3").arg(mount_uuid, filesystem_type).arg(filesystem_size);
|
||||
else
|
||||
return QString("Gio/unmounted/%1").arg((qulonglong)volume.get());
|
||||
return QString("Gio/unmounted/%1").arg((qulonglong)volume_ptr.get());
|
||||
|
||||
}
|
||||
|
||||
bool GioLister::DeviceInfo::is_suitable() const {
|
||||
|
||||
if (!volume) return false; // This excludes smb or ssh mounts
|
||||
if (!volume_ptr) return false; // This excludes smb or ssh mounts
|
||||
|
||||
if (drive && !drive_removable) return false; // This excludes internal drives
|
||||
if (drive_ptr && !drive_removable) return false; // This excludes internal drives
|
||||
|
||||
if (filesystem_type.isEmpty()) return true;
|
||||
|
||||
|
@ -141,7 +141,7 @@ QVariantList GioLister::DeviceIcons(const QString &id) {
|
|||
|
||||
const DeviceInfo &info = devices_[id];
|
||||
|
||||
if (info.mount) {
|
||||
if (info.mount_ptr) {
|
||||
ret << DeviceLister::GuessIconForPath(info.mount_path);
|
||||
ret << info.mount_icon_names;
|
||||
}
|
||||
|
@ -337,7 +337,7 @@ void GioLister::MountAdded(GMount *mount) {
|
|||
|
||||
// The volume might already exist - either mounted or unmounted.
|
||||
for (const QString &id : devices_.keys()) {
|
||||
if (devices_[id].volume == info.volume) {
|
||||
if (devices_[id].volume_ptr == info.volume_ptr) {
|
||||
old_id = id;
|
||||
break;
|
||||
}
|
||||
|
@ -411,7 +411,7 @@ QString GioLister::DeviceInfo::ConvertAndFree(char *str) {
|
|||
void GioLister::DeviceInfo::ReadMountInfo(GMount *mount) {
|
||||
|
||||
// Get basic information
|
||||
this->mount.reset_without_add(mount);
|
||||
mount_ptr.reset_without_add(mount);
|
||||
if (!mount) return;
|
||||
|
||||
mount_name = ConvertAndFree(g_mount_get_name(mount));
|
||||
|
@ -481,7 +481,7 @@ void GioLister::DeviceInfo::ReadMountInfo(GMount *mount) {
|
|||
|
||||
void GioLister::DeviceInfo::ReadVolumeInfo(GVolume *volume) {
|
||||
|
||||
this->volume.reset_without_add(volume);
|
||||
volume_ptr.reset_without_add(volume);
|
||||
if (!volume) return;
|
||||
|
||||
volume_name = ConvertAndFree(g_volume_get_name(volume));
|
||||
|
@ -498,7 +498,7 @@ void GioLister::DeviceInfo::ReadVolumeInfo(GVolume *volume) {
|
|||
|
||||
void GioLister::DeviceInfo::ReadDriveInfo(GDrive *drive) {
|
||||
|
||||
this->drive.reset_without_add(drive);
|
||||
drive_ptr.reset_without_add(drive);
|
||||
if (!drive) return;
|
||||
|
||||
drive_name = ConvertAndFree(g_drive_get_name(drive));
|
||||
|
@ -506,18 +506,21 @@ void GioLister::DeviceInfo::ReadDriveInfo(GDrive *drive) {
|
|||
}
|
||||
|
||||
QString GioLister::FindUniqueIdByMount(GMount *mount) const {
|
||||
|
||||
for (const DeviceInfo &info : devices_) {
|
||||
if (info.mount == mount) return info.unique_id();
|
||||
if (info.mount_ptr == mount) return info.unique_id();
|
||||
}
|
||||
return QString();
|
||||
|
||||
}
|
||||
|
||||
QString GioLister::FindUniqueIdByVolume(GVolume *volume) const {
|
||||
|
||||
for (const DeviceInfo &info : devices_) {
|
||||
if (info.volume == volume) return info.unique_id();
|
||||
if (info.volume_ptr == volume) return info.unique_id();
|
||||
}
|
||||
return QString();
|
||||
|
||||
}
|
||||
|
||||
void GioLister::VolumeEjectFinished(GObject *object, GAsyncResult *result, gpointer) {
|
||||
|
@ -536,11 +539,11 @@ void GioLister::UpdateDeviceFreeSpace(const QString &id) {
|
|||
|
||||
{
|
||||
QMutexLocker l(&mutex_);
|
||||
if (!devices_.contains(id) || !devices_[id].mount || devices_[id].volume_root_uri.startsWith("mtp://")) return;
|
||||
if (!devices_.contains(id) || !devices_[id].mount_ptr || devices_[id].volume_root_uri.startsWith("mtp://")) return;
|
||||
|
||||
DeviceInfo &device_info = devices_[id];
|
||||
|
||||
GFile *root = g_mount_get_root(device_info.mount);
|
||||
GFile *root = g_mount_get_root(device_info.mount_ptr);
|
||||
|
||||
GError *error = nullptr;
|
||||
GFileInfo *info = g_file_query_filesystem_info(root, G_FILE_ATTRIBUTE_FILESYSTEM_FREE, nullptr, &error);
|
||||
|
@ -561,8 +564,10 @@ void GioLister::UpdateDeviceFreeSpace(const QString &id) {
|
|||
}
|
||||
|
||||
bool GioLister::DeviceNeedsMount(const QString &id) {
|
||||
|
||||
QMutexLocker l(&mutex_);
|
||||
return devices_.contains(id) && !devices_[id].mount && !devices_[id].volume_root_uri.startsWith("mtp://");
|
||||
return devices_.contains(id) && !devices_[id].mount_ptr && !devices_[id].volume_root_uri.startsWith("mtp://");
|
||||
|
||||
}
|
||||
|
||||
void GioLister::MountDevice(const QString &id, const int request_id) {
|
||||
|
@ -574,13 +579,13 @@ void GioLister::MountDevice(const QString &id, const int request_id) {
|
|||
}
|
||||
|
||||
const DeviceInfo &info = devices_[id];
|
||||
if (info.mount) {
|
||||
if (info.mount_ptr) {
|
||||
// Already mounted
|
||||
emit DeviceMounted(id, request_id, true);
|
||||
return;
|
||||
}
|
||||
|
||||
g_volume_mount(info.volume, G_MOUNT_MOUNT_NONE, nullptr, nullptr, VolumeMountFinished, nullptr);
|
||||
g_volume_mount(info.volume_ptr, G_MOUNT_MOUNT_NONE, nullptr, nullptr, VolumeMountFinished, nullptr);
|
||||
emit DeviceMounted(id, request_id, true);
|
||||
|
||||
}
|
||||
|
@ -588,26 +593,26 @@ void GioLister::MountDevice(const QString &id, const int request_id) {
|
|||
void GioLister::UnmountDevice(const QString &id) {
|
||||
|
||||
QMutexLocker l(&mutex_);
|
||||
if (!devices_.contains(id) || !devices_[id].mount || devices_[id].volume_root_uri.startsWith("mtp://")) return;
|
||||
if (!devices_.contains(id) || !devices_[id].mount_ptr || devices_[id].volume_root_uri.startsWith("mtp://")) return;
|
||||
|
||||
const DeviceInfo &info = devices_[id];
|
||||
|
||||
if (!info.mount) return;
|
||||
if (!info.mount_ptr) return;
|
||||
|
||||
if (info.volume) {
|
||||
if (g_volume_can_eject(info.volume)) {
|
||||
g_volume_eject_with_operation(info.volume, G_MOUNT_UNMOUNT_NONE, nullptr, nullptr, (GAsyncReadyCallback)VolumeEjectFinished, nullptr);
|
||||
g_object_unref(info.volume);
|
||||
if (info.volume_ptr) {
|
||||
if (g_volume_can_eject(info.volume_ptr)) {
|
||||
g_volume_eject_with_operation(info.volume_ptr, G_MOUNT_UNMOUNT_NONE, nullptr, nullptr, (GAsyncReadyCallback)VolumeEjectFinished, nullptr);
|
||||
g_object_unref(info.volume_ptr);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else return;
|
||||
|
||||
if (g_mount_can_eject(info.mount)) {
|
||||
g_mount_eject_with_operation(info.mount, G_MOUNT_UNMOUNT_NONE, nullptr, nullptr, (GAsyncReadyCallback)MountEjectFinished, nullptr);
|
||||
if (g_mount_can_eject(info.mount_ptr)) {
|
||||
g_mount_eject_with_operation(info.mount_ptr, G_MOUNT_UNMOUNT_NONE, nullptr, nullptr, (GAsyncReadyCallback)MountEjectFinished, nullptr);
|
||||
}
|
||||
else if (g_mount_can_unmount(info.mount)) {
|
||||
g_mount_unmount_with_operation(info.mount, G_MOUNT_UNMOUNT_NONE, nullptr, nullptr, (GAsyncReadyCallback)MountUnmountFinished, nullptr);
|
||||
else if (g_mount_can_unmount(info.mount_ptr)) {
|
||||
g_mount_unmount_with_operation(info.mount_ptr, G_MOUNT_UNMOUNT_NONE, nullptr, nullptr, (GAsyncReadyCallback)MountUnmountFinished, nullptr);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -87,19 +87,19 @@ class GioLister : public DeviceLister {
|
|||
void ReadMountInfo(GMount *mount);
|
||||
|
||||
// Only available if it's a physical drive
|
||||
ScopedGObject<GVolume> volume;
|
||||
ScopedGObject<GVolume> volume_ptr;
|
||||
QString volume_name;
|
||||
QString volume_unix_device;
|
||||
QString volume_root_uri;
|
||||
QString volume_uuid;
|
||||
|
||||
// Only available if it's a physical drive
|
||||
ScopedGObject<GDrive> drive;
|
||||
ScopedGObject<GDrive> drive_ptr;
|
||||
QString drive_name;
|
||||
bool drive_removable;
|
||||
|
||||
// Only available if it's mounted
|
||||
ScopedGObject<GMount> mount;
|
||||
ScopedGObject<GMount> mount_ptr;
|
||||
QString mount_path;
|
||||
QString mount_uri;
|
||||
QString mount_name;
|
||||
|
|
|
@ -372,8 +372,8 @@ Udisks2Lister::PartitionData Udisks2Lister::ReadPartitionData(const QDBusObjectP
|
|||
else
|
||||
result.friendly_name = result.model + " " + result.uuid;
|
||||
|
||||
for (const auto &path : filesystem.mountPoints())
|
||||
result.mount_paths.push_back(path);
|
||||
for (const auto &p : filesystem.mountPoints())
|
||||
result.mount_paths.push_back(p);
|
||||
|
||||
result.free_space = Utilities::FileSystemFreeSpace(result.mount_paths.at(0));
|
||||
}
|
||||
|
|
|
@ -310,8 +310,8 @@ void EditTagDialog::SetSongsFinished(QFuture<QList<Data>> future) {
|
|||
}
|
||||
|
||||
// Add the filenames to the list
|
||||
for (const Data &data : data_) {
|
||||
ui_->song_list->addItem(data.current_.basefilename());
|
||||
for (const Data &tag_data : data_) {
|
||||
ui_->song_list->addItem(tag_data.current_.basefilename());
|
||||
}
|
||||
|
||||
// Select all
|
||||
|
@ -443,8 +443,8 @@ void EditTagDialog::ResetFieldValue(const FieldData &field, const QModelIndexLis
|
|||
|
||||
// Reset each selected song
|
||||
for (const QModelIndex &i : sel) {
|
||||
Data &data = data_[i.row()];
|
||||
data.set_value(field.id_, data.original_value(field.id_));
|
||||
Data &tag_data = data_[i.row()];
|
||||
tag_data.set_value(field.id_, tag_data.original_value(field.id_));
|
||||
}
|
||||
|
||||
// Reset the field
|
||||
|
@ -733,10 +733,10 @@ void EditTagDialog::ButtonClicked(QAbstractButton *button) {
|
|||
}
|
||||
}
|
||||
|
||||
void EditTagDialog::SaveData(const QList<Data> &data) {
|
||||
void EditTagDialog::SaveData(const QList<Data> &tag_data) {
|
||||
|
||||
for (int i = 0; i < data.count(); ++i) {
|
||||
const Data &ref = data[i];
|
||||
for (int i = 0; i < tag_data.count(); ++i) {
|
||||
const Data &ref = tag_data[i];
|
||||
if (ref.current_.IsMetadataEqual(ref.original_)) continue;
|
||||
|
||||
pending_++;
|
||||
|
|
|
@ -156,7 +156,7 @@ class EditTagDialog : public QDialog {
|
|||
|
||||
// Called by QtConcurrentRun
|
||||
QList<Data> LoadData(const SongList &songs) const;
|
||||
void SaveData(const QList<Data> &data);
|
||||
void SaveData(const QList<Data> &tag_data);
|
||||
|
||||
private:
|
||||
Ui_EditTagDialog *ui_;
|
||||
|
|
|
@ -103,9 +103,9 @@ void TrackSelectionDialog::Init(const SongList &songs) {
|
|||
data_.clear();
|
||||
|
||||
for (const Song &song : songs) {
|
||||
Data data;
|
||||
data.original_song_ = song;
|
||||
data_ << data;
|
||||
Data tag_data;
|
||||
tag_data.original_song_ = song;
|
||||
data_ << tag_data;
|
||||
|
||||
QListWidgetItem *item = new QListWidgetItem(ui_->song_list);
|
||||
item->setText(QFileInfo(song.url().toLocalFile()).fileName());
|
||||
|
@ -175,14 +175,14 @@ void TrackSelectionDialog::UpdateStack() {
|
|||
const int row = ui_->song_list->currentRow();
|
||||
if (row < 0 || row >= data_.count()) return;
|
||||
|
||||
const Data &data = data_[row];
|
||||
const Data &tag_data = data_[row];
|
||||
|
||||
if (data.pending_) {
|
||||
if (tag_data.pending_) {
|
||||
ui_->stack->setCurrentWidget(ui_->loading_page);
|
||||
ui_->progress->set_text(data.progress_string_ + "...");
|
||||
ui_->progress->set_text(tag_data.progress_string_ + "...");
|
||||
return;
|
||||
}
|
||||
else if (data.results_.isEmpty()) {
|
||||
else if (tag_data.results_.isEmpty()) {
|
||||
ui_->stack->setCurrentWidget(ui_->error_page);
|
||||
return;
|
||||
}
|
||||
|
@ -193,13 +193,13 @@ void TrackSelectionDialog::UpdateStack() {
|
|||
|
||||
// Put the original tags at the top
|
||||
AddDivider(tr("Original tags"), ui_->results);
|
||||
AddSong(data.original_song_, -1, ui_->results);
|
||||
AddSong(tag_data.original_song_, -1, ui_->results);
|
||||
|
||||
// Fill tree view with songs
|
||||
AddDivider(tr("Suggested tags"), ui_->results);
|
||||
|
||||
int song_index = 0;
|
||||
for (const Song &song : data.results_) {
|
||||
for (const Song &song : tag_data.results_) {
|
||||
AddSong(song, song_index++, ui_->results);
|
||||
}
|
||||
|
||||
|
@ -207,7 +207,7 @@ void TrackSelectionDialog::UpdateStack() {
|
|||
for (int i = 0; i < ui_->results->model()->rowCount(); ++i) {
|
||||
const QModelIndex index = ui_->results->model()->index(i, 0);
|
||||
const QVariant id = index.data(Qt::UserRole);
|
||||
if (!id.isNull() && id.toInt() == data.selected_result_) {
|
||||
if (!id.isNull() && id.toInt() == tag_data.selected_result_) {
|
||||
ui_->results->setCurrentIndex(index);
|
||||
break;
|
||||
}
|
||||
|
@ -301,13 +301,13 @@ void TrackSelectionDialog::accept() {
|
|||
|
||||
QDialog::accept();
|
||||
|
||||
for (const Data &data : data_) {
|
||||
if (data.pending_ || data.results_.isEmpty() || data.selected_result_ == -1)
|
||||
for (const Data &tag_data : data_) {
|
||||
if (tag_data.pending_ || tag_data.results_.isEmpty() || tag_data.selected_result_ == -1)
|
||||
continue;
|
||||
|
||||
const Song &new_metadata = data.results_[data.selected_result_];
|
||||
const Song &new_metadata = tag_data.results_[tag_data.selected_result_];
|
||||
|
||||
emit SongChosen(data.original_song_, new_metadata);
|
||||
emit SongChosen(tag_data.original_song_, new_metadata);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -673,10 +673,10 @@ void XineEngine::XineEventListener(void *p, const xine_event_t *event) {
|
|||
{
|
||||
// Series of \0 separated strings, terminated with a \0\0
|
||||
char str[2000];
|
||||
char *p = str;
|
||||
for (char *msg = data->messages; !(*msg == '\0' && *(msg+1) == '\0'); ++msg, ++p)
|
||||
*p = *msg == '\0' ? '\n' : *msg;
|
||||
*p = '\0';
|
||||
char *str_p = str;
|
||||
for (char *msg = data->messages; !(*msg == '\0' && *(msg+1) == '\0'); ++msg, ++str_p)
|
||||
*str_p = *msg == '\0' ? '\n' : *msg;
|
||||
*str_p = '\0';
|
||||
qLog(Debug) << "Xine:" << str;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -347,11 +347,11 @@ void InternetCollectionView::contextMenuEvent(QContextMenuEvent *e) {
|
|||
|
||||
void InternetCollectionView::Load() {
|
||||
|
||||
QMimeData *data = model()->mimeData(selectedIndexes());
|
||||
if (MimeData *mime_data = qobject_cast<MimeData*>(data)) {
|
||||
mime_data->clear_first_ = true;
|
||||
QMimeData *q_mimedata = model()->mimeData(selectedIndexes());
|
||||
if (MimeData *mimedata = qobject_cast<MimeData*>(q_mimedata)) {
|
||||
mimedata->clear_first_ = true;
|
||||
}
|
||||
emit AddToPlaylistSignal(data);
|
||||
emit AddToPlaylistSignal(q_mimedata);
|
||||
|
||||
}
|
||||
|
||||
|
@ -363,31 +363,31 @@ void InternetCollectionView::AddToPlaylist() {
|
|||
|
||||
void InternetCollectionView::AddToPlaylistEnqueue() {
|
||||
|
||||
QMimeData *data = model()->mimeData(selectedIndexes());
|
||||
if (MimeData* mime_data = qobject_cast<MimeData*>(data)) {
|
||||
mime_data->enqueue_now_ = true;
|
||||
QMimeData *q_mimedata = model()->mimeData(selectedIndexes());
|
||||
if (MimeData *mimedata = qobject_cast<MimeData*>(q_mimedata)) {
|
||||
mimedata->enqueue_now_ = true;
|
||||
}
|
||||
emit AddToPlaylistSignal(data);
|
||||
emit AddToPlaylistSignal(q_mimedata);
|
||||
|
||||
}
|
||||
|
||||
void InternetCollectionView::AddToPlaylistEnqueueNext() {
|
||||
|
||||
QMimeData *data = model()->mimeData(selectedIndexes());
|
||||
if (MimeData *mime_data = qobject_cast<MimeData*>(data)) {
|
||||
mime_data->enqueue_next_now_ = true;
|
||||
QMimeData *q_mimedata = model()->mimeData(selectedIndexes());
|
||||
if (MimeData *mimedata = qobject_cast<MimeData*>(q_mimedata)) {
|
||||
mimedata->enqueue_next_now_ = true;
|
||||
}
|
||||
emit AddToPlaylistSignal(data);
|
||||
emit AddToPlaylistSignal(q_mimedata);
|
||||
|
||||
}
|
||||
|
||||
void InternetCollectionView::OpenInNewPlaylist() {
|
||||
|
||||
QMimeData *data = model()->mimeData(selectedIndexes());
|
||||
if (MimeData* mime_data = qobject_cast<MimeData*>(data)) {
|
||||
mime_data->open_in_new_playlist_ = true;
|
||||
QMimeData *q_mimedata = model()->mimeData(selectedIndexes());
|
||||
if (MimeData* mimedata = qobject_cast<MimeData*>(q_mimedata)) {
|
||||
mimedata->open_in_new_playlist_ = true;
|
||||
}
|
||||
emit AddToPlaylistSignal(data);
|
||||
emit AddToPlaylistSignal(q_mimedata);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -607,31 +607,31 @@ void InternetSearchView::AddSelectedToPlaylist() {
|
|||
|
||||
void InternetSearchView::LoadSelected() {
|
||||
|
||||
MimeData *data = SelectedMimeData();
|
||||
if (!data) return;
|
||||
MimeData *mimedata = SelectedMimeData();
|
||||
if (!mimedata) return;
|
||||
|
||||
data->clear_first_ = true;
|
||||
emit AddToPlaylist(data);
|
||||
mimedata->clear_first_ = true;
|
||||
emit AddToPlaylist(mimedata);
|
||||
|
||||
}
|
||||
|
||||
void InternetSearchView::AddSelectedToPlaylistEnqueue() {
|
||||
|
||||
MimeData *data = SelectedMimeData();
|
||||
if (!data) return;
|
||||
MimeData *mimedata = SelectedMimeData();
|
||||
if (!mimedata) return;
|
||||
|
||||
data->enqueue_now_ = true;
|
||||
emit AddToPlaylist(data);
|
||||
mimedata->enqueue_now_ = true;
|
||||
emit AddToPlaylist(mimedata);
|
||||
|
||||
}
|
||||
|
||||
void InternetSearchView::OpenSelectedInNewPlaylist() {
|
||||
|
||||
MimeData *data = SelectedMimeData();
|
||||
if (!data) return;
|
||||
MimeData *mimedata = SelectedMimeData();
|
||||
if (!mimedata) return;
|
||||
|
||||
data->open_in_new_playlist_ = true;
|
||||
emit AddToPlaylist(data);
|
||||
mimedata->open_in_new_playlist_ = true;
|
||||
emit AddToPlaylist(mimedata);
|
||||
|
||||
}
|
||||
|
||||
|
@ -734,9 +734,9 @@ void InternetSearchView::SetSearchType(const InternetSearchView::SearchType type
|
|||
|
||||
void InternetSearchView::AddArtists() {
|
||||
|
||||
MimeData *data = SelectedMimeData();
|
||||
if (!data) return;
|
||||
if (const InternetSongMimeData *internet_song_data = qobject_cast<const InternetSongMimeData*>(data)) {
|
||||
MimeData *mimedata = SelectedMimeData();
|
||||
if (!mimedata) return;
|
||||
if (const InternetSongMimeData *internet_song_data = qobject_cast<const InternetSongMimeData*>(mimedata)) {
|
||||
emit AddArtistsSignal(internet_song_data->songs);
|
||||
}
|
||||
|
||||
|
@ -744,9 +744,9 @@ void InternetSearchView::AddArtists() {
|
|||
|
||||
void InternetSearchView::AddAlbums() {
|
||||
|
||||
MimeData *data = SelectedMimeData();
|
||||
if (!data) return;
|
||||
if (const InternetSongMimeData *internet_song_data = qobject_cast<const InternetSongMimeData*>(data)) {
|
||||
MimeData *mimedata = SelectedMimeData();
|
||||
if (!mimedata) return;
|
||||
if (const InternetSongMimeData *internet_song_data = qobject_cast<const InternetSongMimeData*>(mimedata)) {
|
||||
emit AddAlbumsSignal(internet_song_data->songs);
|
||||
}
|
||||
|
||||
|
@ -754,9 +754,9 @@ void InternetSearchView::AddAlbums() {
|
|||
|
||||
void InternetSearchView::AddSongs() {
|
||||
|
||||
MimeData *data = SelectedMimeData();
|
||||
if (!data) return;
|
||||
if (const InternetSongMimeData *internet_song_data = qobject_cast<const InternetSongMimeData*>(data)) {
|
||||
MimeData *mimedata = SelectedMimeData();
|
||||
if (!mimedata) return;
|
||||
if (const InternetSongMimeData *internet_song_data = qobject_cast<const InternetSongMimeData*>(mimedata)) {
|
||||
emit AddSongsSignal(internet_song_data->songs);
|
||||
}
|
||||
|
||||
|
@ -844,6 +844,7 @@ void InternetSearchView::AlbumCoverLoaded(const quint64 id, const AlbumCoverLoad
|
|||
if (!cover_loader_tasks_.contains(id)) {
|
||||
return;
|
||||
}
|
||||
|
||||
QPair<QModelIndex, QString> cover_loader_task = cover_loader_tasks_.take(id);
|
||||
QModelIndex idx = cover_loader_task.first;
|
||||
QString key = cover_loader_task.second;
|
||||
|
|
|
@ -735,7 +735,7 @@ bool Playlist::dropMimeData(const QMimeData *data, Qt::DropAction action, int ro
|
|||
else if (pid == own_pid) {
|
||||
// Drag from a different playlist
|
||||
PlaylistItemList items;
|
||||
for (int row : source_rows) items << source_playlist->item_at(row);
|
||||
for (const int i : source_rows) items << source_playlist->item_at(i);
|
||||
|
||||
if (items.count() > kUndoItemLimit) {
|
||||
// Too big to keep in the undo stack. Also clear the stack because it might have been invalidated.
|
||||
|
@ -748,8 +748,8 @@ bool Playlist::dropMimeData(const QMimeData *data, Qt::DropAction action, int ro
|
|||
|
||||
// Remove the items from the source playlist if it was a move event
|
||||
if (action == Qt::MoveAction) {
|
||||
for (int row : source_rows) {
|
||||
source_playlist->undo_stack()->push(new PlaylistUndoCommands::RemoveItems(source_playlist, row, 1));
|
||||
for (const int i : source_rows) {
|
||||
source_playlist->undo_stack()->push(new PlaylistUndoCommands::RemoveItems(source_playlist, i, 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1035,7 +1035,7 @@ void Playlist::UpdateItems(const SongList &songs) {
|
|||
QLinkedList<Song> songs_list;
|
||||
for (const Song &song : songs) songs_list.append(song);
|
||||
|
||||
for (int i = 0; i < items_.size(); i++) {
|
||||
for (int i = 0; i < items_.size() ; i++) {
|
||||
// Update current items list
|
||||
QMutableLinkedListIterator<Song> it(songs_list);
|
||||
while (it.hasNext()) {
|
||||
|
@ -1054,7 +1054,7 @@ void Playlist::UpdateItems(const SongList &songs) {
|
|||
items_[i] = new_item;
|
||||
emit dataChanged(index(i, 0), index(i, ColumnCount - 1));
|
||||
// Also update undo actions
|
||||
for (int i = 0; i < undo_stack_->count(); i++) {
|
||||
for (int y = 0 ; y < undo_stack_->count() ; y++) {
|
||||
QUndoCommand *undo_action = const_cast<QUndoCommand*>(undo_stack_->command(i));
|
||||
PlaylistUndoCommands::InsertItems *undo_action_insert = dynamic_cast<PlaylistUndoCommands::InsertItems*>(undo_action);
|
||||
if (undo_action_insert) {
|
||||
|
@ -1078,7 +1078,7 @@ QMimeData *Playlist::mimeData(const QModelIndexList &indexes) const {
|
|||
// We only want one index per row, but we can't just take column 0 because the user might have hidden it.
|
||||
const int first_column = indexes.first().column();
|
||||
|
||||
QMimeData *data = new QMimeData;
|
||||
QMimeData *mimedata = new QMimeData;
|
||||
|
||||
QList<QUrl> urls;
|
||||
QList<int> rows;
|
||||
|
@ -1101,10 +1101,10 @@ QMimeData *Playlist::mimeData(const QModelIndexList &indexes) const {
|
|||
stream.writeRawData((char*)&pid, sizeof(pid));
|
||||
buf.close();
|
||||
|
||||
data->setUrls(urls);
|
||||
data->setData(kRowsMimetype, buf.data());
|
||||
mimedata->setUrls(urls);
|
||||
mimedata->setData(kRowsMimetype, buf.data());
|
||||
|
||||
return data;
|
||||
return mimedata;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -531,9 +531,11 @@ void PlaylistView::showEvent(QShowEvent *) {
|
|||
|
||||
}
|
||||
|
||||
namespace {
|
||||
bool CompareSelectionRanges(const QItemSelectionRange &a, const QItemSelectionRange &b) {
|
||||
return b.bottom() < a.bottom();
|
||||
}
|
||||
} // namespace
|
||||
|
||||
void PlaylistView::keyPressEvent(QKeyEvent *event) {
|
||||
|
||||
|
@ -1224,9 +1226,9 @@ void PlaylistView::CopyCurrentSongToClipboard() const {
|
|||
continue;
|
||||
}
|
||||
|
||||
const QVariant data = model()->data(currentIndex().sibling(currentIndex().row(), i));
|
||||
if (data.type() == QVariant::String) {
|
||||
columns << data.toString();
|
||||
const QVariant var_data = model()->data(currentIndex().sibling(currentIndex().row(), i));
|
||||
if (var_data.type() == QVariant::String) {
|
||||
columns << var_data.toString();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -237,12 +237,10 @@ void BackendSettingsPage::Load_Output(QString output, QVariant device) {
|
|||
if (output.isEmpty()) output = engine()->DefaultOutput();
|
||||
|
||||
ui_->combobox_output->clear();
|
||||
int i = 0;
|
||||
for (const EngineBase::OutputDetails &o : engine()->GetOutputsList()) {
|
||||
i++;
|
||||
ui_->combobox_output->addItem(IconLoader::Load(o.iconname), o.description, QVariant::fromValue(o));
|
||||
}
|
||||
if (i > 1) ui_->combobox_output->setEnabled(true);
|
||||
if (ui_->combobox_output->count() > 1) ui_->combobox_output->setEnabled(true);
|
||||
|
||||
bool found(false);
|
||||
for (int i = 0; i < ui_->combobox_output->count(); ++i) {
|
||||
|
|
|
@ -104,13 +104,13 @@ void MoodbarSettingsPage::InitMoodbarPreviews() {
|
|||
qLog(Warning) << "Unable to open moodbar sample file";
|
||||
return;
|
||||
}
|
||||
QByteArray data(file.readAll());
|
||||
QByteArray file_data = file.readAll();
|
||||
|
||||
// Render and set each preview
|
||||
for (int i = 0; i < MoodbarRenderer::StyleCount; ++i) {
|
||||
|
||||
const MoodbarRenderer::MoodbarStyle style = MoodbarRenderer::MoodbarStyle(i);
|
||||
const ColorVector colors = MoodbarRenderer::Colors(data, style, palette());
|
||||
const ColorVector colors = MoodbarRenderer::Colors(file_data, style, palette());
|
||||
|
||||
QPixmap pixmap(preview_size);
|
||||
QPainter p(&pixmap);
|
||||
|
|
|
@ -180,8 +180,8 @@ void SettingsDialog::showEvent(QShowEvent *e) {
|
|||
|
||||
// Load settings
|
||||
loading_settings_ = true;
|
||||
for (const PageData &data : pages_.values()) {
|
||||
data.page_->Load();
|
||||
for (const PageData &page : pages_.values()) {
|
||||
page.page_->Load();
|
||||
}
|
||||
loading_settings_ = false;
|
||||
|
||||
|
@ -207,8 +207,8 @@ void SettingsDialog::accept() {
|
|||
void SettingsDialog::reject() {
|
||||
|
||||
// Notify each page that user clicks on Cancel
|
||||
for (const PageData &data : pages_.values()) {
|
||||
data.page_->Cancel();
|
||||
for (const PageData &page : pages_.values()) {
|
||||
page.page_->Cancel();
|
||||
}
|
||||
SaveGeometry();
|
||||
|
||||
|
@ -294,18 +294,18 @@ void SettingsDialog::AddPage(Page id, SettingsPage *page, QTreeWidgetItem *paren
|
|||
ui_->stacked_widget->addWidget(area);
|
||||
|
||||
// Remember where the page is
|
||||
PageData data;
|
||||
data.item_ = item;
|
||||
data.scroll_area_ = area;
|
||||
data.page_ = page;
|
||||
pages_[id] = data;
|
||||
PageData page_data;
|
||||
page_data.item_ = item;
|
||||
page_data.scroll_area_ = area;
|
||||
page_data.page_ = page;
|
||||
pages_[id] = page_data;
|
||||
|
||||
}
|
||||
|
||||
void SettingsDialog::Save() {
|
||||
|
||||
for (const PageData &data : pages_.values()) {
|
||||
data.page_->Save();
|
||||
for (const PageData &page : pages_.values()) {
|
||||
page.page_->Save();
|
||||
}
|
||||
emit ReloadSettings();
|
||||
|
||||
|
@ -340,9 +340,9 @@ void SettingsDialog::CurrentItemChanged(QTreeWidgetItem *item) {
|
|||
ui_->title->setText("<b>" + item->text(0) + "</b>");
|
||||
|
||||
// Display the right page
|
||||
for (const PageData &data : pages_.values()) {
|
||||
if (data.item_ == item) {
|
||||
ui_->stacked_widget->setCurrentWidget(data.scroll_area_);
|
||||
for (const PageData &page : pages_.values()) {
|
||||
if (page.item_ == item) {
|
||||
ui_->stacked_widget->setCurrentWidget(page.scroll_area_);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -419,11 +419,11 @@ void TranscodeDialog::AddDestination() {
|
|||
}
|
||||
|
||||
QIcon icon = IconLoader::Load("folder");
|
||||
QVariant data = QVariant::fromValue(dir);
|
||||
QVariant data_var = QVariant::fromValue(dir);
|
||||
// Do not insert duplicates.
|
||||
int duplicate_index = ui_->destination->findData(data);
|
||||
int duplicate_index = ui_->destination->findData(data_var);
|
||||
if (duplicate_index == -1) {
|
||||
ui_->destination->addItem(icon, dir, data);
|
||||
ui_->destination->addItem(icon, dir, data_var);
|
||||
ui_->destination->setCurrentIndex(ui_->destination->count() - 1);
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -105,15 +105,15 @@ GstElement *Transcoder::CreateElementForMimeType(const QString &element_type, co
|
|||
GstRegistry *registry = gst_registry_get();
|
||||
GList *const features = gst_registry_get_feature_list(registry, GST_TYPE_ELEMENT_FACTORY);
|
||||
|
||||
for (GList *p = features; p; p = g_list_next(p)) {
|
||||
GstElementFactory *factory = GST_ELEMENT_FACTORY(p->data);
|
||||
for (GList *f = features ; f ; f = g_list_next(f)) {
|
||||
GstElementFactory *factory = GST_ELEMENT_FACTORY(f->data);
|
||||
|
||||
// Is this the right type of plugin?
|
||||
if (QString(gst_element_factory_get_klass(factory)).contains(element_type)) {
|
||||
const GList *const templates = gst_element_factory_get_static_pad_templates(factory);
|
||||
for (const GList *p = templates; p; p = g_list_next(p)) {
|
||||
for (const GList *t = templates ; t ; t = g_list_next(t)) {
|
||||
// Only interested in source pads
|
||||
GstStaticPadTemplate *pad_template = reinterpret_cast<GstStaticPadTemplate*>(p->data);
|
||||
GstStaticPadTemplate *pad_template = reinterpret_cast<GstStaticPadTemplate*>(t->data);
|
||||
if (pad_template->direction != GST_PAD_SRC) continue;
|
||||
|
||||
// Does this pad support the mime type we want?
|
||||
|
|
|
@ -108,11 +108,11 @@ void AutoExpandingTreeView::ItemDoubleClicked(const QModelIndex &idx) {
|
|||
ignore_next_click_ = true;
|
||||
|
||||
if (add_on_double_click_) {
|
||||
QMimeData *data = model()->mimeData(QModelIndexList() << idx);
|
||||
if (MimeData *mime_data = qobject_cast<MimeData*>(data)) {
|
||||
mime_data->from_doubleclick_ = true;
|
||||
QMimeData *q_mimedata = model()->mimeData(QModelIndexList() << idx);
|
||||
if (MimeData *mimedata = qobject_cast<MimeData*>(q_mimedata)) {
|
||||
mimedata->from_doubleclick_ = true;
|
||||
}
|
||||
emit AddToPlaylistSignal(data);
|
||||
emit AddToPlaylistSignal(q_mimedata);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -127,11 +127,11 @@ void AutoExpandingTreeView::mousePressEvent(QMouseEvent *event) {
|
|||
|
||||
//enqueue to playlist with middleClick
|
||||
if (event->button() == Qt::MidButton) {
|
||||
QMimeData *data = model()->mimeData(selectedIndexes());
|
||||
if (MimeData *mime_data = qobject_cast<MimeData*>(data)) {
|
||||
mime_data->enqueue_now_ = true;
|
||||
QMimeData *q_mimedata = model()->mimeData(selectedIndexes());
|
||||
if (MimeData *mimedata = qobject_cast<MimeData*>(q_mimedata)) {
|
||||
mimedata->enqueue_now_ = true;
|
||||
}
|
||||
emit AddToPlaylistSignal(data);
|
||||
emit AddToPlaylistSignal(q_mimedata);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -158,24 +158,24 @@ void FileView::ChangeFilePathWithoutUndo(const QString &new_path) {
|
|||
|
||||
}
|
||||
|
||||
void FileView::ItemActivated(const QModelIndex &index) {
|
||||
if (model_->isDir(index))
|
||||
ChangeFilePath(model_->filePath(index));
|
||||
void FileView::ItemActivated(const QModelIndex &idx) {
|
||||
if (model_->isDir(idx))
|
||||
ChangeFilePath(model_->filePath(idx));
|
||||
}
|
||||
|
||||
void FileView::ItemDoubleClick(const QModelIndex &index) {
|
||||
void FileView::ItemDoubleClick(const QModelIndex &idx) {
|
||||
|
||||
if (model_->isDir(index))
|
||||
if (model_->isDir(idx))
|
||||
return;
|
||||
|
||||
QString file_path = model_->filePath(index);
|
||||
QString file_path = model_->filePath(idx);
|
||||
|
||||
MimeData *data = new MimeData;
|
||||
data->from_doubleclick_ = true;
|
||||
data->setUrls(QList<QUrl>() << QUrl::fromLocalFile(file_path));
|
||||
data->name_for_new_playlist_ = file_path;
|
||||
MimeData *mimedata = new MimeData;
|
||||
mimedata->from_doubleclick_ = true;
|
||||
mimedata->setUrls(QList<QUrl>() << QUrl::fromLocalFile(file_path));
|
||||
mimedata->name_for_new_playlist_ = file_path;
|
||||
|
||||
emit AddToPlaylist(data);
|
||||
emit AddToPlaylist(mimedata);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -74,8 +74,8 @@ class FileView : public QWidget {
|
|||
void FileUp();
|
||||
void FileHome();
|
||||
void ChangeFilePath(const QString &new_path);
|
||||
void ItemActivated(const QModelIndex &index);
|
||||
void ItemDoubleClick(const QModelIndex &index);
|
||||
void ItemActivated(const QModelIndex &idx);
|
||||
void ItemDoubleClick(const QModelIndex &idx);
|
||||
|
||||
void Delete(const QStringList &filenames);
|
||||
void DeleteFinished(const SongList &songs_with_errors);
|
||||
|
|
|
@ -78,17 +78,17 @@ QList<QUrl> FileViewList::UrlListFromSelection() const {
|
|||
|
||||
MimeData *FileViewList::MimeDataFromSelection() const {
|
||||
|
||||
MimeData *data = new MimeData;
|
||||
data->setUrls(UrlListFromSelection());
|
||||
MimeData *mimedata = new MimeData;
|
||||
mimedata->setUrls(UrlListFromSelection());
|
||||
|
||||
QList<QString> filenames = FilenamesFromSelection();
|
||||
// if just one folder selected - use it's path as the new playlist's name
|
||||
if (filenames.size() == 1 && QFileInfo(filenames.first()).isDir()) {
|
||||
if (filenames.first().length() > 20) {
|
||||
data->name_for_new_playlist_ = QDir(filenames.first()).dirName();
|
||||
mimedata->name_for_new_playlist_ = QDir(filenames.first()).dirName();
|
||||
}
|
||||
else {
|
||||
data->name_for_new_playlist_ = filenames.first();
|
||||
mimedata->name_for_new_playlist_ = filenames.first();
|
||||
}
|
||||
}
|
||||
// otherwise, use the current root path
|
||||
|
@ -97,18 +97,18 @@ MimeData *FileViewList::MimeDataFromSelection() const {
|
|||
if (path.length() > 20) {
|
||||
QFileInfo info(path);
|
||||
if (info.isDir()) {
|
||||
data->name_for_new_playlist_ = QDir(info.filePath()).dirName();
|
||||
mimedata->name_for_new_playlist_ = QDir(info.filePath()).dirName();
|
||||
}
|
||||
else {
|
||||
data->name_for_new_playlist_ = info.baseName();
|
||||
mimedata->name_for_new_playlist_ = info.baseName();
|
||||
}
|
||||
}
|
||||
else {
|
||||
data->name_for_new_playlist_ = path;
|
||||
mimedata->name_for_new_playlist_ = path;
|
||||
}
|
||||
}
|
||||
|
||||
return data;
|
||||
return mimedata;
|
||||
|
||||
}
|
||||
|
||||
|
@ -124,9 +124,11 @@ QStringList FileViewList::FilenamesFromSelection() const {
|
|||
}
|
||||
|
||||
void FileViewList::LoadSlot() {
|
||||
MimeData *data = MimeDataFromSelection();
|
||||
data->clear_first_ = true;
|
||||
emit AddToPlaylist(data);
|
||||
|
||||
MimeData *mimedata = MimeDataFromSelection();
|
||||
mimedata->clear_first_ = true;
|
||||
emit AddToPlaylist(mimedata);
|
||||
|
||||
}
|
||||
|
||||
void FileViewList::AddToPlaylistSlot() {
|
||||
|
@ -134,9 +136,11 @@ void FileViewList::AddToPlaylistSlot() {
|
|||
}
|
||||
|
||||
void FileViewList::OpenInNewPlaylistSlot() {
|
||||
MimeData *data = MimeDataFromSelection();
|
||||
data->open_in_new_playlist_ = true;
|
||||
emit AddToPlaylist(data);
|
||||
|
||||
MimeData *mimedata = MimeDataFromSelection();
|
||||
mimedata->open_in_new_playlist_ = true;
|
||||
emit AddToPlaylist(mimedata);
|
||||
|
||||
}
|
||||
|
||||
void FileViewList::CopyToCollectionSlot() {
|
||||
|
@ -175,10 +179,10 @@ void FileViewList::mousePressEvent(QMouseEvent *e) {
|
|||
// we need to update the menu selection
|
||||
menu_selection_ = selectionModel()->selection();
|
||||
|
||||
MimeData *data = new MimeData;
|
||||
data->setUrls(UrlListFromSelection());
|
||||
data->enqueue_now_ = true;
|
||||
emit AddToPlaylist(data);
|
||||
MimeData *mimedata = new MimeData;
|
||||
mimedata->setUrls(UrlListFromSelection());
|
||||
mimedata->enqueue_now_ = true;
|
||||
emit AddToPlaylist(mimedata);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
|
|
@ -46,11 +46,6 @@ class SystemTrayIcon;
|
|||
|
||||
class QDBusPendingCallWatcher;
|
||||
|
||||
#ifdef HAVE_DBUS
|
||||
QDBusArgument& operator<< (QDBusArgument &arg, const QImage &image);
|
||||
const QDBusArgument &operator>> (const QDBusArgument &arg, QImage &image);
|
||||
#endif
|
||||
|
||||
class OSD : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
|
|
|
@ -51,6 +51,9 @@
|
|||
|
||||
#ifdef HAVE_DBUS
|
||||
|
||||
QDBusArgument &operator<< (QDBusArgument &arg, const QImage &image);
|
||||
const QDBusArgument &operator>> (const QDBusArgument &arg, QImage &image);
|
||||
|
||||
QDBusArgument &operator<<(QDBusArgument &arg, const QImage &image) {
|
||||
|
||||
if (image.isNull()) {
|
||||
|
|
|
@ -40,24 +40,25 @@ THE SOFTWARE.
|
|||
#include "core/iconloader.h"
|
||||
|
||||
class QSearchFieldPrivate : public QObject {
|
||||
public:
|
||||
QSearchFieldPrivate(QSearchField *searchField, QLineEdit *lineEdit, QToolButton *clearButton)
|
||||
: QObject(searchField), lineEdit(lineEdit), clearButton(clearButton) {}
|
||||
public:
|
||||
QSearchFieldPrivate(QSearchField *searchField, QLineEdit *lineedit, QToolButton *clearbutton)
|
||||
: QObject(searchField), lineedit_(lineedit), clearbutton_(clearbutton) {}
|
||||
|
||||
int lineEditFrameWidth() const {
|
||||
return lineEdit->style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
|
||||
return lineedit_->style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
|
||||
}
|
||||
|
||||
int clearButtonPaddedWidth() const {
|
||||
return clearButton->width() + lineEditFrameWidth() * 2;
|
||||
return clearbutton_->width() + lineEditFrameWidth() * 2;
|
||||
}
|
||||
|
||||
int clearButtonPaddedHeight() const {
|
||||
return clearButton->height() + lineEditFrameWidth() * 2;
|
||||
return clearbutton_->height() + lineEditFrameWidth() * 2;
|
||||
}
|
||||
|
||||
QPointer<QLineEdit> lineEdit;
|
||||
QPointer<QToolButton> clearButton;
|
||||
QPointer<QLineEdit> lineedit_;
|
||||
QPointer<QToolButton> clearbutton_;
|
||||
|
||||
};
|
||||
|
||||
QSearchField::QSearchField(QWidget *parent) : QWidget(parent) {
|
||||
|
@ -68,21 +69,21 @@ QSearchField::QSearchField(QWidget *parent) : QWidget(parent) {
|
|||
connect(lineEdit, SIGNAL(returnPressed()), this, SIGNAL(returnPressed()));
|
||||
connect(lineEdit, SIGNAL(textChanged(QString)), this, SLOT(setText(QString)));
|
||||
|
||||
QToolButton *clearButton = new QToolButton(this);
|
||||
QToolButton *clearbutton = new QToolButton(this);
|
||||
QIcon clearIcon(IconLoader::Load("edit-clear-locationbar-ltr"));
|
||||
|
||||
clearButton->setIcon(clearIcon);
|
||||
clearButton->setIconSize(QSize(16, 16));
|
||||
clearButton->setStyleSheet("border: none; padding: 0px;");
|
||||
clearButton->resize(clearButton->sizeHint());
|
||||
clearbutton->setIcon(clearIcon);
|
||||
clearbutton->setIconSize(QSize(16, 16));
|
||||
clearbutton->setStyleSheet("border: none; padding: 0px;");
|
||||
clearbutton->resize(clearbutton->sizeHint());
|
||||
|
||||
connect(clearButton, SIGNAL(clicked()), this, SLOT(clear()));
|
||||
connect(clearbutton, SIGNAL(clicked()), this, SLOT(clear()));
|
||||
|
||||
pimpl = new QSearchFieldPrivate(this, lineEdit, clearButton);
|
||||
pimpl = new QSearchFieldPrivate(this, lineEdit, clearbutton);
|
||||
|
||||
const int frame_width = lineEdit->style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
|
||||
|
||||
lineEdit->setStyleSheet(QString("QLineEdit { padding-left: %1px; } ").arg(clearButton->width()));
|
||||
lineEdit->setStyleSheet(QString("QLineEdit { padding-left: %1px; } ").arg(clearbutton->width()));
|
||||
const int width = frame_width + qMax(lineEdit->minimumSizeHint().width(), pimpl->clearButtonPaddedWidth());
|
||||
const int height = frame_width + qMax(lineEdit->minimumSizeHint().height(), pimpl->clearButtonPaddedHeight());
|
||||
lineEdit->setMinimumSize(width, height);
|
||||
|
@ -97,25 +98,27 @@ QSearchField::QSearchField(QWidget *parent) : QWidget(parent) {
|
|||
|
||||
void QSearchField::setText(const QString &text) {
|
||||
|
||||
Q_ASSERT(pimpl && pimpl->clearButton && pimpl->lineEdit);
|
||||
if (!(pimpl && pimpl->clearButton && pimpl->lineEdit)) return;
|
||||
if (text != this->text()) pimpl->lineEdit->setText(text);
|
||||
Q_ASSERT(pimpl && pimpl->clearbutton_ && pimpl->lineedit_);
|
||||
if (!(pimpl && pimpl->clearbutton_ && pimpl->lineedit_)) return;
|
||||
if (text != this->text()) pimpl->lineedit_->setText(text);
|
||||
|
||||
}
|
||||
|
||||
void QSearchField::setPlaceholderText(const QString &text) {
|
||||
Q_ASSERT(pimpl && pimpl->lineEdit);
|
||||
if (!(pimpl && pimpl->lineEdit)) return;
|
||||
pimpl->lineEdit->setPlaceholderText(text);
|
||||
|
||||
Q_ASSERT(pimpl && pimpl->lineedit_);
|
||||
if (!(pimpl && pimpl->lineedit_)) return;
|
||||
pimpl->lineedit_->setPlaceholderText(text);
|
||||
|
||||
}
|
||||
|
||||
QString QSearchField::placeholderText() const {
|
||||
return pimpl->lineEdit->placeholderText();
|
||||
return pimpl->lineedit_->placeholderText();
|
||||
}
|
||||
|
||||
void QSearchField::setFocus(Qt::FocusReason reason) {
|
||||
Q_ASSERT(pimpl && pimpl->lineEdit);
|
||||
if (pimpl && pimpl->lineEdit) pimpl->lineEdit->setFocus(reason);
|
||||
Q_ASSERT(pimpl && pimpl->lineedit_);
|
||||
if (pimpl && pimpl->lineedit_) pimpl->lineedit_->setFocus(reason);
|
||||
}
|
||||
|
||||
void QSearchField::setFocus() {
|
||||
|
@ -123,35 +126,47 @@ void QSearchField::setFocus() {
|
|||
}
|
||||
|
||||
void QSearchField::clear() {
|
||||
Q_ASSERT(pimpl && pimpl->lineEdit);
|
||||
if (!(pimpl && pimpl->lineEdit)) return;
|
||||
pimpl->lineEdit->clear();
|
||||
|
||||
Q_ASSERT(pimpl && pimpl->lineedit_);
|
||||
|
||||
if (!(pimpl && pimpl->lineedit_)) return;
|
||||
pimpl->lineedit_->clear();
|
||||
|
||||
}
|
||||
|
||||
void QSearchField::selectAll() {
|
||||
Q_ASSERT(pimpl && pimpl->lineEdit);
|
||||
if (!(pimpl && pimpl->lineEdit)) return;
|
||||
pimpl->lineEdit->selectAll();
|
||||
|
||||
Q_ASSERT(pimpl && pimpl->lineedit_);
|
||||
|
||||
if (!(pimpl && pimpl->lineedit_)) return;
|
||||
pimpl->lineedit_->selectAll();
|
||||
|
||||
}
|
||||
|
||||
QString QSearchField::text() const {
|
||||
Q_ASSERT(pimpl && pimpl->lineEdit);
|
||||
if (!(pimpl && pimpl->lineEdit)) return QString();
|
||||
return pimpl->lineEdit->text();
|
||||
|
||||
Q_ASSERT(pimpl && pimpl->lineedit_);
|
||||
|
||||
if (!(pimpl && pimpl->lineedit_)) return QString();
|
||||
return pimpl->lineedit_->text();
|
||||
|
||||
}
|
||||
|
||||
void QSearchField::resizeEvent(QResizeEvent *resizeEvent) {
|
||||
Q_ASSERT(pimpl && pimpl->clearButton && pimpl->lineEdit);
|
||||
if (!(pimpl && pimpl->clearButton && pimpl->lineEdit)) return;
|
||||
|
||||
Q_ASSERT(pimpl && pimpl->clearbutton_ && pimpl->lineedit_);
|
||||
if (!(pimpl && pimpl->clearbutton_ && pimpl->lineedit_)) return;
|
||||
|
||||
QWidget::resizeEvent(resizeEvent);
|
||||
const int x = pimpl->lineEditFrameWidth();
|
||||
const int y = (height() - pimpl->clearButton->height())/2;
|
||||
pimpl->clearButton->move(x, y);
|
||||
const int y = (height() - pimpl->clearbutton_->height())/2;
|
||||
pimpl->clearbutton_->move(x, y);
|
||||
|
||||
}
|
||||
|
||||
bool QSearchField::eventFilter(QObject *o, QEvent *e) {
|
||||
if (pimpl && pimpl->lineEdit && o == pimpl->lineEdit) {
|
||||
|
||||
if (pimpl && pimpl->lineedit_ && o == pimpl->lineedit_) {
|
||||
// Forward some lineEdit events to QSearchField (only those we need for
|
||||
// now, but some might be added later if needed)
|
||||
switch (e->type()) {
|
||||
|
@ -164,4 +179,5 @@ bool QSearchField::eventFilter(QObject *o, QEvent *e) {
|
|||
}
|
||||
}
|
||||
return QWidget::eventFilter(o, e);
|
||||
|
||||
}
|
||||
|
|
|
@ -40,15 +40,14 @@
|
|||
const int StretchHeaderView::kMinimumColumnWidth = 10;
|
||||
const int StretchHeaderView::kMagicNumber = 0x502c950f;
|
||||
|
||||
StretchHeaderView::StretchHeaderView(Qt::Orientation orientation, QWidget* parent)
|
||||
StretchHeaderView::StretchHeaderView(const Qt::Orientation orientation, QWidget *parent)
|
||||
: QHeaderView(orientation, parent),
|
||||
stretch_enabled_(false),
|
||||
in_mouse_move_event_(false)
|
||||
{
|
||||
in_mouse_move_event_(false) {
|
||||
connect(this, SIGNAL(sectionResized(int,int,int)), SLOT(SectionResized(int,int,int)));
|
||||
}
|
||||
|
||||
void StretchHeaderView::setModel(QAbstractItemModel* model) {
|
||||
void StretchHeaderView::setModel(QAbstractItemModel *model) {
|
||||
|
||||
QHeaderView::setModel(model);
|
||||
|
||||
|
@ -113,7 +112,7 @@ void StretchHeaderView::UpdateWidths(const QList<int>& sections) {
|
|||
|
||||
}
|
||||
|
||||
void StretchHeaderView::HideSection(int logical) {
|
||||
void StretchHeaderView::HideSection(const int logical) {
|
||||
|
||||
// Would this hide the last section?
|
||||
bool all_hidden = true;
|
||||
|
@ -151,36 +150,41 @@ void StretchHeaderView::ShowSection(int logical) {
|
|||
visible_count ++;
|
||||
}
|
||||
|
||||
column_widths_[logical] =
|
||||
visible_count == 0 ? 1.0 : 1.0 / visible_count;
|
||||
column_widths_[logical] = visible_count == 0 ? 1.0 : 1.0 / visible_count;
|
||||
NormaliseWidths();
|
||||
UpdateWidths();
|
||||
}
|
||||
|
||||
void StretchHeaderView::SetSectionHidden(int logical, bool hidden) {
|
||||
void StretchHeaderView::SetSectionHidden(const int logical, const bool hidden) {
|
||||
|
||||
if (hidden) {
|
||||
HideSection(logical);
|
||||
}
|
||||
else {
|
||||
ShowSection(logical);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void StretchHeaderView::resizeEvent(QResizeEvent* event) {
|
||||
void StretchHeaderView::resizeEvent(QResizeEvent *event) {
|
||||
|
||||
QHeaderView::resizeEvent(event);
|
||||
|
||||
if (!stretch_enabled_) return;
|
||||
|
||||
UpdateWidths();
|
||||
|
||||
}
|
||||
|
||||
void StretchHeaderView::mouseMoveEvent(QMouseEvent* e) {
|
||||
void StretchHeaderView::mouseMoveEvent(QMouseEvent *e) {
|
||||
|
||||
in_mouse_move_event_ = true;
|
||||
QHeaderView::mouseMoveEvent(e);
|
||||
in_mouse_move_event_ = false;
|
||||
|
||||
}
|
||||
|
||||
void StretchHeaderView::SectionResized(int logical, int, int new_size) {
|
||||
void StretchHeaderView::SectionResized(const int logical, const int, const int new_size) {
|
||||
|
||||
if (!stretch_enabled_) return;
|
||||
|
||||
|
@ -210,7 +214,7 @@ void StretchHeaderView::ToggleStretchEnabled() {
|
|||
SetStretchEnabled(!is_stretch_enabled());
|
||||
}
|
||||
|
||||
void StretchHeaderView::SetStretchEnabled(bool enabled) {
|
||||
void StretchHeaderView::SetStretchEnabled(const bool enabled) {
|
||||
|
||||
stretch_enabled_ = enabled;
|
||||
|
||||
|
@ -230,7 +234,7 @@ void StretchHeaderView::SetStretchEnabled(bool enabled) {
|
|||
|
||||
}
|
||||
|
||||
void StretchHeaderView::SetColumnWidth(int logical, ColumnWidthType width) {
|
||||
void StretchHeaderView::SetColumnWidth(const int logical, const ColumnWidthType width) {
|
||||
|
||||
if (!stretch_enabled_) return;
|
||||
|
||||
|
@ -240,13 +244,14 @@ void StretchHeaderView::SetColumnWidth(int logical, ColumnWidthType width) {
|
|||
for (int i=0 ; i<count() ; ++i)
|
||||
if (!isSectionHidden(i) && i != logical)
|
||||
other_columns << i;
|
||||
|
||||
NormaliseWidths(other_columns);
|
||||
|
||||
}
|
||||
|
||||
bool StretchHeaderView::RestoreState(const QByteArray& data) {
|
||||
bool StretchHeaderView::RestoreState(const QByteArray &sdata) {
|
||||
|
||||
QDataStream s(data);
|
||||
QDataStream s(sdata);
|
||||
s.setVersion(QDataStream::Qt_5_6);
|
||||
|
||||
int magic_number = 0;
|
||||
|
|
|
@ -39,32 +39,32 @@ class StretchHeaderView : public QHeaderView {
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit StretchHeaderView(Qt::Orientation orientation, QWidget* parent = nullptr);
|
||||
explicit StretchHeaderView(const Qt::Orientation orientation, QWidget* parent = nullptr);
|
||||
|
||||
typedef double ColumnWidthType;
|
||||
|
||||
static const int kMinimumColumnWidth;
|
||||
static const int kMagicNumber;
|
||||
|
||||
void setModel(QAbstractItemModel* model);
|
||||
void setModel(QAbstractItemModel *model);
|
||||
|
||||
// Serialises the proportional and actual column widths.
|
||||
// Use these instead of QHeaderView::restoreState and QHeaderView::saveState to persist the proportional values directly and avoid floating point errors over time.
|
||||
bool RestoreState(const QByteArray& data);
|
||||
bool RestoreState(const QByteArray &sdata);
|
||||
QByteArray SaveState() const;
|
||||
|
||||
// Hides a section and resizes all other sections to fill the gap. Does nothing if you try to hide the last section.
|
||||
void HideSection(int logical);
|
||||
void HideSection(const int logical);
|
||||
|
||||
// Shows a section and resizes all other sections to make room.
|
||||
void ShowSection(int logical);
|
||||
void ShowSection(const int logical);
|
||||
|
||||
// Calls either HideSection or ShowSection.
|
||||
void SetSectionHidden(int logical, bool hidden);
|
||||
void SetSectionHidden(const int logical, const bool hidden);
|
||||
|
||||
// Sets the width of the given column and resizes other columns appropriately.
|
||||
// width is the proportion of the entire width from 0.0 to 1.0.
|
||||
void SetColumnWidth(int logical, ColumnWidthType width);
|
||||
void SetColumnWidth(const int logical, const ColumnWidthType width);
|
||||
|
||||
bool is_stretch_enabled() const { return stretch_enabled_; }
|
||||
|
||||
|
@ -72,16 +72,16 @@ class StretchHeaderView : public QHeaderView {
|
|||
// Changes the stretch mode. Enabling stretch mode will initialise the
|
||||
// proportional column widths from the current state of the header.
|
||||
void ToggleStretchEnabled();
|
||||
void SetStretchEnabled(bool enabled);
|
||||
void SetStretchEnabled(const bool enabled);
|
||||
|
||||
signals:
|
||||
// Emitted when the stretch mode is changed.
|
||||
void StretchEnabledChanged(bool enabled);
|
||||
void StretchEnabledChanged(const bool enabled);
|
||||
|
||||
protected:
|
||||
// QWidget
|
||||
void mouseMoveEvent(QMouseEvent* e);
|
||||
void resizeEvent(QResizeEvent* event);
|
||||
void mouseMoveEvent(QMouseEvent *e);
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
|
||||
private:
|
||||
// Scales column_widths_ values so the total is 1.0.
|
||||
|
@ -91,7 +91,7 @@ class StretchHeaderView : public QHeaderView {
|
|||
void UpdateWidths(const QList<int>& sections = QList<int>());
|
||||
|
||||
private slots:
|
||||
void SectionResized(int logical, int old_size, int new_size);
|
||||
void SectionResized(const int logical, const int old_size, const int new_size);
|
||||
|
||||
private:
|
||||
bool stretch_enabled_;
|
||||
|
|
Loading…
Reference in New Issue