[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"
namespace CalamaresUtils::Locale
namespace CalamaresUtils
{
namespace Locale
{
Label::Label()
@ -70,4 +72,5 @@ QLocale Label::getLocale( const QString& localeName )
return QLocale( localeName );
}
}
} // namespace

View File

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

View File

@ -22,7 +22,9 @@
#include "CalamaresVersion.h" // For the list of translations
namespace CalamaresUtils::Locale
namespace CalamaresUtils
{
namespace Locale
{
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; } );
}
LabelModel* const availableTranslations()
LabelModel* availableTranslations()
{
static LabelModel model( QString( CALAMARES_TRANSLATION_LANGUAGES ).split( ';') );
return &model;
}
}
} // namespace

View File

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

View File

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

View File

@ -24,8 +24,9 @@
#include <QLocale>
#include <QPair>
namespace CalamaresUtils {}
namespace CalamaresUtils::Locale
namespace CalamaresUtils
{
namespace Locale
{
/* All the functions in this file do lookups of locale data
* 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 );
/// @brief Get a likely locale for a 2-letter country code
DLLEXPORT QLocale countryLocale( const QString& code );
}
} // namespace
#endif