Scrub the auto usage, use unique_ptr, use correct types instead of QList
This commit is contained in:
parent
3a72faba97
commit
09d68bf415
|
@ -53,7 +53,7 @@ Organise::Organise(TaskManager* task_manager,
|
||||||
{
|
{
|
||||||
original_thread_ = thread();
|
original_thread_ = thread();
|
||||||
|
|
||||||
for (const auto& song : songs) {
|
for (const Song& song : songs) {
|
||||||
tasks_pending_ << Task(song);
|
tasks_pending_ << Task(song);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,7 @@ void Organise::ProcessSomeFiles() {
|
||||||
|
|
||||||
if (!destination_->StartCopy(&supported_filetypes_)) {
|
if (!destination_->StartCopy(&supported_filetypes_)) {
|
||||||
// Failed to start - mark everything as failed :(
|
// Failed to start - mark everything as failed :(
|
||||||
for (const auto& task : tasks_pending_)
|
for (const Task& task : tasks_pending_)
|
||||||
files_with_errors_ << task.song_.url().toLocalFile();
|
files_with_errors_ << task.song_.url().toLocalFile();
|
||||||
tasks_pending_.clear();
|
tasks_pending_.clear();
|
||||||
}
|
}
|
||||||
|
@ -237,7 +237,7 @@ void Organise::UpdateProgress() {
|
||||||
|
|
||||||
// Update transcoding progress
|
// Update transcoding progress
|
||||||
QMap<QString, float> transcode_progress = transcoder_->GetProgress();
|
QMap<QString, float> transcode_progress = transcoder_->GetProgress();
|
||||||
for (const auto& filename : transcode_progress.keys()) {
|
for (const QString& filename : transcode_progress.keys()) {
|
||||||
if (!tasks_transcoding_.contains(filename))
|
if (!tasks_transcoding_.contains(filename))
|
||||||
continue;
|
continue;
|
||||||
tasks_transcoding_[filename].transcode_progress_ = transcode_progress[filename];
|
tasks_transcoding_[filename].transcode_progress_ = transcode_progress[filename];
|
||||||
|
@ -248,10 +248,10 @@ void Organise::UpdateProgress() {
|
||||||
// only need to be copied total 100.
|
// only need to be copied total 100.
|
||||||
int progress = tasks_complete_ * 100;
|
int progress = tasks_complete_ * 100;
|
||||||
|
|
||||||
for (const auto& task : tasks_pending_) {
|
for (const Task& task : tasks_pending_) {
|
||||||
progress += qBound(0, static_cast<int>(task.transcode_progress_ * 50), 50);
|
progress += qBound(0, static_cast<int>(task.transcode_progress_ * 50), 50);
|
||||||
}
|
}
|
||||||
for (const auto& task : tasks_transcoding_.values()) {
|
for (const Task& task : tasks_transcoding_.values()) {
|
||||||
progress += qBound(0, static_cast<int>(task.transcode_progress_ * 50), 50);
|
progress += qBound(0, static_cast<int>(task.transcode_progress_ * 50), 50);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -141,7 +141,7 @@ void PodcastBackend::UpdateEpisodes(const PodcastEpisodeList& episodes) {
|
||||||
" local_url = :local_url"
|
" local_url = :local_url"
|
||||||
" WHERE ROWID = :id", db);
|
" WHERE ROWID = :id", db);
|
||||||
|
|
||||||
for (const auto& episode : episodes) {
|
for (const PodcastEpisode& episode : episodes) {
|
||||||
q.bindValue(":listened", episode.listened());
|
q.bindValue(":listened", episode.listened());
|
||||||
q.bindValue(":listened_date", episode.listened_date().toTime_t());
|
q.bindValue(":listened_date", episode.listened_date().toTime_t());
|
||||||
q.bindValue(":downloaded", episode.downloaded());
|
q.bindValue(":downloaded", episode.downloaded());
|
||||||
|
|
|
@ -74,10 +74,10 @@ signals:
|
||||||
void SubscriptionRemoved(const Podcast& podcast);
|
void SubscriptionRemoved(const Podcast& podcast);
|
||||||
|
|
||||||
// Emitted when episodes are added to a subscription that *already exists*.
|
// Emitted when episodes are added to a subscription that *already exists*.
|
||||||
void EpisodesAdded(const QList<PodcastEpisode>& episodes);
|
void EpisodesAdded(const PodcastEpisodeList& episodes);
|
||||||
|
|
||||||
// Emitted when existing episodes are updated.
|
// Emitted when existing episodes are updated.
|
||||||
void EpisodesUpdated(const QList<PodcastEpisode>& episodes);
|
void EpisodesUpdated(const PodcastEpisodeList& episodes);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Adds each episode to the database, setting their IDs after inserting each
|
// Adds each episode to the database, setting their IDs after inserting each
|
||||||
|
|
|
@ -56,8 +56,8 @@ PodcastDownloader::PodcastDownloader(Application* app, QObject* parent)
|
||||||
last_progress_signal_(0),
|
last_progress_signal_(0),
|
||||||
auto_delete_timer_(new QTimer(this))
|
auto_delete_timer_(new QTimer(this))
|
||||||
{
|
{
|
||||||
connect(backend_, SIGNAL(EpisodesAdded(QList<PodcastEpisode>)),
|
connect(backend_, SIGNAL(EpisodesAdded(PodcastEpisodeList)),
|
||||||
SLOT(EpisodesAdded(QList<PodcastEpisode>)));
|
SLOT(EpisodesAdded(PodcastEpisodeList)));
|
||||||
connect(backend_, SIGNAL(SubscriptionAdded(Podcast)),
|
connect(backend_, SIGNAL(SubscriptionAdded(Podcast)),
|
||||||
SLOT(SubscriptionAdded(Podcast)));
|
SLOT(SubscriptionAdded(Podcast)));
|
||||||
connect(app_, SIGNAL(SettingsChanged()), SLOT(ReloadSettings()));
|
connect(app_, SIGNAL(SettingsChanged()), SLOT(ReloadSettings()));
|
||||||
|
@ -282,9 +282,9 @@ void PodcastDownloader::SubscriptionAdded(const Podcast& podcast) {
|
||||||
EpisodesAdded(podcast.episodes());
|
EpisodesAdded(podcast.episodes());
|
||||||
}
|
}
|
||||||
|
|
||||||
void PodcastDownloader::EpisodesAdded(const QList<PodcastEpisode>& episodes) {
|
void PodcastDownloader::EpisodesAdded(const PodcastEpisodeList& episodes) {
|
||||||
if (auto_download_) {
|
if (auto_download_) {
|
||||||
for (const auto& episode : episodes) {
|
for (const PodcastEpisode& episode : episodes) {
|
||||||
DownloadEpisode(episode);
|
DownloadEpisode(episode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -307,7 +307,7 @@ void PodcastDownloader::AutoDelete() {
|
||||||
<< (delete_after_secs_ / kSecsPerDay)
|
<< (delete_after_secs_ / kSecsPerDay)
|
||||||
<< "days ago";
|
<< "days ago";
|
||||||
|
|
||||||
for (const auto& episode : old_episodes) {
|
for (const PodcastEpisode& episode : old_episodes) {
|
||||||
DeleteEpisode(episode);
|
DeleteEpisode(episode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,8 +69,8 @@ PodcastService::PodcastService(Application* app, InternetModel* parent)
|
||||||
|
|
||||||
connect(backend_, SIGNAL(SubscriptionAdded(Podcast)), SLOT(SubscriptionAdded(Podcast)));
|
connect(backend_, SIGNAL(SubscriptionAdded(Podcast)), SLOT(SubscriptionAdded(Podcast)));
|
||||||
connect(backend_, SIGNAL(SubscriptionRemoved(Podcast)), SLOT(SubscriptionRemoved(Podcast)));
|
connect(backend_, SIGNAL(SubscriptionRemoved(Podcast)), SLOT(SubscriptionRemoved(Podcast)));
|
||||||
connect(backend_, SIGNAL(EpisodesAdded(QList<PodcastEpisode>)), SLOT(EpisodesAdded(QList<PodcastEpisode>)));
|
connect(backend_, SIGNAL(EpisodesAdded(PodcastEpisodeList)), SLOT(EpisodesAdded(PodcastEpisodeList)));
|
||||||
connect(backend_, SIGNAL(EpisodesUpdated(QList<PodcastEpisode>)), SLOT(EpisodesUpdated(QList<PodcastEpisode>)));
|
connect(backend_, SIGNAL(EpisodesUpdated(PodcastEpisodeList)), SLOT(EpisodesUpdated(PodcastEpisodeList)));
|
||||||
|
|
||||||
connect(app_->playlist_manager(), SIGNAL(CurrentSongChanged(Song)), SLOT(CurrentSongChanged(Song)));
|
connect(app_->playlist_manager(), SIGNAL(CurrentSongChanged(Song)), SLOT(CurrentSongChanged(Song)));
|
||||||
}
|
}
|
||||||
|
@ -127,9 +127,9 @@ void PodcastService::CopyToDevice() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void PodcastService::CopyToDevice(const PodcastEpisodeList& episodes_list) {
|
void PodcastService::CopyToDevice(const PodcastEpisodeList& episodes_list) {
|
||||||
QList<Song> songs;
|
SongList songs;
|
||||||
Podcast podcast;
|
Podcast podcast;
|
||||||
for (const auto& episode : episodes_list) {
|
for (const PodcastEpisode& episode : episodes_list) {
|
||||||
podcast = backend_->GetSubscriptionById(episode.podcast_database_id());
|
podcast = backend_->GetSubscriptionById(episode.podcast_database_id());
|
||||||
songs.append(episode.ToSong(podcast));
|
songs.append(episode.ToSong(podcast));
|
||||||
}
|
}
|
||||||
|
@ -143,16 +143,16 @@ void PodcastService::CopyToDevice(const PodcastEpisodeList& episodes_list) {
|
||||||
void PodcastService::CopyToDevice(const QModelIndexList& episode_indexes,
|
void PodcastService::CopyToDevice(const QModelIndexList& episode_indexes,
|
||||||
const QModelIndexList& podcast_indexes) {
|
const QModelIndexList& podcast_indexes) {
|
||||||
PodcastEpisode episode_tmp;
|
PodcastEpisode episode_tmp;
|
||||||
QList<Song> songs;
|
SongList songs;
|
||||||
PodcastEpisodeList episodes;
|
PodcastEpisodeList episodes;
|
||||||
Podcast podcast;
|
Podcast podcast;
|
||||||
for (const auto& index : episode_indexes) {
|
for (const QModelIndex& index : episode_indexes) {
|
||||||
episode_tmp = index.data(Role_Episode).value<PodcastEpisode>();
|
episode_tmp = index.data(Role_Episode).value<PodcastEpisode>();
|
||||||
if (episode_tmp.downloaded())
|
if (episode_tmp.downloaded())
|
||||||
episodes << episode_tmp;
|
episodes << episode_tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const auto& podcast : podcast_indexes) {
|
for (const QModelIndex& podcast : podcast_indexes) {
|
||||||
for (int i = 0; i < podcast.model()->rowCount(podcast); ++i) {
|
for (int i = 0; i < podcast.model()->rowCount(podcast); ++i) {
|
||||||
const QModelIndex& index = podcast.child(i, 0);
|
const QModelIndex& index = podcast.child(i, 0);
|
||||||
episode_tmp = index.data(Role_Episode).value<PodcastEpisode>();
|
episode_tmp = index.data(Role_Episode).value<PodcastEpisode>();
|
||||||
|
@ -160,7 +160,7 @@ void PodcastService::CopyToDevice(const QModelIndexList& episode_indexes,
|
||||||
episodes << episode_tmp;
|
episodes << episode_tmp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (const auto& episode : episodes) {
|
for (const PodcastEpisode& episode : episodes) {
|
||||||
podcast = backend_->GetSubscriptionById(episode.podcast_database_id());
|
podcast = backend_->GetSubscriptionById(episode.podcast_database_id());
|
||||||
songs.append(episode.ToSong(podcast));
|
songs.append(episode.ToSong(podcast));
|
||||||
}
|
}
|
||||||
|
@ -190,7 +190,7 @@ void PodcastService::PopulatePodcastList(QStandardItem* parent) {
|
||||||
default_icon_ = QIcon(":providers/podcast16.png");
|
default_icon_ = QIcon(":providers/podcast16.png");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const auto& podcast : backend_->GetAllSubscriptions()) {
|
for (const Podcast& podcast : backend_->GetAllSubscriptions()) {
|
||||||
parent->appendRow(CreatePodcastItem(podcast));
|
parent->appendRow(CreatePodcastItem(podcast));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -270,7 +270,7 @@ QStandardItem* PodcastService::CreatePodcastItem(const Podcast& podcast) {
|
||||||
|
|
||||||
// Add the episodes in this podcast and gather aggregate stats.
|
// Add the episodes in this podcast and gather aggregate stats.
|
||||||
int unlistened_count = 0;
|
int unlistened_count = 0;
|
||||||
for (const auto& episode : backend_->GetEpisodes(podcast.database_id())) {
|
for (const PodcastEpisode& episode : backend_->GetEpisodes(podcast.database_id())) {
|
||||||
if (!episode.listened()) {
|
if (!episode.listened()) {
|
||||||
unlistened_count++;
|
unlistened_count++;
|
||||||
}
|
}
|
||||||
|
@ -360,7 +360,7 @@ void PodcastService::ShowContextMenu(const QPoint& global_pos) {
|
||||||
explicitly_selected_podcasts_.clear();
|
explicitly_selected_podcasts_.clear();
|
||||||
QSet<int> podcast_ids;
|
QSet<int> podcast_ids;
|
||||||
|
|
||||||
for (const auto& index : model()->selected_indexes()) {
|
for (const QModelIndex& index : model()->selected_indexes()) {
|
||||||
switch (index.data(InternetModel::Role_Type).toInt()) {
|
switch (index.data(InternetModel::Role_Type).toInt()) {
|
||||||
case Type_Podcast: {
|
case Type_Podcast: {
|
||||||
const int id = index.data(Role_Podcast).value<Podcast>().database_id();
|
const int id = index.data(Role_Podcast).value<Podcast>().database_id();
|
||||||
|
@ -431,14 +431,14 @@ void PodcastService::ShowContextMenu(const QPoint& global_pos) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void PodcastService::UpdateSelectedPodcast() {
|
void PodcastService::UpdateSelectedPodcast() {
|
||||||
for (const auto& index : selected_podcasts_) {
|
for (const QModelIndex& index : selected_podcasts_) {
|
||||||
app_->podcast_updater()->UpdatePodcastNow(
|
app_->podcast_updater()->UpdatePodcastNow(
|
||||||
index.data(Role_Podcast).value<Podcast>());
|
index.data(Role_Podcast).value<Podcast>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PodcastService::RemoveSelectedPodcast() {
|
void PodcastService::RemoveSelectedPodcast() {
|
||||||
for (const auto& index : selected_podcasts_) {
|
for (const QModelIndex& index : selected_podcasts_) {
|
||||||
backend_->Unsubscribe(index.data(Role_Podcast).value<Podcast>());
|
backend_->Unsubscribe(index.data(Role_Podcast).value<Podcast>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -494,10 +494,10 @@ void PodcastService::SubscriptionRemoved(const Podcast& podcast) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PodcastService::EpisodesAdded(const QList<PodcastEpisode>& episodes) {
|
void PodcastService::EpisodesAdded(const PodcastEpisodeList& episodes) {
|
||||||
QSet<int> seen_podcast_ids;
|
QSet<int> seen_podcast_ids;
|
||||||
|
|
||||||
for (const auto& episode : episodes) {
|
for (const PodcastEpisode& episode : episodes) {
|
||||||
const int database_id = episode.podcast_database_id();
|
const int database_id = episode.podcast_database_id();
|
||||||
QStandardItem* parent = podcasts_by_database_id_[database_id];
|
QStandardItem* parent = podcasts_by_database_id_[database_id];
|
||||||
if (!parent)
|
if (!parent)
|
||||||
|
@ -508,7 +508,7 @@ void PodcastService::EpisodesAdded(const QList<PodcastEpisode>& episodes) {
|
||||||
if (!seen_podcast_ids.contains(database_id)) {
|
if (!seen_podcast_ids.contains(database_id)) {
|
||||||
// Update the unlistened count text once for each podcast
|
// Update the unlistened count text once for each podcast
|
||||||
int unlistened_count = 0;
|
int unlistened_count = 0;
|
||||||
for (const auto& episode : backend_->GetEpisodes(database_id)) {
|
for (const PodcastEpisode& episode : backend_->GetEpisodes(database_id)) {
|
||||||
if (!episode.listened()) {
|
if (!episode.listened()) {
|
||||||
unlistened_count++;
|
unlistened_count++;
|
||||||
}
|
}
|
||||||
|
@ -520,10 +520,10 @@ void PodcastService::EpisodesAdded(const QList<PodcastEpisode>& episodes) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PodcastService::EpisodesUpdated(const QList<PodcastEpisode>& episodes) {
|
void PodcastService::EpisodesUpdated(const PodcastEpisodeList& episodes) {
|
||||||
QSet<int> seen_podcast_ids;
|
QSet<int> seen_podcast_ids;
|
||||||
|
|
||||||
for (const auto& episode : episodes) {
|
for (const PodcastEpisode& episode : episodes) {
|
||||||
const int podcast_database_id = episode.podcast_database_id();
|
const int podcast_database_id = episode.podcast_database_id();
|
||||||
QStandardItem* item = episodes_by_database_id_[episode.database_id()];
|
QStandardItem* item = episodes_by_database_id_[episode.database_id()];
|
||||||
QStandardItem* parent = podcasts_by_database_id_[podcast_database_id];
|
QStandardItem* parent = podcasts_by_database_id_[podcast_database_id];
|
||||||
|
@ -538,7 +538,7 @@ void PodcastService::EpisodesUpdated(const QList<PodcastEpisode>& episodes) {
|
||||||
if (!seen_podcast_ids.contains(podcast_database_id)) {
|
if (!seen_podcast_ids.contains(podcast_database_id)) {
|
||||||
// Update the unlistened count text once for each podcast
|
// Update the unlistened count text once for each podcast
|
||||||
int unlistened_count = 0;
|
int unlistened_count = 0;
|
||||||
for (const auto& episode : backend_->GetEpisodes(podcast_database_id)) {
|
for (const PodcastEpisode& episode : backend_->GetEpisodes(podcast_database_id)) {
|
||||||
if (!episode.listened()) {
|
if (!episode.listened()) {
|
||||||
unlistened_count++;
|
unlistened_count++;
|
||||||
}
|
}
|
||||||
|
@ -551,14 +551,14 @@ void PodcastService::EpisodesUpdated(const QList<PodcastEpisode>& episodes) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void PodcastService::DownloadSelectedEpisode() {
|
void PodcastService::DownloadSelectedEpisode() {
|
||||||
for (const auto& index : selected_episodes_) {
|
for (const QModelIndex& index : selected_episodes_) {
|
||||||
app_->podcast_downloader()->DownloadEpisode(
|
app_->podcast_downloader()->DownloadEpisode(
|
||||||
index.data(Role_Episode).value<PodcastEpisode>());
|
index.data(Role_Episode).value<PodcastEpisode>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PodcastService::DeleteDownloadedData() {
|
void PodcastService::DeleteDownloadedData() {
|
||||||
for (const auto& index : selected_episodes_) {
|
for (const QModelIndex& index : selected_episodes_) {
|
||||||
app_->podcast_downloader()->DeleteEpisode(
|
app_->podcast_downloader()->DeleteEpisode(
|
||||||
index.data(Role_Episode).value<PodcastEpisode>());
|
index.data(Role_Episode).value<PodcastEpisode>());
|
||||||
}
|
}
|
||||||
|
@ -607,7 +607,7 @@ void PodcastService::SetListened(const PodcastEpisodeList& episodes_list,
|
||||||
bool listened) {
|
bool listened) {
|
||||||
PodcastEpisodeList episodes;
|
PodcastEpisodeList episodes;
|
||||||
QDateTime current_date_time = QDateTime::currentDateTime();
|
QDateTime current_date_time = QDateTime::currentDateTime();
|
||||||
for (auto episode : episodes_list) {
|
for (PodcastEpisode episode : episodes_list) {
|
||||||
episode.set_listened(listened);
|
episode.set_listened(listened);
|
||||||
if (listened) {
|
if (listened) {
|
||||||
episode.set_listened_date(current_date_time);
|
episode.set_listened_date(current_date_time);
|
||||||
|
@ -624,7 +624,7 @@ void PodcastService::SetListened(const QModelIndexList& episode_indexes,
|
||||||
PodcastEpisodeList episodes;
|
PodcastEpisodeList episodes;
|
||||||
|
|
||||||
// Get all the episodes from the indexes.
|
// Get all the episodes from the indexes.
|
||||||
for (auto& index : episode_indexes) {
|
for (const QModelIndex& index : episode_indexes) {
|
||||||
episodes << index.data(Role_Episode).value<PodcastEpisode>();
|
episodes << index.data(Role_Episode).value<PodcastEpisode>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,8 +22,8 @@
|
||||||
#include "internet/internetmodel.h"
|
#include "internet/internetmodel.h"
|
||||||
#include "internet/internetservice.h"
|
#include "internet/internetservice.h"
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
#include <QScopedPointer>
|
#include <QScopedPointer>
|
||||||
#include <boost/scoped_ptr.hpp>
|
|
||||||
|
|
||||||
class AddPodcastDialog;
|
class AddPodcastDialog;
|
||||||
class OrganiseDialog;
|
class OrganiseDialog;
|
||||||
|
@ -80,8 +80,8 @@ private slots:
|
||||||
|
|
||||||
void SubscriptionAdded(const Podcast& podcast);
|
void SubscriptionAdded(const Podcast& podcast);
|
||||||
void SubscriptionRemoved(const Podcast& podcast);
|
void SubscriptionRemoved(const Podcast& podcast);
|
||||||
void EpisodesAdded(const QList<PodcastEpisode>& episodes);
|
void EpisodesAdded(const PodcastEpisodeList& episodes);
|
||||||
void EpisodesUpdated(const QList<PodcastEpisode>& episodes);
|
void EpisodesUpdated(const PodcastEpisodeList& episodes);
|
||||||
|
|
||||||
void DownloadProgressChanged(const PodcastEpisode& episode,
|
void DownloadProgressChanged(const PodcastEpisode& episode,
|
||||||
PodcastDownloader::State state,
|
PodcastDownloader::State state,
|
||||||
|
@ -141,7 +141,7 @@ private:
|
||||||
QAction* set_listened_action_;
|
QAction* set_listened_action_;
|
||||||
QAction* copy_to_device_;
|
QAction* copy_to_device_;
|
||||||
QStandardItem* root_;
|
QStandardItem* root_;
|
||||||
boost::scoped_ptr<OrganiseDialog> organise_dialog_;
|
std::unique_ptr<OrganiseDialog> organise_dialog_;
|
||||||
|
|
||||||
QModelIndexList explicitly_selected_podcasts_;
|
QModelIndexList explicitly_selected_podcasts_;
|
||||||
QModelIndexList selected_podcasts_;
|
QModelIndexList selected_podcasts_;
|
||||||
|
|
|
@ -85,7 +85,7 @@ OrganiseDialog::OrganiseDialog(TaskManager* task_manager, QWidget *parent)
|
||||||
// Build the insert menu
|
// Build the insert menu
|
||||||
QMenu* tag_menu = new QMenu(this);
|
QMenu* tag_menu = new QMenu(this);
|
||||||
QSignalMapper* tag_mapper = new QSignalMapper(this);
|
QSignalMapper* tag_mapper = new QSignalMapper(this);
|
||||||
for (const auto& title : tag_titles) {
|
for (const QString& title : tag_titles) {
|
||||||
QAction* action = tag_menu->addAction(title, tag_mapper, SLOT(map()));
|
QAction* action = tag_menu->addAction(title, tag_mapper, SLOT(map()));
|
||||||
tag_mapper->setMapping(action, tags[title]);
|
tag_mapper->setMapping(action, tags[title]);
|
||||||
}
|
}
|
||||||
|
@ -108,7 +108,7 @@ int OrganiseDialog::SetSongs(const SongList& songs) {
|
||||||
total_size_ = 0;
|
total_size_ = 0;
|
||||||
songs_.clear();
|
songs_.clear();
|
||||||
|
|
||||||
for (const auto& song : songs) {
|
for (const Song& song : songs) {
|
||||||
if (song.url().scheme() != "file") {
|
if (song.url().scheme() != "file") {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -130,7 +130,7 @@ int OrganiseDialog::SetUrls(const QList<QUrl> &urls, quint64 total_size) {
|
||||||
Song song;
|
Song song;
|
||||||
|
|
||||||
// Only add file:// URLs
|
// Only add file:// URLs
|
||||||
for (const auto& url : urls) {
|
for (const QUrl& url : urls) {
|
||||||
if (url.scheme() != "file")
|
if (url.scheme() != "file")
|
||||||
continue;
|
continue;
|
||||||
TagReaderClient::Instance()->ReadFileBlocking(url.toLocalFile(), &song);
|
TagReaderClient::Instance()->ReadFileBlocking(url.toLocalFile(), &song);
|
||||||
|
@ -146,7 +146,7 @@ int OrganiseDialog::SetFilenames(const QStringList& filenames, quint64 total_siz
|
||||||
Song song;
|
Song song;
|
||||||
|
|
||||||
// Load some of the songs to show in the preview
|
// Load some of the songs to show in the preview
|
||||||
for (const auto& filename : filenames) {
|
for (const QString& filename : filenames) {
|
||||||
TagReaderClient::Instance()->ReadFileBlocking(song.basefilename(), &song);
|
TagReaderClient::Instance()->ReadFileBlocking(song.basefilename(), &song);
|
||||||
if (song.is_valid())
|
if (song.is_valid())
|
||||||
songs << song;
|
songs << song;
|
||||||
|
@ -210,7 +210,7 @@ void OrganiseDialog::UpdatePreviews() {
|
||||||
ui_->preview_group->setVisible(has_local_destination);
|
ui_->preview_group->setVisible(has_local_destination);
|
||||||
ui_->naming_group->setVisible(has_local_destination);
|
ui_->naming_group->setVisible(has_local_destination);
|
||||||
if (has_local_destination) {
|
if (has_local_destination) {
|
||||||
for (const auto& song : songs_) {
|
for (const Song& song : songs_) {
|
||||||
QString filename = storage->LocalPath() + "/" +
|
QString filename = storage->LocalPath() + "/" +
|
||||||
format_.GetFilenameForSong(song);
|
format_.GetFilenameForSong(song);
|
||||||
ui_->preview->addItem(QDir::toNativeSeparators(filename));
|
ui_->preview->addItem(QDir::toNativeSeparators(filename));
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#ifndef ORGANISEDIALOG_H
|
#ifndef ORGANISEDIALOG_H
|
||||||
#define ORGANISEDIALOG_H
|
#define ORGANISEDIALOG_H
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
@ -25,8 +26,6 @@
|
||||||
#include "core/organiseformat.h"
|
#include "core/organiseformat.h"
|
||||||
#include "core/song.h"
|
#include "core/song.h"
|
||||||
|
|
||||||
#include <boost/scoped_ptr.hpp>
|
|
||||||
|
|
||||||
class LibraryWatcher;
|
class LibraryWatcher;
|
||||||
class OrganiseErrorDialog;
|
class OrganiseErrorDialog;
|
||||||
class TaskManager;
|
class TaskManager;
|
||||||
|
@ -77,7 +76,7 @@ private:
|
||||||
SongList songs_;
|
SongList songs_;
|
||||||
quint64 total_size_;
|
quint64 total_size_;
|
||||||
|
|
||||||
boost::scoped_ptr<OrganiseErrorDialog> error_dialog_;
|
std::unique_ptr<OrganiseErrorDialog> error_dialog_;
|
||||||
|
|
||||||
bool resized_by_user_;
|
bool resized_by_user_;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue