forked from qt-creator/qt-creator
PerfProfiler: Allow creating trace points without valid project
We can still create trace points on the desktop device then. Change-Id: I123bece2d11a6405883e0bcec9b066cec4e017b9 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -26,6 +26,7 @@
|
|||||||
#include "perftracepointdialog.h"
|
#include "perftracepointdialog.h"
|
||||||
#include "ui_perftracepointdialog.h"
|
#include "ui_perftracepointdialog.h"
|
||||||
|
|
||||||
|
#include <projectexplorer/devicesupport/devicemanager.h>
|
||||||
#include <projectexplorer/kitinformation.h>
|
#include <projectexplorer/kitinformation.h>
|
||||||
#include <projectexplorer/project.h>
|
#include <projectexplorer/project.h>
|
||||||
#include <projectexplorer/session.h>
|
#include <projectexplorer/session.h>
|
||||||
@@ -46,17 +47,26 @@ PerfTracePointDialog::PerfTracePointDialog() :
|
|||||||
{
|
{
|
||||||
m_ui->setupUi(this);
|
m_ui->setupUi(this);
|
||||||
|
|
||||||
Project *currentProject = SessionManager::startupProject();
|
if (Project *currentProject = SessionManager::startupProject()) {
|
||||||
QTC_ASSERT(currentProject, return);
|
if (const Target *target = currentProject->activeTarget()) {
|
||||||
|
const Kit *kit = target->kit();
|
||||||
|
QTC_ASSERT(kit, return);
|
||||||
|
|
||||||
const Target *target = currentProject->activeTarget();
|
m_device = DeviceKitInformation::device(kit);
|
||||||
QTC_ASSERT(target, return);
|
if (!m_device) {
|
||||||
|
m_ui->textEdit->setPlainText(tr("Error: No device available for active target."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const Kit *kit = target->kit();
|
if (!m_device) {
|
||||||
QTC_ASSERT(kit, return);
|
const DeviceManager *deviceManager = DeviceManager::instance();
|
||||||
|
|
||||||
m_device = DeviceKitInformation::device(kit);
|
// There should at least be a desktop device.
|
||||||
QTC_ASSERT(m_device, return);
|
m_device = deviceManager->defaultDevice(Constants::DESKTOP_DEVICE_TYPE);
|
||||||
|
QTC_ASSERT(m_device, return);
|
||||||
|
}
|
||||||
|
|
||||||
QFile file(":/perfprofiler/tracepoints.sh");
|
QFile file(":/perfprofiler/tracepoints.sh");
|
||||||
if (file.open(QIODevice::ReadOnly)) {
|
if (file.open(QIODevice::ReadOnly)) {
|
||||||
|
Reference in New Issue
Block a user