[libcalamares] Fix nested namespaces

- Declaring namespace A::B is a C++17 extension, and Calamares
   is C++14. Split the namespace declarations.
 - While here, fix extra const warning as well.
This commit is contained in:
Adriaan de Groot 2019-05-13 12:23:41 +02:00
parent 859e95432e
commit 7302b9c851
6 changed files with 26 additions and 13 deletions

View File

@ -19,7 +19,9 @@
#include "Label.h" #include "Label.h"
namespace CalamaresUtils::Locale namespace CalamaresUtils
{
namespace Locale
{ {
Label::Label() Label::Label()
@ -70,4 +72,5 @@ QLocale Label::getLocale( const QString& localeName )
return QLocale( localeName ); return QLocale( localeName );
} }
}
} // namespace } // namespace

View File

@ -23,8 +23,9 @@
#include <QLocale> #include <QLocale>
#include <QString> #include <QString>
namespace CalamaresUtils {} namespace CalamaresUtils
namespace CalamaresUtils::Locale {
namespace Locale
{ {
/** /**
@ -120,7 +121,7 @@ protected:
QString m_englishLabel; QString m_englishLabel;
} ; } ;
}
} // namespace } // namespace
#endif #endif

View File

@ -22,7 +22,9 @@
#include "CalamaresVersion.h" // For the list of translations #include "CalamaresVersion.h" // For the list of translations
namespace CalamaresUtils::Locale namespace CalamaresUtils
{
namespace Locale
{ {
LabelModel::LabelModel( const QStringList& locales, QObject* parent ) LabelModel::LabelModel( const QStringList& locales, QObject* parent )
@ -121,10 +123,11 @@ LabelModel::find( const QString& countryCode ) const
return find( [&]( const Label& l ){ return l.language() == c_l.second; } ); return find( [&]( const Label& l ){ return l.language() == c_l.second; } );
} }
LabelModel* const availableTranslations() LabelModel* availableTranslations()
{ {
static LabelModel model( QString( CALAMARES_TRANSLATION_LANGUAGES ).split( ';') ); static LabelModel model( QString( CALAMARES_TRANSLATION_LANGUAGES ).split( ';') );
return &model; return &model;
} }
}
} // namespace } // namespace

View File

@ -26,8 +26,9 @@
#include <QVector> #include <QVector>
namespace CalamaresUtils {} namespace CalamaresUtils
namespace CalamaresUtils::Locale {
namespace Locale
{ {
class DLLEXPORT LabelModel : public QAbstractListModel class DLLEXPORT LabelModel : public QAbstractListModel
@ -78,7 +79,7 @@ private:
* *
* NOTE: While the model is not typed const, it should be. Do not modify. * NOTE: While the model is not typed const, it should be. Do not modify.
*/ */
DLLEXPORT LabelModel* const availableTranslations(); DLLEXPORT LabelModel* availableTranslations();
}
} // namespace } // namespace
#endif #endif

View File

@ -20,7 +20,9 @@
#include "CountryData_p.cpp" #include "CountryData_p.cpp"
namespace CalamaresUtils::Locale namespace CalamaresUtils
{
namespace Locale
{ {
struct TwoChar struct TwoChar
@ -87,4 +89,5 @@ QLocale::Language languageForCountry(QLocale::Country country)
return p->l; return p->l;
} }
}
} // namespace } // namespace

View File

@ -24,8 +24,9 @@
#include <QLocale> #include <QLocale>
#include <QPair> #include <QPair>
namespace CalamaresUtils {} namespace CalamaresUtils
namespace CalamaresUtils::Locale {
namespace Locale
{ {
/* All the functions in this file do lookups of locale data /* All the functions in this file do lookups of locale data
* based on CLDR tables; these are lookups that you can't (easily) * based on CLDR tables; these are lookups that you can't (easily)
@ -48,6 +49,7 @@ namespace CalamaresUtils::Locale
DLLEXPORT QPair< QLocale::Country, QLocale::Language > countryData( const QString& code ); DLLEXPORT QPair< QLocale::Country, QLocale::Language > countryData( const QString& code );
/// @brief Get a likely locale for a 2-letter country code /// @brief Get a likely locale for a 2-letter country code
DLLEXPORT QLocale countryLocale( const QString& code ); DLLEXPORT QLocale countryLocale( const QString& code );
}
} // namespace } // namespace
#endif #endif