forked from qt-creator/qt-creator
Valgrind: Modernize test connections
Change-Id: I945bee28f04c1bba225a8c6a6f785b6cc5c9ac95 Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
This commit is contained in:
@@ -66,11 +66,12 @@ int main(int argc, char *argv[])
|
||||
runner.setParser(&parser);
|
||||
|
||||
ModelDemo demo(&runner);
|
||||
runner.connect(&runner, SIGNAL(finished()), &demo, SLOT(finished()));
|
||||
QObject::connect(&runner, &ValgrindRunner::finished,
|
||||
&demo, &ModelDemo::finished);
|
||||
ErrorListModel model;
|
||||
parser.connect(&parser, SIGNAL(error(Valgrind::XmlProtocol::Error)),
|
||||
&model, SLOT(addError(Valgrind::XmlProtocol::Error)),
|
||||
Qt::QueuedConnection);
|
||||
QObject::connect(&parser, &ThreadedParser::error,
|
||||
&model, &ErrorListModel::addError,
|
||||
Qt::QueuedConnection);
|
||||
|
||||
QTreeView errorview;
|
||||
errorview.setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
@@ -85,8 +86,8 @@ int main(int argc, char *argv[])
|
||||
stackView.setModel(&stackModel);
|
||||
stackView.show();
|
||||
|
||||
errorview.connect(errorview.selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
|
||||
&demo, SLOT(selectionChanged(QItemSelection,QItemSelection)));
|
||||
QObject::connect(errorview.selectionModel(), &QItemSelectionModel::selectionChanged,
|
||||
&demo, &ModelDemo::selectionChanged);
|
||||
|
||||
|
||||
runner.start();
|
||||
|
||||
@@ -59,12 +59,12 @@ public:
|
||||
explicit Recorder(Valgrind::XmlProtocol::Parser *parser, QObject *parent = 0)
|
||||
: QObject(parent)
|
||||
{
|
||||
connect(parser, SIGNAL(error(Valgrind::XmlProtocol::Error)),
|
||||
this, SLOT(error(Valgrind::XmlProtocol::Error)));
|
||||
connect(parser, SIGNAL(errorCount(qint64, qint64)),
|
||||
this, SLOT(errorCount(qint64, qint64)));
|
||||
connect(parser, SIGNAL(suppressionCount(QString, qint64)),
|
||||
this, SLOT(suppressionCount(QString, qint64)));
|
||||
connect(parser, &Valgrind::XmlProtocol::Parser::error,
|
||||
this, &Recorder::error);
|
||||
connect(parser, &Valgrind::XmlProtocol::Parser::errorCount,
|
||||
this, &Recorder::errorCount);
|
||||
connect(parser, &Valgrind::XmlProtocol::Parser::suppressionCount,
|
||||
this, &Recorder::suppressionCount);
|
||||
}
|
||||
|
||||
QList<Valgrind::XmlProtocol::Error> errors;
|
||||
@@ -98,16 +98,16 @@ public:
|
||||
: QObject()
|
||||
, m_errorReceived(false)
|
||||
{
|
||||
connect(parser, SIGNAL(error(Valgrind::XmlProtocol::Error)),
|
||||
this, SLOT(error(Valgrind::XmlProtocol::Error)));
|
||||
connect(parser, SIGNAL(internalError(QString)),
|
||||
this, SLOT(internalError(QString)));
|
||||
connect(parser, SIGNAL(status(Valgrind::XmlProtocol::Status)),
|
||||
this, SLOT(status(Valgrind::XmlProtocol::Status)));
|
||||
connect(runner, SIGNAL(logMessageReceived(QByteArray)),
|
||||
this, SLOT(logMessageReceived(QByteArray)));
|
||||
connect(runner, SIGNAL(processErrorReceived(QString, QProcess::ProcessError)),
|
||||
this, SLOT(processErrorReceived(QString)));
|
||||
connect(parser, &Valgrind::XmlProtocol::ThreadedParser::error,
|
||||
this, &RunnerDumper::error);
|
||||
connect(parser, &Valgrind::XmlProtocol::ThreadedParser::internalError,
|
||||
this, &RunnerDumper::internalError);
|
||||
connect(parser, &Valgrind::XmlProtocol::ThreadedParser::status,
|
||||
this, &RunnerDumper::status);
|
||||
connect(runner, &Valgrind::Memcheck::MemcheckRunner::logMessageReceived,
|
||||
this, &RunnerDumper::logMessageReceived);
|
||||
connect(runner, &Valgrind::ValgrindRunner::processErrorReceived,
|
||||
this, &RunnerDumper::processErrorReceived);
|
||||
}
|
||||
|
||||
public slots:
|
||||
|
||||
@@ -136,16 +136,16 @@ void TestRunner::init()
|
||||
m_runner = new MemcheckRunner;
|
||||
m_runner->setValgrindExecutable(QLatin1String("valgrind"));
|
||||
m_runner->setProcessChannelMode(QProcess::ForwardedChannels);
|
||||
connect(m_runner, SIGNAL(logMessageReceived(QByteArray)),
|
||||
this, SLOT(logMessageReceived(QByteArray)));
|
||||
connect(m_runner, SIGNAL(processErrorReceived(QString,QProcess::ProcessError)),
|
||||
this, SLOT(internalError(QString)));
|
||||
connect(m_runner, &MemcheckRunner::logMessageReceived,
|
||||
this, &TestRunner::logMessageReceived);
|
||||
connect(m_runner, &ValgrindRunner::processErrorReceived,
|
||||
this, &TestRunner::internalError);
|
||||
Q_ASSERT(!m_parser);
|
||||
m_parser = new ThreadedParser;
|
||||
connect(m_parser, SIGNAL(internalError(QString)),
|
||||
this, SLOT(internalError(QString)));
|
||||
connect(m_parser, SIGNAL(error(Valgrind::XmlProtocol::Error)),
|
||||
this, SLOT(error(Valgrind::XmlProtocol::Error)));
|
||||
connect(m_parser, &ThreadedParser::internalError,
|
||||
this, &TestRunner::internalError);
|
||||
connect(m_parser, &ThreadedParser::error,
|
||||
this, &TestRunner::error);
|
||||
|
||||
m_runner->setParser(m_parser);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user