Merge branch 'InternalErrors'

This commit is contained in:
Kimmo Varis 2010-08-29 09:41:11 +03:00
commit beb2cfdd5d
10 changed files with 73 additions and 5 deletions

View File

@ -48,6 +48,7 @@ ShowTypes;
#define SETTINGS_CHECK_THREADS "Check threads" #define SETTINGS_CHECK_THREADS "Check threads"
#define SETTINGS_SHOW_FULL_PATH "Show full path" #define SETTINGS_SHOW_FULL_PATH "Show full path"
#define SETTINGS_SHOW_NO_ERRORS "Show no errors message" #define SETTINGS_SHOW_NO_ERRORS "Show no errors message"
#define SETTINGS_SHOW_DEBUG_WARNINGS "Show debug warnings"
#define SETTINGS_SAVE_ALL_ERRORS "Save all errors" #define SETTINGS_SAVE_ALL_ERRORS "Save all errors"
#define SETTINGS_SAVE_FULL_PATH "Save full path" #define SETTINGS_SAVE_FULL_PATH "Save full path"
#define SETTINGS_CHECK_DIALOG_WIDTH "Check dialog width" #define SETTINGS_CHECK_DIALOG_WIDTH "Check dialog width"

View File

@ -37,3 +37,12 @@ ErrorItem::ErrorItem(const ErrorLine &line)
severity = line.severity; severity = line.severity;
msg = line.msg; msg = line.msg;
} }
QString ErrorItem::ToString() const
{
QString str = file + " - " + id + " - " + severity +"\n";
str += " " + msg;
for (int i = 0; i < files.size(); i++)
str += " " + files[i] + ": " + lines[i] + "\n";
return str;
}

View File

@ -39,6 +39,12 @@ public:
ErrorItem(const ErrorLine &line); ErrorItem(const ErrorLine &line);
~ErrorItem() { } ~ErrorItem() { }
/**
* @brief Convert error item to string.
* @return Error item as string.
*/
QString ToString() const;
QString file; QString file;
QStringList files; QStringList files;
QList<unsigned int> lines; QList<unsigned int> lines;

View File

