From e8bbc2da633da8ad0c86dd8153d8ca8061fdff88 Mon Sep 17 00:00:00 2001 From: wmayer Date: Thu, 3 Nov 2022 13:58:07 +0100 Subject: [PATCH] Gui: fix some minor warnings reported by GH Actions --- src/Gui/DlgGeneralImp.cpp | 11 +++++------ src/Gui/DlgGeneralImp.h | 4 ++-- src/Gui/Language/Translator.cpp | 18 +++++++++--------- src/Gui/Language/Translator.h | 1 + 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/Gui/DlgGeneralImp.cpp b/src/Gui/DlgGeneralImp.cpp index 0f91b76f8f..94fb870ae8 100644 --- a/src/Gui/DlgGeneralImp.cpp +++ b/src/Gui/DlgGeneralImp.cpp @@ -308,14 +308,13 @@ void DlgGeneralImp::loadSettings() QStringList filter; filter << QString::fromLatin1("*.qss"); filter << QString::fromLatin1("*.css"); - QFileInfoList fileNames; // read from user, resource and built-in directory QStringList qssPaths = QDir::searchPaths(QString::fromLatin1("qss")); for (const auto & qssPath : qssPaths) { dir.setPath(qssPath); - fileNames = dir.entryInfoList(filter, QDir::Files, QDir::Name); - for (const auto & fileName : fileNames) { + QFileInfoList fileNames = dir.entryInfoList(filter, QDir::Files, QDir::Name); + for (const auto & fileName : qAsConst(fileNames)) { if (cssFiles.find(fileName.baseName()) == cssFiles.end()) { cssFiles[fileName.baseName()] = fileName.fileName(); } @@ -353,15 +352,15 @@ void DlgGeneralImp::loadSettings() ui->StyleSheets->setCurrentIndex(index); } -void DlgGeneralImp::changeEvent(QEvent *e) +void DlgGeneralImp::changeEvent(QEvent *event) { - if (e->type() == QEvent::LanguageChange) { + if (event->type() == QEvent::LanguageChange) { int index = ui->UseLocaleFormatting->currentIndex(); ui->retranslateUi(this); ui->UseLocaleFormatting->setCurrentIndex(index); } else { - QWidget::changeEvent(e); + QWidget::changeEvent(event); } } diff --git a/src/Gui/DlgGeneralImp.h b/src/Gui/DlgGeneralImp.h index eb28751155..685c20a586 100644 --- a/src/Gui/DlgGeneralImp.h +++ b/src/Gui/DlgGeneralImp.h @@ -45,14 +45,14 @@ class DlgGeneralImp : public PreferencePage Q_OBJECT public: - DlgGeneralImp( QWidget* parent = nullptr ); + explicit DlgGeneralImp( QWidget* parent = nullptr ); ~DlgGeneralImp() override; void saveSettings() override; void loadSettings() override; protected: - void changeEvent(QEvent *e) override; + void changeEvent(QEvent *event) override; protected Q_SLOTS: void onLoadPreferencePackClicked(const std::string &packName); diff --git a/src/Gui/Language/Translator.cpp b/src/Gui/Language/Translator.cpp index e2bcfb58b2..719020b7f7 100644 --- a/src/Gui/Language/Translator.cpp +++ b/src/Gui/Language/Translator.cpp @@ -44,7 +44,7 @@ using namespace Gui; * * The internationalization of FreeCAD makes heavy use of the internationalization * support of Qt. For more details refer to your Qt documentation. - * + * * \section stepbystep Step by step * To integrate a new language into FreeCAD or one of its application modules * you have to perform the following steps: @@ -52,13 +52,13 @@ using namespace Gui; * \subsection tsfile Creation of a .ts file * First you have to generate a .ts file for the language to be translated. You can do this * by running the \a lupdate tool in the \a bin path of your Qt installation. As argument - * you can specify either all related source files and the .ts output file or a Qt project + * you can specify either all related source files and the .ts output file or a Qt project * file (.pro) which contains all relevant source files. * * \subsection translate Translation into your language * To translate the english string literals into the language you want to support you can open your * .ts file with \a QtLinguist and translate all literals by hand. Another way - * for translation is to use the tool \a tsauto from Sebastien Fricker.This tool uses the + * for translation is to use the tool \a tsauto from Sebastien Fricker.This tool uses the * engine from Google web page (www.google.com). tsauto supports the languages * \li english * \li french @@ -69,7 +69,7 @@ using namespace Gui; * * \remark To get most of the literals translated you should have removed all * special characters (like &, !, ?, ...). Otherwise the translation could fail. - * After having translated all literals you can load the .ts file into QtLinguist and + * After having translated all literals you can load the .ts file into QtLinguist and * invoke the menu item \a Release which generates the binary .qm file. * * \subsection usets Integration of the .qm file @@ -85,13 +85,13 @@ using namespace Gui; * * Command Line: rcc.exe -name $(InputName) $(InputPath) -o "$(InputDir)qrc_$(InputName).cpp" * Outputs: $(InputDir)qrc_$(InputName).cpp - * + * * For the gcc build system you just have to add the line \.qrc to the BUILT_SOURCES * sources section of the Makefile.am, run automake and configure (or ./confog.status) afterwards. * * Finally, you have to add a the line * \code - * + * * Q_INIT_RESOURCE(resource); * * \endcode @@ -285,7 +285,7 @@ void Translator::updateLocaleChange() const QStringList Translator::directories() const { - QStringList list; + QStringList list; auto dir = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/General")-> GetASCII("AdditionalTranslationsDirectory", ""); if (!dir.empty()) @@ -295,7 +295,7 @@ QStringList Translator::directories() const QDir resc(QString::fromUtf8(App::Application::getResourceDir().c_str())); list.push_back(resc.absoluteFilePath(QLatin1String("translations"))); list.push_back(QLatin1String(":/translations")); - + return list; } @@ -335,7 +335,7 @@ void Translator::installQMFiles(const QDir& dir, const char* locale) /** * This method checks for newly added (internal) .qm files which might be added at runtime. This e.g. happens if a plugin - * gets loaded at runtime. For each newly added files that supports the currently set language a new translator object is created + * gets loaded at runtime. For each newly added files that supports the currently set language a new translator object is created * to load the file. */ void Translator::refresh() diff --git a/src/Gui/Language/Translator.h b/src/Gui/Language/Translator.h index ece19edd32..11caee8fa2 100644 --- a/src/Gui/Language/Translator.h +++ b/src/Gui/Language/Translator.h @@ -27,6 +27,7 @@ #include #include #include +#include class QDir;