From 17b1e9fbe66b3c6d8db27083ddc7de4ca5e755c5 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 15 Oct 2014 20:55:24 +0200 Subject: [PATCH] Make format --- src/engines/gstenginepipeline.cpp | 68 ++++++++++------------ src/engines/gstenginepipeline.h | 3 +- src/internet/internetmodel.cpp | 5 +- src/internet/internetmodel.h | 3 +- src/internet/internetshowsettingspage.cpp | 6 +- src/moodbar/moodbarbuilder.cpp | 18 ++---- src/moodbar/moodbarpipeline.cpp | 12 ++-- src/playlist/playlistmanager.cpp | 5 +- src/playlist/playlistmanager.h | 3 +- src/playlist/playlistsaveoptionsdialog.cpp | 3 +- src/playlist/playlistview.cpp | 11 ++-- src/playlistparsers/asxiniparser.cpp | 3 +- src/playlistparsers/asxiniparser.h | 3 +- src/playlistparsers/asxparser.cpp | 4 +- src/playlistparsers/asxparser.h | 3 +- src/playlistparsers/cueparser.cpp | 17 +----- src/playlistparsers/cueparser.h | 3 +- src/playlistparsers/m3uparser.cpp | 3 +- src/playlistparsers/m3uparser.h | 3 +- src/playlistparsers/parserbase.cpp | 3 +- src/playlistparsers/parserbase.h | 6 +- src/playlistparsers/playlistparser.cpp | 3 +- src/playlistparsers/playlistparser.h | 3 +- src/playlistparsers/plsparser.cpp | 7 ++- src/playlistparsers/plsparser.h | 3 +- src/playlistparsers/wplparser.cpp | 4 +- src/playlistparsers/xspfparser.cpp | 7 ++- src/playlistparsers/xspfparser.h | 3 +- src/transcoder/transcodedialog.cpp | 22 +++---- src/ui/settingsdialog.cpp | 3 - 30 files changed, 102 insertions(+), 138 deletions(-) diff --git a/src/engines/gstenginepipeline.cpp b/src/engines/gstenginepipeline.cpp index af7e72066..8ed8fef3b 100644 --- a/src/engines/gstenginepipeline.cpp +++ b/src/engines/gstenginepipeline.cpp @@ -105,8 +105,9 @@ GstEnginePipeline::GstEnginePipeline(GstEngine* engine) // will receive an error message. We should have a lightweight version of // server() that just return it (or NULL) without trying to create it IMO to // avoid this issue. - //if (InternetModel::Service()->IsBlobInstalled()) { - // connect(InternetModel::Service()->server(), SIGNAL(SeekCompleted()), + // if (InternetModel::Service()->IsBlobInstalled()) { + // connect(InternetModel::Service()->server(), + // SIGNAL(SeekCompleted()), // SLOT(SpotifySeekCompleted())); //} } @@ -248,25 +249,20 @@ bool GstEnginePipeline::Init() { !device_.toString().isEmpty()) { switch (device_.type()) { case QVariant::Int: - g_object_set(G_OBJECT(audiosink_), - "device", device_.toInt(), - nullptr); + g_object_set(G_OBJECT(audiosink_), "device", device_.toInt(), nullptr); break; case QVariant::String: - g_object_set(G_OBJECT(audiosink_), - "device", device_.toString().toUtf8().constData(), - nullptr); + g_object_set(G_OBJECT(audiosink_), "device", + device_.toString().toUtf8().constData(), nullptr); break; - #ifdef Q_OS_WIN32 +#ifdef Q_OS_WIN32 case QVariant::ByteArray: { GUID guid = QUuid(device_.toByteArray()); - g_object_set(G_OBJECT(audiosink_), - "device", &guid, - nullptr); + g_object_set(G_OBJECT(audiosink_), "device", &guid, nullptr); break; } - #endif // Q_OS_WIN32 +#endif // Q_OS_WIN32 default: qLog(Warning) << "Unknown device type" << device_; @@ -335,8 +331,8 @@ bool GstEnginePipeline::Init() { // We do it here because we want pre-equalized and pre-volume samples // so that our visualization are not be affected by them. pad = gst_element_get_static_pad(event_probe, "src"); - gst_pad_add_probe( - pad, GST_PAD_PROBE_TYPE_EVENT_UPSTREAM, &EventHandoffCallback, this, NULL); + gst_pad_add_probe(pad, GST_PAD_PROBE_TYPE_EVENT_UPSTREAM, + &EventHandoffCallback, this, NULL); gst_object_unref(pad); // Configure the fakesink properly @@ -347,8 +343,8 @@ bool GstEnginePipeline::Init() { int last_band_frequency = 0; for (int i = 0; i < kEqBandCount; ++i) { - GstObject* band = GST_OBJECT(gst_child_proxy_get_child_by_index( - GST_CHILD_PROXY(equalizer_), i)); + GstObject* band = GST_OBJECT( + gst_child_proxy_get_child_by_index(GST_CHILD_PROXY(equalizer_), i)); const float frequency = kEqBandFrequencies[i]; const float bandwidth = frequency - last_band_frequency; @@ -382,9 +378,8 @@ bool GstEnginePipeline::Init() { // Link the elements with special caps // The scope path through the tee gets 16-bit ints. - GstCaps* caps16 = gst_caps_new_simple ("audio/x-raw", - "format", G_TYPE_STRING, "S16LE", - NULL); + GstCaps* caps16 = gst_caps_new_simple("audio/x-raw", "format", G_TYPE_STRING, + "S16LE", NULL); gst_element_link_filtered(probe_converter, probe_sink, caps16); gst_caps_unref(caps16); @@ -407,8 +402,7 @@ bool GstEnginePipeline::Init() { // Add probes and handlers. gst_pad_add_probe(gst_element_get_static_pad(probe_converter, "src"), - GST_PAD_PROBE_TYPE_BUFFER, - HandoffCallback, this, nullptr); + GST_PAD_PROBE_TYPE_BUFFER, HandoffCallback, this, nullptr); gst_bus_set_sync_handler(gst_pipeline_get_bus(GST_PIPELINE(pipeline_)), BusCallbackSync, this, nullptr); bus_cb_id_ = gst_bus_add_watch(gst_pipeline_get_bus(GST_PIPELINE(pipeline_)), @@ -469,9 +463,8 @@ bool GstEnginePipeline::InitFromUrl(const QUrl& url, qint64 end_nanosec) { GstEnginePipeline::~GstEnginePipeline() { if (pipeline_) { - gst_bus_set_sync_handler( - gst_pipeline_get_bus(GST_PIPELINE(pipeline_)), - nullptr, nullptr, nullptr); + gst_bus_set_sync_handler(gst_pipeline_get_bus(GST_PIPELINE(pipeline_)), + nullptr, nullptr, nullptr); g_source_remove(bus_cb_id_); gst_element_set_state(pipeline_, GST_STATE_NULL); gst_object_unref(GST_OBJECT(pipeline_)); @@ -941,21 +934,22 @@ GstState GstEnginePipeline::state() const { QFuture GstEnginePipeline::SetState(GstState state) { if (url_.scheme() == "spotify" && !buffering_) { - const GstState current_state = this->state(); + const GstState current_state = this->state(); - if (state == GST_STATE_PAUSED && current_state == GST_STATE_PLAYING) { - SpotifyService* spotify = InternetModel::Service(); + if (state == GST_STATE_PAUSED && current_state == GST_STATE_PLAYING) { + SpotifyService* spotify = InternetModel::Service(); - // Need to schedule this in the spotify service's thread - QMetaObject::invokeMethod(spotify, "SetPaused", Qt::QueuedConnection, - Q_ARG(bool, true)); - } else if (state == GST_STATE_PLAYING && current_state == GST_STATE_PAUSED) { - SpotifyService* spotify = InternetModel::Service(); + // Need to schedule this in the spotify service's thread + QMetaObject::invokeMethod(spotify, "SetPaused", Qt::QueuedConnection, + Q_ARG(bool, true)); + } else if (state == GST_STATE_PLAYING && + current_state == GST_STATE_PAUSED) { + SpotifyService* spotify = InternetModel::Service(); - // Need to schedule this in the spotify service's thread - QMetaObject::invokeMethod(spotify, "SetPaused", Qt::QueuedConnection, - Q_ARG(bool, false)); - } + // Need to schedule this in the spotify service's thread + QMetaObject::invokeMethod(spotify, "SetPaused", Qt::QueuedConnection, + Q_ARG(bool, false)); + } } return ConcurrentRun::Run( &set_state_threadpool_, &gst_element_set_state, pipeline_, state); diff --git a/src/engines/gstenginepipeline.h b/src/engines/gstenginepipeline.h index 60bf70a78..e2d85cbdc 100644 --- a/src/engines/gstenginepipeline.h +++ b/src/engines/gstenginepipeline.h @@ -131,7 +131,8 @@ signals: static gboolean BusCallback(GstBus*, GstMessage*, gpointer); static void NewPadCallback(GstElement*, GstPad*, gpointer); static GstPadProbeReturn HandoffCallback(GstPad*, GstPadProbeInfo*, gpointer); - static GstPadProbeReturn EventHandoffCallback(GstPad*, GstPadProbeInfo*, gpointer); + static GstPadProbeReturn EventHandoffCallback(GstPad*, GstPadProbeInfo*, + gpointer); static void SourceDrainedCallback(GstURIDecodeBin*, gpointer); static void SourceSetupCallback(GstURIDecodeBin*, GParamSpec* pspec, gpointer); diff --git a/src/internet/internetmodel.cpp b/src/internet/internetmodel.cpp index ef15b42ba..cac2e9967 100644 --- a/src/internet/internetmodel.cpp +++ b/src/internet/internetmodel.cpp @@ -338,7 +338,8 @@ void InternetModel::UpdateServices() { bool setting_val = s.value(service_name).toBool(); // Only update if values are different - if (setting_val == true && shown_services_[internet_service].shown == false) { + if (setting_val == true && + shown_services_[internet_service].shown == false) { ShowService(internet_service); } else if (setting_val == false && shown_services_[internet_service].shown == true) { @@ -352,7 +353,7 @@ void InternetModel::UpdateServices() { } void InternetModel::ShowService(InternetService* service) { - if(shown_services_[service].shown != true) { + if (shown_services_[service].shown != true) { invisibleRootItem()->appendRow(shown_services_[service].item); shown_services_[service].shown = true; } diff --git a/src/internet/internetmodel.h b/src/internet/internetmodel.h index 13fe80348..98112c77f 100644 --- a/src/internet/internetmodel.h +++ b/src/internet/internetmodel.h @@ -115,7 +115,7 @@ class InternetModel : public QStandardItemModel { }; struct ServiceItem { - QStandardItem *item; + QStandardItem* item; bool shown; }; @@ -180,7 +180,6 @@ signals: void ServiceDeleted(); private: - QMap shown_services_; static QMap* sServices; diff --git a/src/internet/internetshowsettingspage.cpp b/src/internet/internetshowsettingspage.cpp index baba3887f..fc6482716 100644 --- a/src/internet/internetshowsettingspage.cpp +++ b/src/internet/internetshowsettingspage.cpp @@ -38,7 +38,8 @@ void InternetShowSettingsPage::Load() { ui_->sources->clear(); - for (QMap::iterator service = shown_services.begin(); + for (QMap::iterator service = + shown_services.begin(); service != shown_services.end(); ++service) { QTreeWidgetItem* item = new QTreeWidgetItem; @@ -46,7 +47,8 @@ void InternetShowSettingsPage::Load() { item->setText(0, service.value().item->text()); item->setIcon(0, service.value().item->icon()); - Qt::CheckState check_state = service.value().shown == true ? Qt::Checked : Qt::Unchecked; + Qt::CheckState check_state = + service.value().shown == true ? Qt::Checked : Qt::Unchecked; item->setData(0, Qt::CheckStateRole, check_state); /* We have to store the constant name of the service */ item->setData(1, Qt::UserRole, service.key()->name()); diff --git a/src/moodbar/moodbarbuilder.cpp b/src/moodbar/moodbarbuilder.cpp index 30fa9962d..bcd5d6dce 100644 --- a/src/moodbar/moodbarbuilder.cpp +++ b/src/moodbar/moodbarbuilder.cpp @@ -23,18 +23,14 @@ namespace { static const int sBarkBands[] = { - 100, 200, 300, 400, 510, 630, 770, 920, - 1080, 1270, 1480, 1720, 2000, 2320, 2700, 3150, - 3700, 4400, 5300, 6400, 7700, 9500, 12000, 15500 }; + 100, 200, 300, 400, 510, 630, 770, 920, 1080, 1270, 1480, 1720, + 2000, 2320, 2700, 3150, 3700, 4400, 5300, 6400, 7700, 9500, 12000, 15500}; static const int sBarkBandCount = arraysize(sBarkBands); } // namespace -MoodbarBuilder::MoodbarBuilder() - : bands_(0), - rate_hz_(0) { -} +MoodbarBuilder::MoodbarBuilder() : bands_(0), rate_hz_(0) {} int MoodbarBuilder::BandFrequency(int band) const { return ((rate_hz_ / 2) * band + rate_hz_ / 4) / bands_; @@ -151,9 +147,8 @@ void MoodbarBuilder::Normalize(QList* vals, double Rgb::*member) { for (auto it = vals->begin(); it != vals->end(); ++it) { double* value = &((*it).*member); - *value = std::isfinite(*value) - ? qBound(0.0, (*value - mini) / delta, 1.0) - : 0; + *value = + std::isfinite(*value) ? qBound(0.0, (*value - mini) / delta, 1.0) : 0; } } @@ -161,8 +156,7 @@ QByteArray MoodbarBuilder::Finish(int width) { QByteArray ret; ret.resize(width * 3); char* data = ret.data(); - if (frames_.count() == 0) - return ret; + if (frames_.count() == 0) return ret; Normalize(&frames_, &Rgb::r); Normalize(&frames_, &Rgb::g); diff --git a/src/moodbar/moodbarpipeline.cpp b/src/moodbar/moodbarpipeline.cpp index 92cf1a8e5..a12d5581f 100644 --- a/src/moodbar/moodbarpipeline.cpp +++ b/src/moodbar/moodbarpipeline.cpp @@ -102,17 +102,13 @@ void MoodbarPipeline::Start() { builder_.reset(new MoodbarBuilder); // Set properties - g_object_set(decodebin, - "uri", local_filename_.toEncoded().constData(), - nullptr); - g_object_set(spectrum, - "bands", kBands, + g_object_set(decodebin, "uri", local_filename_.toEncoded().constData(), nullptr); + g_object_set(spectrum, "bands", kBands, nullptr); GstFastSpectrum* fast_spectrum = GST_FASTSPECTRUM(spectrum); - fast_spectrum->output_callback = [this](double* magnitudes, int size) { - builder_->AddFrame(magnitudes, size); - }; + fast_spectrum->output_callback = [this]( + double* magnitudes, int size) { builder_->AddFrame(magnitudes, size); }; // Connect signals CHECKED_GCONNECT(decodebin, "pad-added", &NewPadCallback, this); diff --git a/src/playlist/playlistmanager.cpp b/src/playlist/playlistmanager.cpp index 334d26c29..2aa5be678 100644 --- a/src/playlist/playlistmanager.cpp +++ b/src/playlist/playlistmanager.cpp @@ -167,7 +167,8 @@ void PlaylistManager::Load(const QString& filename) { return; } - Playlist* playlist = AddPlaylist(id, info.baseName(), QString(), QString(), false); + Playlist* playlist = + AddPlaylist(id, info.baseName(), QString(), QString(), false); QList urls; playlist->InsertUrls(urls << QUrl::fromLocalFile(filename)); @@ -195,7 +196,6 @@ void PlaylistManager::Save(int id, const QString& filename, void PlaylistManager::ItemsLoadedForSavePlaylist(QFutureWatcher* watcher, const QString& filename, Playlist::Path path_type) { - SongList song_list = watcher->future().results(); parser_->Save(song_list, filename, path_type); } @@ -263,7 +263,6 @@ void PlaylistManager::Rename(int id, const QString& new_name) { } void PlaylistManager::Favorite(int id, bool favorite) { - if (playlists_.contains(id)) { // If playlists_ contains this playlist, its means it's opened: star or // unstar it. diff --git a/src/playlist/playlistmanager.h b/src/playlist/playlistmanager.h index 6f33bbb6f..4d1072827 100644 --- a/src/playlist/playlistmanager.h +++ b/src/playlist/playlistmanager.h @@ -76,7 +76,8 @@ class PlaylistManagerInterface : public QObject { virtual void New(const QString& name, const SongList& songs = SongList(), const QString& special_type = QString()) = 0; virtual void Load(const QString& filename) = 0; - virtual void Save(int id, const QString& filename, Playlist::Path path_type) = 0; + virtual void Save(int id, const QString& filename, + Playlist::Path path_type) = 0; virtual void Rename(int id, const QString& new_name) = 0; virtual void Delete(int id) = 0; virtual bool Close(int id) = 0; diff --git a/src/playlist/playlistsaveoptionsdialog.cpp b/src/playlist/playlistsaveoptionsdialog.cpp index 48bda0859..69a4f4a94 100644 --- a/src/playlist/playlistsaveoptionsdialog.cpp +++ b/src/playlist/playlistsaveoptionsdialog.cpp @@ -48,5 +48,6 @@ void PlaylistSaveOptionsDialog::accept() { } Playlist::Path PlaylistSaveOptionsDialog::path_type() const { - return static_cast(ui->filePaths->itemData(ui->filePaths->currentIndex()).toInt()); + return static_cast( + ui->filePaths->itemData(ui->filePaths->currentIndex()).toInt()); } diff --git a/src/playlist/playlistview.cpp b/src/playlist/playlistview.cpp index c034433b6..fe4ec4562 100644 --- a/src/playlist/playlistview.cpp +++ b/src/playlist/playlistview.cpp @@ -967,8 +967,9 @@ void PlaylistView::paintEvent(QPaintEvent* event) { if (model()->rowCount() == 0) drop_pos = 1; else - drop_pos = 1 + visualRect(model()->index(model()->rowCount() - 1, - first_column)).bottom(); + drop_pos = 1 + + visualRect(model()->index(model()->rowCount() - 1, + first_column)).bottom(); break; } @@ -1112,10 +1113,10 @@ void PlaylistView::ReloadSettings() { force_background_redraw_ = true; } - if(!s.value("click_edit_inline", true).toBool()) - setEditTriggers(editTriggers() & ~QAbstractItemView::SelectedClicked); + if (!s.value("click_edit_inline", true).toBool()) + setEditTriggers(editTriggers() & ~QAbstractItemView::SelectedClicked); else - setEditTriggers(editTriggers() | QAbstractItemView::SelectedClicked); + setEditTriggers(editTriggers() | QAbstractItemView::SelectedClicked); } void PlaylistView::SaveSettings() { diff --git a/src/playlistparsers/asxiniparser.cpp b/src/playlistparsers/asxiniparser.cpp index 79b5b4a4c..d52220ed5 100644 --- a/src/playlistparsers/asxiniparser.cpp +++ b/src/playlistparsers/asxiniparser.cpp @@ -50,8 +50,7 @@ SongList AsxIniParser::Load(QIODevice* device, const QString& playlist_path, } void AsxIniParser::Save(const SongList& songs, QIODevice* device, - const QDir& dir, - Playlist::Path path_type) const { + const QDir& dir, Playlist::Path path_type) const { QTextStream s(device); s << "[Reference]" << endl; diff --git a/src/playlistparsers/asxiniparser.h b/src/playlistparsers/asxiniparser.h index d8736ac1e..6a7c092e1 100644 --- a/src/playlistparsers/asxiniparser.h +++ b/src/playlistparsers/asxiniparser.h @@ -33,8 +33,7 @@ class AsxIniParser : public ParserBase { SongList Load(QIODevice* device, const QString& playlist_path = "", const QDir& dir = QDir()) const; - void Save(const SongList& songs, QIODevice* device, - const QDir& dir = QDir(), + void Save(const SongList& songs, QIODevice* device, const QDir& dir = QDir(), Playlist::Path path_type = Playlist::Path_Automatic) const; }; diff --git a/src/playlistparsers/asxparser.cpp b/src/playlistparsers/asxparser.cpp index 4223c06df..505ce758e 100644 --- a/src/playlistparsers/asxparser.cpp +++ b/src/playlistparsers/asxparser.cpp @@ -117,8 +117,8 @@ return_song: return song; } -void ASXParser::Save(const SongList& songs, QIODevice* device, - const QDir&, Playlist::Path path_type) const { +void ASXParser::Save(const SongList& songs, QIODevice* device, const QDir&, + Playlist::Path path_type) const { QXmlStreamWriter writer(device); writer.setAutoFormatting(true); writer.setAutoFormattingIndent(2); diff --git a/src/playlistparsers/asxparser.h b/src/playlistparsers/asxparser.h index c46a27c4a..0efae535e 100644 --- a/src/playlistparsers/asxparser.h +++ b/src/playlistparsers/asxparser.h @@ -33,8 +33,7 @@ class ASXParser : public XMLParser { SongList Load(QIODevice* device, const QString& playlist_path = "", const QDir& dir = QDir()) const; - void Save(const SongList& songs, QIODevice* device, - const QDir& dir = QDir(), + void Save(const SongList& songs, QIODevice* device, const QDir& dir = QDir(), Playlist::Path path_type = Playlist::Path_Automatic) const; private: diff --git a/src/playlistparsers/cueparser.cpp b/src/playlistparsers/cueparser.cpp index 00d1401e3..83643b064 100644 --- a/src/playlistparsers/cueparser.cpp +++ b/src/playlistparsers/cueparser.cpp @@ -63,7 +63,6 @@ SongList CueParser::Load(QIODevice* device, const QString& playlist_path, // -- whole file while (!text_stream.atEnd()) { - QString album_artist; QString album; QString album_composer; @@ -86,22 +85,18 @@ SongList CueParser::Load(QIODevice* device, const QString& playlist_path, // PERFORMER if (line_name == kPerformer) { - album_artist = line_value; // TITLE } else if (line_name == kTitle) { - album = line_value; // SONGWRITER } else if (line_name == kSongWriter) { - album_composer = line_value; // FILE } else if (line_name == kFile) { - file = QDir::isAbsolutePath(line_value) ? line_value : dir.absoluteFilePath(line_value); @@ -127,7 +122,6 @@ SongList CueParser::Load(QIODevice* device, const QString& playlist_path, // end of the header -> go into the track mode } else if (line_name == kTrack) { - files++; break; } @@ -166,7 +160,6 @@ SongList CueParser::Load(QIODevice* device, const QString& playlist_path, splitted.size() > 2 ? splitted[2].toLower() : ""; if (line_name == kTrack) { - // the beginning of another track's definition - we're saving the // current one // for later (if it's valid of course) @@ -187,33 +180,26 @@ SongList CueParser::Load(QIODevice* device, const QString& playlist_path, } } else if (line_name == kIndex) { - // we need the index's position field if (!line_additional.isEmpty()) { - // if there's none "01" index, we'll just take the first one // also, we'll take the "01" index even if it's the last one if (line_value == "01" || index.isEmpty()) { - index = line_additional; } } } else if (line_name == kPerformer) { - artist = line_value; } else if (line_name == kTitle) { - title = line_value; } else if (line_name == kSongWriter) { - composer = line_value; // end of track's for the current file -> parse next one } else if (line_name == kFile) { - break; } @@ -351,8 +337,7 @@ qint64 CueParser::IndexToMarker(const QString& index) const { return (frames * kNsecPerSec) / 75; } -void CueParser::Save(const SongList& songs, QIODevice* device, - const QDir& dir, +void CueParser::Save(const SongList& songs, QIODevice* device, const QDir& dir, Playlist::Path path_type) const { // TODO } diff --git a/src/playlistparsers/cueparser.h b/src/playlistparsers/cueparser.h index 13ca9d067..1ec87f42d 100644 --- a/src/playlistparsers/cueparser.h +++ b/src/playlistparsers/cueparser.h @@ -53,8 +53,7 @@ class CueParser : public ParserBase { SongList Load(QIODevice* device, const QString& playlist_path = "", const QDir& dir = QDir()) const; - void Save(const SongList& songs, QIODevice* device, - const QDir& dir = QDir(), + void Save(const SongList& songs, QIODevice* device, const QDir& dir = QDir(), Playlist::Path path_type = Playlist::Path_Automatic) const; private: diff --git a/src/playlistparsers/m3uparser.cpp b/src/playlistparsers/m3uparser.cpp index 6f6874982..a716830b5 100644 --- a/src/playlistparsers/m3uparser.cpp +++ b/src/playlistparsers/m3uparser.cpp @@ -104,8 +104,7 @@ bool M3UParser::ParseMetadata(const QString& line, return true; } -void M3UParser::Save(const SongList& songs, QIODevice* device, - const QDir& dir, +void M3UParser::Save(const SongList& songs, QIODevice* device, const QDir& dir, Playlist::Path path_type) const { device->write("#EXTM3U\n"); diff --git a/src/playlistparsers/m3uparser.h b/src/playlistparsers/m3uparser.h index c8695e5bd..887a24cad 100644 --- a/src/playlistparsers/m3uparser.h +++ b/src/playlistparsers/m3uparser.h @@ -41,8 +41,7 @@ class M3UParser : public ParserBase { SongList Load(QIODevice* device, const QString& playlist_path = "", const QDir& dir = QDir()) const; - void Save(const SongList& songs, QIODevice* device, - const QDir& dir = QDir(), + void Save(const SongList& songs, QIODevice* device, const QDir& dir = QDir(), Playlist::Path path_type = Playlist::Path_Automatic) const; private: diff --git a/src/playlistparsers/parserbase.cpp b/src/playlistparsers/parserbase.cpp index 2a3b7dab2..3dbd2e134 100644 --- a/src/playlistparsers/parserbase.cpp +++ b/src/playlistparsers/parserbase.cpp @@ -86,8 +86,7 @@ Song ParserBase::LoadSong(const QString& filename_or_url, qint64 beginning, return song; } -QString ParserBase::URLOrFilename(const QUrl& url, - const QDir& dir, +QString ParserBase::URLOrFilename(const QUrl& url, const QDir& dir, Playlist::Path path_type) const { if (url.scheme() != "file") return url.toString(); diff --git a/src/playlistparsers/parserbase.h b/src/playlistparsers/parserbase.h index d12feece4..669ce7d2c 100644 --- a/src/playlistparsers/parserbase.h +++ b/src/playlistparsers/parserbase.h @@ -51,9 +51,9 @@ class ParserBase : public QObject { // from the parser's point of view). virtual SongList Load(QIODevice* device, const QString& playlist_path = "", const QDir& dir = QDir()) const = 0; - virtual void Save(const SongList& songs, QIODevice* device, - const QDir& dir = QDir(), - Playlist::Path path_type = Playlist::Path_Automatic) const = 0; + virtual void Save( + const SongList& songs, QIODevice* device, const QDir& dir = QDir(), + Playlist::Path path_type = Playlist::Path_Automatic) const = 0; protected: // Loads a song. If filename_or_url is a URL (with a scheme other than diff --git a/src/playlistparsers/playlistparser.cpp b/src/playlistparsers/playlistparser.cpp index 9079eace8..3ea1dcba5 100644 --- a/src/playlistparsers/playlistparser.cpp +++ b/src/playlistparsers/playlistparser.cpp @@ -130,8 +130,7 @@ SongList PlaylistParser::LoadFromDevice(QIODevice* device, return parser->Load(device, path_hint, dir_hint); } -void PlaylistParser::Save(const SongList& songs, - const QString& filename, +void PlaylistParser::Save(const SongList& songs, const QString& filename, Playlist::Path path_type) const { QFileInfo info(filename); diff --git a/src/playlistparsers/playlistparser.h b/src/playlistparsers/playlistparser.h index d25eb7e59..7cc92e064 100644 --- a/src/playlistparsers/playlistparser.h +++ b/src/playlistparsers/playlistparser.h @@ -49,7 +49,8 @@ class PlaylistParser : public QObject { SongList LoadFromDevice(QIODevice* device, const QString& path_hint = QString(), const QDir& dir_hint = QDir()) const; - void Save(const SongList& songs, const QString& filename, Playlist::Path) const; + void Save(const SongList& songs, const QString& filename, + Playlist::Path) const; private: QString FilterForParser(const ParserBase* parser, diff --git a/src/playlistparsers/plsparser.cpp b/src/playlistparsers/plsparser.cpp index 9edce3061..0d7016ac7 100644 --- a/src/playlistparsers/plsparser.cpp +++ b/src/playlistparsers/plsparser.cpp @@ -61,8 +61,8 @@ SongList PLSParser::Load(QIODevice* device, const QString& playlist_path, return songs.values(); } -void PLSParser::Save(const SongList& songs, QIODevice* device, - const QDir& dir, Playlist::Path path_type) const { +void PLSParser::Save(const SongList& songs, QIODevice* device, const QDir& dir, + Playlist::Path path_type) const { QTextStream s(device); s << "[playlist]" << endl; s << "Version=2" << endl; @@ -70,7 +70,8 @@ void PLSParser::Save(const SongList& songs, QIODevice* device, int n = 1; for (const Song& song : songs) { - s << "File" << n << "=" << URLOrFilename(song.url(), dir, path_type) << endl; + s << "File" << n << "=" << URLOrFilename(song.url(), dir, path_type) + << endl; s << "Title" << n << "=" << song.title() << endl; s << "Length" << n << "=" << song.length_nanosec() / kNsecPerSec << endl; ++n; diff --git a/src/playlistparsers/plsparser.h b/src/playlistparsers/plsparser.h index 3bc57a9e8..22898a4cb 100644 --- a/src/playlistparsers/plsparser.h +++ b/src/playlistparsers/plsparser.h @@ -33,8 +33,7 @@ class PLSParser : public ParserBase { SongList Load(QIODevice* device, const QString& playlist_path = "", const QDir& dir = QDir()) const; - void Save(const SongList& songs, QIODevice* device, - const QDir& dir = QDir(), + void Save(const SongList& songs, QIODevice* device, const QDir& dir = QDir(), Playlist::Path path_type = Playlist::Path_Automatic) const; }; diff --git a/src/playlistparsers/wplparser.cpp b/src/playlistparsers/wplparser.cpp index 0dc022f35..f11156528 100644 --- a/src/playlistparsers/wplparser.cpp +++ b/src/playlistparsers/wplparser.cpp @@ -76,8 +76,8 @@ void WplParser::ParseSeq(const QDir& dir, QXmlStreamReader* reader, } } -void WplParser::Save(const SongList& songs, QIODevice* device, - const QDir& dir, Playlist::Path path_type) const { +void WplParser::Save(const SongList& songs, QIODevice* device, const QDir& dir, + Playlist::Path path_type) const { QXmlStreamWriter writer(device); writer.setAutoFormatting(true); writer.setAutoFormattingIndent(2); diff --git a/src/playlistparsers/xspfparser.cpp b/src/playlistparsers/xspfparser.cpp index 7f452684c..34c9b51df 100644 --- a/src/playlistparsers/xspfparser.cpp +++ b/src/playlistparsers/xspfparser.cpp @@ -102,8 +102,8 @@ return_song: return song; } -void XSPFParser::Save(const SongList& songs, QIODevice* device, - const QDir& dir, Playlist::Path path_type) const { +void XSPFParser::Save(const SongList& songs, QIODevice* device, const QDir& dir, + Playlist::Path path_type) const { QFileInfo file; QXmlStreamWriter writer(device); writer.setAutoFormatting(true); @@ -120,7 +120,8 @@ void XSPFParser::Save(const SongList& songs, QIODevice* device, StreamElement tracklist("trackList", &writer); for (const Song& song : songs) { - QString filename_or_url = URLOrFilename(song.url(), dir, path_type).toUtf8(); + QString filename_or_url = + URLOrFilename(song.url(), dir, path_type).toUtf8(); StreamElement track("track", &writer); writer.writeTextElement("location", filename_or_url); diff --git a/src/playlistparsers/xspfparser.h b/src/playlistparsers/xspfparser.h index fc7d1fb70..4ddc1eb54 100644 --- a/src/playlistparsers/xspfparser.h +++ b/src/playlistparsers/xspfparser.h @@ -38,8 +38,7 @@ class XSPFParser : public XMLParser { SongList Load(QIODevice* device, const QString& playlist_path = "", const QDir& dir = QDir()) const; - void Save(const SongList& songs, QIODevice* device, - const QDir& dir = QDir(), + void Save(const SongList& songs, QIODevice* device, const QDir& dir = QDir(), Playlist::Path path_type = Playlist::Path_Automatic) const; private: diff --git a/src/transcoder/transcodedialog.cpp b/src/transcoder/transcodedialog.cpp index 172d27a7b..f562bddb7 100644 --- a/src/transcoder/transcodedialog.cpp +++ b/src/transcoder/transcodedialog.cpp @@ -231,23 +231,23 @@ void TranscodeDialog::Add() { void TranscodeDialog::Import() { QString path = QFileDialog::getExistingDirectory( - this, tr("Open a directory to import music from"), - last_import_dir_, QFileDialog::ShowDirsOnly); - + this, tr("Open a directory to import music from"), last_import_dir_, + QFileDialog::ShowDirsOnly); + if (path.isEmpty()) return; - + QStringList filenames; - QStringList audioTypes = QString(FileView::kFileFilter).split(" ", - QString::SkipEmptyParts); - QDirIterator files(path, audioTypes, QDir::Files | QDir::Readable, - QDirIterator::Subdirectories); - + QStringList audioTypes = + QString(FileView::kFileFilter).split(" ", QString::SkipEmptyParts); + QDirIterator files(path, audioTypes, QDir::Files | QDir::Readable, + QDirIterator::Subdirectories); + while (files.hasNext()) { filenames << files.next(); } - + SetFilenames(filenames); - + last_import_dir_ = path; QSettings settings; settings.beginGroup(kSettingsGroup); diff --git a/src/ui/settingsdialog.cpp b/src/ui/settingsdialog.cpp index 6cd09ae85..ab9f824d5 100644 --- a/src/ui/settingsdialog.cpp +++ b/src/ui/settingsdialog.cpp @@ -84,7 +84,6 @@ #include "internet/seafilesettingspage.h" #endif - #include #include #include @@ -194,8 +193,6 @@ SettingsDialog::SettingsDialog(Application* app, BackgroundStreams* streams, AddPage(Page_Seafile, new SeafileSettingsPage(this), providers); #endif - - AddPage(Page_Magnatune, new MagnatuneSettingsPage(this), providers); AddPage(Page_DigitallyImported, new DigitallyImportedSettingsPage(this), providers);