@ -361,7 +361,7 @@ Settings MainWindow::GetCppcheckSettings()
} }
result.debug = false; result.debug = false;
result.debugwarnings = false; result.debugwarnings = mSettings->value(SETTINGS_SHOW_DEBUG_WARNINGS, 0).toBool();
result._checkCodingStyle = true; result._checkCodingStyle = true;
result._errorsOnly = false; result._errorsOnly = false;
result._verbose = true; result._verbose = true;
@ -819,6 +819,14 @@ void MainWindow::Log(const QString &logline)
} }
} }
void MainWindow::DebugError(const ErrorItem &item)
{
if (mLogView)
{
mLogView->AppendLine(item.ToString());
}
}
void MainWindow::EnableProjectActions(bool enable) void MainWindow::EnableProjectActions(bool enable)
{ {
mUI.mActionCloseProjectFile->setEnabled(enable); mUI.mActionCloseProjectFile->setEnabled(enable);

View File

@ -36,6 +36,7 @@ class ThreadHandler;
class LogView; class LogView;
class HelpWindow; class HelpWindow;
class Project; class Project;
class ErrorItem;
/// @addtogroup GUI /// @addtogroup GUI
/// @{ /// @{
@ -218,6 +219,12 @@ protected slots:
*/ */
void Log(const QString &logline); void Log(const QString &logline);
/**
* @brief Handle new debug error.
*
*/
void DebugError(const ErrorItem &item);
protected: protected:
/** /**

View File

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>589</width> <width>589</width>
<height>274</height> <height>281</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -17,7 +17,7 @@
<item> <item>
<widget class="QTabWidget" name="tabWidget"> <widget class="QTabWidget" name="tabWidget">
<property name="currentIndex"> <property name="currentIndex">
<number>1</number> <number>0</number>
</property> </property>
<widget class="QWidget" name="tab"> <widget class="QWidget" name="tab">
<attribute name="title"> <attribute name="title">
@ -61,6 +61,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QCheckBox" name="mShowDebugWarnings">
<property name="text">
<string>Show internal warnings in log</string>
</property>
</widget>
</item>
<item> <item>
<spacer name="verticalSpacer_2"> <spacer name="verticalSpacer_2">
<property name="orientation"> <property name="orientation">
@ -164,6 +171,22 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<tabstops>
<tabstop>tabWidget</tabstop>
<tabstop>mJobs</tabstop>
<tabstop>mForce</tabstop>
<tabstop>mShowFullPath</tabstop>
<tabstop>mShowNoErrorsMessage</tabstop>
<tabstop>mShowDebugWarnings</tabstop>
<tabstop>mListWidget</tabstop>
<tabstop>mButtonAdd</tabstop>
<tabstop>mButtonDelete</tabstop>
<tabstop>mButtonModify</tabstop>
<tabstop>mButtonDefault</tabstop>
<tabstop>mSaveAllErrors</tabstop>
<tabstop>mSaveFullPath</tabstop>
<tabstop>mButtons</tabstop>
</tabstops>
<resources/> <resources/>
<connections> <connections>
<connection> <connection>

View File

@ -46,7 +46,7 @@ SettingsDialog::SettingsDialog(QSettings *programSettings,
mUI.mForce->setCheckState(BoolToCheckState(programSettings->value(SETTINGS_CHECK_FORCE, false).toBool())); mUI.mForce->setCheckState(BoolToCheckState(programSettings->value(SETTINGS_CHECK_FORCE, false).toBool()));
mUI.mShowFullPath->setCheckState(BoolToCheckState(programSettings->value(SETTINGS_SHOW_FULL_PATH, false).toBool())); mUI.mShowFullPath->setCheckState(BoolToCheckState(programSettings->value(SETTINGS_SHOW_FULL_PATH, false).toBool()));
mUI.mShowNoErrorsMessage->setCheckState(BoolToCheckState(programSettings->value(SETTINGS_SHOW_NO_ERRORS, false).toBool())); mUI.mShowNoErrorsMessage->setCheckState(BoolToCheckState(programSettings->value(SETTINGS_SHOW_NO_ERRORS, false).toBool()));
mUI.mShowDebugWarnings->setCheckState(BoolToCheckState(programSettings->value(SETTINGS_SHOW_DEBUG_WARNINGS, false).toBool()));
connect(mUI.mButtonAdd, SIGNAL(clicked()), connect(mUI.mButtonAdd, SIGNAL(clicked()),
this, SLOT(AddApplication())); this, SLOT(AddApplication()));
@ -122,6 +122,7 @@ void SettingsDialog::SaveCheckboxValues()
SaveCheckboxValue(mUI.mSaveFullPath, SETTINGS_SAVE_FULL_PATH); SaveCheckboxValue(mUI.mSaveFullPath, SETTINGS_SAVE_FULL_PATH);
SaveCheckboxValue(mUI.mShowFullPath, SETTINGS_SHOW_FULL_PATH); SaveCheckboxValue(mUI.mShowFullPath, SETTINGS_SHOW_FULL_PATH);
SaveCheckboxValue(mUI.mShowNoErrorsMessage, SETTINGS_SHOW_NO_ERRORS); SaveCheckboxValue(mUI.mShowNoErrorsMessage, SETTINGS_SHOW_NO_ERRORS);
SaveCheckboxValue(mUI.mShowDebugWarnings, SETTINGS_SHOW_DEBUG_WARNINGS);
} }
void SettingsDialog::SaveCheckboxValue(QCheckBox *box, const QString &name) void SettingsDialog::SaveCheckboxValue(QCheckBox *box, const QString &name)

View File

@ -146,6 +146,9 @@ void ThreadHandler::Initialize(ResultsView *view)
connect(&mResults, SIGNAL(Log(const QString &)), connect(&mResults, SIGNAL(Log(const QString &)),
parent(), SLOT(Log(const QString &))); parent(), SLOT(Log(const QString &)));
connect(&mResults, SIGNAL(Error(const ErrorItem &)),
parent(), SLOT(Error(const ErrorItem &)));
} }
void ThreadHandler::LoadSettings(QSettings &settings) void ThreadHandler::LoadSettings(QSettings &settings)

View File

@ -71,7 +71,10 @@ void ThreadResult::reportErr(const ErrorLogger::ErrorMessage &msg)
item.msg = QString(msg._msg.c_str()); item.msg = QString(msg._msg.c_str());
item.severity = QString::fromStdString(Severity::toString(msg._severity)); item.severity = QString::fromStdString(Severity::toString(msg._severity));
if (msg._severity != Severity::debug)
emit Error(item); emit Error(item);
else
emit DebugError(item);
} }
QString ThreadResult::GetNextFile() QString ThreadResult::GetNextFile()

View File

@ -100,6 +100,13 @@ signals:
*/ */
void Log(const QString &logline); void Log(const QString &logline);
/**
* @brief Signal of a debug error
*
* @param item Error data
*/
void DebugError(const ErrorItem &item);
protected: protected:
/** /**