Connection syntax migration (#637)
This commit is contained in:
@@ -32,18 +32,20 @@ AddStreamDialog::AddStreamDialog(QWidget* parent) : QDialog(parent), ui_(new Ui_
|
||||
|
||||
ui_->setupUi(this);
|
||||
|
||||
connect(ui_->url, SIGNAL(textChanged(QString)), SLOT(TextChanged(QString)));
|
||||
QObject::connect(ui_->url, &QLineEdit::textChanged, this, &AddStreamDialog::TextChanged);
|
||||
TextChanged(QString());
|
||||
|
||||
}
|
||||
|
||||
AddStreamDialog::~AddStreamDialog() { delete ui_; }
|
||||
|
||||
void AddStreamDialog::showEvent(QShowEvent*) {
|
||||
void AddStreamDialog::showEvent(QShowEvent *e) {
|
||||
|
||||
ui_->url->setFocus();
|
||||
ui_->url->selectAll();
|
||||
|
||||
QDialog::showEvent(e);
|
||||
|
||||
}
|
||||
|
||||
void AddStreamDialog::TextChanged(const QString &text) {
|
||||
|
||||
@@ -38,7 +38,7 @@ class AddStreamDialog : public QDialog {
|
||||
void set_url(const QUrl &url) { ui_->url->setText(url.toString());}
|
||||
|
||||
protected:
|
||||
void showEvent(QShowEvent*) override;
|
||||
void showEvent(QShowEvent *e) override;
|
||||
|
||||
private slots:
|
||||
void TextChanged(const QString &text);
|
||||
|
||||
@@ -45,7 +45,7 @@ Console::Console(Application *app, QWidget *parent) : QDialog(parent), app_(app)
|
||||
|
||||
setWindowFlags(windowFlags()|Qt::WindowMaximizeButtonHint);
|
||||
|
||||
connect(ui_.run, SIGNAL(clicked()), SLOT(RunQuery()));
|
||||
QObject::connect(ui_.run, &QPushButton::clicked, this, &Console::RunQuery);
|
||||
|
||||
QFont font("Monospace");
|
||||
font.setStyleHint(QFont::TypeWriter);
|
||||
|
||||
@@ -69,7 +69,7 @@ DeleteConfirmationDialog::DeleteConfirmationDialog(const QStringList &files, QWi
|
||||
label_text_bottom->setText(tr("Are you sure you want to continue?"));
|
||||
|
||||
button_box_->setStandardButtons(QDialogButtonBox::Yes|QDialogButtonBox::Cancel);
|
||||
connect(button_box_, SIGNAL(clicked(QAbstractButton*)), this, SLOT(ButtonClicked(QAbstractButton*)));
|
||||
QObject::connect(button_box_, &QDialogButtonBox::clicked, this, &DeleteConfirmationDialog::ButtonClicked);
|
||||
|
||||
// Add layout
|
||||
QGridLayout *grid = new QGridLayout(this);
|
||||
|
||||
@@ -113,13 +113,13 @@ EditTagDialog::EditTagDialog(Application *app, QWidget *parent)
|
||||
|
||||
cover_options_.default_output_image_ = AlbumCoverLoader::ScaleAndPad(cover_options_, QImage(":/pictures/cdcase.png")).first;
|
||||
|
||||
connect(app_->album_cover_loader(), SIGNAL(AlbumCoverLoaded(quint64, AlbumCoverLoaderResult)), SLOT(AlbumCoverLoaded(quint64, AlbumCoverLoaderResult)));
|
||||
QObject::connect(app_->album_cover_loader(), &AlbumCoverLoader::AlbumCoverLoaded, this, &EditTagDialog::AlbumCoverLoaded);
|
||||
|
||||
#if defined(HAVE_GSTREAMER) && defined(HAVE_CHROMAPRINT)
|
||||
connect(tag_fetcher_, SIGNAL(ResultAvailable(Song, SongList)), results_dialog_, SLOT(FetchTagFinished(Song, SongList)), Qt::QueuedConnection);
|
||||
connect(tag_fetcher_, SIGNAL(Progress(Song, QString)), results_dialog_, SLOT(FetchTagProgress(Song, QString)));
|
||||
connect(results_dialog_, SIGNAL(SongChosen(Song, Song)), SLOT(FetchTagSongChosen(Song, Song)));
|
||||
connect(results_dialog_, SIGNAL(finished(int)), tag_fetcher_, SLOT(Cancel()));
|
||||
QObject::connect(tag_fetcher_, &TagFetcher::ResultAvailable, results_dialog_, &TrackSelectionDialog::FetchTagFinished, Qt::QueuedConnection);
|
||||
QObject::connect(tag_fetcher_, &TagFetcher::Progress, results_dialog_, &TrackSelectionDialog::FetchTagProgress);
|
||||
QObject::connect(results_dialog_, &TrackSelectionDialog::SongChosen, this, &EditTagDialog::FetchTagSongChosen);
|
||||
QObject::connect(results_dialog_, &TrackSelectionDialog::finished, tag_fetcher_, &TagFetcher::Cancel);
|
||||
#endif
|
||||
|
||||
album_cover_choice_controller_->Init(app_);
|
||||
@@ -143,23 +143,22 @@ EditTagDialog::EditTagDialog(Application *app, QWidget *parent)
|
||||
// Store information about the field
|
||||
fields_ << FieldData(label, widget, widget->objectName());
|
||||
|
||||
// Connect the Reset signal
|
||||
if (dynamic_cast<ExtendedEditor*>(widget)) {
|
||||
connect(widget, SIGNAL(Reset()), SLOT(ResetField()));
|
||||
}
|
||||
|
||||
// Connect the edited signal
|
||||
if (qobject_cast<QLineEdit*>(widget)) {
|
||||
connect(widget, SIGNAL(textChanged(QString)), SLOT(FieldValueEdited()));
|
||||
if (LineEdit *lineedit = qobject_cast<LineEdit*>(widget)) {
|
||||
QObject::connect(lineedit, &LineEdit::textChanged, this, &EditTagDialog::FieldValueEdited);
|
||||
QObject::connect(lineedit, &LineEdit::Reset, this, &EditTagDialog::ResetField);
|
||||
}
|
||||
else if (qobject_cast<QPlainTextEdit*>(widget)) {
|
||||
connect(widget, SIGNAL(textChanged()), SLOT(FieldValueEdited()));
|
||||
else if (TextEdit *textedit = qobject_cast<TextEdit*>(widget)) {
|
||||
QObject::connect(textedit, &TextEdit::textChanged, this, &EditTagDialog::FieldValueEdited);
|
||||
QObject::connect(textedit, &TextEdit::Reset, this, &EditTagDialog::ResetField);
|
||||
}
|
||||
else if (qobject_cast<QSpinBox*>(widget)) {
|
||||
connect(widget, SIGNAL(valueChanged(int)), SLOT(FieldValueEdited()));
|
||||
else if (SpinBox *spinbox = qobject_cast<SpinBox*>(widget)) {
|
||||
QObject::connect(spinbox, QOverload<int>::of(&SpinBox::valueChanged), this, &EditTagDialog::FieldValueEdited);
|
||||
QObject::connect(spinbox, &SpinBox::Reset, this, &EditTagDialog::ResetField);
|
||||
}
|
||||
else if (qobject_cast<QCheckBox*>(widget)) {
|
||||
connect(widget, SIGNAL(stateChanged(int)), SLOT(FieldValueEdited()));
|
||||
else if (CheckBox *checkbox = qobject_cast<CheckBox*>(widget)) {
|
||||
QObject::connect(checkbox, &QCheckBox::stateChanged, this, &EditTagDialog::FieldValueEdited);
|
||||
QObject::connect(checkbox, &CheckBox::Reset, this, &EditTagDialog::ResetField);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -179,11 +178,11 @@ EditTagDialog::EditTagDialog(Application *app, QWidget *parent)
|
||||
// Pretend the summary text is just a label
|
||||
ui_->summary->setMaximumHeight(ui_->art->height() - ui_->summary_art_button->height() - 4);
|
||||
|
||||
connect(ui_->song_list->selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)), SLOT(SelectionChanged()));
|
||||
connect(ui_->button_box, SIGNAL(clicked(QAbstractButton*)), SLOT(ButtonClicked(QAbstractButton*)));
|
||||
connect(ui_->playcount_reset, SIGNAL(clicked()), SLOT(ResetPlayCounts()));
|
||||
QObject::connect(ui_->song_list->selectionModel(), &QItemSelectionModel::selectionChanged, this, &EditTagDialog::SelectionChanged);
|
||||
QObject::connect(ui_->button_box, &QDialogButtonBox::clicked, this, &EditTagDialog::ButtonClicked);
|
||||
QObject::connect(ui_->playcount_reset, &QPushButton::clicked, this, &EditTagDialog::ResetPlayCounts);
|
||||
#if defined(HAVE_GSTREAMER) && defined(HAVE_CHROMAPRINT)
|
||||
connect(ui_->fetch_tag, SIGNAL(clicked()), SLOT(FetchTag()));
|
||||
QObject::connect(ui_->fetch_tag, &QPushButton::clicked, this, &EditTagDialog::FetchTag);
|
||||
#endif
|
||||
|
||||
// Set up the album cover menu
|
||||
@@ -191,12 +190,12 @@ EditTagDialog::EditTagDialog(Application *app, QWidget *parent)
|
||||
|
||||
QList<QAction*> actions = album_cover_choice_controller_->GetAllActions();
|
||||
|
||||
connect(album_cover_choice_controller_->cover_from_file_action(), SIGNAL(triggered()), this, SLOT(LoadCoverFromFile()));
|
||||
connect(album_cover_choice_controller_->cover_to_file_action(), SIGNAL(triggered()), this, SLOT(SaveCoverToFile()));
|
||||
connect(album_cover_choice_controller_->cover_from_url_action(), SIGNAL(triggered()), this, SLOT(LoadCoverFromURL()));
|
||||
connect(album_cover_choice_controller_->search_for_cover_action(), SIGNAL(triggered()), this, SLOT(SearchForCover()));
|
||||
connect(album_cover_choice_controller_->unset_cover_action(), SIGNAL(triggered()), this, SLOT(UnsetCover()));
|
||||
connect(album_cover_choice_controller_->show_cover_action(), SIGNAL(triggered()), this, SLOT(ShowCover()));
|
||||
QObject::connect(album_cover_choice_controller_->cover_from_file_action(), &QAction::triggered, this, &EditTagDialog::LoadCoverFromFile);
|
||||
QObject::connect(album_cover_choice_controller_->cover_to_file_action(), &QAction::triggered, this, &EditTagDialog::SaveCoverToFile);
|
||||
QObject::connect(album_cover_choice_controller_->cover_from_url_action(), &QAction::triggered, this, &EditTagDialog::LoadCoverFromURL);
|
||||
QObject::connect(album_cover_choice_controller_->search_for_cover_action(), &QAction::triggered, this, &EditTagDialog::SearchForCover);
|
||||
QObject::connect(album_cover_choice_controller_->unset_cover_action(), &QAction::triggered, this, &EditTagDialog::UnsetCover);
|
||||
QObject::connect(album_cover_choice_controller_->show_cover_action(), &QAction::triggered, this, &EditTagDialog::ShowCover);
|
||||
|
||||
cover_menu_->addActions(actions);
|
||||
|
||||
@@ -211,8 +210,8 @@ EditTagDialog::EditTagDialog(Application *app, QWidget *parent)
|
||||
ui_->button_box->addButton(previous_button_, QDialogButtonBox::ResetRole);
|
||||
ui_->button_box->addButton(next_button_, QDialogButtonBox::ResetRole);
|
||||
|
||||
connect(previous_button_, SIGNAL(clicked()), SLOT(PreviousSong()));
|
||||
connect(next_button_, SIGNAL(clicked()), SLOT(NextSong()));
|
||||
QObject::connect(previous_button_, &QPushButton::clicked, this, &EditTagDialog::PreviousSong);
|
||||
QObject::connect(next_button_, &QPushButton::clicked, this, &EditTagDialog::NextSong);
|
||||
|
||||
// Set some shortcuts for the buttons
|
||||
new QShortcut(QKeySequence::Back, previous_button_, SLOT(click()));
|
||||
@@ -775,7 +774,7 @@ void EditTagDialog::SaveData(const QList<Data> &tag_data) {
|
||||
const Data &ref = tag_data[i];
|
||||
if (ref.current_.IsMetadataEqual(ref.original_)) continue;
|
||||
|
||||
pending_++;
|
||||
++pending_;
|
||||
TagReaderReply *reply = TagReaderClient::Instance()->SaveFile(ref.current_.url().toLocalFile(), ref.current_);
|
||||
NewClosure(reply, SIGNAL(Finished(bool)), this, SLOT(SongSaveComplete(TagReaderReply*, QString, Song)), reply, ref.current_.url().toLocalFile(), ref.current_);
|
||||
|
||||
@@ -902,8 +901,8 @@ void EditTagDialog::FetchTag() {
|
||||
|
||||
SongList songs;
|
||||
|
||||
for (const QModelIndex &index : sel) {
|
||||
Song song = data_[index.row()].original_;
|
||||
for (const QModelIndex &idx : sel) {
|
||||
Song song = data_[idx.row()].original_;
|
||||
if (!song.is_valid()) {
|
||||
continue;
|
||||
}
|
||||
@@ -960,7 +959,7 @@ void EditTagDialog::FetchTagSongChosen(const Song &original_song, const Song &ne
|
||||
|
||||
void EditTagDialog::SongSaveComplete(TagReaderReply *reply, const QString &filename, const Song &song) {
|
||||
|
||||
pending_--;
|
||||
--pending_;
|
||||
|
||||
if (!reply->message().save_file_response().success()) {
|
||||
QString message = tr("An error occurred writing metadata to '%1'").arg(filename);
|
||||
|
||||
@@ -75,7 +75,7 @@ class EditTagDialog : public QDialog {
|
||||
void accept() override;
|
||||
|
||||
signals:
|
||||
void Error(const QString &message);
|
||||
void Error(QString message);
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject *o, QEvent *e) override;
|
||||
|
||||
@@ -58,6 +58,8 @@ ErrorDialog::~ErrorDialog() {
|
||||
|
||||
void ErrorDialog::ShowMessage(const QString &message) {
|
||||
|
||||
if (message.isEmpty()) return;
|
||||
|
||||
current_messages_ << message;
|
||||
UpdateContent();
|
||||
|
||||
@@ -83,4 +85,3 @@ void ErrorDialog::UpdateContent() {
|
||||
ui_->messages->setHtml(html);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -54,4 +54,3 @@ class ErrorDialog : public QDialog {
|
||||
};
|
||||
|
||||
#endif // ERRORDIALOG_H
|
||||
|
||||
|
||||
@@ -35,8 +35,7 @@ LastFMImportDialog::LastFMImportDialog(LastFMImport *lastfm_import, QWidget *par
|
||||
lastfm_import_(lastfm_import),
|
||||
finished_(false),
|
||||
playcount_total_(0),
|
||||
lastplayed_total_(0)
|
||||
{
|
||||
lastplayed_total_(0) {
|
||||
|
||||
ui_->setupUi(this);
|
||||
|
||||
@@ -46,21 +45,23 @@ LastFMImportDialog::LastFMImportDialog(LastFMImport *lastfm_import, QWidget *par
|
||||
|
||||
Reset();
|
||||
|
||||
connect(ui_->button_close, SIGNAL(clicked()), SLOT(Close()));
|
||||
connect(ui_->button_go, SIGNAL(clicked()), SLOT(Start()));
|
||||
connect(ui_->button_cancel, SIGNAL(clicked()), SLOT(Cancel()));
|
||||
QObject::connect(ui_->button_close, &QPushButton::clicked, this, &LastFMImportDialog::Close);
|
||||
QObject::connect(ui_->button_go, &QPushButton::clicked, this, &LastFMImportDialog::Start);
|
||||
QObject::connect(ui_->button_cancel, &QPushButton::clicked, this, &LastFMImportDialog::Cancel);
|
||||
|
||||
connect(ui_->checkbox_last_played, SIGNAL(stateChanged(int)), SLOT(UpdateGoButtonState()));
|
||||
connect(ui_->checkbox_playcounts, SIGNAL(stateChanged(int)), SLOT(UpdateGoButtonState()));
|
||||
QObject::connect(ui_->checkbox_last_played, &QCheckBox::stateChanged, this, &LastFMImportDialog::UpdateGoButtonState);
|
||||
QObject::connect(ui_->checkbox_playcounts, &QCheckBox::stateChanged, this, &LastFMImportDialog::UpdateGoButtonState);
|
||||
|
||||
}
|
||||
|
||||
LastFMImportDialog::~LastFMImportDialog() { delete ui_; }
|
||||
|
||||
void LastFMImportDialog::closeEvent(QCloseEvent*) {
|
||||
void LastFMImportDialog::closeEvent(QCloseEvent *e) {
|
||||
|
||||
ResetFinished();
|
||||
|
||||
QDialog::closeEvent(e);
|
||||
|
||||
}
|
||||
|
||||
void LastFMImportDialog::Start() {
|
||||
|
||||
@@ -39,7 +39,7 @@ class LastFMImportDialog : public QDialog {
|
||||
~LastFMImportDialog() override;
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent*) override;
|
||||
void closeEvent(QCloseEvent *e) override;
|
||||
|
||||
private:
|
||||
void ResetFinished();
|
||||
@@ -51,10 +51,11 @@ class LastFMImportDialog : public QDialog {
|
||||
void Close();
|
||||
void UpdateGoButtonState();
|
||||
|
||||
void UpdateTotal(const int lastplayed_total, const int playcount_total);
|
||||
void UpdateProgress(const int lastplayed_received, const int playcount_received);
|
||||
public slots:
|
||||
void Finished();
|
||||
void FinishedWithError(const QString &error);
|
||||
void UpdateTotal(const int lastplayed_total, const int playcount_total);
|
||||
void UpdateProgress(const int lastplayed_received, const int playcount_received);
|
||||
|
||||
private:
|
||||
Ui_LastFMImportDialog *ui_;
|
||||
|
||||
@@ -89,7 +89,7 @@ SnapDialog::SnapDialog(QWidget *parent) : QDialog(parent), ui_(new Ui_SnapDialog
|
||||
|
||||
ui_->buttonBox->button(QDialogButtonBox::Ok)->setShortcut(QKeySequence::Close);
|
||||
|
||||
connect(ui_->checkbox_do_not_show_message_again, SIGNAL(toggled(bool)), SLOT(DoNotShowMessageAgain()));
|
||||
QObject::connect(ui_->checkbox_do_not_show_message_again, &QCheckBox::toggled, this, &SnapDialog::DoNotShowMessageAgain);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -56,14 +56,13 @@
|
||||
TrackSelectionDialog::TrackSelectionDialog(QWidget *parent)
|
||||
: QDialog(parent),
|
||||
ui_(new Ui_TrackSelectionDialog),
|
||||
save_on_close_(false)
|
||||
{
|
||||
save_on_close_(false) {
|
||||
|
||||
// Setup dialog window
|
||||
ui_->setupUi(this);
|
||||
|
||||
connect(ui_->song_list, SIGNAL(currentRowChanged(int)), SLOT(UpdateStack()));
|
||||
connect(ui_->results, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), SLOT(ResultSelected()));
|
||||
QObject::connect(ui_->song_list, &QListWidget::currentRowChanged, this, &TrackSelectionDialog::UpdateStack);
|
||||
QObject::connect(ui_->results, &QTreeWidget::currentItemChanged, this, &TrackSelectionDialog::ResultSelected);
|
||||
|
||||
ui_->splitter->setSizes(QList<int>() << 200 << width() - 200);
|
||||
SetLoading(QString());
|
||||
@@ -74,8 +73,8 @@ TrackSelectionDialog::TrackSelectionDialog(QWidget *parent)
|
||||
ui_->button_box->addButton(previous_button_, QDialogButtonBox::ResetRole);
|
||||
ui_->button_box->addButton(next_button_, QDialogButtonBox::ResetRole);
|
||||
|
||||
connect(previous_button_, SIGNAL(clicked()), SLOT(PreviousSong()));
|
||||
connect(next_button_, SIGNAL(clicked()), SLOT(NextSong()));
|
||||
QObject::connect(previous_button_, &QPushButton::clicked, this, &TrackSelectionDialog::PreviousSong);
|
||||
QObject::connect(next_button_, &QPushButton::clicked, this, &TrackSelectionDialog::NextSong);
|
||||
|
||||
// Set some shortcuts for the buttons
|
||||
new QShortcut(QKeySequence::Back, previous_button_, SLOT(click()));
|
||||
@@ -294,7 +293,7 @@ void TrackSelectionDialog::accept() {
|
||||
QFuture<void> future = QtConcurrent::run(&TrackSelectionDialog::SaveData, data_);
|
||||
QFutureWatcher<void> *watcher = new QFutureWatcher<void>(this);
|
||||
watcher->setFuture(future);
|
||||
connect(watcher, SIGNAL(finished()), SLOT(AcceptFinished()));
|
||||
QObject::connect(watcher, &QFutureWatcher<void>::finished, this, &TrackSelectionDialog::AcceptFinished);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -53,8 +53,8 @@ class TrackSelectionDialog : public QDialog {
|
||||
void accept() override;
|
||||
|
||||
signals:
|
||||
void Error(const QString&);
|
||||
void SongChosen(const Song &original_song, const Song &new_metadata);
|
||||
void Error(QString);
|
||||
void SongChosen(Song original_song, Song new_metadata);
|
||||
|
||||
private slots:
|
||||
void UpdateStack();
|
||||
|
||||
Reference in New Issue
Block a user