diff --git a/src/plugins/analyzerbase/analyzerutils.cpp b/src/plugins/analyzerbase/analyzerutils.cpp index 1216f9cfb539b4faac3c6da27ff54bbece6d36ee..3d4e71747d457acf1c042a2b2239cf83b8472d45 100644 --- a/src/plugins/analyzerbase/analyzerutils.cpp +++ b/src/plugins/analyzerbase/analyzerutils.cpp @@ -33,6 +33,7 @@ #include "analyzerconstants.h" #include <cpptools/cppmodelmanager.h> +#include <projectexplorer/taskhub.h> #include <texteditor/texteditor.h> #include <texteditor/textdocument.h> @@ -46,6 +47,7 @@ using namespace Analyzer; using namespace Core; +using namespace ProjectExplorer; static void moveCursorToEndOfName(QTextCursor *tc) { @@ -93,3 +95,10 @@ CPlusPlus::Symbol *AnalyzerUtils::findSymbolUnderCursor() const CPlusPlus::LookupItem &lookupItem = lookupItems.first(); // ### TODO: select best candidate. return lookupItem.declaration(); } + +void AnalyzerUtils::logToIssuesPane(Task::TaskType type, const QString &message) +{ + TaskHub::addTask(type, message, Analyzer::Constants::ANALYZERTASK_ID); + if (type == Task::Error) + TaskHub::requestPopup(); +} diff --git a/src/plugins/analyzerbase/analyzerutils.h b/src/plugins/analyzerbase/analyzerutils.h index 210da4860d8e9052d2ec5d67459c19f0e37c25cf..a7d544e8b5d9f6294830ebae8e80a65366f6903c 100644 --- a/src/plugins/analyzerbase/analyzerutils.h +++ b/src/plugins/analyzerbase/analyzerutils.h @@ -33,15 +33,15 @@ #include "analyzerbase_global.h" -QT_BEGIN_NAMESPACE -class QWidget; -QT_END_NAMESPACE +#include <projectexplorer/task.h> namespace CPlusPlus { class Symbol; } namespace AnalyzerUtils { ANALYZER_EXPORT CPlusPlus::Symbol *findSymbolUnderCursor(); + ANALYZER_EXPORT void logToIssuesPane(ProjectExplorer::Task::TaskType type, + const QString &message); } #endif // ANALYZERUTILS_H diff --git a/src/plugins/valgrind/callgrindtool.cpp b/src/plugins/valgrind/callgrindtool.cpp index c658815aaadb6e36dab4180ec1f61cdd31ec1731..dcd2a1396b2080ca7df81405a5576de464613965 100644 --- a/src/plugins/valgrind/callgrindtool.cpp +++ b/src/plugins/valgrind/callgrindtool.cpp @@ -88,7 +88,6 @@ #include <QHBoxLayout> #include <QLineEdit> #include <QMenu> -#include <QMessageBox> #include <QSortFilterProxyModel> #include <QToolBar> #include <QToolButton> @@ -933,8 +932,8 @@ void CallgrindToolPrivate::loadExternalLogFile() QFile logFile(filePath); if (!logFile.open(QIODevice::ReadOnly | QIODevice::Text)) { - QMessageBox::critical(AnalyzerManager::mainWindow(), tr("Internal Error"), - tr("Failed to open file for reading: %1").arg(filePath)); + AnalyzerUtils::logToIssuesPane(Task::Error, + tr("Callgrind: Failed to open file for reading: %1").arg(filePath)); return; } diff --git a/src/plugins/valgrind/memchecktool.cpp b/src/plugins/valgrind/memchecktool.cpp index 4365c077dfc6a2f6fd65d657b1d079c377edc039..ebee6c1c3b1579d21224490b4ef4c3af11fd5c2f 100644 --- a/src/plugins/valgrind/memchecktool.cpp +++ b/src/plugins/valgrind/memchecktool.cpp @@ -36,6 +36,7 @@ #include "valgrindplugin.h" #include <analyzerbase/analyzermanager.h> +#include <analyzerbase/analyzerutils.h> #include <analyzerbase/analyzerconstants.h> #include <valgrind/valgrindsettings.h> @@ -83,7 +84,6 @@ #include <QSpinBox> #include <QAction> #include <QMenu> -#include <QMessageBox> #include <QToolButton> #include <QCheckBox> #include <utils/stylehelper.h> @@ -493,8 +493,8 @@ void MemcheckTool::loadExternalXmlLogFile() QFile *logFile = new QFile(filePath); if (!logFile->open(QIODevice::ReadOnly | QIODevice::Text)) { delete logFile; - QMessageBox::critical(m_errorView, tr("Internal Error"), - tr("Failed to open file for reading: %1").arg(filePath)); + AnalyzerUtils::logToIssuesPane(Task::Error, + tr("Memcheck: Failed to open file for reading: %1").arg(filePath)); return; } @@ -524,8 +524,8 @@ void MemcheckTool::parserError(const Error &error) void MemcheckTool::internalParserError(const QString &errorString) { - QMessageBox::critical(m_errorView, tr("Internal Error"), - tr("Error occurred parsing Valgrind output: %1").arg(errorString)); + AnalyzerUtils::logToIssuesPane(Task::Error, + tr("Memcheck: Error occurred parsing Valgrind output: %1").arg(errorString)); } void MemcheckTool::clearErrorView()