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()
{
for (const QMetaObject::Connection &connection : m_connections) {
QObject::disconnect(connection);
}
}
QWidget *LauncherOptionPage::setupWidget()
@ -776,7 +773,7 @@ QWidget *LauncherOptionPage::setupWidget()
m_restoreArgsButton->setPixmap(
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"));
QObject::connect(m_restoreArgsButton, &IconButton::clicked, this, &LauncherOptionPage::restoreDefaultArguments);
connect(m_restoreArgsButton, &IconButton::clicked, this, &LauncherOptionPage::restoreDefaultArguments);
ui()->argumentsLineEdit->insertCustomButton(0, m_restoreArgsButton);
}
@ -790,20 +787,17 @@ QWidget *LauncherOptionPage::setupWidget()
// connect signals & slots
if (m_process) {
m_connections << connect(m_process, &SyncthingProcess::readyRead, this, &LauncherOptionPage::handleSyncthingReadyRead, Qt::QueuedConnection);
m_connections << connect(m_process,
static_cast<void (SyncthingProcess::*)(int exitCode, QProcess::ExitStatus exitStatus)>(&SyncthingProcess::finished), this,
connect(m_process, &SyncthingProcess::readyRead, this, &LauncherOptionPage::handleSyncthingReadyRead, Qt::QueuedConnection);
connect(m_process, static_cast<void (SyncthingProcess::*)(int exitCode, QProcess::ExitStatus exitStatus)>(&SyncthingProcess::finished), this,
&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) {
m_connections << connect(
m_launcher, &SyncthingLauncher::outputAvailable, this, &LauncherOptionPage::handleSyncthingOutputAvailable, Qt::QueuedConnection);
m_connections << connect(m_launcher, &SyncthingLauncher::exited, this, &LauncherOptionPage::handleSyncthingExited, Qt::QueuedConnection);
m_connections << connect(
m_launcher, &SyncthingLauncher::errorOccurred, this, &LauncherOptionPage::handleSyncthingError, Qt::QueuedConnection);
connect(m_launcher, &SyncthingLauncher::outputAvailable, this, &LauncherOptionPage::handleSyncthingOutputAvailable, Qt::QueuedConnection);
connect(m_launcher, &SyncthingLauncher::exited, this, &LauncherOptionPage::handleSyncthingExited, Qt::QueuedConnection);
connect(m_launcher, &SyncthingLauncher::errorOccurred, this, &LauncherOptionPage::handleSyncthingError, Qt::QueuedConnection);
}
QObject::connect(ui()->launchNowPushButton, &QPushButton::clicked, this, &LauncherOptionPage::launch);
QObject::connect(ui()->stopPushButton, &QPushButton::clicked, this, &LauncherOptionPage::stop);
connect(ui()->launchNowPushButton, &QPushButton::clicked, this, &LauncherOptionPage::launch);
connect(ui()->stopPushButton, &QPushButton::clicked, this, &LauncherOptionPage::stop);
return widget;
}

View File

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