Commit c3acbc46 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh

CrashHandler: Use Qt5-style connects

The heavy lifting was done by clazy.

Change-Id: I236fca3e8741d0e8ff510045dc7e51dda076546a
Reviewed-by: Nikolai Kosjar's avatarNikolai Kosjar <nikolai.kosjar@qt.io>
parent f5560579
...@@ -49,11 +49,14 @@ public: ...@@ -49,11 +49,14 @@ public:
BacktraceCollector::BacktraceCollector(QObject *parent) : BacktraceCollector::BacktraceCollector(QObject *parent) :
QObject(parent), d(new BacktraceCollectorPrivate) QObject(parent), d(new BacktraceCollectorPrivate)
{ {
connect(&d->debugger, SIGNAL(finished(int,QProcess::ExitStatus)), connect(&d->debugger,
SLOT(onDebuggerFinished(int,QProcess::ExitStatus))); static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished),
connect(&d->debugger, SIGNAL(error(QProcess::ProcessError)), this, &BacktraceCollector::onDebuggerFinished);
SLOT(onDebuggerError(QProcess::ProcessError))); connect(&d->debugger,
connect(&d->debugger, SIGNAL(readyRead()), SLOT(onDebuggerOutputAvailable())); static_cast<void (QProcess::*)(QProcess::ProcessError)>(&QProcess::error),
this, &BacktraceCollector::onDebuggerError);
connect(&d->debugger, &QIODevice::readyRead,
this, &BacktraceCollector::onDebuggerOutputAvailable);
d->debugger.setProcessChannelMode(QProcess::MergedChannels); d->debugger.setProcessChannelMode(QProcess::MergedChannels);
} }
......
...@@ -45,12 +45,11 @@ signals: ...@@ -45,12 +45,11 @@ signals:
void backtrace(const QString &backtrace); void backtrace(const QString &backtrace);
void backtraceChunk(const QString &chunk); void backtraceChunk(const QString &chunk);
private slots: private:
void onDebuggerOutputAvailable(); void onDebuggerOutputAvailable();
void onDebuggerFinished(int exitCode, QProcess::ExitStatus exitStatus); void onDebuggerFinished(int exitCode, QProcess::ExitStatus exitStatus);
void onDebuggerError(QProcess::ProcessError err); void onDebuggerError(QProcess::ProcessError err);
private:
QString createTemporaryCommandFile(); QString createTemporaryCommandFile();
BacktraceCollectorPrivate *d; BacktraceCollectorPrivate *d;
......
...@@ -103,9 +103,11 @@ public: ...@@ -103,9 +103,11 @@ public:
CrashHandler::CrashHandler(pid_t pid, const QString &signalName, QObject *parent) CrashHandler::CrashHandler(pid_t pid, const QString &signalName, QObject *parent)
: QObject(parent), d(new CrashHandlerPrivate(pid, signalName, this)) : QObject(parent), d(new CrashHandlerPrivate(pid, signalName, this))
{ {
connect(&d->backtraceCollector, SIGNAL(error(QString)), SLOT(onError(QString))); connect(&d->backtraceCollector, &BacktraceCollector::error, this, &CrashHandler::onError);
connect(&d->backtraceCollector, SIGNAL(backtraceChunk(QString)), SLOT(onBacktraceChunk(QString))); connect(&d->backtraceCollector, &BacktraceCollector::backtraceChunk,
connect(&d->backtraceCollector, SIGNAL(backtrace(QString)), SLOT(onBacktraceFinished(QString))); this, &CrashHandler::onBacktraceChunk);
connect(&d->backtraceCollector, &BacktraceCollector::backtrace,
this, &CrashHandler::onBacktraceFinished);
d->dialog.appendDebugInfo(collectKernelVersionInfo()); d->dialog.appendDebugInfo(collectKernelVersionInfo());
d->dialog.appendDebugInfo(collectLinuxDistributionInfo()); d->dialog.appendDebugInfo(collectLinuxDistributionInfo());
......
...@@ -43,7 +43,6 @@ public: ...@@ -43,7 +43,6 @@ public:
void run(); void run();
public slots:
void onError(const QString &errorMessage); void onError(const QString &errorMessage);
void onBacktraceChunk(const QString &chunk); void onBacktraceChunk(const QString &chunk);
void onBacktraceFinished(const QString &backtrace); void onBacktraceFinished(const QString &backtrace);
......
...@@ -59,10 +59,13 @@ CrashHandlerDialog::CrashHandlerDialog(CrashHandler *handler, const QString &sig ...@@ -59,10 +59,13 @@ CrashHandlerDialog::CrashHandlerDialog(CrashHandler *handler, const QString &sig
QIcon icon = style->standardIcon(QStyle::SP_MessageBoxCritical); QIcon icon = style->standardIcon(QStyle::SP_MessageBoxCritical);
m_ui->iconLabel->setPixmap(icon.pixmap(iconSize, iconSize)); m_ui->iconLabel->setPixmap(icon.pixmap(iconSize, iconSize));
connect(m_ui->copyToClipBoardButton, SIGNAL(clicked()), this, SLOT(copyToClipboardClicked())); connect(m_ui->copyToClipBoardButton, &QAbstractButton::clicked,
connect(m_ui->reportBugButton, SIGNAL(clicked()), m_crashHandler, SLOT(openBugTracker())); this, &CrashHandlerDialog::copyToClipboardClicked);
connect(m_ui->debugAppButton, SIGNAL(clicked()), m_crashHandler, SLOT(debugApplication())); connect(m_ui->reportBugButton, &QAbstractButton::clicked,
connect(m_ui->closeButton, SIGNAL(clicked()), this, SLOT(close())); m_crashHandler, &CrashHandler::openBugTracker);
connect(m_ui->debugAppButton, &QAbstractButton::clicked,
m_crashHandler, &CrashHandler::debugApplication);
connect(m_ui->closeButton, &QAbstractButton::clicked, this, &CrashHandlerDialog::close);
setApplicationInfo(signalName); setApplicationInfo(signalName);
} }
......
...@@ -52,11 +52,10 @@ public: ...@@ -52,11 +52,10 @@ public:
void disableDebugAppButton(); void disableDebugAppButton();
bool runDebuggerWhileBacktraceNotFinished(); bool runDebuggerWhileBacktraceNotFinished();
private slots: private:
void copyToClipboardClicked(); void copyToClipboardClicked();
void close(); void close();
private:
CrashHandler *m_crashHandler; CrashHandler *m_crashHandler;
Ui::CrashHandlerDialog *m_ui; Ui::CrashHandlerDialog *m_ui;
}; };
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment