On cancel analyzer setup the progress bar closes now.

During the start of the remote analyzer you can choose the network connection
to the remote analyzer. If you cancel this selection now the progressbar is set
to canceled, and will disapear after a certain amount of time.

Task-number: QTCREATORBUG-6014
Change-Id: I944f27adec11200d417266183e3d371606c89112
Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
David Schulz
2012-01-20 14:19:44 +01:00
committed by hjk
parent efe9bca20c
commit 800dfe4c9e
8 changed files with 27 additions and 22 deletions

View File

@@ -124,7 +124,6 @@ void AnalyzerRunControl::start()
d->m_isRunning = true; d->m_isRunning = true;
emit started(); emit started();
} }
} }
RunControl::StopResult AnalyzerRunControl::stop() RunControl::StopResult AnalyzerRunControl::stop()

View File

@@ -70,10 +70,11 @@ CallgrindController *CallgrindRunner::controller() const
return m_controller; return m_controller;
} }
void CallgrindRunner::start() bool CallgrindRunner::start()
{ {
ValgrindRunner::start(); ValgrindRunner::start();
m_controller->setValgrindProcess(valgrindProcess()); m_controller->setValgrindProcess(valgrindProcess());
return true;
} }
void CallgrindRunner::processFinished(int ret, QProcess::ExitStatus status) void CallgrindRunner::processFinished(int ret, QProcess::ExitStatus status)

View File

@@ -55,7 +55,7 @@ public:
CallgrindController *controller() const; CallgrindController *controller() const;
bool isPaused() const; bool isPaused() const;
void start(); bool start();
signals: signals:
void statusMessage(const QString &message); void statusMessage(const QString &message);

View File

@@ -96,19 +96,19 @@ void MemcheckRunner::setParser(XmlProtocol::ThreadedParser *parser)
d->parser = parser; d->parser = parser;
} }
void MemcheckRunner::start() bool MemcheckRunner::start()
{ {
if (startMode() == Analyzer::StartLocal) { if (startMode() == Analyzer::StartLocal) {
QTC_ASSERT(d->parser, return); QTC_ASSERT(d->parser, return false);
bool check = d->xmlServer.listen(QHostAddress(QHostAddress::LocalHost)); bool check = d->xmlServer.listen(QHostAddress(QHostAddress::LocalHost));
QTC_ASSERT(check, return); QTC_ASSERT(check, return false);
d->xmlServer.setMaxPendingConnections(1); d->xmlServer.setMaxPendingConnections(1);
const quint16 xmlPortNumber = d->xmlServer.serverPort(); const quint16 xmlPortNumber = d->xmlServer.serverPort();
connect(&d->xmlServer, SIGNAL(newConnection()), SLOT(xmlSocketConnected())); connect(&d->xmlServer, SIGNAL(newConnection()), SLOT(xmlSocketConnected()));
check = d->logServer.listen(QHostAddress(QHostAddress::LocalHost)); check = d->logServer.listen(QHostAddress(QHostAddress::LocalHost));
QTC_ASSERT(check, return); QTC_ASSERT(check, return false);
d->logServer.setMaxPendingConnections(1); d->logServer.setMaxPendingConnections(1);
const quint16 logPortNumber = d->logServer.serverPort(); const quint16 logPortNumber = d->logServer.serverPort();
connect(&d->logServer, SIGNAL(newConnection()), SLOT(logSocketConnected())); connect(&d->logServer, SIGNAL(newConnection()), SLOT(logSocketConnected()));
@@ -123,7 +123,7 @@ void MemcheckRunner::start()
} }
if (startMode() == Analyzer::StartRemote) { if (startMode() == Analyzer::StartRemote) {
QTC_ASSERT(d->parser, return); QTC_ASSERT(d->parser, return false);
QList<QHostAddress> possibleHostAddresses; QList<QHostAddress> possibleHostAddresses;
//NOTE: ::allAddresses does not seem to work for usb interfaces... //NOTE: ::allAddresses does not seem to work for usb interfaces...
@@ -144,7 +144,7 @@ void MemcheckRunner::start()
if (possibleHostAddresses.isEmpty()) { if (possibleHostAddresses.isEmpty()) {
emit processErrorReceived(tr("No network interface found for remote analysis."), emit processErrorReceived(tr("No network interface found for remote analysis."),
QProcess::FailedToStart); QProcess::FailedToStart);
return; return false;
} else if (possibleHostAddresses.size() > 1) { } else if (possibleHostAddresses.size() > 1) {
QDialog dlg; QDialog dlg;
dlg.setWindowTitle(tr("Select Network Interface")); dlg.setWindowTitle(tr("Select Network Interface"));
@@ -171,27 +171,29 @@ void MemcheckRunner::start()
layout->addWidget(buttons); layout->addWidget(buttons);
dlg.setLayout(layout); dlg.setLayout(layout);
if (dlg.exec() != QDialog::Accepted) if (dlg.exec() != QDialog::Accepted) {
return; emit processErrorReceived(tr("No Network Interface was chosen for remote analysis"), QProcess::FailedToStart);
return false;
}
QTC_ASSERT(list->currentRow() >= 0, return); QTC_ASSERT(list->currentRow() >= 0, return false);
QTC_ASSERT(list->currentRow() < possibleHostAddresses.size(), return); QTC_ASSERT(list->currentRow() < possibleHostAddresses.size(), return false);
hostAddr = possibleHostAddresses.at(list->currentRow()); hostAddr = possibleHostAddresses.at(list->currentRow());
} else { } else {
hostAddr = possibleHostAddresses.first(); hostAddr = possibleHostAddresses.first();
} }
QString ip = hostAddr.toString(); QString ip = hostAddr.toString();
QTC_ASSERT(!ip.isEmpty(), return); QTC_ASSERT(!ip.isEmpty(), return false);
bool check = d->xmlServer.listen(hostAddr); bool check = d->xmlServer.listen(hostAddr);
QTC_ASSERT(check, return); QTC_ASSERT(check, return false);
d->xmlServer.setMaxPendingConnections(1); d->xmlServer.setMaxPendingConnections(1);
const quint16 xmlPortNumber = d->xmlServer.serverPort(); const quint16 xmlPortNumber = d->xmlServer.serverPort();
connect(&d->xmlServer, SIGNAL(newConnection()), SLOT(xmlSocketConnected())); connect(&d->xmlServer, SIGNAL(newConnection()), SLOT(xmlSocketConnected()));
check = d->logServer.listen(hostAddr); check = d->logServer.listen(hostAddr);
QTC_ASSERT(check, return); QTC_ASSERT(check, return false);
d->logServer.setMaxPendingConnections(1); d->logServer.setMaxPendingConnections(1);
const quint16 logPortNumber = d->logServer.serverPort(); const quint16 logPortNumber = d->logServer.serverPort();
connect(&d->logServer, SIGNAL(newConnection()), SLOT(logSocketConnected())); connect(&d->logServer, SIGNAL(newConnection()), SLOT(logSocketConnected()));
@@ -204,7 +206,7 @@ void MemcheckRunner::start()
setValgrindArguments(memcheckArguments); setValgrindArguments(memcheckArguments);
} }
ValgrindRunner::start(); return ValgrindRunner::start();
} }
void MemcheckRunner::xmlSocketConnected() void MemcheckRunner::xmlSocketConnected()

