forked from qt-creator/qt-creator
Valgrind: Log errors to issues pane instead of popping up a QMessageBox.
Just as informative, but less intrusive and can't introduce event loop problems. Change-Id: I7dec17b1e82ba23340376075125f965017047959 Reviewed-by: hjk <hjk@theqtcompany.com>
This commit is contained in:
@@ -33,6 +33,7 @@
|
|||||||
#include "analyzerconstants.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>
|
||||||
|
|
||||||
@@ -46,6 +47,7 @@
|
|||||||
|
|
||||||
using namespace Analyzer;
|
using namespace Analyzer;
|
||||||
using namespace Core;
|
using namespace Core;
|
||||||
|
using namespace ProjectExplorer;
|
||||||
|
|
||||||
static void moveCursorToEndOfName(QTextCursor *tc)
|
static void moveCursorToEndOfName(QTextCursor *tc)
|
||||||
{
|
{
|
||||||
@@ -93,3 +95,10 @@ 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, Analyzer::Constants::ANALYZERTASK_ID);
|
||||||
|
if (type == Task::Error)
|
||||||
|
TaskHub::requestPopup();
|
||||||
|
}
|
||||||
|
@@ -33,15 +33,15 @@
|
|||||||
|
|
||||||
#include "analyzerbase_global.h"
|
#include "analyzerbase_global.h"
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
#include <projectexplorer/task.h>
|
||||||
class QWidget;
|
|
||||||
QT_END_NAMESPACE
|
|
||||||
|
|
||||||
namespace CPlusPlus { class Symbol; }
|
namespace CPlusPlus { class Symbol; }
|
||||||
|
|
||||||
namespace AnalyzerUtils
|
namespace AnalyzerUtils
|
||||||
{
|
{
|
||||||
ANALYZER_EXPORT CPlusPlus::Symbol *findSymbolUnderCursor();
|
ANALYZER_EXPORT CPlusPlus::Symbol *findSymbolUnderCursor();
|
||||||
|
ANALYZER_EXPORT void logToIssuesPane(ProjectExplorer::Task::TaskType type,
|
||||||
|
const QString &message);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // ANALYZERUTILS_H
|
#endif // ANALYZERUTILS_H
|
||||||
|
@@ -88,7 +88,6 @@
|
|||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QMessageBox>
|
|
||||||
#include <QSortFilterProxyModel>
|
#include <QSortFilterProxyModel>
|
||||||
#include <QToolBar>
|
#include <QToolBar>
|
||||||
#include <QToolButton>
|
#include <QToolButton>
|
||||||
@@ -933,8 +932,8 @@ void CallgrindToolPrivate::loadExternalLogFile()
|
|||||||
|
|
||||||
QFile logFile(filePath);
|
QFile logFile(filePath);
|
||||||
if (!logFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
if (!logFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||||
QMessageBox::critical(AnalyzerManager::mainWindow(), tr("Internal Error"),
|
AnalyzerUtils::logToIssuesPane(Task::Error,
|
||||||
tr("Failed to open file for reading: %1").arg(filePath));
|
tr("Callgrind: Failed to open file for reading: %1").arg(filePath));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -36,6 +36,7 @@
|
|||||||
#include "valgrindplugin.h"
|
#include "valgrindplugin.h"
|
||||||
|
|
||||||
#include <analyzerbase/analyzermanager.h>
|
#include <analyzerbase/analyzermanager.h>
|
||||||
|
#include <analyzerbase/analyzerutils.h>
|
||||||
#include <analyzerbase/analyzerconstants.h>
|
#include <analyzerbase/analyzerconstants.h>
|
||||||
|
|
||||||
#include <valgrind/valgrindsettings.h>
|
#include <valgrind/valgrindsettings.h>
|
||||||
@@ -83,7 +84,6 @@
|
|||||||
#include <QSpinBox>
|
#include <QSpinBox>
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QMessageBox>
|
|
||||||
#include <QToolButton>
|
#include <QToolButton>
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
#include <utils/stylehelper.h>
|
#include <utils/stylehelper.h>
|
||||||
@@ -493,8 +493,8 @@ 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;
|
||||||
QMessageBox::critical(m_errorView, tr("Internal Error"),
|
AnalyzerUtils::logToIssuesPane(Task::Error,
|
||||||
tr("Failed to open file for reading: %1").arg(filePath));
|
tr("Memcheck: Failed to open file for reading: %1").arg(filePath));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -524,8 +524,8 @@ void MemcheckTool::parserError(const Error &error)
|
|||||||
|
|
||||||
void MemcheckTool::internalParserError(const QString &errorString)
|
void MemcheckTool::internalParserError(const QString &errorString)
|
||||||
{
|
{
|
||||||
QMessageBox::critical(m_errorView, tr("Internal Error"),
|
AnalyzerUtils::logToIssuesPane(Task::Error,
|
||||||
tr("Error occurred parsing Valgrind output: %1").arg(errorString));
|
tr("Memcheck: Error occurred parsing Valgrind output: %1").arg(errorString));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MemcheckTool::clearErrorView()
|
void MemcheckTool::clearErrorView()
|
||||||
|
Reference in New Issue
Block a user