Commit a8eb924a authored by hjk's avatar hjk

Debugger: Dissolve AnalyzerUtils::logToIssuesPane()

If the Error + popup combo is generic it should live in TaskHub.
If it is not, end user code should decide when to popup.
Not an intermediate level.

Change-Id: I195ba8c17c5cc192ff9762ed6f45629143bcbb35
Reviewed-by: Christian Stenger's avatarChristian Stenger <christian.stenger@qt.io>
parent 3a933281
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#include "clangstaticanalyzersettings.h" #include "clangstaticanalyzersettings.h"
#include "clangstaticanalyzerutils.h" #include "clangstaticanalyzerutils.h"
#include <debugger/analyzer/analyzerutils.h> #include <debugger/analyzer/analyzerconstants.h>
#include <clangcodemodel/clangutils.h> #include <clangcodemodel/clangutils.h>
...@@ -419,7 +419,8 @@ void ClangStaticAnalyzerRunControl::start() ...@@ -419,7 +419,8 @@ void ClangStaticAnalyzerRunControl::start()
const QString errorMessage = tr("Clang Static Analyzer: Invalid executable \"%1\", stop.") const QString errorMessage = tr("Clang Static Analyzer: Invalid executable \"%1\", stop.")
.arg(executable); .arg(executable);
appendMessage(errorMessage + QLatin1Char('\n'), Utils::ErrorMessageFormat); appendMessage(errorMessage + QLatin1Char('\n'), Utils::ErrorMessageFormat);
AnalyzerUtils::logToIssuesPane(Task::Error, errorMessage); TaskHub::addTask(Task::Error, errorMessage, Debugger::Constants::ANALYZERTASK_ID);
TaskHub::requestPopup();
emit finished(); emit finished();
return; return;
} }
...@@ -432,7 +433,8 @@ void ClangStaticAnalyzerRunControl::start() ...@@ -432,7 +433,8 @@ void ClangStaticAnalyzerRunControl::start()
const QString errorMessage const QString errorMessage
= tr("Clang Static Analyzer: Failed to create temporary dir, stop."); = tr("Clang Static Analyzer: Failed to create temporary dir, stop.");
appendMessage(errorMessage + QLatin1Char('\n'), Utils::ErrorMessageFormat); appendMessage(errorMessage + QLatin1Char('\n'), Utils::ErrorMessageFormat);
AnalyzerUtils::logToIssuesPane(Task::Error, errorMessage); TaskHub::addTask(Task::Error, errorMessage, Debugger::Constants::ANALYZERTASK_ID);
TaskHub::requestPopup();
emit finished(); emit finished();
return; return;
} }
...@@ -571,8 +573,8 @@ void ClangStaticAnalyzerRunControl::onRunnerFinishedWithFailure(const QString &e ...@@ -571,8 +573,8 @@ void ClangStaticAnalyzerRunControl::onRunnerFinishedWithFailure(const QString &e
+ QLatin1Char('\n') + QLatin1Char('\n')
, Utils::StdErrFormat); , Utils::StdErrFormat);
appendMessage(errorDetails, Utils::StdErrFormat); appendMessage(errorDetails, Utils::StdErrFormat);
AnalyzerUtils::logToIssuesPane(Task::Warning, errorMessage); TaskHub::addTask(Task::Warning, errorMessage, Debugger::Constants::ANALYZERTASK_ID);
AnalyzerUtils::logToIssuesPane(Task::Warning, errorDetails); TaskHub::addTask(Task::Warning, errorDetails, Debugger::Constants::ANALYZERTASK_ID);
handleFinished(); handleFinished();
} }
...@@ -605,8 +607,9 @@ void ClangStaticAnalyzerRunControl::finalize() ...@@ -605,8 +607,9 @@ void ClangStaticAnalyzerRunControl::finalize()
Utils::NormalMessageFormat); Utils::NormalMessageFormat);
if (m_filesNotAnalyzed != 0) { if (m_filesNotAnalyzed != 0) {
AnalyzerUtils::logToIssuesPane(Task::Error, QString msg = tr("Clang Static Analyzer: Not all files could be analyzed.");
tr("Clang Static Analyzer: Not all files could be analyzed.")); TaskHub::addTask(Task::Error, msg, Debugger::Constants::ANALYZERTASK_ID);
TaskHub::requestPopup();
} }
m_progress.reportFinished(); m_progress.reportFinished();
......
...@@ -25,10 +25,7 @@ ...@@ -25,10 +25,7 @@
#include "analyzerutils.h" #include "analyzerutils.h"
#include "analyzerconstants.h"
#include <cpptools/cppmodelmanager.h> #include <cpptools/cppmodelmanager.h>
#include <projectexplorer/taskhub.h>
#include <texteditor/texteditor.h> #include <texteditor/texteditor.h>
#include <texteditor/textdocument.h> #include <texteditor/textdocument.h>
...@@ -39,7 +36,6 @@ ...@@ -39,7 +36,6 @@
#include <QTextCursor> #include <QTextCursor>
using namespace Debugger;
using namespace Core; using namespace Core;
using namespace ProjectExplorer; using namespace ProjectExplorer;
...@@ -89,10 +85,3 @@ CPlusPlus::Symbol *AnalyzerUtils::findSymbolUnderCursor() ...@@ -89,10 +85,3 @@ CPlusPlus::Symbol *AnalyzerUtils::findSymbolUnderCursor()
const CPlusPlus::LookupItem &lookupItem = lookupItems.first(); // ### TODO: select best candidate. const CPlusPlus::LookupItem &lookupItem = lookupItems.first(); // ### TODO: select best candidate.
return lookupItem.declaration(); return lookupItem.declaration();
} }
void AnalyzerUtils::logToIssuesPane(Task::TaskType type, const QString &message)
{
TaskHub::addTask(type, message, Debugger::Constants::ANALYZERTASK_ID);
if (type == Task::Error)
TaskHub::requestPopup();
}
...@@ -27,13 +27,9 @@ ...@@ -27,13 +27,9 @@
#include <debugger/debugger_global.h> #include <debugger/debugger_global.h>
#include <projectexplorer/task.h>
namespace CPlusPlus { class Symbol; } namespace CPlusPlus { class Symbol; }
namespace AnalyzerUtils namespace AnalyzerUtils
{ {
DEBUGGER_EXPORT CPlusPlus::Symbol *findSymbolUnderCursor(); DEBUGGER_EXPORT CPlusPlus::Symbol *findSymbolUnderCursor();
DEBUGGER_EXPORT void logToIssuesPane(ProjectExplorer::Task::TaskType type,
const QString &message);
} }
...@@ -78,6 +78,7 @@ ...@@ -78,6 +78,7 @@
#include <projectexplorer/projectexplorericons.h> #include <projectexplorer/projectexplorericons.h>
#include <projectexplorer/projecttree.h> #include <projectexplorer/projecttree.h>
#include <projectexplorer/session.h> #include <projectexplorer/session.h>
#include <projectexplorer/taskhub.h>
#include <utils/fancymainwindow.h> #include <utils/fancymainwindow.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
...@@ -909,8 +910,9 @@ void CallgrindTool::loadExternalLogFile() ...@@ -909,8 +910,9 @@ void CallgrindTool::loadExternalLogFile()
QFile logFile(filePath); QFile logFile(filePath);
if (!logFile.open(QIODevice::ReadOnly | QIODevice::Text)) { if (!logFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
AnalyzerUtils::logToIssuesPane(Task::Error, QString msg = tr("Callgrind: Failed to open file for reading: %1").arg(filePath);
tr("Callgrind: Failed to open file for reading: %1").arg(filePath)); TaskHub::addTask(Task::Error, msg, Debugger::Constants::ANALYZERTASK_ID);
TaskHub::requestPopup();
return; return;
} }
......
...@@ -53,6 +53,7 @@ ...@@ -53,6 +53,7 @@
#include <projectexplorer/project.h> #include <projectexplorer/project.h>
#include <projectexplorer/runconfiguration.h> #include <projectexplorer/runconfiguration.h>
#include <projectexplorer/target.h> #include <projectexplorer/target.h>
#include <projectexplorer/taskhub.h>
#include <projectexplorer/session.h> #include <projectexplorer/session.h>
#include <projectexplorer/buildconfiguration.h> #include <projectexplorer/buildconfiguration.h>
...@@ -592,8 +593,9 @@ void MemcheckTool::loadExternalXmlLogFile() ...@@ -592,8 +593,9 @@ void MemcheckTool::loadExternalXmlLogFile()
QFile *logFile = new QFile(filePath); QFile *logFile = new QFile(filePath);
if (!logFile->open(QIODevice::ReadOnly | QIODevice::Text)) { if (!logFile->open(QIODevice::ReadOnly | QIODevice::Text)) {
delete logFile; delete logFile;
AnalyzerUtils::logToIssuesPane(Task::Error, QString msg = tr("Memcheck: Failed to open file for reading: %1").arg(filePath);
tr("Memcheck: Failed to open file for reading: %1").arg(filePath)); TaskHub::addTask(Task::Error, msg, Debugger::Constants::ANALYZERTASK_ID);
TaskHub::requestPopup();
return; return;
} }
...@@ -623,8 +625,9 @@ void MemcheckTool::parserError(const Error &error) ...@@ -623,8 +625,9 @@ void MemcheckTool::parserError(const Error &error)
void MemcheckTool::internalParserError(const QString &errorString) void MemcheckTool::internalParserError(const QString &errorString)
{ {
AnalyzerUtils::logToIssuesPane(Task::Error, QString msg = tr("Memcheck: Error occurred parsing Valgrind output: %1").arg(errorString);
tr("Memcheck: Error occurred parsing Valgrind output: %1").arg(errorString)); TaskHub::addTask(Task::Error, msg, Debugger::Constants::ANALYZERTASK_ID);
TaskHub::requestPopup();
} }
void MemcheckTool::clearErrorView() void MemcheckTool::clearErrorView()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment