Originally Posted by
squidge
and you read your settings file how?
This is my routine to read settings:
void MainWindow::readSettings()
{
/* language group */
settings.beginGroup("language");
m_language = settings.value("lang", "en").toString();
settings.endGroup();
/* paths group */
settings.beginGroup("paths");
m_w1SourceDir = settings.value("w1_source", "C:").toString();
m_w2SourceDir = settings.value("w2_source", "C:").toString();
m_w1OutputDir = settings.value("w1_output", "C:").toString();
m_w2OutputDir = settings.value("w2_output", "C:").toString();
settings.endGroup();
/* background file */
settings.beginGroup("background");
m_bgFile = settings.value("file", "./audio de fondo/Grabacion_marca de agua_cruz report - MONO.mp3").toString();
m_loopMode = settings.value("loop_mode", "loop").toString();
m_loopInterval = settings.value("loop_interval", 5).toInt();
settings.endGroup();
/* steps */
settings.beginGroup("steps");
m_sstep = settings.value("sec", 1).toInt();
m_mstep = settings.value("min", 1).toInt();
settings.endGroup();
/* colors group */
settings.beginGroup("colors");
m_bgColor = settings.value( "background", colVariant ).value<QColor>();
m_wfColor = settings.value( "waveform", Qt::darkBlue ).value<QColor>();
m_tlColor = settings.value( "timeline", Qt::darkRed ).value<QColor>();
m_mkColor = settings.value( "markers", Qt::yellow ).value<QColor>();
m_slColor = settings.value( "selection", Qt::red ).value<QColor>();
settings.endGroup();
}
void MainWindow::readSettings()
{
QSettings settings("config.ini", QSettings::IniFormat);
/* language group */
settings.beginGroup("language");
m_language = settings.value("lang", "en").toString();
settings.endGroup();
/* paths group */
settings.beginGroup("paths");
m_w1SourceDir = settings.value("w1_source", "C:").toString();
m_w2SourceDir = settings.value("w2_source", "C:").toString();
m_w1OutputDir = settings.value("w1_output", "C:").toString();
m_w2OutputDir = settings.value("w2_output", "C:").toString();
settings.endGroup();
/* background file */
settings.beginGroup("background");
m_bgFile = settings.value("file", "./audio de fondo/Grabacion_marca de agua_cruz report - MONO.mp3").toString();
m_loopMode = settings.value("loop_mode", "loop").toString();
m_loopInterval = settings.value("loop_interval", 5).toInt();
settings.endGroup();
/* steps */
settings.beginGroup("steps");
m_sstep = settings.value("sec", 1).toInt();
m_mstep = settings.value("min", 1).toInt();
settings.endGroup();
/* colors group */
settings.beginGroup("colors");
QColor defColor = Qt::white;
QVariant colVariant = defColor;
m_bgColor = settings.value( "background", colVariant ).value<QColor>();
m_wfColor = settings.value( "waveform", Qt::darkBlue ).value<QColor>();
m_tlColor = settings.value( "timeline", Qt::darkRed ).value<QColor>();
m_mkColor = settings.value( "markers", Qt::yellow ).value<QColor>();
m_slColor = settings.value( "selection", Qt::red ).value<QColor>();
settings.endGroup();
}
To copy to clipboard, switch view to plain text mode
I installed 2 translation files in the main.cpp so:
enTranslator.load( "ecpstudio_en");
app.installTranslator( &enTranslator );
esTranslator.load( "ecpstudio_es");
app.installTranslator( &esTranslator );
QApplication app(argc, argv);
QTranslator enTranslator;
enTranslator.load( "ecpstudio_en");
app.installTranslator( &enTranslator );
QTranslator esTranslator;
esTranslator.load( "ecpstudio_es");
app.installTranslator( &esTranslator );
To copy to clipboard, switch view to plain text mode
then I perform a test on the m_language variable ( after read the configuration file )
if ( QString::compare(m_language,
"en", Qt
::CaseInsensitive) == 0 ) // here I would do effective the english translation file
else
// here I would do effective the spanish translation file
if ( QString::compare(m_language, "en", Qt::CaseInsensitive) == 0 )
// here I would do effective the english translation file
else
// here I would do effective the spanish translation file
To copy to clipboard, switch view to plain text mode
Bookmarks