View File

@@ -54,7 +54,7 @@ public:
~MemcheckRunner(); ~MemcheckRunner();
void setParser(XmlProtocol::ThreadedParser *parser); void setParser(XmlProtocol::ThreadedParser *parser);
void start(); bool start();
signals: signals:
void logMessageReceived(const QByteArray &); void logMessageReceived(const QByteArray &);

View File

@@ -117,8 +117,10 @@ bool ValgrindEngine::start()
connect(runner(), SIGNAL(finished()), connect(runner(), SIGNAL(finished()),
SLOT(runnerFinished())); SLOT(runnerFinished()));
runner()->start(); if (!runner()->start()) {
m_progress->cancel();
return false;
}
return true; return true;
} }

View File

@@ -219,12 +219,13 @@ void ValgrindRunner::waitForFinished() const
loop.exec(); loop.exec();
} }
void ValgrindRunner::start() bool ValgrindRunner::start()
{ {
if (d->startMode == Analyzer::StartLocal) if (d->startMode == Analyzer::StartLocal)
d->run(new LocalValgrindProcess(this)); d->run(new LocalValgrindProcess(this));
else if (d->startMode == Analyzer::StartRemote) else if (d->startMode == Analyzer::StartRemote)
d->run(new RemoteValgrindProcess(d->connParams, this)); d->run(new RemoteValgrindProcess(d->connParams, this));
return true;
} }
void ValgrindRunner::processError(QProcess::ProcessError e) void ValgrindRunner::processError(QProcess::ProcessError e)

View File

@@ -83,7 +83,7 @@ public:
QString errorString() const; QString errorString() const;
virtual void start(); virtual bool start();
virtual void stop(); virtual void stop();
ValgrindProcess *valgrindProcess() const; ValgrindProcess *valgrindProcess() const;