Remove useless else
This commit is contained in:
parent
93df859aa4
commit
b233600b8c
|
@ -36,10 +36,10 @@ TagReaderBase::TagReaderBase() = default;
|
|||
float TagReaderBase::ConvertPOPMRating(const int POPM_rating) {
|
||||
|
||||
if (POPM_rating < 0x01) return 0.0F;
|
||||
else if (POPM_rating < 0x40) return 0.20F;
|
||||
else if (POPM_rating < 0x80) return 0.40F;
|
||||
else if (POPM_rating < 0xC0) return 0.60F;
|
||||
else if (POPM_rating < 0xFC) return 0.80F;
|
||||
if (POPM_rating < 0x40) return 0.20F;
|
||||
if (POPM_rating < 0x80) return 0.40F;
|
||||
if (POPM_rating < 0xC0) return 0.60F;
|
||||
if (POPM_rating < 0xFC) return 0.80F;
|
||||
|
||||
return 1.0F;
|
||||
|
||||
|
@ -48,10 +48,10 @@ float TagReaderBase::ConvertPOPMRating(const int POPM_rating) {
|
|||
int TagReaderBase::ConvertToPOPMRating(const float rating) {
|
||||
|
||||
if (rating < 0.20) return 0x00;
|
||||
else if (rating < 0.40) return 0x01;
|
||||
else if (rating < 0.60) return 0x40;
|
||||
else if (rating < 0.80) return 0x80;
|
||||
else if (rating < 1.0) return 0xC0;
|
||||
if (rating < 0.40) return 0x01;
|
||||
if (rating < 0.60) return 0x40;
|
||||
if (rating < 0.80) return 0x80;
|
||||
if (rating < 1.0) return 0xC0;
|
||||
|
||||
return 0xFF;
|
||||
|
||||
|
|
|
@ -61,34 +61,34 @@ bool TagReaderWorker::HandleMessage(const spb::tagreader::Message &message, spb:
|
|||
reply.mutable_is_media_file_response()->set_success(success);
|
||||
return success;
|
||||
}
|
||||
else if (message.has_read_file_request()) {
|
||||
if (message.has_read_file_request()) {
|
||||
const QString filename = QString::fromUtf8(message.read_file_request().filename().data(), static_cast<qint64>(message.read_file_request().filename().size()));
|
||||
bool success = reader->ReadFile(filename, reply.mutable_read_file_response()->mutable_metadata());
|
||||
return success;
|
||||
}
|
||||
else if (message.has_save_file_request()) {
|
||||
if (message.has_save_file_request()) {
|
||||
bool success = reader->SaveFile(message.save_file_request());
|
||||
reply.mutable_save_file_response()->set_success(success);
|
||||
return success;
|
||||
}
|
||||
else if (message.has_load_embedded_art_request()) {
|
||||
if (message.has_load_embedded_art_request()) {
|
||||
const QString filename = QString::fromUtf8(message.load_embedded_art_request().filename().data(), static_cast<qint64>(message.load_embedded_art_request().filename().size()));
|
||||
QByteArray data = reader->LoadEmbeddedArt(filename);
|
||||
reply.mutable_load_embedded_art_response()->set_data(data.constData(), data.size());
|
||||
return true;
|
||||
}
|
||||
else if (message.has_save_embedded_art_request()) {
|
||||
if (message.has_save_embedded_art_request()) {
|
||||
bool success = reader->SaveEmbeddedArt(message.save_embedded_art_request());
|
||||
reply.mutable_save_embedded_art_response()->set_success(success);
|
||||
return success;
|
||||
}
|
||||
else if (message.has_save_song_playcount_to_file_request()) {
|
||||
if (message.has_save_song_playcount_to_file_request()) {
|
||||
const QString filename = QString::fromUtf8(message.save_song_playcount_to_file_request().filename().data(), static_cast<qint64>(message.save_song_playcount_to_file_request().filename().size()));
|
||||
bool success = reader->SaveSongPlaycountToFile(filename, message.save_song_playcount_to_file_request().metadata());
|
||||
reply.mutable_save_song_playcount_to_file_response()->set_success(success);
|
||||
return success;
|
||||
}
|
||||
else if (message.has_save_song_rating_to_file_request()) {
|
||||
if (message.has_save_song_rating_to_file_request()) {
|
||||
const QString filename = QString::fromUtf8(message.save_song_rating_to_file_request().filename().data(), static_cast<qint64>(message.save_song_rating_to_file_request().filename().size()));
|
||||
bool success = reader->SaveSongRatingToFile(filename, message.save_song_rating_to_file_request().metadata());
|
||||
reply.mutable_save_song_rating_to_file_response()->set_success(success);
|
||||
|
|
|
@ -285,7 +285,7 @@ QColor ensureContrast(const QColor &bg, const QColor &fg, int amount) {
|
|||
if (ds > amount / 2 && (bs > 125 && fs > 125)) {
|
||||
return fg;
|
||||
}
|
||||
else if (dv > amount / 2 && (bv > 125 && fv > 125)) {
|
||||
if (dv > amount / 2 && (bv > 125 && fv > 125)) {
|
||||
return fg;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -280,19 +280,19 @@ bool CollectionFilter::FieldNumericalValueMatchesData(const T value, const QStri
|
|||
if (foperator == QLatin1Char('=') || foperator == QLatin1String("==")) {
|
||||
return data == value;
|
||||
}
|
||||
else if (foperator == QLatin1String("!=") || foperator == QLatin1String("<>")) {
|
||||
if (foperator == QLatin1String("!=") || foperator == QLatin1String("<>")) {
|
||||
return data != value;
|
||||
}
|
||||
else if (foperator == QLatin1Char('<')) {
|
||||
if (foperator == QLatin1Char('<')) {
|
||||
return data < value;
|
||||
}
|
||||
else if (foperator == QLatin1Char('>')) {
|
||||
if (foperator == QLatin1Char('>')) {
|
||||
return data > value;
|
||||
}
|
||||
else if (foperator == QLatin1String(">=")) {
|
||||
if (foperator == QLatin1String(">=")) {
|
||||
return data >= value;
|
||||
}
|
||||
else if (foperator == QLatin1String("<=")) {
|
||||
if (foperator == QLatin1String("<=")) {
|
||||
return data <= value;
|
||||
}
|
||||
|
||||
|
|
|
@ -241,9 +241,8 @@ QString CollectionFilterWidget::group_by_version() const {
|
|||
if (settings_prefix_.isEmpty()) {
|
||||
return QStringLiteral("group_by_version");
|
||||
}
|
||||
else {
|
||||
|
||||
return QStringLiteral("%1_group_by_version").arg(settings_prefix_);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -252,9 +251,8 @@ QString CollectionFilterWidget::group_by_key() const {
|
|||
if (settings_prefix_.isEmpty()) {
|
||||
return QStringLiteral("group_by");
|
||||
}
|
||||
else {
|
||||
|
||||
return QStringLiteral("%1_group_by").arg(settings_prefix_);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -265,9 +263,8 @@ QString CollectionFilterWidget::separate_albums_by_grouping_key() const {
|
|||
if (settings_prefix_.isEmpty()) {
|
||||
return QStringLiteral("separate_albums_by_grouping");
|
||||
}
|
||||
else {
|
||||
|
||||
return QStringLiteral("%1_separate_albums_by_grouping").arg(settings_prefix_);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -360,20 +360,16 @@ QVariant CollectionModel::data(const CollectionItem *item, const int role) const
|
|||
if (item->children.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
else if (std::any_of(item->children.begin(), item->children.end(), [this, role](CollectionItem *child) { return !data(child, role).toBool(); })) {
|
||||
if (std::any_of(item->children.begin(), item->children.end(), [this, role](CollectionItem *child) { return !data(child, role).toBool(); })) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (item->type == CollectionItem::Type::Song) {
|
||||
if (item->type == CollectionItem::Type::Song) {
|
||||
return item->metadata.IsEditable();
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
case Role_SortText:
|
||||
return item->SortText();
|
||||
|
@ -1042,7 +1038,7 @@ QString CollectionModel::PrettyYearAlbum(const int year, const QString &album) {
|
|||
QString CollectionModel::PrettyAlbumDisc(const QString &album, const int disc) {
|
||||
|
||||
if (disc <= 0 || Song::AlbumContainsDisc(album)) return TextOrUnknown(album);
|
||||
else return TextOrUnknown(album) + QStringLiteral(" - (Disc ") + QString::number(disc) + QStringLiteral(")");
|
||||
return TextOrUnknown(album) + QStringLiteral(" - (Disc ") + QString::number(disc) + QStringLiteral(")");
|
||||
|
||||
}
|
||||
|
||||
|
@ -1070,14 +1066,12 @@ QString CollectionModel::PrettyFormat(const Song &song) {
|
|||
if (song.samplerate() <= 0) {
|
||||
return song.TextForFiletype();
|
||||
}
|
||||
else {
|
||||
|
||||
if (song.bitdepth() <= 0) {
|
||||
return QStringLiteral("%1 (%2)").arg(song.TextForFiletype(), QString::number(song.samplerate() / 1000.0, 'G', 5));
|
||||
}
|
||||
else {
|
||||
|
||||
return QStringLiteral("%1 (%2/%3)").arg(song.TextForFiletype(), QString::number(song.samplerate() / 1000.0, 'G', 5)).arg(song.bitdepth());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -1129,11 +1123,8 @@ QString CollectionModel::SortText(const GroupBy group_by, const int container_le
|
|||
if (container_level == 1 && !IsAlbumGroupBy(options_active_.group_by[0])) {
|
||||
return SortText(song.title());
|
||||
}
|
||||
else {
|
||||
return SortTextForSong(song);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return QString();
|
||||
|
|
|
@ -326,7 +326,8 @@ SongList CollectionWatcher::ScanTransaction::FindSongsInSubdirectory(const QStri
|
|||
if (cached_songs_.contains(path)) {
|
||||
return cached_songs_.values(path);
|
||||
}
|
||||
else return SongList();
|
||||
|
||||
return SongList();
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -78,9 +78,8 @@ QString SavedGroupingManager::GetSavedGroupingsSettingsGroup(const QString &sett
|
|||
if (settings_group.isEmpty() || settings_group == QLatin1String(CollectionSettingsPage::kSettingsGroup)) {
|
||||
return QLatin1String(kSavedGroupingsSettingsGroup);
|
||||
}
|
||||
else {
|
||||
|
||||
return QLatin1String(kSavedGroupingsSettingsGroup) + QLatin1Char('_') + settings_group;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -124,8 +124,7 @@ bool FilesystemMusicStorage::DeleteFromStorage(const DeleteJob &job) {
|
|||
if (fileInfo.isDir()) {
|
||||
return Utilities::RemoveRecursive(path);
|
||||
}
|
||||
else {
|
||||
|
||||
return QFile::remove(path);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2578,14 +2578,13 @@ bool MainWindow::LoadUrl(const QString &url) {
|
|||
return true;
|
||||
}
|
||||
#ifdef HAVE_TIDAL
|
||||
else if (url.startsWith(QLatin1String("tidal://login"))) {
|
||||
if (url.startsWith(QLatin1String("tidal://login"))) {
|
||||
emit AuthorizationUrlReceived(QUrl(url));
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
|
||||
qLog(Error) << "Can't open" << url;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ bool MultiSortFilterProxy::lessThan(const QModelIndex &left, const QModelIndex &
|
|||
if (ret < 0) {
|
||||
return spec.second == Qt::AscendingOrder;
|
||||
}
|
||||
else if (ret > 0) {
|
||||
if (ret > 0) {
|
||||
return spec.second != Qt::AscendingOrder;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -937,11 +937,11 @@ bool Song::IsSimilar(const Song &other) const {
|
|||
Song::Source Song::SourceFromURL(const QUrl &url) {
|
||||
|
||||
if (url.isLocalFile()) return Source::LocalFile;
|
||||
else if (url.scheme() == QStringLiteral("cdda")) return Source::CDDA;
|
||||
else if (url.scheme() == QStringLiteral("tidal")) return Source::Tidal;
|
||||
else if (url.scheme() == QStringLiteral("subsonic")) return Source::Subsonic;
|
||||
else if (url.scheme() == QStringLiteral("qobuz")) return Source::Qobuz;
|
||||
else if (url.scheme() == QStringLiteral("http") || url.scheme() == QStringLiteral("https") || url.scheme() == QStringLiteral("rtsp")) {
|
||||
if (url.scheme() == QStringLiteral("cdda")) return Source::CDDA;
|
||||
if (url.scheme() == QStringLiteral("tidal")) return Source::Tidal;
|
||||
if (url.scheme() == QStringLiteral("subsonic")) return Source::Subsonic;
|
||||
if (url.scheme() == QStringLiteral("qobuz")) return Source::Qobuz;
|
||||
if (url.scheme() == QStringLiteral("http") || url.scheme() == QStringLiteral("https") || url.scheme() == QStringLiteral("rtsp")) {
|
||||
if (url.host().endsWith(QLatin1String("tidal.com"), Qt::CaseInsensitive)) { return Source::Tidal; }
|
||||
if (url.host().endsWith(QLatin1String("qobuz.com"), Qt::CaseInsensitive)) { return Source::Qobuz; }
|
||||
if (url.host().endsWith(QLatin1String("somafm.com"), Qt::CaseInsensitive)) { return Source::SomaFM; }
|
||||
|
@ -1046,9 +1046,9 @@ QString Song::TextForFiletype(const FileType filetype) {
|
|||
case FileType::DSDIFF: return QStringLiteral("DSDIFF");
|
||||
case FileType::PCM: return QStringLiteral("PCM");
|
||||
case FileType::APE: return QStringLiteral("Monkey's Audio");
|
||||
case FileType::MOD: return QStringLiteral("Module Music Format");
|
||||
case FileType::S3M: return QStringLiteral("Module Music Format");
|
||||
case FileType::XM: return QStringLiteral("Module Music Format");
|
||||
case FileType::MOD:
|
||||
case FileType::S3M:
|
||||
case FileType::XM:
|
||||
case FileType::IT: return QStringLiteral("Module Music Format");
|
||||
case FileType::CDDA: return QStringLiteral("CDDA");
|
||||
case FileType::SPC: return QStringLiteral("SNES SPC700");
|
||||
|
@ -1147,84 +1147,84 @@ bool Song::IsFileLossless() const {
|
|||
Song::FileType Song::FiletypeByMimetype(const QString &mimetype) {
|
||||
|
||||
if (mimetype.compare(QLatin1String("audio/wav"), Qt::CaseInsensitive) == 0 || mimetype.compare(QLatin1String("audio/x-wav"), Qt::CaseInsensitive) == 0) return FileType::WAV;
|
||||
else if (mimetype.compare(QLatin1String("audio/x-flac"), Qt::CaseInsensitive) == 0) return FileType::FLAC;
|
||||
else if (mimetype.compare(QLatin1String("audio/x-wavpack"), Qt::CaseInsensitive) == 0) return FileType::WavPack;
|
||||
else if (mimetype.compare(QLatin1String("audio/x-vorbis"), Qt::CaseInsensitive) == 0) return FileType::OggVorbis;
|
||||
else if (mimetype.compare(QLatin1String("audio/x-opus"), Qt::CaseInsensitive) == 0) return FileType::OggOpus;
|
||||
else if (mimetype.compare(QLatin1String("audio/x-speex"), Qt::CaseInsensitive) == 0) return FileType::OggSpeex;
|
||||
if (mimetype.compare(QLatin1String("audio/x-flac"), Qt::CaseInsensitive) == 0) return FileType::FLAC;
|
||||
if (mimetype.compare(QLatin1String("audio/x-wavpack"), Qt::CaseInsensitive) == 0) return FileType::WavPack;
|
||||
if (mimetype.compare(QLatin1String("audio/x-vorbis"), Qt::CaseInsensitive) == 0) return FileType::OggVorbis;
|
||||
if (mimetype.compare(QLatin1String("audio/x-opus"), Qt::CaseInsensitive) == 0) return FileType::OggOpus;
|
||||
if (mimetype.compare(QLatin1String("audio/x-speex"), Qt::CaseInsensitive) == 0) return FileType::OggSpeex;
|
||||
// Gstreamer returns audio/mpeg for both MP3 and MP4/AAC.
|
||||
// else if (mimetype.compare("audio/mpeg", Qt::CaseInsensitive) == 0) return FileType::MPEG;
|
||||
else if (mimetype.compare(QLatin1String("audio/aac"), Qt::CaseInsensitive) == 0) return FileType::MP4;
|
||||
else if (mimetype.compare(QLatin1String("audio/x-wma"), Qt::CaseInsensitive) == 0) return FileType::ASF;
|
||||
else if (mimetype.compare(QLatin1String("audio/aiff"), Qt::CaseInsensitive) == 0 || mimetype.compare(QLatin1String("audio/x-aiff"), Qt::CaseInsensitive) == 0) return FileType::AIFF;
|
||||
else if (mimetype.compare(QLatin1String("audio/x-musepack"), Qt::CaseInsensitive) == 0) return FileType::MPC;
|
||||
else if (mimetype.compare(QLatin1String("application/x-project"), Qt::CaseInsensitive) == 0) return FileType::MPC;
|
||||
else if (mimetype.compare(QLatin1String("audio/x-dsf"), Qt::CaseInsensitive) == 0) return FileType::DSF;
|
||||
else if (mimetype.compare(QLatin1String("audio/x-dsd"), Qt::CaseInsensitive) == 0) return FileType::DSDIFF;
|
||||
else if (mimetype.compare(QLatin1String("audio/x-ape"), Qt::CaseInsensitive) == 0 || mimetype.compare(QLatin1String("application/x-ape"), Qt::CaseInsensitive) == 0 || mimetype.compare(QLatin1String("audio/x-ffmpeg-parsed-ape"), Qt::CaseInsensitive) == 0) return FileType::APE;
|
||||
else if (mimetype.compare(QLatin1String("audio/x-mod"), Qt::CaseInsensitive) == 0) return FileType::MOD;
|
||||
else if (mimetype.compare(QLatin1String("audio/x-s3m"), Qt::CaseInsensitive) == 0) return FileType::S3M;
|
||||
else if (mimetype.compare(QLatin1String("audio/x-spc"), Qt::CaseInsensitive) == 0) return FileType::SPC;
|
||||
else if (mimetype.compare(QLatin1String("audio/x-vgm"), Qt::CaseInsensitive) == 0) return FileType::VGM;
|
||||
// if (mimetype.compare("audio/mpeg", Qt::CaseInsensitive) == 0) return FileType::MPEG;
|
||||
if (mimetype.compare(QLatin1String("audio/aac"), Qt::CaseInsensitive) == 0) return FileType::MP4;
|
||||
if (mimetype.compare(QLatin1String("audio/x-wma"), Qt::CaseInsensitive) == 0) return FileType::ASF;
|
||||
if (mimetype.compare(QLatin1String("audio/aiff"), Qt::CaseInsensitive) == 0 || mimetype.compare(QLatin1String("audio/x-aiff"), Qt::CaseInsensitive) == 0) return FileType::AIFF;
|
||||
if (mimetype.compare(QLatin1String("audio/x-musepack"), Qt::CaseInsensitive) == 0) return FileType::MPC;
|
||||
if (mimetype.compare(QLatin1String("application/x-project"), Qt::CaseInsensitive) == 0) return FileType::MPC;
|
||||
if (mimetype.compare(QLatin1String("audio/x-dsf"), Qt::CaseInsensitive) == 0) return FileType::DSF;
|
||||
if (mimetype.compare(QLatin1String("audio/x-dsd"), Qt::CaseInsensitive) == 0) return FileType::DSDIFF;
|
||||
if (mimetype.compare(QLatin1String("audio/x-ape"), Qt::CaseInsensitive) == 0 || mimetype.compare(QLatin1String("application/x-ape"), Qt::CaseInsensitive) == 0 || mimetype.compare(QLatin1String("audio/x-ffmpeg-parsed-ape"), Qt::CaseInsensitive) == 0) return FileType::APE;
|
||||
if (mimetype.compare(QLatin1String("audio/x-mod"), Qt::CaseInsensitive) == 0) return FileType::MOD;
|
||||
if (mimetype.compare(QLatin1String("audio/x-s3m"), Qt::CaseInsensitive) == 0) return FileType::S3M;
|
||||
if (mimetype.compare(QLatin1String("audio/x-spc"), Qt::CaseInsensitive) == 0) return FileType::SPC;
|
||||
if (mimetype.compare(QLatin1String("audio/x-vgm"), Qt::CaseInsensitive) == 0) return FileType::VGM;
|
||||
|
||||
else return FileType::Unknown;
|
||||
return FileType::Unknown;
|
||||
|
||||
}
|
||||
|
||||
Song::FileType Song::FiletypeByDescription(const QString &text) {
|
||||
|
||||
if (text.compare(QLatin1String("WAV"), Qt::CaseInsensitive) == 0) return FileType::WAV;
|
||||
else if (text.compare(QLatin1String("Free Lossless Audio Codec (FLAC)"), Qt::CaseInsensitive) == 0) return FileType::FLAC;
|
||||
else if (text.compare(QLatin1String("Wavpack"), Qt::CaseInsensitive) == 0) return FileType::WavPack;
|
||||
else if (text.compare(QLatin1String("Vorbis"), Qt::CaseInsensitive) == 0) return FileType::OggVorbis;
|
||||
else if (text.compare(QLatin1String("Opus"), Qt::CaseInsensitive) == 0) return FileType::OggOpus;
|
||||
else if (text.compare(QLatin1String("Speex"), Qt::CaseInsensitive) == 0) return FileType::OggSpeex;
|
||||
else if (text.compare(QLatin1String("MPEG-1 Layer 2 (MP2)"), Qt::CaseInsensitive) == 0) return FileType::MPEG;
|
||||
else if (text.compare(QLatin1String("MPEG-1 Layer 3 (MP3)"), Qt::CaseInsensitive) == 0) return FileType::MPEG;
|
||||
else if (text.compare(QLatin1String("MPEG-4 AAC"), Qt::CaseInsensitive) == 0) return FileType::MP4;
|
||||
else if (text.compare(QLatin1String("WMA"), Qt::CaseInsensitive) == 0) return FileType::ASF;
|
||||
else if (text.compare(QLatin1String("Audio Interchange File Format"), Qt::CaseInsensitive) == 0) return FileType::AIFF;
|
||||
else if (text.compare(QLatin1String("MPC"), Qt::CaseInsensitive) == 0) return FileType::MPC;
|
||||
else if (text.compare(QLatin1String("Musepack (MPC)"), Qt::CaseInsensitive) == 0) return FileType::MPC;
|
||||
else if (text.compare(QLatin1String("audio/x-dsf"), Qt::CaseInsensitive) == 0) return FileType::DSF;
|
||||
else if (text.compare(QLatin1String("audio/x-dsd"), Qt::CaseInsensitive) == 0) return FileType::DSDIFF;
|
||||
else if (text.compare(QLatin1String("audio/x-ffmpeg-parsed-ape"), Qt::CaseInsensitive) == 0) return FileType::APE;
|
||||
else if (text.compare(QLatin1String("Module Music Format (MOD)"), Qt::CaseInsensitive) == 0) return FileType::MOD;
|
||||
else if (text.compare(QLatin1String("Module Music Format (MOD)"), Qt::CaseInsensitive) == 0) return FileType::S3M;
|
||||
else if (text.compare(QLatin1String("SNES SPC700"), Qt::CaseInsensitive) == 0) return FileType::SPC;
|
||||
else if (text.compare(QLatin1String("VGM"), Qt::CaseInsensitive) == 0) return FileType::VGM;
|
||||
else return FileType::Unknown;
|
||||
if (text.compare(QLatin1String("Free Lossless Audio Codec (FLAC)"), Qt::CaseInsensitive) == 0) return FileType::FLAC;
|
||||
if (text.compare(QLatin1String("Wavpack"), Qt::CaseInsensitive) == 0) return FileType::WavPack;
|
||||
if (text.compare(QLatin1String("Vorbis"), Qt::CaseInsensitive) == 0) return FileType::OggVorbis;
|
||||
if (text.compare(QLatin1String("Opus"), Qt::CaseInsensitive) == 0) return FileType::OggOpus;
|
||||
if (text.compare(QLatin1String("Speex"), Qt::CaseInsensitive) == 0) return FileType::OggSpeex;
|
||||
if (text.compare(QLatin1String("MPEG-1 Layer 2 (MP2)"), Qt::CaseInsensitive) == 0) return FileType::MPEG;
|
||||
if (text.compare(QLatin1String("MPEG-1 Layer 3 (MP3)"), Qt::CaseInsensitive) == 0) return FileType::MPEG;
|
||||
if (text.compare(QLatin1String("MPEG-4 AAC"), Qt::CaseInsensitive) == 0) return FileType::MP4;
|
||||
if (text.compare(QLatin1String("WMA"), Qt::CaseInsensitive) == 0) return FileType::ASF;
|
||||
if (text.compare(QLatin1String("Audio Interchange File Format"), Qt::CaseInsensitive) == 0) return FileType::AIFF;
|
||||
if (text.compare(QLatin1String("MPC"), Qt::CaseInsensitive) == 0) return FileType::MPC;
|
||||
if (text.compare(QLatin1String("Musepack (MPC)"), Qt::CaseInsensitive) == 0) return FileType::MPC;
|
||||
if (text.compare(QLatin1String("audio/x-dsf"), Qt::CaseInsensitive) == 0) return FileType::DSF;
|
||||
if (text.compare(QLatin1String("audio/x-dsd"), Qt::CaseInsensitive) == 0) return FileType::DSDIFF;
|
||||
if (text.compare(QLatin1String("audio/x-ffmpeg-parsed-ape"), Qt::CaseInsensitive) == 0) return FileType::APE;
|
||||
if (text.compare(QLatin1String("Module Music Format (MOD)"), Qt::CaseInsensitive) == 0) return FileType::MOD;
|
||||
if (text.compare(QLatin1String("Module Music Format (MOD)"), Qt::CaseInsensitive) == 0) return FileType::S3M;
|
||||
if (text.compare(QLatin1String("SNES SPC700"), Qt::CaseInsensitive) == 0) return FileType::SPC;
|
||||
if (text.compare(QLatin1String("VGM"), Qt::CaseInsensitive) == 0) return FileType::VGM;
|
||||
|
||||
return FileType::Unknown;
|
||||
|
||||
}
|
||||
|
||||
Song::FileType Song::FiletypeByExtension(const QString &ext) {
|
||||
|
||||
if (ext.compare(QLatin1String("wav"), Qt::CaseInsensitive) == 0 || ext.compare(QLatin1String("wave"), Qt::CaseInsensitive) == 0) return FileType::WAV;
|
||||
else if (ext.compare(QLatin1String("flac"), Qt::CaseInsensitive) == 0) return FileType::FLAC;
|
||||
else if (ext.compare(QLatin1String("wavpack"), Qt::CaseInsensitive) == 0 || ext.compare(QLatin1String("wv"), Qt::CaseInsensitive) == 0) return FileType::WavPack;
|
||||
else if (ext.compare(QLatin1String("ogg"), Qt::CaseInsensitive) == 0 || ext.compare(QLatin1String("oga"), Qt::CaseInsensitive) == 0) return FileType::OggVorbis;
|
||||
else if (ext.compare(QLatin1String("opus"), Qt::CaseInsensitive) == 0) return FileType::OggOpus;
|
||||
else if (ext.compare(QLatin1String("speex"), Qt::CaseInsensitive) == 0 || ext.compare(QLatin1String("spx"), Qt::CaseInsensitive) == 0) return FileType::OggSpeex;
|
||||
else if (ext.compare(QLatin1String("mp2"), Qt::CaseInsensitive) == 0) return FileType::MPEG;
|
||||
else if (ext.compare(QLatin1String("mp3"), Qt::CaseInsensitive) == 0) return FileType::MPEG;
|
||||
else if (ext.compare(QLatin1String("mp4"), Qt::CaseInsensitive) == 0 || ext.compare(QLatin1String("m4a"), Qt::CaseInsensitive) == 0 || ext.compare(QLatin1String("aac"), Qt::CaseInsensitive) == 0) return FileType::MP4;
|
||||
else if (ext.compare(QLatin1String("asf"), Qt::CaseInsensitive) == 0 || ext.compare(QLatin1String("wma"), Qt::CaseInsensitive) == 0) return FileType::ASF;
|
||||
else if (ext.compare(QLatin1String("aiff"), Qt::CaseInsensitive) == 0 || ext.compare(QLatin1String("aif"), Qt::CaseInsensitive) == 0 || ext.compare(QLatin1String("aifc"), Qt::CaseInsensitive) == 0) return FileType::AIFF;
|
||||
else if (ext.compare(QLatin1String("mpc"), Qt::CaseInsensitive) == 0 || ext.compare(QLatin1String("mp+"), Qt::CaseInsensitive) == 0 || ext.compare(QLatin1String("mpp"), Qt::CaseInsensitive) == 0) return FileType::MPC;
|
||||
else if (ext.compare(QLatin1String("dsf"), Qt::CaseInsensitive) == 0) return FileType::DSF;
|
||||
else if (ext.compare(QLatin1String("dsd"), Qt::CaseInsensitive) == 0 || ext.compare(QLatin1String("dff"), Qt::CaseInsensitive) == 0) return FileType::DSDIFF;
|
||||
else if (ext.compare(QLatin1String("ape"), Qt::CaseInsensitive) == 0) return FileType::APE;
|
||||
else if (ext.compare(QLatin1String("mod"), Qt::CaseInsensitive) == 0 ||
|
||||
if (ext.compare(QLatin1String("flac"), Qt::CaseInsensitive) == 0) return FileType::FLAC;
|
||||
if (ext.compare(QLatin1String("wavpack"), Qt::CaseInsensitive) == 0 || ext.compare(QLatin1String("wv"), Qt::CaseInsensitive) == 0) return FileType::WavPack;
|
||||
if (ext.compare(QLatin1String("opus"), Qt::CaseInsensitive) == 0) return FileType::OggOpus;
|
||||
if (ext.compare(QLatin1String("speex"), Qt::CaseInsensitive) == 0 || ext.compare(QLatin1String("spx"), Qt::CaseInsensitive) == 0) return FileType::OggSpeex;
|
||||
if (ext.compare(QLatin1String("mp2"), Qt::CaseInsensitive) == 0) return FileType::MPEG;
|
||||
if (ext.compare(QLatin1String("mp3"), Qt::CaseInsensitive) == 0) return FileType::MPEG;
|
||||
if (ext.compare(QLatin1String("mp4"), Qt::CaseInsensitive) == 0 || ext.compare(QLatin1String("m4a"), Qt::CaseInsensitive) == 0 || ext.compare(QLatin1String("aac"), Qt::CaseInsensitive) == 0) return FileType::MP4;
|
||||
if (ext.compare(QLatin1String("asf"), Qt::CaseInsensitive) == 0 || ext.compare(QLatin1String("wma"), Qt::CaseInsensitive) == 0) return FileType::ASF;
|
||||
if (ext.compare(QLatin1String("aiff"), Qt::CaseInsensitive) == 0 || ext.compare(QLatin1String("aif"), Qt::CaseInsensitive) == 0 || ext.compare(QLatin1String("aifc"), Qt::CaseInsensitive) == 0) return FileType::AIFF;
|
||||
if (ext.compare(QLatin1String("mpc"), Qt::CaseInsensitive) == 0 || ext.compare(QLatin1String("mp+"), Qt::CaseInsensitive) == 0 || ext.compare(QLatin1String("mpp"), Qt::CaseInsensitive) == 0) return FileType::MPC;
|
||||
if (ext.compare(QLatin1String("dsf"), Qt::CaseInsensitive) == 0) return FileType::DSF;
|
||||
if (ext.compare(QLatin1String("dsd"), Qt::CaseInsensitive) == 0 || ext.compare(QLatin1String("dff"), Qt::CaseInsensitive) == 0) return FileType::DSDIFF;
|
||||
if (ext.compare(QLatin1String("ape"), Qt::CaseInsensitive) == 0) return FileType::APE;
|
||||
if (ext.compare(QLatin1String("mod"), Qt::CaseInsensitive) == 0 ||
|
||||
ext.compare(QLatin1String("module"), Qt::CaseInsensitive) == 0 ||
|
||||
ext.compare(QLatin1String("nst"), Qt::CaseInsensitive) == 0||
|
||||
ext.compare(QLatin1String("wow"), Qt::CaseInsensitive) == 0) return FileType::MOD;
|
||||
else if (ext.compare(QLatin1String("s3m"), Qt::CaseInsensitive) == 0) return FileType::S3M;
|
||||
else if (ext.compare(QLatin1String("xm"), Qt::CaseInsensitive) == 0) return FileType::XM;
|
||||
else if (ext.compare(QLatin1String("it"), Qt::CaseInsensitive) == 0) return FileType::IT;
|
||||
else if (ext.compare(QLatin1String("spc"), Qt::CaseInsensitive) == 0) return FileType::SPC;
|
||||
else if (ext.compare(QLatin1String("vgm"), Qt::CaseInsensitive) == 0) return FileType::VGM;
|
||||
if (ext.compare(QLatin1String("s3m"), Qt::CaseInsensitive) == 0) return FileType::S3M;
|
||||
if (ext.compare(QLatin1String("xm"), Qt::CaseInsensitive) == 0) return FileType::XM;
|
||||
if (ext.compare(QLatin1String("it"), Qt::CaseInsensitive) == 0) return FileType::IT;
|
||||
if (ext.compare(QLatin1String("spc"), Qt::CaseInsensitive) == 0) return FileType::SPC;
|
||||
if (ext.compare(QLatin1String("vgm"), Qt::CaseInsensitive) == 0) return FileType::VGM;
|
||||
|
||||
else return FileType::Unknown;
|
||||
return FileType::Unknown;
|
||||
|
||||
}
|
||||
|
||||
|
@ -1664,14 +1664,14 @@ void Song::InitFromMTP(const LIBMTP_track_t *track, const QString &host) {
|
|||
|
||||
switch (track->filetype) {
|
||||
case LIBMTP_FILETYPE_WAV: d->filetype_ = FileType::WAV; break;
|
||||
case LIBMTP_FILETYPE_MP3: d->filetype_ = FileType::MPEG; break;
|
||||
case LIBMTP_FILETYPE_WMA: d->filetype_ = FileType::ASF; break;
|
||||
case LIBMTP_FILETYPE_OGG: d->filetype_ = FileType::OggVorbis; break;
|
||||
case LIBMTP_FILETYPE_MP4: d->filetype_ = FileType::MP4; break;
|
||||
case LIBMTP_FILETYPE_AAC: d->filetype_ = FileType::MP4; break;
|
||||
case LIBMTP_FILETYPE_FLAC: d->filetype_ = FileType::OggFlac; break;
|
||||
case LIBMTP_FILETYPE_MP2: d->filetype_ = FileType::MPEG; break;
|
||||
case LIBMTP_FILETYPE_M4A: d->filetype_ = FileType::MP4; break;
|
||||
case LIBMTP_FILETYPE_MP2:
|
||||
case LIBMTP_FILETYPE_MP3: d->filetype_ = FileType::MPEG; break;
|
||||
case LIBMTP_FILETYPE_M4A:
|
||||
case LIBMTP_FILETYPE_MP4:
|
||||
case LIBMTP_FILETYPE_AAC: d->filetype_ = FileType::MP4; break;
|
||||
case LIBMTP_FILETYPE_WMA: d->filetype_ = FileType::ASF; break;
|
||||
default:
|
||||
d->filetype_ = FileType::Unknown;
|
||||
d->valid_ = false;
|
||||
|
|
|
@ -109,23 +109,13 @@ QPalette StyleHelper::sidebarFontPalette(const QPalette &original) {
|
|||
|
||||
QColor StyleHelper::panelTextColor(bool lightColored) {
|
||||
|
||||
if (lightColored) {
|
||||
return Qt::black;
|
||||
}
|
||||
else {
|
||||
return Qt::white;
|
||||
}
|
||||
return lightColored ? Qt::black : Qt::white;
|
||||
|
||||
}
|
||||
|
||||
QColor StyleHelper::baseColor(bool lightColored) {
|
||||
|
||||
if (lightColored) {
|
||||
return m_baseColor.lighter(230);
|
||||
}
|
||||
else {
|
||||
return m_baseColor;
|
||||
}
|
||||
return lightColored ? m_baseColor.lighter(230) : m_baseColor;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -306,7 +306,7 @@ AlbumCoverLoader::LoadImageResult AlbumCoverLoader::LoadUrlImage(TaskPtr task, c
|
|||
if (cover_url.isLocalFile()) {
|
||||
return LoadLocalUrlImage(task, result_type, cover_url);
|
||||
}
|
||||
else if (network_->supportedSchemes().contains(cover_url.scheme())) {
|
||||
if (network_->supportedSchemes().contains(cover_url.scheme())) {
|
||||
return LoadRemoteUrlImage(task, result_type, cover_url);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -340,9 +340,10 @@ void LastFmCoverProvider::Error(const QString &error, const QVariant &debug) {
|
|||
LastFmCoverProvider::LastFmImageSize LastFmCoverProvider::ImageSizeFromString(const QString &size) {
|
||||
|
||||
if (size == QLatin1String("small")) return LastFmImageSize::Small;
|
||||
else if (size == QLatin1String("medium")) return LastFmImageSize::Medium;
|
||||
else if (size == QLatin1String("large")) return LastFmImageSize::Large;
|
||||
else if (size == QLatin1String("extralarge")) return LastFmImageSize::ExtraLarge;
|
||||
else return LastFmImageSize::Unknown;
|
||||
if (size == QLatin1String("medium")) return LastFmImageSize::Medium;
|
||||
if (size == QLatin1String("large")) return LastFmImageSize::Large;
|
||||
if (size == QLatin1String("extralarge")) return LastFmImageSize::ExtraLarge;
|
||||
|
||||
return LastFmImageSize::Unknown;
|
||||
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ void MusixmatchCoverProvider::HandleSearchReply(QNetworkReply *reply, const int
|
|||
emit SearchFinished(id, results);
|
||||
return;
|
||||
}
|
||||
else if (reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() != 200) {
|
||||
if (reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() != 200) {
|
||||
Error(QStringLiteral("Received HTTP code %1").arg(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt()));
|
||||
emit SearchFinished(id, results);
|
||||
return;
|
||||
|
|
|
@ -63,9 +63,8 @@ QUrl CddaSongLoader::GetUrlFromTrack(int track_number) const {
|
|||
if (url_.isEmpty()) {
|
||||
return QUrl(QStringLiteral("cdda://%1a").arg(track_number));
|
||||
}
|
||||
else {
|
||||
|
||||
return QUrl(QStringLiteral("cdda://%1/%2").arg(url_.path()).arg(track_number));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -194,7 +194,7 @@ QString About::PersonToHtml(const Person &person) {
|
|||
if (person.email.isEmpty()) {
|
||||
return person.name;
|
||||
}
|
||||
else {
|
||||
|
||||
return QStringLiteral("%1 <<a href=\"mailto:%2\">%3</a>>").arg(person.name, person.email, person.email);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -181,7 +181,7 @@ void TrackSelectionDialog::UpdateStack() {
|
|||
ui_->progress->set_text(tag_data.progress_string_ + QStringLiteral("..."));
|
||||
return;
|
||||
}
|
||||
else if (tag_data.results_.isEmpty()) {
|
||||
if (tag_data.results_.isEmpty()) {
|
||||
ui_->stack->setCurrentWidget(ui_->error_page);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -215,10 +215,9 @@ qint64 VLCEngine::length_nanosec() const {
|
|||
if (result > 0) {
|
||||
return result;
|
||||
}
|
||||
else {
|
||||
|
||||
// Get the length from the pipeline if we don't know.
|
||||
return (length() * kNsecPerMsec);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -211,7 +211,7 @@ bool InternetCollectionView::RestoreLevelFocus(const QModelIndex &parent) {
|
|||
setCurrentIndex(current);
|
||||
return true;
|
||||
}
|
||||
else if (last_selected_path_.contains(text)) {
|
||||
if (last_selected_path_.contains(text)) {
|
||||
expand(current);
|
||||
// If a selected container or song were not found, we've got into a wrong subtree (happens with "unknown" all the time)
|
||||
if (!RestoreLevelFocus(current)) {
|
||||
|
|
|
@ -790,12 +790,11 @@ QString InternetSearchView::PixmapCacheKey(const InternetSearchView::Result &res
|
|||
if (result.metadata_.art_automatic_is_valid()) {
|
||||
return Song::TextForSource(service_->source()) + QLatin1Char('/') + result.metadata_.art_automatic().toString();
|
||||
}
|
||||
else if (!result.metadata_.effective_albumartist().isEmpty() && !result.metadata_.album().isEmpty()) {
|
||||
if (!result.metadata_.effective_albumartist().isEmpty() && !result.metadata_.album().isEmpty()) {
|
||||
return Song::TextForSource(service_->source()) + QLatin1Char('/') + result.metadata_.effective_albumartist() + QLatin1Char('/') + result.metadata_.album();
|
||||
}
|
||||
else {
|
||||
|
||||
return Song::TextForSource(service_->source()) + QLatin1Char('/') + result.metadata_.url().toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -68,9 +68,8 @@ bool MusixmatchLyricsProvider::StartSearch(const int id, const LyricsSearchReque
|
|||
if (use_api_) {
|
||||
return SendSearchRequest(search);
|
||||
}
|
||||
else {
|
||||
|
||||
return CreateLyricsRequest(search);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -284,7 +283,7 @@ void MusixmatchLyricsProvider::HandleLyricsReply(QNetworkReply *reply, LyricsSea
|
|||
EndSearch(search, url);
|
||||
return;
|
||||
}
|
||||
else if (reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() != 200) {
|
||||
if (reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() != 200) {
|
||||
Error(QStringLiteral("Received HTTP code %1").arg(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt()));
|
||||
EndSearch(search, url);
|
||||
return;
|
||||
|
|
|
@ -328,7 +328,7 @@ bool MusicBrainzClient::MediumHasDiscid(const QString &discid, QXmlStreamReader
|
|||
if (type == QXmlStreamReader::StartElement && name == QLatin1String("disc") && reader->attributes().value(QStringLiteral("id")).toString() == discid) {
|
||||
return true;
|
||||
}
|
||||
else if (type == QXmlStreamReader::EndElement && name == QLatin1String("disc-list")) {
|
||||
if (type == QXmlStreamReader::EndElement && name == QLatin1String("disc-list")) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -765,9 +765,8 @@ Qt::ItemFlags Playlist::flags(const QModelIndex &idx) const {
|
|||
if (item_at(idx.row())->Metadata().IsEditable() && column_is_editable(static_cast<Column>(idx.column()))) flags |= Qt::ItemIsEditable;
|
||||
return flags;
|
||||
}
|
||||
else {
|
||||
|
||||
return Qt::ItemIsDropEnabled;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -259,9 +259,8 @@ PlaylistItemPtr PlaylistBackend::NewPlaylistItemFromQuery(const SqlRow &row, Sha
|
|||
item->InitFromQuery(row);
|
||||
return RestoreCueData(item, state);
|
||||
}
|
||||
else {
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -142,10 +142,9 @@ QColor PlaylistItem::GetCurrentBackgroundColor() const {
|
|||
if (background_colors_.isEmpty()) {
|
||||
return QColor();
|
||||
}
|
||||
else {
|
||||
|
||||
QList<short> background_colors_keys = background_colors_.keys();
|
||||
return background_colors_[background_colors_keys.last()];
|
||||
}
|
||||
|
||||
}
|
||||
bool PlaylistItem::HasCurrentBackgroundColor() const {
|
||||
|
@ -164,10 +163,9 @@ void PlaylistItem::RemoveForegroundColor(const short priority) {
|
|||
QColor PlaylistItem::GetCurrentForegroundColor() const {
|
||||
|
||||
if (foreground_colors_.isEmpty()) return QColor();
|
||||
else {
|
||||
|
||||
QList<short> foreground_colors_keys = foreground_colors_.keys();
|
||||
return foreground_colors_[foreground_colors_keys.last()];
|
||||
}
|
||||
|
||||
}
|
||||
bool PlaylistItem::HasCurrentForegroundColor() const {
|
||||
|
|
|
@ -52,9 +52,8 @@ PlaylistItemPtrList PlaylistGeneratorInserter::Generate(PlaylistGeneratorPtr gen
|
|||
if (dynamic_count > 0) {
|
||||
return generator->GenerateMore(dynamic_count);
|
||||
}
|
||||
else {
|
||||
|
||||
return generator->Generate();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -161,7 +161,7 @@ bool SmartPlaylistSearchTerm::is_valid() const {
|
|||
if (operator_ == Operator::NumericDate) {
|
||||
return value_.toInt() >= 0;
|
||||
}
|
||||
else if (operator_ == Operator::RelativeDate) {
|
||||
if (operator_ == Operator::RelativeDate) {
|
||||
return (value_.toInt() >= 0 && value_.toInt() < second_value_.toInt());
|
||||
}
|
||||
|
||||
|
|
|
@ -355,15 +355,13 @@ void SubsonicService::HandlePingReply(QNetworkReply *reply, const QUrl &url, con
|
|||
emit TestFailure(message);
|
||||
return;
|
||||
}
|
||||
else if (status == QLatin1String("ok")) {
|
||||
if (status == QLatin1String("ok")) {
|
||||
emit TestComplete(true);
|
||||
emit TestSuccess();
|
||||
return;
|
||||
}
|
||||
else {
|
||||
|
||||
PingError(QStringLiteral("Ping reply status from server is unknown"), json_obj);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -86,10 +86,10 @@ void OpenInFileManager(const QString &path, const QUrl &url) {
|
|||
if (command.isEmpty() || command == QLatin1String("exo-open")) {
|
||||
QDesktopServices::openUrl(QUrl::fromLocalFile(path));
|
||||
}
|
||||
else if (command.startsWith(QLatin1String("nautilus"))) {
|
||||
proc.startDetached(command, QStringList() << command_params << QStringLiteral("--select") << url.toLocalFile());
|
||||
}
|
||||
else if (command.startsWith(QLatin1String("dolphin")) || command.startsWith(QLatin1String("konqueror")) || command.startsWith(QLatin1String("kfmclient"))) {
|
||||
else if (command.startsWith(QLatin1String("nautilus")) ||
|
||||
command.startsWith(QLatin1String("dolphin")) ||
|
||||
command.startsWith(QLatin1String("konqueror")) ||
|
||||
command.startsWith(QLatin1String("kfmclient"))) {
|
||||
proc.startDetached(command, QStringList() << command_params << QStringLiteral("--select") << url.toLocalFile());
|
||||
}
|
||||
else if (command.startsWith(QLatin1String("caja"))) {
|
||||
|
|
|
@ -78,15 +78,16 @@ QByteArray ImageUtils::FileToJpegData(const QString &filename) {
|
|||
if (filename.isEmpty()) return QByteArray();
|
||||
|
||||
QByteArray image_data = Utilities::ReadDataFromFile(filename);
|
||||
if (Utilities::MimeTypeFromData(image_data) == QStringLiteral("image/jpeg")) return image_data;
|
||||
else {
|
||||
if (Utilities::MimeTypeFromData(image_data) == QStringLiteral("image/jpeg")) {
|
||||
return image_data;
|
||||
}
|
||||
|
||||
QImage image;
|
||||
if (image.loadFromData(image_data)) {
|
||||
if (!image.isNull()) {
|
||||
image_data = SaveImageToJpegData(image);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return image_data;
|
||||
|
||||
|
|
Loading…
Reference in New Issue