2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2016 The Qt Company Ltd.
|
2022-12-21 10:12:09 +01:00
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
2011-03-04 12:15:18 +01:00
|
|
|
|
2022-10-24 23:44:24 +02:00
|
|
|
#include <utils/commandline.h>
|
2022-06-20 12:26:37 +02:00
|
|
|
#include <utils/launcherinterface.h>
|
|
|
|
|
#include <utils/temporarydirectory.h>
|
|
|
|
|
|
2011-03-04 12:15:18 +01:00
|
|
|
#include <valgrind/xmlprotocol/frame.h>
|
|
|
|
|
#include <valgrind/xmlprotocol/parser.h>
|
|
|
|
|
#include <valgrind/xmlprotocol/stack.h>
|
|
|
|
|
#include <valgrind/xmlprotocol/status.h>
|
|
|
|
|
|
|
|
|
|
#include "modeldemo.h"
|
|
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QApplication>
|
|
|
|
|
#include <QTreeView>
|
2011-03-04 12:15:18 +01:00
|
|
|
|
|
|
|
|
using namespace Valgrind;
|
|
|
|
|
using namespace Valgrind::XmlProtocol;
|
|
|
|
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
|
|
|
{
|
|
|
|
|
QApplication app(argc, argv);
|
2022-06-20 12:26:37 +02:00
|
|
|
|
|
|
|
|
Utils::TemporaryDirectory::setMasterTemporaryDirectory(QDir::tempPath() + "/QtCreator-XXXXXX");
|
|
|
|
|
const QString libExecPath(qApp->applicationDirPath() + '/'
|
|
|
|
|
+ QLatin1String(TEST_RELATIVE_LIBEXEC_PATH));
|
|
|
|
|
Utils::LauncherInterface::setPathToLauncher(libExecPath);
|
|
|
|
|
|
2015-02-03 23:56:02 +02:00
|
|
|
qRegisterMetaType<Error>();
|
2011-03-04 12:15:18 +01:00
|
|
|
|
2017-06-21 08:08:43 +02:00
|
|
|
ValgrindRunner runner;
|
2019-07-23 10:17:57 +02:00
|
|
|
runner.setValgrindCommand({VALGRIND_FAKE_PATH,
|
2019-07-23 08:30:25 +02:00
|
|
|
{"-i", PARSERTESTS_DATA_DIR "/memcheck-output-sample1.xml"}});
|
2011-03-04 12:15:18 +01:00
|
|
|
ModelDemo demo(&runner);
|
2023-08-16 17:54:33 +02:00
|
|
|
QObject::connect(&runner, &ValgrindRunner::processErrorReceived, &app, [](const QString &err) {
|
|
|
|
|
qDebug() << err;
|
|
|
|
|
});
|
|
|
|
|
QObject::connect(&runner, &ValgrindRunner::done, &app, [](bool success) {
|
|
|
|
|
qApp->exit(success ? 0 : 1);
|
|
|
|
|
});
|
2011-03-04 12:15:18 +01:00
|
|
|
ErrorListModel model;
|
2023-08-05 10:17:55 +02:00
|
|
|
QObject::connect(&runner, &ValgrindRunner::error, &model, &ErrorListModel::addError,
|
2015-06-09 10:56:57 +02:00
|
|
|
Qt::QueuedConnection);
|
2011-03-04 12:15:18 +01:00
|
|
|
|
|
|
|
|
QTreeView errorview;
|
|
|
|
|
errorview.setSelectionMode(QAbstractItemView::SingleSelection);
|
|
|
|
|
errorview.setSelectionBehavior(QAbstractItemView::SelectRows);
|
|
|
|
|
errorview.setModel(&model);
|
|
|
|
|
errorview.show();
|
|
|
|
|
|
|
|
|
|
StackModel stackModel;
|
|
|
|
|
demo.stackModel = &stackModel;
|
|
|
|
|
|
|
|
|
|
QTreeView stackView;
|
|
|
|
|
stackView.setModel(&stackModel);
|
|
|
|
|
stackView.show();
|
|
|
|
|
|
2015-06-09 10:56:57 +02:00
|
|
|
QObject::connect(errorview.selectionModel(), &QItemSelectionModel::selectionChanged,
|
|
|
|
|
&demo, &ModelDemo::selectionChanged);
|
2011-03-04 12:15:18 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
runner.start();
|
|
|
|
|
|
|
|
|
|
return app.exec();
|
|
|
|
|
}
|