GUI: Add checked directory path to main window caption.

This commit is contained in:
Kimmo Varis 2009-06-22 18:45:48 +03:00
parent 3012bd5312
commit e3271115f2
2 changed files with 19 additions and 1 deletions

View File

@ -107,7 +107,7 @@ MainWindow::MainWindow() :
LoadSettings();
mThread->Initialize(&mResults);
setWindowTitle(tr("Cppcheck"));
FormatAndSetTitle();
EnableCheckButtons(true);
@ -233,6 +233,7 @@ void MainWindow::DoCheckFiles(QFileDialog::FileMode mode)
mSettings.value(tr("Check path"), "").toString());
if (selected.isEmpty())
mCurrentDirectory.clear();
FormatAndSetTitle();
}
else if (mode == QFileDialog::DirectoryOnly)
{
@ -243,6 +244,7 @@ void MainWindow::DoCheckFiles(QFileDialog::FileMode mode)
{
mCurrentDirectory = dir;
selected.append(dir);
FormatAndSetTitle(dir);
}
}
@ -566,3 +568,13 @@ void MainWindow::Save()
void MainWindow::ResultsAdded()
{
}
void MainWindow::FormatAndSetTitle(const QString &text)
{
QString title;
if (text.isEmpty())
title = tr("Cppcheck");
else
title = QString(tr("Cppcheck - %1")).arg(text);
setWindowTitle(title);
}

View File

@ -223,6 +223,12 @@ protected:
*/
void SaveSettings();
/**
* @brief Format main window title.
* @param text Text added to end of the title.
*/
void FormatAndSetTitle(const QString &text = QString());
/**
* @brief Program settings
*