From 7f5fe30e364399456ab1369b9e0251c3c2494176 Mon Sep 17 00:00:00 2001 From: gxalpha Date: Tue, 28 Feb 2023 15:12:57 +0100 Subject: [PATCH] UI: Replace SIGNAL and SLOT macros in remux Also removes a GCC 4.8-workaround that should have been solved using .data() on the QPointer instead of using a temporary variable. --- UI/window-remux.cpp | 39 +++++++++++++++++---------------------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/UI/window-remux.cpp b/UI/window-remux.cpp index 02d56a734..1603a9e96 100644 --- a/UI/window-remux.cpp +++ b/UI/window-remux.cpp @@ -114,8 +114,8 @@ QWidget *RemuxEntryPathItemDelegate::createEditor( QSizePolicy::ControlType::LineEdit)); layout->addWidget(text); - QObject::connect(text, SIGNAL(editingFinished()), this, - SLOT(updateText())); + QObject::connect(text, &QLineEdit::editingFinished, this, + &RemuxEntryPathItemDelegate::updateText); QToolButton *browseButton = new QToolButton(); browseButton->setText("..."); @@ -700,35 +700,30 @@ OBSRemux::OBSRemux(const char *path, QWidget *parent, bool autoRemux_) ->setText(QTStr("Remux.ClearAll")); ui->buttonBox->button(QDialogButtonBox::Reset)->setDisabled(true); - connect(ui->buttonBox->button(QDialogButtonBox::Ok), SIGNAL(clicked()), - this, SLOT(beginRemux())); + connect(ui->buttonBox->button(QDialogButtonBox::Ok), + &QPushButton::clicked, this, &OBSRemux::beginRemux); connect(ui->buttonBox->button(QDialogButtonBox::Reset), - SIGNAL(clicked()), this, SLOT(clearFinished())); + &QPushButton::clicked, this, &OBSRemux::clearFinished); connect(ui->buttonBox->button(QDialogButtonBox::RestoreDefaults), - SIGNAL(clicked()), this, SLOT(clearAll())); + &QPushButton::clicked, this, &OBSRemux::clearAll); connect(ui->buttonBox->button(QDialogButtonBox::Close), - SIGNAL(clicked()), this, SLOT(close())); + &QPushButton::clicked, this, &OBSRemux::close); worker->moveToThread(&remuxer); remuxer.start(); - //gcc-4.8 can't use QPointer below - RemuxWorker *worker_ = worker; - connect(worker_, &RemuxWorker::updateProgress, this, + connect(worker.data(), &RemuxWorker::updateProgress, this, &OBSRemux::updateProgress); - connect(&remuxer, &QThread::finished, worker_, &QObject::deleteLater); - connect(worker_, &RemuxWorker::remuxFinished, this, + connect(&remuxer, &QThread::finished, worker.data(), + &QObject::deleteLater); + connect(worker.data(), &RemuxWorker::remuxFinished, this, &OBSRemux::remuxFinished); - connect(this, &OBSRemux::remux, worker_, &RemuxWorker::remux); + connect(this, &OBSRemux::remux, worker.data(), &RemuxWorker::remux); - // Guessing the GCC bug mentioned above would also affect - // QPointer? Unsure. - RemuxQueueModel *queueModel_ = queueModel; - connect(queueModel_, - SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, - SLOT(rowCountChanged(const QModelIndex &, int, int))); - connect(queueModel_, SIGNAL(rowsRemoved(const QModelIndex &, int, int)), - this, SLOT(rowCountChanged(const QModelIndex &, int, int))); + connect(queueModel.data(), &RemuxQueueModel::rowsInserted, this, + &OBSRemux::rowCountChanged); + connect(queueModel.data(), &RemuxQueueModel::rowsRemoved, this, + &OBSRemux::rowCountChanged); QModelIndex index = queueModel->createIndex(0, 1); QMetaObject::invokeMethod(ui->tableView, "setCurrentIndex", @@ -945,7 +940,7 @@ void OBSRemux::remuxFinished(bool success) queueModel->finishEntry(success); if (autoRemux && autoRemuxFile != "") { - QTimer::singleShot(3000, this, SLOT(close())); + QTimer::singleShot(3000, this, &OBSRemux::close); OBSBasic *main = OBSBasic::Get(); main->ShowStatusBarMessage(