GUI: Rename methods
This commit is contained in:
parent
97a86313aa
commit
c1eb71e84d
|
@ -34,8 +34,8 @@ ApplicationDialog::ApplicationDialog(const QString &title,
|
|||
{
|
||||
mUI.setupUi(this);
|
||||
|
||||
connect(mUI.mButtonBrowse, SIGNAL(clicked()), this, SLOT(Browse()));
|
||||
connect(mUI.mButtons, SIGNAL(accepted()), this, SLOT(Ok()));
|
||||
connect(mUI.mButtonBrowse, SIGNAL(clicked()), this, SLOT(browse()));
|
||||
connect(mUI.mButtons, SIGNAL(accepted()), this, SLOT(ok()));
|
||||
connect(mUI.mButtons, SIGNAL(rejected()), this, SLOT(reject()));
|
||||
mUI.mPath->setText(app.getPath());
|
||||
mUI.mName->setText(app.getName());
|
||||
|
@ -50,7 +50,7 @@ ApplicationDialog::~ApplicationDialog()
|
|||
//dtor
|
||||
}
|
||||
|
||||
void ApplicationDialog::Browse()
|
||||
void ApplicationDialog::browse()
|
||||
{
|
||||
QString filter;
|
||||
#ifdef Q_OS_WIN
|
||||
|
@ -70,7 +70,7 @@ void ApplicationDialog::Browse()
|
|||
}
|
||||
}
|
||||
|
||||
void ApplicationDialog::Ok()
|
||||
void ApplicationDialog::ok()
|
||||
{
|
||||
if (mUI.mName->text().isEmpty() || mUI.mPath->text().isEmpty()) {
|
||||
QMessageBox msg(QMessageBox::Warning,
|
||||
|
|
|
@ -51,13 +51,13 @@ public:
|
|||
|
||||
protected slots:
|
||||
|
||||
void Ok();
|
||||
void ok();
|
||||
|
||||
/**
|
||||
* @brief Slot to browse for an application
|
||||
*
|
||||
*/
|
||||
void Browse();
|
||||
void browse();
|
||||
|
||||
protected:
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ void CheckThread::run()
|
|||
mCppcheck.analyseWholeProgram(buildDir, files2);
|
||||
}
|
||||
mFiles.clear();
|
||||
emit Done();
|
||||
emit done();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -73,7 +73,7 @@ void CheckThread::run()
|
|||
while (!file.isEmpty() && mState == Running) {
|
||||
qDebug() << "Checking file" << file;
|
||||
mCppcheck.check(file.toStdString());
|
||||
emit FileChecked(file);
|
||||
emit fileChecked(file);
|
||||
|
||||
if (mState == Running)
|
||||
file = mResult.getNextFile();
|
||||
|
@ -84,7 +84,7 @@ void CheckThread::run()
|
|||
file = QString::fromStdString(fileSettings.filename);
|
||||
qDebug() << "Checking file" << file;
|
||||
mCppcheck.check(fileSettings);
|
||||
emit FileChecked(file);
|
||||
emit fileChecked(file);
|
||||
|
||||
if (mState == Running)
|
||||
fileSettings = mResult.getNextFileSettings();
|
||||
|
@ -95,7 +95,7 @@ void CheckThread::run()
|
|||
else
|
||||
mState = Stopped;
|
||||
|
||||
emit Done();
|
||||
emit done();
|
||||
}
|
||||
|
||||
void CheckThread::stop()
|
||||
|
|
|
@ -67,9 +67,9 @@ signals:
|
|||
* @brief cpp checking is done
|
||||
*
|
||||
*/
|
||||
void Done();
|
||||
void done();
|
||||
|
||||
void FileChecked(const QString &file);
|
||||
void fileChecked(const QString &file);
|
||||
protected:
|
||||
|
||||
/**
|
||||
|
|
|
@ -65,7 +65,7 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
|
||||
TranslationHandler* th = new TranslationHandler(&app);
|
||||
th->SetLanguage(settings->value(SETTINGS_LANGUAGE, th->SuggestLanguage()).toString());
|
||||
th->setLanguage(settings->value(SETTINGS_LANGUAGE, th->suggestLanguage()).toString());
|
||||
|
||||
if (!CheckArgs(app.arguments()))
|
||||
return 0;
|
||||
|
|
|
@ -351,7 +351,7 @@ void MainWindow::saveSettings() const
|
|||
|
||||
mApplications->saveSettings();
|
||||
|
||||
mSettings->setValue(SETTINGS_LANGUAGE, mTranslation->GetCurrentLanguage());
|
||||
mSettings->setValue(SETTINGS_LANGUAGE, mTranslation->getCurrentLanguage());
|
||||
mUI.mResults->saveSettings(mSettings);
|
||||
}
|
||||
|
||||
|
@ -459,14 +459,14 @@ void MainWindow::checkCode(const QString& code, const QString& filename)
|
|||
// Initialize dummy ThreadResult as ErrorLogger
|
||||
ThreadResult result;
|
||||
result.setFiles(QStringList(filename));
|
||||
connect(&result, SIGNAL(Progress(int, const QString&)),
|
||||
mUI.mResults, SLOT(Progress(int, const QString&)));
|
||||
connect(&result, SIGNAL(Error(const ErrorItem &)),
|
||||
mUI.mResults, SLOT(Error(const ErrorItem &)));
|
||||
connect(&result, SIGNAL(Log(const QString &)),
|
||||
this, SLOT(Log(const QString &)));
|
||||
connect(&result, SIGNAL(DebugError(const ErrorItem &)),
|
||||
this, SLOT(DebugError(const ErrorItem &)));
|
||||
connect(&result, SIGNAL(progress(int, const QString&)),
|
||||
mUI.mResults, SLOT(progress(int, const QString&)));
|
||||
connect(&result, SIGNAL(error(const ErrorItem &)),
|
||||
mUI.mResults, SLOT(error(const ErrorItem &)));
|
||||
connect(&result, SIGNAL(log(const QString &)),
|
||||
this, SLOT(log(const QString &)));
|
||||
connect(&result, SIGNAL(debugError(const ErrorItem &)),
|
||||
this, SLOT(debugError(const ErrorItem &)));
|
||||
|
||||
// Create CppCheck instance
|
||||
CppCheck cppcheck(result, true);
|
||||
|
@ -895,13 +895,13 @@ void MainWindow::programSettings()
|
|||
{
|
||||
SettingsDialog dialog(mApplications, mTranslation, this);
|
||||
if (dialog.exec() == QDialog::Accepted) {
|
||||
dialog.SaveSettingValues();
|
||||
mUI.mResults->updateSettings(dialog.ShowFullPath(),
|
||||
dialog.SaveFullPath(),
|
||||
dialog.SaveAllErrors(),
|
||||
dialog.ShowNoErrorsMessage(),
|
||||
dialog.ShowErrorId(),
|
||||
dialog.ShowInconclusive());
|
||||
dialog.saveSettingValues();
|
||||
mUI.mResults->updateSettings(dialog.showFullPath(),
|
||||
dialog.saveFullPath(),
|
||||
dialog.saveAllErrors(),
|
||||
dialog.showNoErrorsMessage(),
|
||||
dialog.showErrorId(),
|
||||
dialog.showInconclusive());
|
||||
const QString newLang = mSettings->value(SETTINGS_LANGUAGE, "en").toString();
|
||||
setLanguage(newLang);
|
||||
}
|
||||
|
@ -1231,11 +1231,11 @@ void MainWindow::formatAndSetTitle(const QString &text)
|
|||
|
||||
void MainWindow::setLanguage(const QString &code)
|
||||
{
|
||||
const QString currentLang = mTranslation->GetCurrentLanguage();
|
||||
const QString currentLang = mTranslation->getCurrentLanguage();
|
||||
if (currentLang == code)
|
||||
return;
|
||||
|
||||
if (mTranslation->SetLanguage(code)) {
|
||||
if (mTranslation->setLanguage(code)) {
|
||||
//Translate everything that is visible here
|
||||
mUI.retranslateUi(this);
|
||||
mUI.mResults->translate();
|
||||
|
|
|
@ -86,11 +86,11 @@ bool Project::open()
|
|||
bool Project::edit()
|
||||
{
|
||||
ProjectFileDialog dlg(mFilename, mParentWidget);
|
||||
dlg.LoadFromProjectFile(mProjectFile);
|
||||
dlg.loadFromProjectFile(mProjectFile);
|
||||
if (dlg.exec() != QDialog::Accepted)
|
||||
return false;
|
||||
|
||||
dlg.SaveToProjectFile(mProjectFile);
|
||||
dlg.saveToProjectFile(mProjectFile);
|
||||
|
||||
if (!mProjectFile->write()) {
|
||||
QMessageBox msg(QMessageBox::Critical,
|
||||
|
|
|
@ -42,7 +42,7 @@ ProjectFileDialog::ProjectFileDialog(const QString &path, QWidget *parent)
|
|||
QString filename = inf.fileName();
|
||||
QString title = tr("Project file: %1").arg(filename);
|
||||
setWindowTitle(title);
|
||||
LoadSettings();
|
||||
loadSettings();
|
||||
|
||||
// Checkboxes for the libraries..
|
||||
const QString applicationFilePath = QCoreApplication::applicationFilePath();
|
||||
|
@ -91,66 +91,66 @@ ProjectFileDialog::ProjectFileDialog(const QString &path, QWidget *parent)
|
|||
}
|
||||
|
||||
connect(mUI.mButtons, SIGNAL(accepted()), this, SLOT(accept()));
|
||||
connect(mUI.mBtnBrowseBuildDir, SIGNAL(clicked()), this, SLOT(BrowseBuildDir()));
|
||||
connect(mUI.mBtnBrowseImportProject, SIGNAL(clicked()), this, SLOT(BrowseImportProject()));
|
||||
connect(mUI.mBtnAddCheckPath, SIGNAL(clicked()), this, SLOT(AddCheckPath()));
|
||||
connect(mUI.mBtnEditCheckPath, SIGNAL(clicked()), this, SLOT(EditCheckPath()));
|
||||
connect(mUI.mBtnRemoveCheckPath, SIGNAL(clicked()), this, SLOT(RemoveCheckPath()));
|
||||
connect(mUI.mBtnAddInclude, SIGNAL(clicked()), this, SLOT(AddIncludeDir()));
|
||||
connect(mUI.mBtnEditInclude, SIGNAL(clicked()), this, SLOT(EditIncludeDir()));
|
||||
connect(mUI.mBtnRemoveInclude, SIGNAL(clicked()), this, SLOT(RemoveIncludeDir()));
|
||||
connect(mUI.mBtnAddIgnorePath, SIGNAL(clicked()), this, SLOT(AddExcludePath()));
|
||||
connect(mUI.mBtnEditIgnorePath, SIGNAL(clicked()), this, SLOT(EditExcludePath()));
|
||||
connect(mUI.mBtnRemoveIgnorePath, SIGNAL(clicked()), this, SLOT(RemoveExcludePath()));
|
||||
connect(mUI.mBtnIncludeUp, SIGNAL(clicked()), this, SLOT(MoveIncludePathUp()));
|
||||
connect(mUI.mBtnIncludeDown, SIGNAL(clicked()), this, SLOT(MoveIncludePathDown()));
|
||||
connect(mUI.mBtnAddSuppression, SIGNAL(clicked()), this, SLOT(AddSuppression()));
|
||||
connect(mUI.mBtnRemoveSuppression, SIGNAL(clicked()), this, SLOT(RemoveSuppression()));
|
||||
connect(mUI.mBtnBrowseBuildDir, SIGNAL(clicked()), this, SLOT(browseBuildDir()));
|
||||
connect(mUI.mBtnBrowseImportProject, SIGNAL(clicked()), this, SLOT(browseImportProject()));
|
||||
connect(mUI.mBtnAddCheckPath, SIGNAL(clicked()), this, SLOT(addCheckPath()));
|
||||
connect(mUI.mBtnEditCheckPath, SIGNAL(clicked()), this, SLOT(editCheckPath()));
|
||||
connect(mUI.mBtnRemoveCheckPath, SIGNAL(clicked()), this, SLOT(removeCheckPath()));
|
||||
connect(mUI.mBtnAddInclude, SIGNAL(clicked()), this, SLOT(addIncludeDir()));
|
||||
connect(mUI.mBtnEditInclude, SIGNAL(clicked()), this, SLOT(editIncludeDir()));
|
||||
connect(mUI.mBtnRemoveInclude, SIGNAL(clicked()), this, SLOT(removeIncludeDir()));
|
||||
connect(mUI.mBtnAddIgnorePath, SIGNAL(clicked()), this, SLOT(addExcludePath()));
|
||||
connect(mUI.mBtnEditIgnorePath, SIGNAL(clicked()), this, SLOT(editExcludePath()));
|
||||
connect(mUI.mBtnRemoveIgnorePath, SIGNAL(clicked()), this, SLOT(removeExcludePath()));
|
||||
connect(mUI.mBtnIncludeUp, SIGNAL(clicked()), this, SLOT(moveIncludePathUp()));
|
||||
connect(mUI.mBtnIncludeDown, SIGNAL(clicked()), this, SLOT(moveIncludePathDown()));
|
||||
connect(mUI.mBtnAddSuppression, SIGNAL(clicked()), this, SLOT(addSuppression()));
|
||||
connect(mUI.mBtnRemoveSuppression, SIGNAL(clicked()), this, SLOT(removeSuppression()));
|
||||
}
|
||||
|
||||
ProjectFileDialog::~ProjectFileDialog()
|
||||
{
|
||||
SaveSettings();
|
||||
saveSettings();
|
||||
}
|
||||
|
||||
void ProjectFileDialog::LoadSettings()
|
||||
void ProjectFileDialog::loadSettings()
|
||||
{
|
||||
QSettings settings;
|
||||
resize(settings.value(SETTINGS_PROJECT_DIALOG_WIDTH, 470).toInt(),
|
||||
settings.value(SETTINGS_PROJECT_DIALOG_HEIGHT, 330).toInt());
|
||||
}
|
||||
|
||||
void ProjectFileDialog::SaveSettings() const
|
||||
void ProjectFileDialog::saveSettings() const
|
||||
{
|
||||
QSettings settings;
|
||||
settings.setValue(SETTINGS_PROJECT_DIALOG_WIDTH, size().width());
|
||||
settings.setValue(SETTINGS_PROJECT_DIALOG_HEIGHT, size().height());
|
||||
}
|
||||
|
||||
void ProjectFileDialog::LoadFromProjectFile(const ProjectFile *projectFile)
|
||||
void ProjectFileDialog::loadFromProjectFile(const ProjectFile *projectFile)
|
||||
{
|
||||
SetRootPath(projectFile->getRootPath());
|
||||
SetBuildDir(projectFile->getBuildDir());
|
||||
SetIncludepaths(projectFile->getIncludeDirs());
|
||||
SetDefines(projectFile->getDefines());
|
||||
SetCheckPaths(projectFile->getCheckPaths());
|
||||
SetImportProject(projectFile->getImportProject());
|
||||
SetExcludedPaths(projectFile->getExcludedPaths());
|
||||
SetLibraries(projectFile->getLibraries());
|
||||
SetSuppressions(projectFile->getSuppressions());
|
||||
setRootPath(projectFile->getRootPath());
|
||||
setBuildDir(projectFile->getBuildDir());
|
||||
setIncludepaths(projectFile->getIncludeDirs());
|
||||
setDefines(projectFile->getDefines());
|
||||
setCheckPaths(projectFile->getCheckPaths());
|
||||
setImportProject(projectFile->getImportProject());
|
||||
setExcludedPaths(projectFile->getExcludedPaths());
|
||||
setLibraries(projectFile->getLibraries());
|
||||
setSuppressions(projectFile->getSuppressions());
|
||||
}
|
||||
|
||||
void ProjectFileDialog::SaveToProjectFile(ProjectFile *projectFile) const
|
||||
void ProjectFileDialog::saveToProjectFile(ProjectFile *projectFile) const
|
||||
{
|
||||
projectFile->setRootPath(GetRootPath());
|
||||
projectFile->setBuildDir(GetBuildDir());
|
||||
projectFile->setImportProject(GetImportProject());
|
||||
projectFile->setIncludes(GetIncludePaths());
|
||||
projectFile->setDefines(GetDefines());
|
||||
projectFile->setCheckPaths(GetCheckPaths());
|
||||
projectFile->setExcludedPaths(GetExcludedPaths());
|
||||
projectFile->setLibraries(GetLibraries());
|
||||
projectFile->setSuppressions(GetSuppressions());
|
||||
projectFile->setRootPath(getRootPath());
|
||||
projectFile->setBuildDir(getBuildDir());
|
||||
projectFile->setImportProject(getImportProject());
|
||||
projectFile->setIncludes(getIncludePaths());
|
||||
projectFile->setDefines(getDefines());
|
||||
projectFile->setCheckPaths(getCheckPaths());
|
||||
projectFile->setExcludedPaths(getExcludedPaths());
|
||||
projectFile->setLibraries(getLibraries());
|
||||
projectFile->setSuppressions(getSuppressions());
|
||||
}
|
||||
|
||||
QString ProjectFileDialog::getExistingDirectory(const QString &caption, bool trailingSlash)
|
||||
|
@ -178,14 +178,14 @@ QString ProjectFileDialog::getExistingDirectory(const QString &caption, bool tra
|
|||
return selectedDir;
|
||||
}
|
||||
|
||||
void ProjectFileDialog::BrowseBuildDir()
|
||||
void ProjectFileDialog::browseBuildDir()
|
||||
{
|
||||
const QString dir(getExistingDirectory(tr("Select Cppcheck build dir"), false));
|
||||
if (!dir.isEmpty())
|
||||
mUI.mEditBuildDir->setText(dir);
|
||||
}
|
||||
|
||||
void ProjectFileDialog::BrowseImportProject()
|
||||
void ProjectFileDialog::browseImportProject()
|
||||
{
|
||||
const QFileInfo inf(mFilePath);
|
||||
const QDir &dir = inf.absoluteDir();
|
||||
|
@ -196,7 +196,7 @@ void ProjectFileDialog::BrowseImportProject()
|
|||
mUI.mEditImportProject->setText(dir.relativeFilePath(fileName));
|
||||
}
|
||||
|
||||
void ProjectFileDialog::AddIncludeDir(const QString &dir)
|
||||
void ProjectFileDialog::addIncludeDir(const QString &dir)
|
||||
{
|
||||
if (dir.isNull() || dir.isEmpty())
|
||||
return;
|
||||
|
@ -207,7 +207,7 @@ void ProjectFileDialog::AddIncludeDir(const QString &dir)
|
|||
mUI.mListIncludeDirs->addItem(item);
|
||||
}
|
||||
|
||||
void ProjectFileDialog::AddCheckPath(const QString &path)
|
||||
void ProjectFileDialog::addCheckPath(const QString &path)
|
||||
{
|
||||
if (path.isNull() || path.isEmpty())
|
||||
return;
|
||||
|
@ -218,7 +218,7 @@ void ProjectFileDialog::AddCheckPath(const QString &path)
|
|||
mUI.mListCheckPaths->addItem(item);
|
||||
}
|
||||
|
||||
void ProjectFileDialog::AddExcludePath(const QString &path)
|
||||
void ProjectFileDialog::addExcludePath(const QString &path)
|
||||
{
|
||||
if (path.isNull() || path.isEmpty())
|
||||
return;
|
||||
|
@ -229,7 +229,7 @@ void ProjectFileDialog::AddExcludePath(const QString &path)
|
|||
mUI.mListExcludedPaths->addItem(item);
|
||||
}
|
||||
|
||||
QString ProjectFileDialog::GetRootPath() const
|
||||
QString ProjectFileDialog::getRootPath() const
|
||||
{
|
||||
QString root = mUI.mEditProjectRoot->text();
|
||||
root = root.trimmed();
|
||||
|
@ -237,17 +237,17 @@ QString ProjectFileDialog::GetRootPath() const
|
|||
return root;
|
||||
}
|
||||
|
||||
QString ProjectFileDialog::GetBuildDir() const
|
||||
QString ProjectFileDialog::getBuildDir() const
|
||||
{
|
||||
return mUI.mEditBuildDir->text();
|
||||
}
|
||||
|
||||
QString ProjectFileDialog::GetImportProject() const
|
||||
QString ProjectFileDialog::getImportProject() const
|
||||
{
|
||||
return mUI.mEditImportProject->text();
|
||||
}
|
||||
|
||||
QStringList ProjectFileDialog::GetIncludePaths() const
|
||||
QStringList ProjectFileDialog::getIncludePaths() const
|
||||
{
|
||||
const int count = mUI.mListIncludeDirs->count();
|
||||
QStringList includePaths;
|
||||
|
@ -258,7 +258,7 @@ QStringList ProjectFileDialog::GetIncludePaths() const
|
|||
return includePaths;
|
||||
}
|
||||
|
||||
QStringList ProjectFileDialog::GetDefines() const
|
||||
QStringList ProjectFileDialog::getDefines() const
|
||||
{
|
||||
QString define = mUI.mEditDefines->text();
|
||||
QStringList defines;
|
||||
|
@ -272,7 +272,7 @@ QStringList ProjectFileDialog::GetDefines() const
|
|||
return defines;
|
||||
}
|
||||
|
||||
QStringList ProjectFileDialog::GetCheckPaths() const
|
||||
QStringList ProjectFileDialog::getCheckPaths() const
|
||||
{
|
||||
const int count = mUI.mListCheckPaths->count();
|
||||
QStringList paths;
|
||||
|
@ -283,7 +283,7 @@ QStringList ProjectFileDialog::GetCheckPaths() const
|
|||
return paths;
|
||||
}
|
||||
|
||||
QStringList ProjectFileDialog::GetExcludedPaths() const
|
||||
QStringList ProjectFileDialog::getExcludedPaths() const
|
||||
{
|
||||
const int count = mUI.mListExcludedPaths->count();
|
||||
QStringList paths;
|
||||
|
@ -294,7 +294,7 @@ QStringList ProjectFileDialog::GetExcludedPaths() const
|
|||
return paths;
|
||||
}
|
||||
|
||||
QStringList ProjectFileDialog::GetLibraries() const
|
||||
QStringList ProjectFileDialog::getLibraries() const
|
||||
{
|
||||
QStringList libraries;
|
||||
foreach (const QCheckBox *checkbox, mLibraryCheckboxes) {
|
||||
|
@ -304,7 +304,7 @@ QStringList ProjectFileDialog::GetLibraries() const
|
|||
return libraries;
|
||||
}
|
||||
|
||||
QStringList ProjectFileDialog::GetSuppressions() const
|
||||
QStringList ProjectFileDialog::getSuppressions() const
|
||||
{
|
||||
QStringList suppressions;
|
||||
const int count = mUI.mListSuppressions->count();
|
||||
|
@ -315,29 +315,29 @@ QStringList ProjectFileDialog::GetSuppressions() const
|
|||
return suppressions;
|
||||
}
|
||||
|
||||
void ProjectFileDialog::SetRootPath(const QString &root)
|
||||
void ProjectFileDialog::setRootPath(const QString &root)
|
||||
{
|
||||
mUI.mEditProjectRoot->setText(QDir::toNativeSeparators(root));
|
||||
}
|
||||
|
||||
void ProjectFileDialog::SetBuildDir(const QString &buildDir)
|
||||
void ProjectFileDialog::setBuildDir(const QString &buildDir)
|
||||
{
|
||||
mUI.mEditBuildDir->setText(buildDir);
|
||||
}
|
||||
|
||||
void ProjectFileDialog::SetImportProject(const QString &importProject)
|
||||
void ProjectFileDialog::setImportProject(const QString &importProject)
|
||||
{
|
||||
mUI.mEditImportProject->setText(importProject);
|
||||
}
|
||||
|
||||
void ProjectFileDialog::SetIncludepaths(const QStringList &includes)
|
||||
void ProjectFileDialog::setIncludepaths(const QStringList &includes)
|
||||
{
|
||||
foreach (QString dir, includes) {
|
||||
AddIncludeDir(dir);
|
||||
addIncludeDir(dir);
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectFileDialog::SetDefines(const QStringList &defines)
|
||||
void ProjectFileDialog::setDefines(const QStringList &defines)
|
||||
{
|
||||
QString definestr;
|
||||
QString define;
|
||||
|
@ -351,21 +351,21 @@ void ProjectFileDialog::SetDefines(const QStringList &defines)
|
|||
mUI.mEditDefines->setText(definestr);
|
||||
}
|
||||
|
||||
void ProjectFileDialog::SetCheckPaths(const QStringList &paths)
|
||||
void ProjectFileDialog::setCheckPaths(const QStringList &paths)
|
||||
{
|
||||
foreach (QString path, paths) {
|
||||
AddCheckPath(path);
|
||||
addCheckPath(path);
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectFileDialog::SetExcludedPaths(const QStringList &paths)
|
||||
void ProjectFileDialog::setExcludedPaths(const QStringList &paths)
|
||||
{
|
||||
foreach (QString path, paths) {
|
||||
AddExcludePath(path);
|
||||
addExcludePath(path);
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectFileDialog::SetLibraries(const QStringList &libraries)
|
||||
void ProjectFileDialog::setLibraries(const QStringList &libraries)
|
||||
{
|
||||
for (int i = 0; i < mLibraryCheckboxes.size(); i++) {
|
||||
QCheckBox *checkbox = mLibraryCheckboxes[i];
|
||||
|
@ -373,74 +373,74 @@ void ProjectFileDialog::SetLibraries(const QStringList &libraries)
|
|||
}
|
||||
}
|
||||
|
||||
void ProjectFileDialog::SetSuppressions(const QStringList &suppressions)
|
||||
void ProjectFileDialog::setSuppressions(const QStringList &suppressions)
|
||||
{
|
||||
mUI.mListSuppressions->clear();
|
||||
mUI.mListSuppressions->addItems(suppressions);
|
||||
mUI.mListSuppressions->sortItems();
|
||||
}
|
||||
|
||||
void ProjectFileDialog::AddCheckPath()
|
||||
void ProjectFileDialog::addCheckPath()
|
||||
{
|
||||
QString dir = getExistingDirectory(tr("Select a directory to check"), false);
|
||||
if (!dir.isEmpty())
|
||||
AddCheckPath(dir);
|
||||
addCheckPath(dir);
|
||||
}
|
||||
|
||||
void ProjectFileDialog::EditCheckPath()
|
||||
void ProjectFileDialog::editCheckPath()
|
||||
{
|
||||
QListWidgetItem *item = mUI.mListCheckPaths->currentItem();
|
||||
mUI.mListCheckPaths->editItem(item);
|
||||
}
|
||||
|
||||
void ProjectFileDialog::RemoveCheckPath()
|
||||
void ProjectFileDialog::removeCheckPath()
|
||||
{
|
||||
const int row = mUI.mListCheckPaths->currentRow();
|
||||
QListWidgetItem *item = mUI.mListCheckPaths->takeItem(row);
|
||||
delete item;
|
||||
}
|
||||
|
||||
void ProjectFileDialog::AddIncludeDir()
|
||||
void ProjectFileDialog::addIncludeDir()
|
||||
{
|
||||
const QString dir = getExistingDirectory(tr("Select include directory"), true);
|
||||
if (!dir.isEmpty())
|
||||
AddIncludeDir(dir);
|
||||
addIncludeDir(dir);
|
||||
}
|
||||
|
||||
void ProjectFileDialog::RemoveIncludeDir()
|
||||
void ProjectFileDialog::removeIncludeDir()
|
||||
{
|
||||
const int row = mUI.mListIncludeDirs->currentRow();
|
||||
QListWidgetItem *item = mUI.mListIncludeDirs->takeItem(row);
|
||||
delete item;
|
||||
}
|
||||
|
||||
void ProjectFileDialog::EditIncludeDir()
|
||||
void ProjectFileDialog::editIncludeDir()
|
||||
{
|
||||
QListWidgetItem *item = mUI.mListIncludeDirs->currentItem();
|
||||
mUI.mListIncludeDirs->editItem(item);
|
||||
}
|
||||
|
||||
void ProjectFileDialog::AddExcludePath()
|
||||
void ProjectFileDialog::addExcludePath()
|
||||
{
|
||||
QString dir = getExistingDirectory(tr("Select directory to ignore"), true);
|
||||
if (!dir.isEmpty())
|
||||
AddExcludePath(dir);
|
||||
addExcludePath(dir);
|
||||
}
|
||||
|
||||
void ProjectFileDialog::EditExcludePath()
|
||||
void ProjectFileDialog::editExcludePath()
|
||||
{
|
||||
QListWidgetItem *item = mUI.mListExcludedPaths->currentItem();
|
||||
mUI.mListExcludedPaths->editItem(item);
|
||||
}
|
||||
|
||||
void ProjectFileDialog::RemoveExcludePath()
|
||||
void ProjectFileDialog::removeExcludePath()
|
||||
{
|
||||
const int row = mUI.mListExcludedPaths->currentRow();
|
||||
QListWidgetItem *item = mUI.mListExcludedPaths->takeItem(row);
|
||||
delete item;
|
||||
}
|
||||
|
||||
void ProjectFileDialog::MoveIncludePathUp()
|
||||
void ProjectFileDialog::moveIncludePathUp()
|
||||
{
|
||||
int row = mUI.mListIncludeDirs->currentRow();
|
||||
QListWidgetItem *item = mUI.mListIncludeDirs->takeItem(row);
|
||||
|
@ -449,7 +449,7 @@ void ProjectFileDialog::MoveIncludePathUp()
|
|||
mUI.mListIncludeDirs->setCurrentItem(item);
|
||||
}
|
||||
|
||||
void ProjectFileDialog::MoveIncludePathDown()
|
||||
void ProjectFileDialog::moveIncludePathDown()
|
||||
{
|
||||
int row = mUI.mListIncludeDirs->currentRow();
|
||||
QListWidgetItem *item = mUI.mListIncludeDirs->takeItem(row);
|
||||
|
@ -459,7 +459,7 @@ void ProjectFileDialog::MoveIncludePathDown()
|
|||
mUI.mListIncludeDirs->setCurrentItem(item);
|
||||
}
|
||||
|
||||
void ProjectFileDialog::AddSuppression()
|
||||
void ProjectFileDialog::addSuppression()
|
||||
{
|
||||
class QErrorLogger : public ErrorLogger {
|
||||
public:
|
||||
|
@ -484,7 +484,7 @@ void ProjectFileDialog::AddSuppression()
|
|||
}
|
||||
}
|
||||
|
||||
void ProjectFileDialog::RemoveSuppression()
|
||||
void ProjectFileDialog::removeSuppression()
|
||||
{
|
||||
const int row = mUI.mListSuppressions->currentRow();
|
||||
QListWidgetItem *item = mUI.mListSuppressions->takeItem(row);
|
||||
|
|
|
@ -43,210 +43,210 @@ public:
|
|||
ProjectFileDialog(const QString &path, QWidget *parent = 0);
|
||||
virtual ~ProjectFileDialog();
|
||||
|
||||
void LoadFromProjectFile(const ProjectFile *projectFile);
|
||||
void SaveToProjectFile(ProjectFile *projectFile) const;
|
||||
void loadFromProjectFile(const ProjectFile *projectFile);
|
||||
void saveToProjectFile(ProjectFile *projectFile) const;
|
||||
|
||||
/**
|
||||
* @brief Return project root path from the dialog control.
|
||||
* @return Project root path.
|
||||
*/
|
||||
QString GetRootPath() const;
|
||||
QString getRootPath() const;
|
||||
|
||||
QString GetImportProject() const;
|
||||
QString getImportProject() const;
|
||||
|
||||
/** Get Cppcheck build dir */
|
||||
QString GetBuildDir() const;
|
||||
QString getBuildDir() const;
|
||||
|
||||
/**
|
||||
* @brief Return include paths from the dialog control.
|
||||
* @return List of include paths.
|
||||
*/
|
||||
QStringList GetIncludePaths() const;
|
||||
QStringList getIncludePaths() const;
|
||||
|
||||
/**
|
||||
* @brief Return define names from the dialog control.
|
||||
* @return List of define names.
|
||||
*/
|
||||
QStringList GetDefines() const;
|
||||
QStringList getDefines() const;
|
||||
|
||||
/**
|
||||
* @brief Return check paths from the dialog control.
|
||||
* @return List of check paths.
|
||||
*/
|
||||
QStringList GetCheckPaths() const;
|
||||
QStringList getCheckPaths() const;
|
||||
|
||||
/**
|
||||
* @brief Return excluded paths from the dialog control.
|
||||
* @return List of excluded paths.
|
||||
*/
|
||||
QStringList GetExcludedPaths() const;
|
||||
QStringList getExcludedPaths() const;
|
||||
|
||||
/**
|
||||
* @brief Return selected libraries from the dialog control.
|
||||
* @return List of libraries.
|
||||
*/
|
||||
QStringList GetLibraries() const;
|
||||
QStringList getLibraries() const;
|
||||
|
||||
/**
|
||||
* @brief Return suppressions from the dialog control.
|
||||
* @return List of suppressions.
|
||||
*/
|
||||
QStringList GetSuppressions() const;
|
||||
QStringList getSuppressions() const;
|
||||
|
||||
/**
|
||||
* @brief Set project root path to dialog control.
|
||||
* @param root Project root path to set to dialog control.
|
||||
*/
|
||||
void SetRootPath(const QString &root);
|
||||
void setRootPath(const QString &root);
|
||||
|
||||
/** Set build dir */
|
||||
void SetBuildDir(const QString &buildDir);
|
||||
void setBuildDir(const QString &buildDir);
|
||||
|
||||
void SetImportProject(const QString &importProject);
|
||||
void setImportProject(const QString &importProject);
|
||||
|
||||
/**
|
||||
* @brief Set include paths to dialog control.
|
||||
* @param includes List of include paths to set to dialog control.
|
||||
*/
|
||||
void SetIncludepaths(const QStringList &includes);
|
||||
void setIncludepaths(const QStringList &includes);
|
||||
|
||||
/**
|
||||
* @brief Set define names to dialog control.
|
||||
* @param defines List of define names to set to dialog control.
|
||||
*/
|
||||
void SetDefines(const QStringList &defines);
|
||||
void setDefines(const QStringList &defines);
|
||||
|
||||
/**
|
||||
* @brief Set check paths to dialog control.
|
||||
* @param paths List of path names to set to dialog control.
|
||||
*/
|
||||
void SetCheckPaths(const QStringList &paths);
|
||||
void setCheckPaths(const QStringList &paths);
|
||||
|
||||
/**
|
||||
* @brief Set excluded paths to dialog control.
|
||||
* @param paths List of path names to set to dialog control.
|
||||
*/
|
||||
void SetExcludedPaths(const QStringList &paths);
|
||||
void setExcludedPaths(const QStringList &paths);
|
||||
|
||||
/**
|
||||
* @brief Set libraries to dialog control.
|
||||
* @param libraries List of libraries to set to dialog control.
|
||||
*/
|
||||
void SetLibraries(const QStringList &libraries);
|
||||
void setLibraries(const QStringList &libraries);
|
||||
|
||||
/**
|
||||
* @brief Set suppressions to dialog control.
|
||||
* @param suppressions List of suppressions to set to dialog control.
|
||||
*/
|
||||
void SetSuppressions(const QStringList &suppressions);
|
||||
void setSuppressions(const QStringList &suppressions);
|
||||
|
||||
protected slots:
|
||||
|
||||
/**
|
||||
* @brief Browse for build dir.
|
||||
*/
|
||||
void BrowseBuildDir();
|
||||
void browseBuildDir();
|
||||
|
||||
/**
|
||||
* @brief Browse for solution / project / compile database.
|
||||
*/
|
||||
void BrowseImportProject();
|
||||
void browseImportProject();
|
||||
|
||||
/**
|
||||
* @brief Add new path to check.
|
||||
*/
|
||||
void AddCheckPath();
|
||||
void addCheckPath();
|
||||
|
||||
/**
|
||||
* @brief Edit path in the list.
|
||||
*/
|
||||
void EditCheckPath();
|
||||
void editCheckPath();
|
||||
|
||||
/**
|
||||
* @brief Remove path from the list.
|
||||
*/
|
||||
void RemoveCheckPath();
|
||||
void removeCheckPath();
|
||||
|
||||
/**
|
||||
* @brief Browse for include directory.
|
||||
* Allow user to add new include directory to the list.
|
||||
*/
|
||||
void AddIncludeDir();
|
||||
void addIncludeDir();
|
||||
|
||||
/**
|
||||
* @brief Remove include directory from the list.
|
||||
*/
|
||||
void RemoveIncludeDir();
|
||||
void removeIncludeDir();
|
||||
|
||||
/**
|
||||
* @brief Edit include directory in the list.
|
||||
*/
|
||||
void EditIncludeDir();
|
||||
void editIncludeDir();
|
||||
|
||||
/**
|
||||
* @brief Add new path to exclude.
|
||||
*/
|
||||
void AddExcludePath();
|
||||
void addExcludePath();
|
||||
|
||||
/**
|
||||
* @brief Edit excluded path in the list.
|
||||
*/
|
||||
void EditExcludePath();
|
||||
void editExcludePath();
|
||||
|
||||
/**
|
||||
* @brief Remove excluded path from the list.
|
||||
*/
|
||||
void RemoveExcludePath();
|
||||
void removeExcludePath();
|
||||
|
||||
/**
|
||||
* @brief Move include path up in the list.
|
||||
*/
|
||||
void MoveIncludePathUp();
|
||||
void moveIncludePathUp();
|
||||
|
||||
/**
|
||||
* @brief Move include path down in the list.
|
||||
*/
|
||||
void MoveIncludePathDown();
|
||||
void moveIncludePathDown();
|
||||
|
||||
/**
|
||||
* @brief Add suppression to the list
|
||||
*/
|
||||
void AddSuppression();
|
||||
void addSuppression();
|
||||
|
||||
/**
|
||||
* @brief Remove selected suppression from the list
|
||||
*/
|
||||
void RemoveSuppression();
|
||||
void removeSuppression();
|
||||
|
||||
protected:
|
||||
|
||||
/**
|
||||
* @brief Save dialog settings.
|
||||
*/
|
||||
void LoadSettings();
|
||||
void loadSettings();
|
||||
|
||||
/**
|
||||
* @brief Load dialog settings.
|
||||
*/
|
||||
void SaveSettings() const;
|
||||
void saveSettings() const;
|
||||
|
||||
/**
|
||||
* @brief Add new indlude directory.
|
||||
* @param dir Directory to add.
|
||||
*/
|
||||
void AddIncludeDir(const QString &dir);
|
||||
void addIncludeDir(const QString &dir);
|
||||
|
||||
/**
|
||||
* @brief Add new path to check.
|
||||
* @param path Path to add.
|
||||
*/
|
||||
void AddCheckPath(const QString &path);
|
||||
void addCheckPath(const QString &path);
|
||||
|
||||
/**
|
||||
* @brief Add new path to ignore list.
|
||||
* @param path Path to add.
|
||||
*/
|
||||
void AddExcludePath(const QString &path);
|
||||
void addExcludePath(const QString &path);
|
||||
|
||||
private:
|
||||
Ui::ProjectFile mUI;
|
||||
|
|
|
@ -553,7 +553,7 @@ void ResultsTree::contextMenuEvent(QContextMenuEvent * e)
|
|||
signalMapper->setMapping(start, defaultApplicationIndex);
|
||||
|
||||
connect(signalMapper, SIGNAL(mapped(int)),
|
||||
this, SLOT(Context(int)));
|
||||
this, SLOT(context(int)));
|
||||
}
|
||||
|
||||
// Add menuitems to copy full path/filename to clipboard
|
||||
|
@ -594,14 +594,14 @@ void ResultsTree::contextMenuEvent(QContextMenuEvent * e)
|
|||
menu.addAction(hideallid);
|
||||
menu.addAction(opencontainingfolder);
|
||||
|
||||
connect(recheckSelectedFiles, SIGNAL(triggered()), this, SLOT(RecheckSelectedFiles()));
|
||||
connect(copyfilename, SIGNAL(triggered()), this, SLOT(CopyFilename()));
|
||||
connect(copypath, SIGNAL(triggered()), this, SLOT(CopyFullPath()));
|
||||
connect(copymessage, SIGNAL(triggered()), this, SLOT(CopyMessage()));
|
||||
connect(copymessageid, SIGNAL(triggered()), this, SLOT(CopyMessageId()));
|
||||
connect(hide, SIGNAL(triggered()), this, SLOT(HideResult()));
|
||||
connect(hideallid, SIGNAL(triggered()), this, SLOT(HideAllIdResult()));
|
||||
connect(opencontainingfolder, SIGNAL(triggered()), this, SLOT(OpenContainingFolder()));
|
||||
connect(recheckSelectedFiles, SIGNAL(triggered()), this, SLOT(recheckSelectedFiles()));
|
||||
connect(copyfilename, SIGNAL(triggered()), this, SLOT(copyFilename()));
|
||||
connect(copypath, SIGNAL(triggered()), this, SLOT(copyFullPath()));
|
||||
connect(copymessage, SIGNAL(triggered()), this, SLOT(copyMessage()));
|
||||
connect(copymessageid, SIGNAL(triggered()), this, SLOT(copyMessageId()));
|
||||
connect(hide, SIGNAL(triggered()), this, SLOT(hideResult()));
|
||||
connect(hideallid, SIGNAL(triggered()), this, SLOT(hideAllIdResult()));
|
||||
connect(opencontainingfolder, SIGNAL(triggered()), this, SLOT(openContainingFolder()));
|
||||
}
|
||||
|
||||
//Start the menu
|
||||
|
@ -617,7 +617,7 @@ void ResultsTree::contextMenuEvent(QContextMenuEvent * e)
|
|||
}
|
||||
|
||||
disconnect(signalMapper, SIGNAL(mapped(int)),
|
||||
this, SLOT(Context(int)));
|
||||
this, SLOT(context(int)));
|
||||
//And remove the signal mapper
|
||||
delete signalMapper;
|
||||
}
|
||||
|
|
|
@ -195,7 +195,7 @@ void ResultsView::printPreview()
|
|||
{
|
||||
QPrinter printer;
|
||||
QPrintPreviewDialog dialog(&printer, this);
|
||||
connect(&dialog, SIGNAL(paintRequested(QPrinter*)), SLOT(Print(QPrinter*)));
|
||||
connect(&dialog, SIGNAL(paintRequested(QPrinter*)), SLOT(print(QPrinter*)));
|
||||
dialog.exec();
|
||||
}
|
||||
|
||||
|
|
|
@ -26,10 +26,10 @@ ScratchPad::ScratchPad(MainWindow& mainWindow)
|
|||
{
|
||||
mUI.setupUi(this);
|
||||
|
||||
connect(mUI.mCheckButton, SIGNAL(clicked()), this, SLOT(CheckButtonClicked()));
|
||||
connect(mUI.mCheckButton, SIGNAL(clicked()), this, SLOT(checkButtonClicked()));
|
||||
}
|
||||
|
||||
void ScratchPad::CheckButtonClicked()
|
||||
void ScratchPad::checkButtonClicked()
|
||||
{
|
||||
QString filename = mUI.lineEdit->text();
|
||||
if (filename.isEmpty())
|
||||
|
|
|
@ -39,7 +39,7 @@ private slots:
|
|||
/**
|
||||
* @brief Called when check button is clicked.
|
||||
*/
|
||||
void CheckButtonClicked();
|
||||
void checkButtonClicked();
|
||||
|
||||
private:
|
||||
Ui::ScratchPad mUI;
|
||||
|
|
|
@ -43,38 +43,38 @@ SettingsDialog::SettingsDialog(ApplicationList *list,
|
|||
mTempApplications->copy(list);
|
||||
|
||||
mUI.mJobs->setText(settings.value(SETTINGS_CHECK_THREADS, 1).toString());
|
||||
mUI.mForce->setCheckState(BoolToCheckState(settings.value(SETTINGS_CHECK_FORCE, false).toBool()));
|
||||
mUI.mShowFullPath->setCheckState(BoolToCheckState(settings.value(SETTINGS_SHOW_FULL_PATH, false).toBool()));
|
||||
mUI.mShowNoErrorsMessage->setCheckState(BoolToCheckState(settings.value(SETTINGS_SHOW_NO_ERRORS, false).toBool()));
|
||||
mUI.mShowDebugWarnings->setCheckState(BoolToCheckState(settings.value(SETTINGS_SHOW_DEBUG_WARNINGS, false).toBool()));
|
||||
mUI.mSaveAllErrors->setCheckState(BoolToCheckState(settings.value(SETTINGS_SAVE_ALL_ERRORS, false).toBool()));
|
||||
mUI.mSaveFullPath->setCheckState(BoolToCheckState(settings.value(SETTINGS_SAVE_FULL_PATH, false).toBool()));
|
||||
mUI.mInlineSuppressions->setCheckState(BoolToCheckState(settings.value(SETTINGS_INLINE_SUPPRESSIONS, false).toBool()));
|
||||
mUI.mEnableInconclusive->setCheckState(BoolToCheckState(settings.value(SETTINGS_INCONCLUSIVE_ERRORS, false).toBool()));
|
||||
mUI.mShowStatistics->setCheckState(BoolToCheckState(settings.value(SETTINGS_SHOW_STATISTICS, false).toBool()));
|
||||
mUI.mShowErrorId->setCheckState(BoolToCheckState(settings.value(SETTINGS_SHOW_ERROR_ID, false).toBool()));
|
||||
mUI.mForce->setCheckState(boolToCheckState(settings.value(SETTINGS_CHECK_FORCE, false).toBool()));
|
||||
mUI.mShowFullPath->setCheckState(boolToCheckState(settings.value(SETTINGS_SHOW_FULL_PATH, false).toBool()));
|
||||
mUI.mShowNoErrorsMessage->setCheckState(boolToCheckState(settings.value(SETTINGS_SHOW_NO_ERRORS, false).toBool()));
|
||||
mUI.mShowDebugWarnings->setCheckState(boolToCheckState(settings.value(SETTINGS_SHOW_DEBUG_WARNINGS, false).toBool()));
|
||||
mUI.mSaveAllErrors->setCheckState(boolToCheckState(settings.value(SETTINGS_SAVE_ALL_ERRORS, false).toBool()));
|
||||
mUI.mSaveFullPath->setCheckState(boolToCheckState(settings.value(SETTINGS_SAVE_FULL_PATH, false).toBool()));
|
||||
mUI.mInlineSuppressions->setCheckState(boolToCheckState(settings.value(SETTINGS_INLINE_SUPPRESSIONS, false).toBool()));
|
||||
mUI.mEnableInconclusive->setCheckState(boolToCheckState(settings.value(SETTINGS_INCONCLUSIVE_ERRORS, false).toBool()));
|
||||
mUI.mShowStatistics->setCheckState(boolToCheckState(settings.value(SETTINGS_SHOW_STATISTICS, false).toBool()));
|
||||
mUI.mShowErrorId->setCheckState(boolToCheckState(settings.value(SETTINGS_SHOW_ERROR_ID, false).toBool()));
|
||||
|
||||
connect(mUI.mButtons, SIGNAL(accepted()), this, SLOT(Ok()));
|
||||
connect(mUI.mButtons, SIGNAL(accepted()), this, SLOT(ok()));
|
||||
connect(mUI.mButtons, SIGNAL(rejected()), this, SLOT(reject()));
|
||||
connect(mUI.mBtnAddApplication, SIGNAL(clicked()),
|
||||
this, SLOT(AddApplication()));
|
||||
this, SLOT(addApplication()));
|
||||
connect(mUI.mBtnRemoveApplication, SIGNAL(clicked()),
|
||||
this, SLOT(RemoveApplication()));
|
||||
this, SLOT(removeApplication()));
|
||||
connect(mUI.mBtnEditApplication, SIGNAL(clicked()),
|
||||
this, SLOT(EditApplication()));
|
||||
this, SLOT(editApplication()));
|
||||
connect(mUI.mBtnDefaultApplication, SIGNAL(clicked()),
|
||||
this, SLOT(DefaultApplication()));
|
||||
this, SLOT(defaultApplication()));
|
||||
connect(mUI.mListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem *)),
|
||||
this, SLOT(EditApplication()));
|
||||
this, SLOT(editApplication()));
|
||||
connect(mUI.mBtnAddIncludePath, SIGNAL(clicked()),
|
||||
this, SLOT(AddIncludePath()));
|
||||
this, SLOT(addIncludePath()));
|
||||
connect(mUI.mBtnRemoveIncludePath, SIGNAL(clicked()),
|
||||
this, SLOT(RemoveIncludePath()));
|
||||
this, SLOT(removeIncludePath()));
|
||||
connect(mUI.mBtnEditIncludePath, SIGNAL(clicked()),
|
||||
this, SLOT(EditIncludePath()));
|
||||
this, SLOT(editIncludePath()));
|
||||
|
||||
mUI.mListWidget->setSortingEnabled(false);
|
||||
PopulateApplicationList();
|
||||
populateApplicationList();
|
||||
|
||||
const int count = QThread::idealThreadCount();
|
||||
if (count != -1)
|
||||
|
@ -82,17 +82,17 @@ SettingsDialog::SettingsDialog(ApplicationList *list,
|
|||
else
|
||||
mUI.mLblIdealThreads->setText(tr("N/A"));
|
||||
|
||||
LoadSettings();
|
||||
InitTranslationsList();
|
||||
InitIncludepathsList();
|
||||
loadSettings();
|
||||
initTranslationsList();
|
||||
initIncludepathsList();
|
||||
}
|
||||
|
||||
SettingsDialog::~SettingsDialog()
|
||||
{
|
||||
SaveSettings();
|
||||
saveSettings();
|
||||
}
|
||||
|
||||
void SettingsDialog::AddIncludePath(const QString &path)
|
||||
void SettingsDialog::addIncludePath(const QString &path)
|
||||
{
|
||||
if (path.isNull() || path.isEmpty())
|
||||
return;
|
||||
|
@ -102,20 +102,20 @@ void SettingsDialog::AddIncludePath(const QString &path)
|
|||
mUI.mListIncludePaths->addItem(item);
|
||||
}
|
||||
|
||||
void SettingsDialog::InitIncludepathsList()
|
||||
void SettingsDialog::initIncludepathsList()
|
||||
{
|
||||
QSettings settings;
|
||||
const QString allPaths = settings.value(SETTINGS_GLOBAL_INCLUDE_PATHS).toString();
|
||||
const QStringList paths = allPaths.split(";", QString::SkipEmptyParts);
|
||||
foreach (QString path, paths) {
|
||||
AddIncludePath(path);
|
||||
addIncludePath(path);
|
||||
}
|
||||
}
|
||||
|
||||
void SettingsDialog::InitTranslationsList()
|
||||
void SettingsDialog::initTranslationsList()
|
||||
{
|
||||
const QString current = mTranslator->GetCurrentLanguage();
|
||||
QList<TranslationInfo> translations = mTranslator->GetTranslations();
|
||||
const QString current = mTranslator->getCurrentLanguage();
|
||||
QList<TranslationInfo> translations = mTranslator->getTranslations();
|
||||
foreach (TranslationInfo translation, translations) {
|
||||
QListWidgetItem *item = new QListWidgetItem;
|
||||
item->setText(translation.mName);
|
||||
|
@ -126,7 +126,7 @@ void SettingsDialog::InitTranslationsList()
|
|||
}
|
||||
}
|
||||
|
||||
Qt::CheckState SettingsDialog::BoolToCheckState(bool yes)
|
||||
Qt::CheckState SettingsDialog::boolToCheckState(bool yes)
|
||||
{
|
||||
if (yes) {
|
||||
return Qt::Checked;
|
||||
|
@ -134,7 +134,7 @@ Qt::CheckState SettingsDialog::BoolToCheckState(bool yes)
|
|||
return Qt::Unchecked;
|
||||
}
|
||||
|
||||
bool SettingsDialog::CheckStateToBool(Qt::CheckState state)
|
||||
bool SettingsDialog::checkStateToBool(Qt::CheckState state)
|
||||
{
|
||||
if (state == Qt::Checked) {
|
||||
return true;
|
||||
|
@ -143,21 +143,21 @@ bool SettingsDialog::CheckStateToBool(Qt::CheckState state)
|
|||
}
|
||||
|
||||
|
||||
void SettingsDialog::LoadSettings()
|
||||
void SettingsDialog::loadSettings()
|
||||
{
|
||||
QSettings settings;
|
||||
resize(settings.value(SETTINGS_CHECK_DIALOG_WIDTH, 800).toInt(),
|
||||
settings.value(SETTINGS_CHECK_DIALOG_HEIGHT, 600).toInt());
|
||||
}
|
||||
|
||||
void SettingsDialog::SaveSettings() const
|
||||
void SettingsDialog::saveSettings() const
|
||||
{
|
||||
QSettings settings;
|
||||
settings.setValue(SETTINGS_CHECK_DIALOG_WIDTH, size().width());
|
||||
settings.setValue(SETTINGS_CHECK_DIALOG_HEIGHT, size().height());
|
||||
}
|
||||
|
||||
void SettingsDialog::SaveSettingValues() const
|
||||
void SettingsDialog::saveSettingValues() const
|
||||
{
|
||||
int jobs = mUI.mJobs->text().toInt();
|
||||
if (jobs <= 0) {
|
||||
|
@ -166,16 +166,16 @@ void SettingsDialog::SaveSettingValues() const
|
|||
|
||||
QSettings settings;
|
||||
settings.setValue(SETTINGS_CHECK_THREADS, jobs);
|
||||
SaveCheckboxValue(&settings, mUI.mForce, SETTINGS_CHECK_FORCE);
|
||||
SaveCheckboxValue(&settings, mUI.mSaveAllErrors, SETTINGS_SAVE_ALL_ERRORS);
|
||||
SaveCheckboxValue(&settings, mUI.mSaveFullPath, SETTINGS_SAVE_FULL_PATH);
|
||||
SaveCheckboxValue(&settings, mUI.mShowFullPath, SETTINGS_SHOW_FULL_PATH);
|
||||
SaveCheckboxValue(&settings, mUI.mShowNoErrorsMessage, SETTINGS_SHOW_NO_ERRORS);
|
||||
SaveCheckboxValue(&settings, mUI.mShowDebugWarnings, SETTINGS_SHOW_DEBUG_WARNINGS);
|
||||
SaveCheckboxValue(&settings, mUI.mInlineSuppressions, SETTINGS_INLINE_SUPPRESSIONS);
|
||||
SaveCheckboxValue(&settings, mUI.mEnableInconclusive, SETTINGS_INCONCLUSIVE_ERRORS);
|
||||
SaveCheckboxValue(&settings, mUI.mShowStatistics, SETTINGS_SHOW_STATISTICS);
|
||||
SaveCheckboxValue(&settings, mUI.mShowErrorId, SETTINGS_SHOW_ERROR_ID);
|
||||
saveCheckboxValue(&settings, mUI.mForce, SETTINGS_CHECK_FORCE);
|
||||
saveCheckboxValue(&settings, mUI.mSaveAllErrors, SETTINGS_SAVE_ALL_ERRORS);
|
||||
saveCheckboxValue(&settings, mUI.mSaveFullPath, SETTINGS_SAVE_FULL_PATH);
|
||||
saveCheckboxValue(&settings, mUI.mShowFullPath, SETTINGS_SHOW_FULL_PATH);
|
||||
saveCheckboxValue(&settings, mUI.mShowNoErrorsMessage, SETTINGS_SHOW_NO_ERRORS);
|
||||
saveCheckboxValue(&settings, mUI.mShowDebugWarnings, SETTINGS_SHOW_DEBUG_WARNINGS);
|
||||
saveCheckboxValue(&settings, mUI.mInlineSuppressions, SETTINGS_INLINE_SUPPRESSIONS);
|
||||
saveCheckboxValue(&settings, mUI.mEnableInconclusive, SETTINGS_INCONCLUSIVE_ERRORS);
|
||||
saveCheckboxValue(&settings, mUI.mShowStatistics, SETTINGS_SHOW_STATISTICS);
|
||||
saveCheckboxValue(&settings, mUI.mShowErrorId, SETTINGS_SHOW_ERROR_ID);
|
||||
|
||||
const QListWidgetItem *currentLang = mUI.mListLanguages->currentItem();
|
||||
if (currentLang) {
|
||||
|
@ -193,13 +193,13 @@ void SettingsDialog::SaveSettingValues() const
|
|||
settings.setValue(SETTINGS_GLOBAL_INCLUDE_PATHS, includePaths);
|
||||
}
|
||||
|
||||
void SettingsDialog::SaveCheckboxValue(QSettings *settings, QCheckBox *box,
|
||||
void SettingsDialog::saveCheckboxValue(QSettings *settings, QCheckBox *box,
|
||||
const QString &name)
|
||||
{
|
||||
settings->setValue(name, CheckStateToBool(box->checkState()));
|
||||
settings->setValue(name, checkStateToBool(box->checkState()));
|
||||
}
|
||||
|
||||
void SettingsDialog::AddApplication()
|
||||
void SettingsDialog::addApplication()
|
||||
{
|
||||
Application app;
|
||||
ApplicationDialog dialog(tr("Add a new application"), app, this);
|
||||
|
@ -210,7 +210,7 @@ void SettingsDialog::AddApplication()
|
|||
}
|
||||
}
|
||||
|
||||
void SettingsDialog::RemoveApplication()
|
||||
void SettingsDialog::removeApplication()
|
||||
{
|
||||
QList<QListWidgetItem *> selected = mUI.mListWidget->selectedItems();
|
||||
foreach (QListWidgetItem *item, selected) {
|
||||
|
@ -225,10 +225,10 @@ void SettingsDialog::RemoveApplication()
|
|||
mTempApplications->setDefault(currentDefault - 1);
|
||||
}
|
||||
mUI.mListWidget->clear();
|
||||
PopulateApplicationList();
|
||||
populateApplicationList();
|
||||
}
|
||||
|
||||
void SettingsDialog::EditApplication()
|
||||
void SettingsDialog::editApplication()
|
||||
{
|
||||
QList<QListWidgetItem *> selected = mUI.mListWidget->selectedItems();
|
||||
QListWidgetItem *item = 0;
|
||||
|
@ -246,18 +246,18 @@ void SettingsDialog::EditApplication()
|
|||
}
|
||||
}
|
||||
|
||||
void SettingsDialog::DefaultApplication()
|
||||
void SettingsDialog::defaultApplication()
|
||||
{
|
||||
QList<QListWidgetItem *> selected = mUI.mListWidget->selectedItems();
|
||||
if (!selected.isEmpty()) {
|
||||
int index = mUI.mListWidget->row(selected[0]);
|
||||
mTempApplications->setDefault(index);
|
||||
mUI.mListWidget->clear();
|
||||
PopulateApplicationList();
|
||||
populateApplicationList();
|
||||
}
|
||||
}
|
||||
|
||||
void SettingsDialog::PopulateApplicationList()
|
||||
void SettingsDialog::populateApplicationList()
|
||||
{
|
||||
const int defapp = mTempApplications->getDefaultApplication();
|
||||
for (int i = 0; i < mTempApplications->getApplicationCount(); i++) {
|
||||
|
@ -282,62 +282,62 @@ void SettingsDialog::PopulateApplicationList()
|
|||
}
|
||||
}
|
||||
|
||||
void SettingsDialog::Ok()
|
||||
void SettingsDialog::ok()
|
||||
{
|
||||
mApplications->copy(mTempApplications);
|
||||
accept();
|
||||
}
|
||||
|
||||
bool SettingsDialog::ShowFullPath() const
|
||||
bool SettingsDialog::showFullPath() const
|
||||
{
|
||||
return CheckStateToBool(mUI.mShowFullPath->checkState());
|
||||
return checkStateToBool(mUI.mShowFullPath->checkState());
|
||||
}
|
||||
|
||||
bool SettingsDialog::SaveFullPath() const
|
||||
bool SettingsDialog::saveFullPath() const
|
||||
{
|
||||
return CheckStateToBool(mUI.mSaveFullPath->checkState());
|
||||
return checkStateToBool(mUI.mSaveFullPath->checkState());
|
||||
}
|
||||
|
||||
bool SettingsDialog::SaveAllErrors() const
|
||||
bool SettingsDialog::saveAllErrors() const
|
||||
{
|
||||
return CheckStateToBool(mUI.mSaveAllErrors->checkState());
|
||||
return checkStateToBool(mUI.mSaveAllErrors->checkState());
|
||||
}
|
||||
|
||||
bool SettingsDialog::ShowNoErrorsMessage() const
|
||||
bool SettingsDialog::showNoErrorsMessage() const
|
||||
{
|
||||
return CheckStateToBool(mUI.mShowNoErrorsMessage->checkState());
|
||||
return checkStateToBool(mUI.mShowNoErrorsMessage->checkState());
|
||||
}
|
||||
|
||||
bool SettingsDialog::ShowErrorId() const
|
||||
bool SettingsDialog::showErrorId() const
|
||||
{
|
||||
return CheckStateToBool(mUI.mShowErrorId->checkState());
|
||||
return checkStateToBool(mUI.mShowErrorId->checkState());
|
||||
}
|
||||
|
||||
bool SettingsDialog::ShowInconclusive() const
|
||||
bool SettingsDialog::showInconclusive() const
|
||||
{
|
||||
return CheckStateToBool(mUI.mEnableInconclusive->checkState());
|
||||
return checkStateToBool(mUI.mEnableInconclusive->checkState());
|
||||
}
|
||||
|
||||
void SettingsDialog::AddIncludePath()
|
||||
void SettingsDialog::addIncludePath()
|
||||
{
|
||||
QString selectedDir = QFileDialog::getExistingDirectory(this,
|
||||
tr("Select include directory"),
|
||||
getPath(SETTINGS_LAST_INCLUDE_PATH));
|
||||
|
||||
if (!selectedDir.isEmpty()) {
|
||||
AddIncludePath(selectedDir);
|
||||
addIncludePath(selectedDir);
|
||||
setPath(SETTINGS_LAST_INCLUDE_PATH, selectedDir);
|
||||
}
|
||||
}
|
||||
|
||||
void SettingsDialog::RemoveIncludePath()
|
||||
void SettingsDialog::removeIncludePath()
|
||||
{
|
||||
const int row = mUI.mListIncludePaths->currentRow();
|
||||
QListWidgetItem *item = mUI.mListIncludePaths->takeItem(row);
|
||||
delete item;
|
||||
}
|
||||
|
||||
void SettingsDialog::EditIncludePath()
|
||||
void SettingsDialog::editIncludePath()
|
||||
{
|
||||
QListWidgetItem *item = mUI.mListIncludePaths->currentItem();
|
||||
mUI.mListIncludePaths->editItem(item);
|
||||
|
|
|
@ -47,21 +47,21 @@ public:
|
|||
* @brief Save all values to QSettings
|
||||
*
|
||||
*/
|
||||
void SaveSettingValues() const;
|
||||
void saveSettingValues() const;
|
||||
|
||||
/**
|
||||
* @brief Get checkbox value for mShowFullPath
|
||||
*
|
||||
* @return should full path of errors be shown in the tree
|
||||
*/
|
||||
bool ShowFullPath() const;
|
||||
bool showFullPath() const;
|
||||
|
||||
/**
|
||||
* @brief Get checkbox value for mSaveFullPath
|
||||
*
|
||||
* @return should full path of files be saved when creating a report
|
||||
*/
|
||||
bool SaveFullPath() const;
|
||||
bool saveFullPath() const;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -69,14 +69,14 @@ public:
|
|||
*
|
||||
* @return Should "no errors message" be hidden
|
||||
*/
|
||||
bool ShowNoErrorsMessage() const;
|
||||
bool showNoErrorsMessage() const;
|
||||
|
||||
/**
|
||||
* @brief Get checkbox value for mShowIdColumn
|
||||
*
|
||||
* @return Should error id column be displayed
|
||||
*/
|
||||
bool ShowErrorId() const;
|
||||
bool showErrorId() const;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -84,63 +84,63 @@ public:
|
|||
*
|
||||
* @return Should inconclusive column be displayed
|
||||
*/
|
||||
bool ShowInconclusive() const;
|
||||
bool showInconclusive() const;
|
||||
|
||||
/**
|
||||
* @brief Get checkbox value for mSaveAllErrors
|
||||
*
|
||||
* @return should all errors be saved to report
|
||||
*/
|
||||
bool SaveAllErrors() const;
|
||||
bool saveAllErrors() const;
|
||||
|
||||
protected slots:
|
||||
/**
|
||||
* @brief Slot for clicking OK.
|
||||
*
|
||||
*/
|
||||
void Ok();
|
||||
void ok();
|
||||
|
||||
/**
|
||||
* @brief Slot for adding a new application to the list
|
||||
*
|
||||
*/
|
||||
void AddApplication();
|
||||
void addApplication();
|
||||
|
||||
/**
|
||||
* @brief Slot for deleting an application from the list
|
||||
*
|
||||
*/
|
||||
void RemoveApplication();
|
||||
void removeApplication();
|
||||
|
||||
/**
|
||||
* @brief Slot for modifying an application in the list
|
||||
*
|
||||
*/
|
||||
void EditApplication();
|
||||
void editApplication();
|
||||
|
||||
/**
|
||||
* @brief Slot for making the selected application as the default (first)
|
||||
*
|
||||
*/
|
||||
void DefaultApplication();
|
||||
void defaultApplication();
|
||||
|
||||
/**
|
||||
* @brief Slot for adding new include path
|
||||
*
|
||||
*/
|
||||
void AddIncludePath();
|
||||
void addIncludePath();
|
||||
|
||||
/**
|
||||
* @brief Slot for removing an include path.
|
||||
*
|
||||
*/
|
||||
void RemoveIncludePath();
|
||||
void removeIncludePath();
|
||||
|
||||
/**
|
||||
* @brief Slot for editing an include path.
|
||||
*
|
||||
*/
|
||||
void EditIncludePath();
|
||||
void editIncludePath();
|
||||
|
||||
protected:
|
||||
|
||||
|
@ -149,27 +149,26 @@ protected:
|
|||
* @param path Path to add.
|
||||
*
|
||||
*/
|
||||
void AddIncludePath(const QString &path);
|
||||
void addIncludePath(const QString &path);
|
||||
|
||||
/**
|
||||
* @brief Clear all applications from the list and re insert them from mTempApplications
|
||||
*
|
||||
*/
|
||||
void PopulateApplicationList();
|
||||
void populateApplicationList();
|
||||
|
||||
/**
|
||||
* @brief Load saved values
|
||||
* Loads dialog size and column widths.
|
||||
*
|
||||
*/
|
||||
void SaveSettings() const;
|
||||
void loadSettings();
|
||||
|
||||
/**
|
||||
* @brief Save settings
|
||||
* Save dialog size and column widths.
|
||||
*
|
||||
*/
|
||||
void LoadSettings();
|
||||
void saveSettings() const;
|
||||
|
||||
/**
|
||||
* @brief Save a single checkboxes value
|
||||
|
@ -178,7 +177,7 @@ protected:
|
|||
* @param box checkbox to save
|
||||
* @param name name for QSettings to store the value
|
||||
*/
|
||||
static void SaveCheckboxValue(QSettings *settings, QCheckBox *box, const QString &name);
|
||||
static void saveCheckboxValue(QSettings *settings, QCheckBox *box, const QString &name);
|
||||
|
||||
/**
|
||||
* @brief Convert bool to Qt::CheckState
|
||||
|
@ -186,7 +185,7 @@ protected:
|
|||
* @param yes value to convert
|
||||
* @return value converted to Qt::CheckState
|
||||
*/
|
||||
static Qt::CheckState BoolToCheckState(bool yes);
|
||||
static Qt::CheckState boolToCheckState(bool yes);
|
||||
|
||||
/**
|
||||
* @brief Converts Qt::CheckState to bool
|
||||
|
@ -194,17 +193,17 @@ protected:
|
|||
* @param state Qt::CheckState to convert
|
||||
* @return converted value
|
||||
*/
|
||||
static bool CheckStateToBool(Qt::CheckState state);
|
||||
static bool checkStateToBool(Qt::CheckState state);
|
||||
|
||||
/**
|
||||
* @brief Populate the include paths-list.
|
||||
*/
|
||||
void InitIncludepathsList();
|
||||
void initIncludepathsList();
|
||||
|
||||
/**
|
||||
* @brief Populate the translations list.
|
||||
*/
|
||||
void InitTranslationsList();
|
||||
void initTranslationsList();
|
||||
|
||||
/**
|
||||
* @brief List of applications user has specified
|
||||
|
|
|
@ -36,8 +36,7 @@ StatsDialog::StatsDialog(QWidget *parent)
|
|||
mUI.setupUi(this);
|
||||
|
||||
connect(mUI.mCopyToClipboard, SIGNAL(pressed()), this, SLOT(copyToClipboard()));
|
||||
connect(mUI.mPDFexport, SIGNAL(pressed()), this, SLOT(PDFexport()));
|
||||
|
||||
connect(mUI.mPDFexport, SIGNAL(pressed()), this, SLOT(pdfExport()));
|
||||
}
|
||||
|
||||
void StatsDialog::setProject(const Project& project)
|
||||
|
@ -94,7 +93,7 @@ void StatsDialog::setScanDuration(double seconds)
|
|||
|
||||
mUI.mScanDuration->setText(parts.join(tr(" and ")));
|
||||
}
|
||||
void StatsDialog::PDFexport()
|
||||
void StatsDialog::pdfExport()
|
||||
{
|
||||
const QString Stat = QString(
|
||||
"<center><h1>%1 %2</h1></center>\n"
|
||||
|
|
|
@ -64,7 +64,7 @@ public:
|
|||
|
||||
private slots:
|
||||
void copyToClipboard();
|
||||
void PDFexport();
|
||||
void pdfExport();
|
||||
|
||||
private:
|
||||
Ui::StatsDialog mUI;
|
||||
|
|
|
@ -120,9 +120,9 @@ void ThreadHandler::setThreadCount(const int count)
|
|||
//Create new threads
|
||||
for (int i = mThreads.size(); i < count; i++) {
|
||||
mThreads << new CheckThread(mResults);
|
||||
connect(mThreads.last(), SIGNAL(Done()),
|
||||
connect(mThreads.last(), SIGNAL(done()),
|
||||
this, SLOT(threadDone()));
|
||||
connect(mThreads.last(), SIGNAL(FileChecked(const QString &)),
|
||||
connect(mThreads.last(), SIGNAL(fileChecked(const QString &)),
|
||||
&mResults, SLOT(fileChecked(const QString &)));
|
||||
}
|
||||
|
||||
|
@ -133,9 +133,9 @@ void ThreadHandler::removeThreads()
|
|||
{
|
||||
for (int i = 0; i < mThreads.size(); i++) {
|
||||
mThreads[i]->terminate();
|
||||
disconnect(mThreads.last(), SIGNAL(Done()),
|
||||
disconnect(mThreads.last(), SIGNAL(done()),
|
||||
this, SLOT(threadDone()));
|
||||
disconnect(mThreads.last(), SIGNAL(FileChecked(const QString &)),
|
||||
disconnect(mThreads.last(), SIGNAL(fileChecked(const QString &)),
|
||||
&mResults, SLOT(fileChecked(const QString &)));
|
||||
|
||||
delete mThreads[i];
|
||||
|
|
|
@ -51,26 +51,26 @@ TranslationHandler::TranslationHandler(QObject *parent) :
|
|||
{
|
||||
// Add our available languages
|
||||
// Keep this list sorted
|
||||
AddTranslation("Chinese (Simplified)", "cppcheck_zh_CN");
|
||||
AddTranslation("Dutch", "cppcheck_nl");
|
||||
AddTranslation("English", "cppcheck_en");
|
||||
AddTranslation("Finnish", "cppcheck_fi");
|
||||
AddTranslation("French", "cppcheck_fr");
|
||||
AddTranslation("German", "cppcheck_de");
|
||||
AddTranslation("Italian", "cppcheck_it");
|
||||
AddTranslation("Japanese", "cppcheck_ja");
|
||||
AddTranslation("Korean", "cppcheck_ko");
|
||||
AddTranslation("Russian", "cppcheck_ru");
|
||||
AddTranslation("Serbian", "cppcheck_sr");
|
||||
AddTranslation("Spanish", "cppcheck_es");
|
||||
AddTranslation("Swedish", "cppcheck_sv");
|
||||
addTranslation("Chinese (Simplified)", "cppcheck_zh_CN");
|
||||
addTranslation("Dutch", "cppcheck_nl");
|
||||
addTranslation("English", "cppcheck_en");
|
||||
addTranslation("Finnish", "cppcheck_fi");
|
||||
addTranslation("French", "cppcheck_fr");
|
||||
addTranslation("German", "cppcheck_de");
|
||||
addTranslation("Italian", "cppcheck_it");
|
||||
addTranslation("Japanese", "cppcheck_ja");
|
||||
addTranslation("Korean", "cppcheck_ko");
|
||||
addTranslation("Russian", "cppcheck_ru");
|
||||
addTranslation("Serbian", "cppcheck_sr");
|
||||
addTranslation("Spanish", "cppcheck_es");
|
||||
addTranslation("Swedish", "cppcheck_sv");
|
||||
}
|
||||
|
||||
TranslationHandler::~TranslationHandler()
|
||||
{
|
||||
}
|
||||
|
||||
const QStringList TranslationHandler::GetNames() const
|
||||
const QStringList TranslationHandler::getNames() const
|
||||
{
|
||||
QStringList names;
|
||||
foreach (TranslationInfo translation, mTranslations) {
|
||||
|
@ -79,7 +79,7 @@ const QStringList TranslationHandler::GetNames() const
|
|||
return names;
|
||||
}
|
||||
|
||||
bool TranslationHandler::SetLanguage(const QString &code)
|
||||
bool TranslationHandler::setLanguage(const QString &code)
|
||||
{
|
||||
bool failure = false;
|
||||
QString error;
|
||||
|
@ -98,7 +98,7 @@ bool TranslationHandler::SetLanguage(const QString &code)
|
|||
}
|
||||
|
||||
//Make sure the translator is otherwise valid
|
||||
int index = GetLanguageIndexByCode(code);
|
||||
int index = getLanguageIndexByCode(code);
|
||||
if (index == -1) {
|
||||
error = QObject::tr("Unknown language specified!");
|
||||
failure = true;
|
||||
|
@ -161,19 +161,19 @@ bool TranslationHandler::SetLanguage(const QString &code)
|
|||
return true;
|
||||
}
|
||||
|
||||
QString TranslationHandler::GetCurrentLanguage() const
|
||||
QString TranslationHandler::getCurrentLanguage() const
|
||||
{
|
||||
return mCurrentLanguage;
|
||||
}
|
||||
|
||||
QString TranslationHandler::SuggestLanguage() const
|
||||
QString TranslationHandler::suggestLanguage() const
|
||||
{
|
||||
//Get language from system locale's name ie sv_SE or zh_CN
|
||||
QString language = QLocale::system().name();
|
||||
//qDebug()<<"Your language is"<<language;
|
||||
|
||||
//And see if we can find it from our list of language files
|
||||
int index = GetLanguageIndexByCode(language);
|
||||
int index = getLanguageIndexByCode(language);
|
||||
|
||||
//If nothing found, return English
|
||||
if (index < 0) {
|
||||
|
@ -183,7 +183,7 @@ QString TranslationHandler::SuggestLanguage() const
|
|||
return language;
|
||||
}
|
||||
|
||||
void TranslationHandler::AddTranslation(const char *name, const char *filename)
|
||||
void TranslationHandler::addTranslation(const char *name, const char *filename)
|
||||
{
|
||||
TranslationInfo info;
|
||||
info.mName = name;
|
||||
|
@ -193,7 +193,7 @@ void TranslationHandler::AddTranslation(const char *name, const char *filename)
|
|||
mTranslations.append(info);
|
||||
}
|
||||
|
||||
int TranslationHandler::GetLanguageIndexByCode(const QString &code) const
|
||||
int TranslationHandler::getLanguageIndexByCode(const QString &code) const
|
||||
{
|
||||
int index = -1;
|
||||
for (int i = 0; i < mTranslations.size(); i++) {
|
||||
|
|
|
@ -69,14 +69,14 @@ public:
|
|||
* @return List of available translation names.
|
||||
*
|
||||
*/
|
||||
const QStringList GetNames() const;
|
||||
const QStringList getNames() const;
|
||||
|
||||
/**
|
||||
* @brief Get a list of available translations.
|
||||
* @return List of available translations.
|
||||
*
|
||||
*/
|
||||
QList<TranslationInfo> GetTranslations() const {
|
||||
QList<TranslationInfo> getTranslations() const {
|
||||
return mTranslations;
|
||||
}
|
||||
|
||||
|
@ -86,14 +86,14 @@ public:
|
|||
* @return true if succeeds, false otherwise.
|
||||
*
|
||||
*/
|
||||
bool SetLanguage(const QString &code);
|
||||
bool setLanguage(const QString &code);
|
||||
|
||||
/**
|
||||
* @brief Get currently selected translation.
|
||||
* @return ISO 639 language code for current translation.
|
||||
*
|
||||
*/
|
||||
QString GetCurrentLanguage() const;
|
||||
QString getCurrentLanguage() const;
|
||||
|
||||
/**
|
||||
* @brief Get translation suggestion for the system.
|
||||
|
@ -103,7 +103,7 @@ public:
|
|||
* @return Suggested translation ISO 639 language code.
|
||||
*
|
||||
*/
|
||||
QString SuggestLanguage() const;
|
||||
QString suggestLanguage() const;
|
||||
|
||||
protected:
|
||||
|
||||
|
@ -113,7 +113,7 @@ protected:
|
|||
* @param filename Filename of the translation.
|
||||
*
|
||||
*/
|
||||
void AddTranslation(const char *name, const char *filename);
|
||||
void addTranslation(const char *name, const char *filename);
|
||||
|
||||
/**
|
||||
* @brief Find language in the list and return its index.
|
||||
|
@ -121,7 +121,7 @@ protected:
|
|||
* @return Index at list, or -1 if not found.
|
||||
*
|
||||
*/
|
||||
int GetLanguageIndexByCode(const QString &code) const;
|
||||
int getLanguageIndexByCode(const QString &code) const;
|
||||
|
||||
private:
|
||||
|
||||
|
|
Loading…
Reference in New Issue