Serial Studio 1.1.6
A dashboard software for your embedded projects
Misc::Translator Class Reference

The Translator class. More...

#include <Translator.h>

Inheritance diagram for Misc::Translator:
Inheritance graph
Collaboration diagram for Misc::Translator:
Collaboration graph

Public Slots

void setLanguage (const int language)
 
void setLanguage (const QLocale &locale, const QString &language)
 

Signals

void languageChanged ()
 

Public Member Functions

int language () const
 
int systemLanguage () const
 
StringList availableLanguages () const
 
Q_INVOKABLE QString welcomeConsoleText () const
 
Q_INVOKABLE QString acknowledgementsText () const
 

Static Public Member Functions

static Translatorinstance ()
 

Properties

int language
 
StringList availableLanguages
 

Private Member Functions

 Translator ()
 
 Translator (Translator &&)=delete
 
 Translator (const Translator &)=delete
 
Translatoroperator= (Translator &&)=delete
 
Translatoroperator= (const Translator &)=delete
 

Private Attributes

int m_language
 
QSettings m_settings
 
QTranslator m_translator
 

Detailed Description

The Translator class.

The Translator module provides the user interface with a list of available translations, and loads the specified translation file during application startup or when the user changes the language of the application.

Constructor & Destructor Documentation

◆ Translator() [1/3]

Misc::Translator::Translator ( )
explicitprivate

Constructor function

◆ Translator() [2/3]

Misc::Translator::Translator ( Translator &&  )
privatedelete

◆ Translator() [3/3]

Misc::Translator::Translator ( const Translator )
privatedelete

Member Function Documentation

◆ acknowledgementsText()

QString Misc::Translator::acknowledgementsText ( ) const

Returns the acknowledgements text.

◆ availableLanguages()

StringList Misc::Translator::availableLanguages ( ) const

Returns a list with the available translation languages.

◆ instance()

Misc::Translator & Misc::Translator::instance ( )
static

Returns the only instance of the class

◆ language()

int Misc::Translator::language ( ) const

Returns the current language ID, which corresponds to the indexes of the languages returned by the availableLanguages() function.

◆ languageChanged

void Misc::Translator::languageChanged ( )
signal

◆ operator=() [1/2]

Translator & Misc::Translator::operator= ( const Translator )
privatedelete

◆ operator=() [2/2]

Translator & Misc::Translator::operator= ( Translator &&  )
privatedelete

◆ setLanguage [1/2]

void Misc::Translator::setLanguage ( const int  language)
slot

Changes the language of the application and emits the signals appropiate to reload every string that uses the Qt translator system.

Parameters
languagelanguage ID based on the indexes of the availableLanguages() function

◆ setLanguage [2/2]

void Misc::Translator::setLanguage ( const QLocale &  locale,
const QString &  language 
)
slot

Changes the language of the application and emits the signals neccesary to reload every string that uses the Qt translator system.

Parameters
localeuser-set locale
languagename of the *.qm file to load from the "translations" directory inside the application's resources

◆ systemLanguage()

int Misc::Translator::systemLanguage ( ) const

Returns the appropiate language ID based on the current locale settings of the host's operating system.

◆ welcomeConsoleText()

QString Misc::Translator::welcomeConsoleText ( ) const

Returns the welcome text displayed on the console

Member Data Documentation

◆ m_language

int Misc::Translator::m_language
private

◆ m_settings

QSettings Misc::Translator::m_settings
private

◆ m_translator

QTranslator Misc::Translator::m_translator
private

Property Documentation

◆ availableLanguages

StringList Misc::Translator::availableLanguages
read

◆ language

int Misc::Translator::language
readwrite

The documentation for this class was generated from the following files: