Don't keep track of LauncherOptionPage connections

Not required anymore when using QObject as base
This commit is contained in:
Martchus 2019-07-07 14:32:40 +02:00
parent 61716687c9
commit f7713c0b95
2 changed files with 9 additions and 16 deletions

View File

@ -750,9 +750,6 @@ LauncherOptionPage::LauncherOptionPage(const QString &tool, QWidget *parentWidge
LauncherOptionPage::~LauncherOptionPage() LauncherOptionPage::~LauncherOptionPage()
{ {
for (const QMetaObject::Connection &connection : m_connections) {
QObject::disconnect(connection);
}
} }
QWidget *LauncherOptionPage::setupWidget() QWidget *LauncherOptionPage::setupWidget()
@ -776,7 +773,7 @@ QWidget *LauncherOptionPage::setupWidget()
m_restoreArgsButton->setPixmap( m_restoreArgsButton->setPixmap(
QIcon::fromTheme(QStringLiteral("edit-undo"), QIcon(QStringLiteral(":/icons/hicolor/scalable/actions/edit-paste.svg"))).pixmap(16)); QIcon::fromTheme(QStringLiteral("edit-undo"), QIcon(QStringLiteral(":/icons/hicolor/scalable/actions/edit-paste.svg"))).pixmap(16));
m_restoreArgsButton->setToolTip(QCoreApplication::translate("QtGui::LauncherOptionPage", "Restore default")); m_restoreArgsButton->setToolTip(QCoreApplication::translate("QtGui::LauncherOptionPage", "Restore default"));
QObject::connect(m_restoreArgsButton, &IconButton::clicked, this, &LauncherOptionPage::restoreDefaultArguments); connect(m_restoreArgsButton, &IconButton::clicked, this, &LauncherOptionPage::restoreDefaultArguments);
ui()->argumentsLineEdit->insertCustomButton(0, m_restoreArgsButton); ui()->argumentsLineEdit->insertCustomButton(0, m_restoreArgsButton);
} }
@ -790,20 +787,17 @@ QWidget *LauncherOptionPage::setupWidget()
// connect signals & slots // connect signals & slots
if (m_process) { if (m_process) {
m_connections << connect(m_process, &SyncthingProcess::readyRead, this, &LauncherOptionPage::handleSyncthingReadyRead, Qt::QueuedConnection); connect(m_process, &SyncthingProcess::readyRead, this, &LauncherOptionPage::handleSyncthingReadyRead, Qt::QueuedConnection);
m_connections << connect(m_process, connect(m_process, static_cast<void (SyncthingProcess::*)(int exitCode, QProcess::ExitStatus exitStatus)>(&SyncthingProcess::finished), this,
static_cast<void (SyncthingProcess::*)(int exitCode, QProcess::ExitStatus exitStatus)>(&SyncthingProcess::finished), this,
&LauncherOptionPage::handleSyncthingExited, Qt::QueuedConnection); &LauncherOptionPage::handleSyncthingExited, Qt::QueuedConnection);
m_connections << connect(m_process, &SyncthingProcess::errorOccurred, this, &LauncherOptionPage::handleSyncthingError, Qt::QueuedConnection); connect(m_process, &SyncthingProcess::errorOccurred, this, &LauncherOptionPage::handleSyncthingError, Qt::QueuedConnection);
} else if (m_launcher) { } else if (m_launcher) {
m_connections << connect( connect(m_launcher, &SyncthingLauncher::outputAvailable, this, &LauncherOptionPage::handleSyncthingOutputAvailable, Qt::QueuedConnection);
m_launcher, &SyncthingLauncher::outputAvailable, this, &LauncherOptionPage::handleSyncthingOutputAvailable, Qt::QueuedConnection); connect(m_launcher, &SyncthingLauncher::exited, this, &LauncherOptionPage::handleSyncthingExited, Qt::QueuedConnection);
m_connections << connect(m_launcher, &SyncthingLauncher::exited, this, &LauncherOptionPage::handleSyncthingExited, Qt::QueuedConnection); connect(m_launcher, &SyncthingLauncher::errorOccurred, this, &LauncherOptionPage::handleSyncthingError, Qt::QueuedConnection);
m_connections << connect(
m_launcher, &SyncthingLauncher::errorOccurred, this, &LauncherOptionPage::handleSyncthingError, Qt::QueuedConnection);
} }
QObject::connect(ui()->launchNowPushButton, &QPushButton::clicked, this, &LauncherOptionPage::launch); connect(ui()->launchNowPushButton, &QPushButton::clicked, this, &LauncherOptionPage::launch);
QObject::connect(ui()->stopPushButton, &QPushButton::clicked, this, &LauncherOptionPage::stop); connect(ui()->stopPushButton, &QPushButton::clicked, this, &LauncherOptionPage::stop);
return widget; return widget;
} }

View File

@ -121,7 +121,6 @@ private:
Data::SyncthingProcess *const m_process; Data::SyncthingProcess *const m_process;
Data::SyncthingLauncher *const m_launcher; Data::SyncthingLauncher *const m_launcher;
QtUtilities::IconButton *m_restoreArgsButton; QtUtilities::IconButton *m_restoreArgsButton;
QList<QMetaObject::Connection> m_connections;
bool m_kill; bool m_kill;
QString m_tool; QString m_tool;
}; };