diff --git a/src/libcalamares/CMakeLists.txt b/src/libcalamares/CMakeLists.txt index 5efd850a9..4aa7c44df 100644 --- a/src/libcalamares/CMakeLists.txt +++ b/src/libcalamares/CMakeLists.txt @@ -20,7 +20,6 @@ set( libSources Settings.cpp ) set( utilsSources - utils/CalamaresUtils.cpp utils/CalamaresUtilsSystem.cpp utils/CommandList.cpp utils/Dirs.cpp @@ -28,6 +27,7 @@ set( utilsSources utils/Logger.cpp utils/PluginFactory.cpp utils/Retranslator.cpp + utils/String.cpp utils/Variant.cpp utils/Yaml.cpp ) diff --git a/src/libcalamares/PythonJobApi.cpp b/src/libcalamares/PythonJobApi.cpp index c94aa34e1..8e8b8b2ab 100644 --- a/src/libcalamares/PythonJobApi.cpp +++ b/src/libcalamares/PythonJobApi.cpp @@ -22,7 +22,7 @@ #include "PythonHelper.h" #include "utils/Logger.h" #include "utils/CalamaresUtilsSystem.h" -#include "utils/CalamaresUtils.h" +#include "utils/String.h" #include "GlobalStorage.h" #include "JobQueue.h" diff --git a/src/libcalamares/utils/CalamaresUtils.cpp b/src/libcalamares/utils/String.cpp similarity index 96% rename from src/libcalamares/utils/CalamaresUtils.cpp rename to src/libcalamares/utils/String.cpp index 0fd72e267..a39ebd8c7 100644 --- a/src/libcalamares/utils/CalamaresUtils.cpp +++ b/src/libcalamares/utils/String.cpp @@ -22,14 +22,16 @@ * along with Calamares. If not, see . */ -#include "CalamaresUtils.h" +#include "String.h" + +#include namespace CalamaresUtils { QString removeDiacritics( const QString& string ) { - const QString diacriticLetters = QString::fromUtf8( + static const QString diacriticLetters = QString::fromUtf8( "ŠŒŽšœžŸ¥µÀ" "ÁÂÃÄÅÆÇÈÉÊ" "ËÌÍÎÏÐÑÒÓÔ" @@ -46,7 +48,7 @@ removeDiacritics( const QString& string ) "ॹĘꣳŃńŚ" "śŹźŻż" ); - const QStringList noDiacriticLetters = { + static const QStringList noDiacriticLetters = { "S", "OE", "Z", "s", "oe", "z", "Y", "Y", "u", "A", "A", "A", "A", "A", "AA", "AE", "C", "E", "E", "E", "E", "I", "I", "I", "I", "D", "N", "O", "O", "O", diff --git a/src/libcalamares/utils/CalamaresUtils.h b/src/libcalamares/utils/String.h similarity index 94% rename from src/libcalamares/utils/CalamaresUtils.h rename to src/libcalamares/utils/String.h index 2387a7005..0a69bcf83 100644 --- a/src/libcalamares/utils/CalamaresUtils.h +++ b/src/libcalamares/utils/String.h @@ -22,15 +22,12 @@ * along with Calamares. If not, see . */ -#ifndef UTILS_CALAMARESUTILS_H -#define UTILS_CALAMARESUTILS_H +#ifndef UTILS_STRING_H +#define UTILS_STRING_H #include "DllMacro.h" -#include - -class QDir; -class QObject; +#include /** * @brief The CalamaresUtils namespace contains utility functions. diff --git a/src/libcalamaresui/Branding.cpp b/src/libcalamaresui/Branding.cpp index e3da98614..b7bf4c7aa 100644 --- a/src/libcalamaresui/Branding.cpp +++ b/src/libcalamaresui/Branding.cpp @@ -21,7 +21,6 @@ #include "Branding.h" #include "GlobalStorage.h" -#include "utils/CalamaresUtils.h" #include "utils/CalamaresUtilsGui.h" #include "utils/ImageRegistry.h" #include "utils/Logger.h" diff --git a/src/libcalamaresui/utils/CalamaresUtilsGui.h b/src/libcalamaresui/utils/CalamaresUtilsGui.h index 135a57c43..72430a083 100644 --- a/src/libcalamaresui/utils/CalamaresUtilsGui.h +++ b/src/libcalamaresui/utils/CalamaresUtilsGui.h @@ -20,7 +20,6 @@ #ifndef CALAMARESUTILSGUI_H #define CALAMARESUTILSGUI_H -#include "utils/CalamaresUtils.h" #include "UiDllMacro.h" #include diff --git a/src/libcalamaresui/utils/DebugWindow.cpp b/src/libcalamaresui/utils/DebugWindow.cpp index a9be30411..22986014e 100644 --- a/src/libcalamaresui/utils/DebugWindow.cpp +++ b/src/libcalamaresui/utils/DebugWindow.cpp @@ -17,7 +17,6 @@ */ #include "DebugWindow.h" -#include "utils/CalamaresUtils.h" #include "utils/Retranslator.h" #include "utils/qjsonmodel.h" #include "JobQueue.h" diff --git a/src/libcalamaresui/viewpages/PythonQtUtilsWrapper.cpp b/src/libcalamaresui/viewpages/PythonQtUtilsWrapper.cpp index 6adfaa72f..efb3da2a1 100644 --- a/src/libcalamaresui/viewpages/PythonQtUtilsWrapper.cpp +++ b/src/libcalamaresui/viewpages/PythonQtUtilsWrapper.cpp @@ -19,8 +19,8 @@ #include "PythonQtUtilsWrapper.h" #include "utils/CalamaresUtilsSystem.h" -#include "utils/CalamaresUtils.h" #include "utils/Logger.h" +#include "utils/String.h" #include diff --git a/src/modules/preservefiles/PreserveFiles.cpp b/src/modules/preservefiles/PreserveFiles.cpp index 2c1b85103..96d26274c 100644 --- a/src/modules/preservefiles/PreserveFiles.cpp +++ b/src/modules/preservefiles/PreserveFiles.cpp @@ -24,7 +24,6 @@ #include "JobQueue.h" #include "GlobalStorage.h" -#include "utils/CalamaresUtils.h" #include "utils/CalamaresUtilsSystem.h" #include "utils/CommandList.h" #include "utils/Logger.h" @@ -113,7 +112,7 @@ copy_file( const QString& source, const QString& dest ) sourcef.close(); destf.close(); - + return true; } @@ -151,22 +150,22 @@ Calamares::JobResult PreserveFiles::exec() if ( it.perm.isValid() ) { auto s_p = CalamaresUtils::System::instance(); - + int r; - + r = s_p->targetEnvCall( QStringList{ "chown", it.perm.username(), bare_dest } ); if ( r ) cWarning() << "Could not chown target" << bare_dest; - + r = s_p->targetEnvCall( QStringList{ "chgrp", it.perm.group(), bare_dest } ); if ( r ) cWarning() << "Could not chgrp target" << bare_dest; - + r = s_p->targetEnvCall( QStringList{ "chmod", it.perm.octal(), bare_dest } ); if ( r ) cWarning() << "Could not chmod target" << bare_dest; } - + ++count; } } @@ -195,7 +194,7 @@ void PreserveFiles::setConfigurationMap(const QVariantMap& configurationMap) QString defaultPermissions = configurationMap[ "perm" ].toString(); if ( defaultPermissions.isEmpty() ) defaultPermissions = QStringLiteral( "root:root:0400" ); - + QVariantList l = files.toList(); unsigned int c = 0; for ( const auto& li : l ) diff --git a/src/modules/users/UsersPage.cpp b/src/modules/users/UsersPage.cpp index 834287bcd..62292b76c 100644 --- a/src/modules/users/UsersPage.cpp +++ b/src/modules/users/UsersPage.cpp @@ -23,16 +23,21 @@ */ #include "UsersPage.h" + #include "ui_page_usersetup.h" + #include "CreateUserJob.h" #include "SetPasswordJob.h" #include "SetHostNameJob.h" -#include "JobQueue.h" + #include "GlobalStorage.h" -#include "utils/Logger.h" +#include "JobQueue.h" +#include "Settings.h" + #include "utils/CalamaresUtilsGui.h" +#include "utils/Logger.h" #include "utils/Retranslator.h" -#include "Settings.h" +#include "utils/String.h" #include #include