forked from qt-creator/qt-creator
Merge branch '2.3'
Conflicts: src/plugins/debugger/qml/qmlengine.cpp Change-Id: I46509f0c187b71bbaed7b2118a160914f8250ca4
This commit is contained in:
@@ -49,7 +49,7 @@ CodaQmlProfilerRunner::CodaQmlProfilerRunner(S60DeviceRunConfiguration *configur
|
||||
QObject *parent) :
|
||||
AbstractQmlProfilerRunner(parent),
|
||||
m_configuration(configuration),
|
||||
m_runControl(new CodaRunControl(configuration, "QmlProfiler"))
|
||||
m_runControl(new CodaRunControl(configuration, Analyzer::Constants::MODE_ANALYZE))
|
||||
{
|
||||
connect(m_runControl, SIGNAL(finished()), this, SIGNAL(stopped()));
|
||||
connect(m_runControl,
|
||||
|
||||
@@ -37,8 +37,8 @@ import "MainView.js" as Plotter
|
||||
Rectangle {
|
||||
id: root
|
||||
|
||||
property bool dataAvailable: false;
|
||||
property int eventCount: 0;
|
||||
property bool dataAvailable: true;
|
||||
property int eventCount: Plotter.ranges.length;
|
||||
|
||||
// move the cursor in the editor
|
||||
signal updateCursorPosition
|
||||
|
||||
@@ -13,7 +13,7 @@ Rectangle {
|
||||
}
|
||||
}
|
||||
|
||||
width: 200
|
||||
width: Math.max(200, statusText.width+20);
|
||||
height: displayColumn.height + 20
|
||||
|
||||
visible: false;
|
||||
@@ -27,11 +27,11 @@ Rectangle {
|
||||
id: displayColumn
|
||||
y: 10
|
||||
spacing: 5
|
||||
width: parent.width
|
||||
Text {
|
||||
id: statusText
|
||||
width: statusDisplay.width
|
||||
horizontalAlignment: "AlignHCenter"
|
||||
y: 10
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
|
||||
#include <QtGui/QMainWindow>
|
||||
#include <QtGui/QMessageBox>
|
||||
#include <QtCore/QTimer>
|
||||
|
||||
using namespace Analyzer;
|
||||
using namespace ProjectExplorer;
|
||||
@@ -69,7 +70,7 @@ class QmlProfilerEngine::QmlProfilerEnginePrivate
|
||||
{
|
||||
public:
|
||||
QmlProfilerEnginePrivate(QmlProfilerEngine *qq) : q(qq), m_runner(0) {}
|
||||
~QmlProfilerEnginePrivate() {}
|
||||
~QmlProfilerEnginePrivate() { delete m_runner; }
|
||||
|
||||
bool attach(const QString &address, uint port);
|
||||
static AbstractQmlProfilerRunner *createRunner(ProjectExplorer::RunConfiguration *runConfiguration,
|
||||
@@ -81,7 +82,9 @@ public:
|
||||
AbstractQmlProfilerRunner *m_runner;
|
||||
bool m_running;
|
||||
bool m_fetchingData;
|
||||
bool m_fetchDataFromStart;
|
||||
bool m_delayedDelete;
|
||||
QTimer m_noDebugOutputTimer;
|
||||
};
|
||||
|
||||
AbstractQmlProfilerRunner *
|
||||
@@ -116,7 +119,7 @@ QmlProfilerEngine::QmlProfilerEnginePrivate::createRunner(ProjectExplorer::RunCo
|
||||
qobject_cast<RemoteLinux::RemoteLinuxRunConfiguration *>(runConfiguration)) {
|
||||
runner = new RemoteLinuxQmlProfilerRunner(rmConfig, parent);
|
||||
} else {
|
||||
QTC_ASSERT(false, /**/);
|
||||
QTC_CHECK(false);
|
||||
}
|
||||
return runner;
|
||||
}
|
||||
@@ -132,7 +135,14 @@ QmlProfilerEngine::QmlProfilerEngine(IAnalyzerTool *tool,
|
||||
{
|
||||
d->m_running = false;
|
||||
d->m_fetchingData = false;
|
||||
d->m_fetchDataFromStart = false;
|
||||
d->m_delayedDelete = false;
|
||||
|
||||
// Only wait 4 seconds for the 'Waiting for connection' on application ouput, then just try to connect
|
||||
// (application output might be redirected / blocked)
|
||||
d->m_noDebugOutputTimer.setSingleShot(true);
|
||||
d->m_noDebugOutputTimer.setInterval(4000);
|
||||
connect(&d->m_noDebugOutputTimer, SIGNAL(timeout()), this, SLOT(processIsRunning()));
|
||||
}
|
||||
|
||||
QmlProfilerEngine::~QmlProfilerEngine()
|
||||
@@ -142,16 +152,19 @@ QmlProfilerEngine::~QmlProfilerEngine()
|
||||
delete d;
|
||||
}
|
||||
|
||||
void QmlProfilerEngine::start()
|
||||
bool QmlProfilerEngine::start()
|
||||
{
|
||||
QTC_ASSERT(!d->m_runner, return);
|
||||
if (d->m_runner) {
|
||||
delete d->m_runner;
|
||||
d->m_runner = 0;
|
||||
}
|
||||
|
||||
if (QmlProjectManager::QmlProjectRunConfiguration *rc =
|
||||
qobject_cast<QmlProjectManager::QmlProjectRunConfiguration *>(runConfiguration())) {
|
||||
if (rc->observerPath().isEmpty()) {
|
||||
QmlProjectManager::QmlProjectPlugin::showQmlObserverToolWarning();
|
||||
AnalyzerManager::stopTool();
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,7 +174,7 @@ void QmlProfilerEngine::start()
|
||||
if (!qmlRunner->hasExecutable()) {
|
||||
showNonmodalWarning(tr("No executable file to launch."));
|
||||
AnalyzerManager::stopTool();
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,16 +182,24 @@ void QmlProfilerEngine::start()
|
||||
connect(d->m_runner, SIGNAL(appendMessage(QString,Utils::OutputFormat)),
|
||||
this, SLOT(logApplicationMessage(QString,Utils::OutputFormat)));
|
||||
|
||||
d->m_noDebugOutputTimer.start();
|
||||
d->m_runner->start();
|
||||
|
||||
d->m_running = true;
|
||||
d->m_delayedDelete = false;
|
||||
|
||||
if (d->m_fetchDataFromStart) {
|
||||
d->m_fetchingData = true;
|
||||
}
|
||||
|
||||
AnalyzerManager::handleToolStarted();
|
||||
return true;
|
||||
}
|
||||
|
||||
void QmlProfilerEngine::stop()
|
||||
{
|
||||
// keep the flag for the next restart
|
||||
d->m_fetchDataFromStart = d->m_fetchingData;
|
||||
if (d->m_fetchingData) {
|
||||
if (d->m_running)
|
||||
d->m_delayedDelete = true;
|
||||
@@ -191,6 +212,10 @@ void QmlProfilerEngine::stop()
|
||||
|
||||
void QmlProfilerEngine::stopped()
|
||||
{
|
||||
// if it was killed, preserve recording flag
|
||||
if (d->m_running)
|
||||
d->m_fetchDataFromStart = d->m_fetchingData;
|
||||
|
||||
// user feedback
|
||||
if (d->m_running && d->m_fetchingData) {
|
||||
showNonmodalWarning(tr("Application finished before loading profiled data.\n Please use the stop button instead."));
|
||||
@@ -204,6 +229,8 @@ void QmlProfilerEngine::stopped()
|
||||
void QmlProfilerEngine::setFetchingData(bool b)
|
||||
{
|
||||
d->m_fetchingData = b;
|
||||
if (!d->m_running)
|
||||
d->m_fetchDataFromStart = b;
|
||||
}
|
||||
|
||||
void QmlProfilerEngine::dataReceived()
|
||||
@@ -230,6 +257,9 @@ void QmlProfilerEngine::filterApplicationMessage(const QString &msg)
|
||||
|
||||
const int index = msg.indexOf(qddserver);
|
||||
if (index != -1) {
|
||||
// we're actually getting debug output
|
||||
d->m_noDebugOutputTimer.stop();
|
||||
|
||||
QString status = msg;
|
||||
status.remove(0, index + qddserver.length()); // chop of 'QDeclarativeDebugServer: '
|
||||
|
||||
@@ -241,7 +271,7 @@ void QmlProfilerEngine::filterApplicationMessage(const QString &msg)
|
||||
|
||||
QString errorMessage;
|
||||
if (status.startsWith(waitingForConnection)) {
|
||||
emit processRunning(d->m_runner->debugPort());
|
||||
processIsRunning();
|
||||
} else if (status.startsWith(unableToListen)) {
|
||||
//: Error message shown after 'Could not connect ... debugger:"
|
||||
errorMessage = tr("The port seems to be in use.");
|
||||
@@ -273,7 +303,7 @@ void QmlProfilerEngine::filterApplicationMessage(const QString &msg)
|
||||
}
|
||||
} else if (msg.contains(cannotRetrieveDebuggingOutput)) {
|
||||
// we won't get debugging output, so just try to connect ...
|
||||
emit processRunning(d->m_runner->debugPort());
|
||||
processIsRunning();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -305,5 +335,11 @@ void QmlProfilerEngine::showNonmodalWarning(const QString &warningMsg)
|
||||
noExecWarning->show();
|
||||
}
|
||||
|
||||
void QmlProfilerEngine::processIsRunning()
|
||||
{
|
||||
d->m_noDebugOutputTimer.stop();
|
||||
emit processRunning(d->m_runner->debugPort());
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace QmlProfiler
|
||||
|
||||
@@ -54,7 +54,7 @@ signals:
|
||||
void stopRecording();
|
||||
|
||||
public slots:
|
||||
void start();
|
||||
bool start();
|
||||
void stop();
|
||||
|
||||
private slots:
|
||||
@@ -66,6 +66,7 @@ private slots:
|
||||
void logApplicationMessage(const QString &msg, Utils::OutputFormat format);
|
||||
void filterApplicationMessage(const QString &msg);
|
||||
void wrongSetupMessageBoxFinished(int);
|
||||
void processIsRunning();
|
||||
|
||||
private:
|
||||
class QmlProfilerEnginePrivate;
|
||||
|
||||
@@ -40,11 +40,13 @@
|
||||
|
||||
#include <projectexplorer/applicationrunconfiguration.h>
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
#include <projectexplorer/target.h>
|
||||
|
||||
#include <remotelinux/linuxdeviceconfiguration.h>
|
||||
#include <remotelinux/remotelinuxrunconfiguration.h>
|
||||
#include <qt4projectmanager/qt-s60/s60devicedebugruncontrol.h>
|
||||
#include <qt4projectmanager/qt-s60/s60devicerunconfiguration.h>
|
||||
#include <qt4projectmanager/qt-s60/s60deployconfiguration.h>
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
@@ -112,12 +114,12 @@ RunControl *QmlProfilerRunControlFactory::create(RunConfiguration *runConfigurat
|
||||
sp.displayName = rc3->displayName();
|
||||
} else if (Qt4ProjectManager::S60DeviceRunConfiguration *rc4 =
|
||||
qobject_cast<Qt4ProjectManager::S60DeviceRunConfiguration *>(runConfiguration)) {
|
||||
//sp.environment = rc4->environment();
|
||||
//sp.workingDirectory = rc4->workingDirectory();
|
||||
//sp.debuggee = rc4->executable();
|
||||
Qt4ProjectManager::S60DeployConfiguration *deployConf =
|
||||
qobject_cast<Qt4ProjectManager::S60DeployConfiguration *>(runConfiguration->target()->activeDeployConfiguration());
|
||||
|
||||
sp.debuggeeArgs = rc4->commandLineArguments();
|
||||
sp.displayName = rc4->displayName();
|
||||
sp.connParams.host = QLatin1String("localhost");
|
||||
sp.connParams.host = deployConf->deviceAddress();
|
||||
sp.connParams.port = rc4->qmlDebugServerPort();
|
||||
} else {
|
||||
// What could that be?
|
||||
|
||||
@@ -64,6 +64,7 @@
|
||||
#include <coreplugin/coreconstants.h>
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/messagemanager.h>
|
||||
|
||||
#include <qt4projectmanager/qt4buildconfiguration.h>
|
||||
#include <qt4projectmanager/qt-s60/s60deployconfiguration.h>
|
||||
@@ -102,7 +103,6 @@ public:
|
||||
Utils::FileInProjectFinder m_projectFinder;
|
||||
ProjectExplorer::RunConfiguration *m_runConfiguration;
|
||||
bool m_isAttached;
|
||||
QAction *m_attachAction;
|
||||
QToolButton *m_recordButton;
|
||||
QToolButton *m_clearButton;
|
||||
bool m_recordingEnabled;
|
||||
@@ -127,7 +127,6 @@ QmlProfilerTool::QmlProfilerTool(QObject *parent)
|
||||
d->m_project = 0;
|
||||
d->m_runConfiguration = 0;
|
||||
d->m_isAttached = false;
|
||||
d->m_attachAction = 0;
|
||||
d->m_recordingEnabled = true;
|
||||
|
||||
d->m_connectionTimer.setInterval(200);
|
||||
@@ -227,16 +226,6 @@ IAnalyzerEngine *QmlProfilerTool::createEngine(const AnalyzerStartParameters &sp
|
||||
return engine;
|
||||
}
|
||||
|
||||
void QmlProfilerTool::toolSelected()
|
||||
{
|
||||
updateAttachAction(true);
|
||||
}
|
||||
|
||||
void QmlProfilerTool::toolDeselected()
|
||||
{
|
||||
updateAttachAction(false);
|
||||
}
|
||||
|
||||
QWidget *QmlProfilerTool::createWidgets()
|
||||
{
|
||||
QTC_ASSERT(!d->m_traceWindow, return 0);
|
||||
@@ -279,15 +268,6 @@ QWidget *QmlProfilerTool::createWidgets()
|
||||
Core::ActionContainer *manalyzer = am->actionContainer(Analyzer::Constants::M_DEBUG_ANALYZER);
|
||||
const Core::Context globalcontext(Core::Constants::C_GLOBAL);
|
||||
|
||||
d->m_attachAction = new QAction(tr("Attach..."), manalyzer);
|
||||
Core::Command *command = am->registerAction(d->m_attachAction,
|
||||
Constants::ATTACH, globalcontext);
|
||||
command->setAttribute(Core::Command::CA_UpdateText);
|
||||
//manalyzer->addAction(command, Analyzer::Constants::G_ANALYZER_STARTSTOP);
|
||||
connect(d->m_attachAction, SIGNAL(triggered()), this, SLOT(attach()));
|
||||
|
||||
updateAttachAction(false);
|
||||
|
||||
QDockWidget *eventsDock = AnalyzerManager::createDockWidget
|
||||
(this, tr("Events"), d->m_eventsView, Qt::BottomDockWidgetArea);
|
||||
QDockWidget *timelineDock = AnalyzerManager::createDockWidget
|
||||
@@ -363,14 +343,10 @@ void QmlProfilerTool::connectToClient()
|
||||
return;
|
||||
|
||||
if (d->m_connectMode == QmlProfilerToolPrivate::TcpConnection) {
|
||||
if (QmlProfilerPlugin::debugOutput)
|
||||
qWarning("QML Profiler: Connecting to %s:%lld ...", qPrintable(d->m_tcpHost), d->m_tcpPort);
|
||||
|
||||
logStatus(QString("QML Profiler: Connecting to %1:%2 ...").arg(d->m_tcpHost, QString::number(d->m_tcpPort)));
|
||||
d->m_client->connectToHost(d->m_tcpHost, d->m_tcpPort);
|
||||
} else {
|
||||
if (QmlProfilerPlugin::debugOutput)
|
||||
qWarning("QML Profiler: Connecting to ost device %s...", qPrintable(d->m_ostDevice));
|
||||
|
||||
logStatus(QString("QML Profiler: Connecting to %1 ...").arg(d->m_tcpHost));
|
||||
d->m_client->connectToOst(d->m_ostDevice);
|
||||
}
|
||||
}
|
||||
@@ -479,16 +455,6 @@ void QmlProfilerTool::attach()
|
||||
}
|
||||
|
||||
d->m_isAttached = !d->m_isAttached;
|
||||
updateAttachAction(true);
|
||||
}
|
||||
|
||||
void QmlProfilerTool::updateAttachAction(bool isCurrentTool)
|
||||
{
|
||||
if (d->m_isAttached)
|
||||
d->m_attachAction->setText(tr("Detach"));
|
||||
else
|
||||
d->m_attachAction->setText(tr("Attach..."));
|
||||
d->m_attachAction->setEnabled(isCurrentTool);
|
||||
}
|
||||
|
||||
void QmlProfilerTool::tryToConnect()
|
||||
@@ -501,12 +467,11 @@ void QmlProfilerTool::tryToConnect()
|
||||
} else if (d->m_connectionAttempts == 50) {
|
||||
d->m_connectionTimer.stop();
|
||||
d->m_connectionAttempts = 0;
|
||||
if (QmlProfilerPlugin::debugOutput) {
|
||||
if (d->m_client) {
|
||||
qWarning("QML Profiler: Failed to connect: %s", qPrintable(d->m_client->errorString()));
|
||||
} else {
|
||||
qWarning("QML Profiler: Failed to connect.");
|
||||
}
|
||||
|
||||
if (d->m_client) {
|
||||
logError("QML Profiler: Failed to connect! " + d->m_client->errorString());
|
||||
} else {
|
||||
logError("QML Profiler: Failed to connect!");
|
||||
}
|
||||
emit connectionFailed();
|
||||
} else {
|
||||
@@ -575,3 +540,16 @@ void QmlProfilerTool::startTool(StartMode mode)
|
||||
Project *pro = pe->startupProject();
|
||||
pe->runProject(pro, id());
|
||||
}
|
||||
|
||||
void QmlProfilerTool::logStatus(const QString &msg)
|
||||
{
|
||||
Core::MessageManager *messageManager = Core::MessageManager::instance();
|
||||
messageManager->printToOutputPane(msg, false);
|
||||
}
|
||||
|
||||
void QmlProfilerTool::logError(const QString &msg)
|
||||
{
|
||||
// TODO: Rather show errors in the application ouput
|
||||
Core::MessageManager *messageManager = Core::MessageManager::instance();
|
||||
messageManager->printToOutputPane(msg, true);
|
||||
}
|
||||
|
||||
@@ -53,8 +53,6 @@ public:
|
||||
ToolMode toolMode() const;
|
||||
|
||||
void extensionsInitialized() {}
|
||||
void toolSelected();
|
||||
void toolDeselected();
|
||||
|
||||
Analyzer::IAnalyzerEngine *createEngine(const Analyzer::AnalyzerStartParameters &sp,
|
||||
ProjectExplorer::RunConfiguration *runConfiguration = 0);
|
||||
@@ -88,10 +86,11 @@ private slots:
|
||||
void connectionStateChanged();
|
||||
|
||||
private:
|
||||
void updateAttachAction(bool isCurrentTool);
|
||||
void connectToClient();
|
||||
void updateRecordingState();
|
||||
void ensureWidgets();
|
||||
void logStatus(const QString &msg);
|
||||
void logError(const QString &msg);
|
||||
|
||||
class QmlProfilerToolPrivate;
|
||||
QmlProfilerToolPrivate *d;
|
||||
|
||||
@@ -55,6 +55,9 @@ class QmlProfilerTraceClient : public QmlJsDebugClient::QDeclarativeDebugClient
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(bool recording READ isRecording WRITE setRecording NOTIFY recordingChanged)
|
||||
|
||||
// don't hide by signal
|
||||
using QObject::event;
|
||||
|
||||
public:
|
||||
QmlProfilerTraceClient(QmlJsDebugClient::QDeclarativeDebugConnection *client);
|
||||
|
||||
|
||||
@@ -159,7 +159,8 @@ void TraceWindow::clearDisplay()
|
||||
|
||||
void TraceWindow::updateToolbar()
|
||||
{
|
||||
bool dataAvailable = m_view->rootObject()->property("dataAvailable").toBool();
|
||||
bool dataAvailable = m_view->rootObject()->property("dataAvailable").toBool() &&
|
||||
m_view->rootObject()->property("eventCount").toInt() > 0;
|
||||
emit enableToolbar(dataAvailable);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user