[libcalamares] Moc warnings--

- don't have a NOTIFY CONSTANT property
 - the data is constant, so drop NOTIFY
 - remove redundant signals
 - remove setLabels() now it's only needed from one constructor
main
Adriaan de Groot 6 years ago
parent b4b1bf5de2
commit 684c5f477c

@ -35,13 +35,6 @@ Label::Label( const QString& locale, LabelFormat format, QObject* parent )
, m_localeId( locale.isEmpty() ? m_locale.name() : locale ) , m_localeId( locale.isEmpty() ? m_locale.name() : locale )
{ {
setLabels( locale, format );
}
void
Label::setLabels( const QString& locale, LabelFormat format )
{
emit localeIdChanged( m_localeId );
//: language[name] (country[name]) //: language[name] (country[name])
QString longFormat = QObject::tr( "%1 (%2)" ); QString longFormat = QObject::tr( "%1 (%2)" );
@ -62,10 +55,8 @@ Label::setLabels( const QString& locale, LabelFormat format )
countryName = m_locale.nativeCountryName(); countryName = m_locale.nativeCountryName();
} }
m_label = needsCountryName ? longFormat.arg( languageName, countryName ) : languageName; m_label = needsCountryName ? longFormat.arg( languageName, countryName ) : languageName;
emit labelChanged( m_label );
m_englishLabel = needsCountryName ? longFormat.arg( englishName, QLocale::countryToString( m_locale.country() ) ) m_englishLabel = needsCountryName ? longFormat.arg( englishName, QLocale::countryToString( m_locale.country() ) )
: englishName; : englishName;
emit englishLabelChanged( m_englishLabel );
} }
QLocale QLocale

@ -40,9 +40,9 @@ class Label : public QObject
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY( QString label READ label NOTIFY labelChanged CONSTANT FINAL ) Q_PROPERTY( QString label READ label CONSTANT FINAL )
Q_PROPERTY( QString englishLabel READ englishLabel NOTIFY englishLabelChanged CONSTANT FINAL ) Q_PROPERTY( QString englishLabel READ englishLabel CONSTANT FINAL )
Q_PROPERTY( QString localeId MEMBER m_localeId NOTIFY localeIdChanged CONSTANT FINAL ) Q_PROPERTY( QString localeId MEMBER m_localeId CONSTANT FINAL )
public: public:
/** @brief Formatting option for label -- add (country) to label. */ /** @brief Formatting option for label -- add (country) to label. */
@ -103,17 +103,10 @@ public:
static QLocale getLocale( const QString& localeName ); static QLocale getLocale( const QString& localeName );
protected: protected:
void setLabels( const QString& name, LabelFormat format );
QLocale m_locale; QLocale m_locale;
QString m_localeId; // the locale identifier, e.g. "en_GB" QString m_localeId; // the locale identifier, e.g. "en_GB"
QString m_label; // the native name of the locale QString m_label; // the native name of the locale
QString m_englishLabel; QString m_englishLabel;
signals:
void labelChanged( QString label );
void englishLabelChanged( QString englishLabel );
void localeIdChanged( QString localeIdChanged );
}; };
} // namespace Locale } // namespace Locale

Loading…
Cancel
Save