Fixed: Ryzom Configuration language can be different from Ryzom language
--HG-- branch : develop
This commit is contained in:
parent
c4b933d1bd
commit
926af19e1a
17 changed files with 31 additions and 184 deletions
|
@ -111,26 +111,6 @@ void CClientConfigDialog::closeEvent( QCloseEvent *event )
|
||||||
event->ignore();
|
event->ignore();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CClientConfigDialog::changeEvent( QEvent *event )
|
|
||||||
{
|
|
||||||
if( event->type() == QEvent::LanguageChange )
|
|
||||||
{
|
|
||||||
int pageIndex = CategoryStackedWidget->currentIndex();
|
|
||||||
// Signals that are emitted on index change need to be disconnected, since retranslation cleans the widget
|
|
||||||
disconnect( treeWidget, SIGNAL( itemClicked( QTreeWidgetItem *, int ) ),
|
|
||||||
this, SLOT( onClickCategory( QTreeWidgetItem * ) ) );
|
|
||||||
|
|
||||||
retranslateUi( this );
|
|
||||||
|
|
||||||
connect( treeWidget, SIGNAL( itemClicked( QTreeWidgetItem *, int ) ),
|
|
||||||
this, SLOT( onClickCategory( QTreeWidgetItem * ) ) );
|
|
||||||
|
|
||||||
CategoryStackedWidget->setCurrentIndex( pageIndex );
|
|
||||||
}
|
|
||||||
|
|
||||||
QDialog::changeEvent( event );
|
|
||||||
}
|
|
||||||
|
|
||||||
void CClientConfigDialog::onClickOK()
|
void CClientConfigDialog::onClickOK()
|
||||||
{
|
{
|
||||||
saveChanges();
|
saveChanges();
|
||||||
|
|
|
@ -30,11 +30,10 @@ class CClientConfigDialog : public QDialog, public Ui::client_config_dialog
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CClientConfigDialog( QWidget *parent = NULL );
|
CClientConfigDialog( QWidget *parent = NULL );
|
||||||
~CClientConfigDialog();
|
virtual ~CClientConfigDialog();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void closeEvent( QCloseEvent *event );
|
void closeEvent( QCloseEvent *event );
|
||||||
void changeEvent( QEvent *event );
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
//////////////////////////// Main dialog buttons /////////////////////
|
//////////////////////////// Main dialog buttons /////////////////////
|
||||||
|
|
|
@ -76,13 +76,3 @@ void CDisplaySettingsAdvancedWidget::save()
|
||||||
else
|
else
|
||||||
s.config.setInt( "DisableTextureShdr", 0 );
|
s.config.setInt( "DisableTextureShdr", 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDisplaySettingsAdvancedWidget::changeEvent( QEvent *event )
|
|
||||||
{
|
|
||||||
if( event->type() == QEvent::LanguageChange )
|
|
||||||
{
|
|
||||||
retranslateUi( this );
|
|
||||||
}
|
|
||||||
|
|
||||||
QWidget::changeEvent( event );
|
|
||||||
}
|
|
||||||
|
|
|
@ -28,14 +28,10 @@ class CDisplaySettingsAdvancedWidget : public CWidgetBase, public Ui::display_se
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
CDisplaySettingsAdvancedWidget( QWidget *parent );
|
CDisplaySettingsAdvancedWidget( QWidget *parent );
|
||||||
~CDisplaySettingsAdvancedWidget();
|
virtual ~CDisplaySettingsAdvancedWidget();
|
||||||
|
|
||||||
void load();
|
void load();
|
||||||
void save();
|
void save();
|
||||||
|
|
||||||
protected:
|
|
||||||
void changeEvent( QEvent *event );
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DISPLAYSETTINGSADVANCEDWIDGET_H
|
#endif // DISPLAYSETTINGSADVANCEDWIDGET_H
|
||||||
|
|
|
@ -108,21 +108,6 @@ void CDisplaySettingsDetailsWidget::save()
|
||||||
s.config.setInt( "DivideTextureSizeBy2", 1 );
|
s.config.setInt( "DivideTextureSizeBy2", 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDisplaySettingsDetailsWidget::changeEvent( QEvent *event )
|
|
||||||
{
|
|
||||||
if( event->type() == QEvent::LanguageChange )
|
|
||||||
{
|
|
||||||
retranslateUi( this );
|
|
||||||
|
|
||||||
landscapeLabel->setText( getQualityString( landscapeSlider->value() ) );
|
|
||||||
characterLabel->setText( getQualityString( charactersSlider->value() ) );
|
|
||||||
fxLabel->setText( getQualityString( fxSlider->value() ) );
|
|
||||||
textureLabel->setText( getTextureQualityString( texturesSlider->value() ) );
|
|
||||||
}
|
|
||||||
QWidget::changeEvent( event );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void CDisplaySettingsDetailsWidget::onLandscapeSliderChange( int value )
|
void CDisplaySettingsDetailsWidget::onLandscapeSliderChange( int value )
|
||||||
{
|
{
|
||||||
if( ( value < 0 ) || ( value > 3 ) )
|
if( ( value < 0 ) || ( value > 3 ) )
|
||||||
|
|
|
@ -45,14 +45,11 @@ class CDisplaySettingsDetailsWidget : public CWidgetBase, public Ui::display_set
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
CDisplaySettingsDetailsWidget( QWidget *parent = NULL );
|
CDisplaySettingsDetailsWidget( QWidget *parent = NULL );
|
||||||
~CDisplaySettingsDetailsWidget();
|
virtual ~CDisplaySettingsDetailsWidget();
|
||||||
|
|
||||||
void load();
|
void load();
|
||||||
void save();
|
void save();
|
||||||
|
|
||||||
protected:
|
|
||||||
void changeEvent( QEvent *event );
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onLandscapeSliderChange( int value );
|
void onLandscapeSliderChange( int value );
|
||||||
void onCharactersSliderChange( int value );
|
void onCharactersSliderChange( int value );
|
||||||
|
|
|
@ -142,17 +142,6 @@ void CDisplaySettingsWidget::save()
|
||||||
s.config.setInt( "PositionY", ypositionLineEdit->text().toInt() );
|
s.config.setInt( "PositionY", ypositionLineEdit->text().toInt() );
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDisplaySettingsWidget::changeEvent( QEvent *event )
|
|
||||||
{
|
|
||||||
if( event->type() == QEvent::LanguageChange )
|
|
||||||
{
|
|
||||||
disconnect( videomodeComboBox, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onSomethingChanged() ) );
|
|
||||||
retranslateUi( this );
|
|
||||||
connect( videomodeComboBox, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onSomethingChanged() ) );
|
|
||||||
}
|
|
||||||
QWidget::changeEvent( event );
|
|
||||||
}
|
|
||||||
|
|
||||||
void CDisplaySettingsWidget::updateVideoModes()
|
void CDisplaySettingsWidget::updateVideoModes()
|
||||||
{
|
{
|
||||||
CSystem &s = CSystem::GetInstance();
|
CSystem &s = CSystem::GetInstance();
|
||||||
|
|
|
@ -38,14 +38,11 @@ class CDisplaySettingsWidget : public CWidgetBase, public Ui::display_settings_w
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
CDisplaySettingsWidget( QWidget *parent = NULL );
|
CDisplaySettingsWidget( QWidget *parent = NULL );
|
||||||
~CDisplaySettingsWidget();
|
virtual ~CDisplaySettingsWidget();
|
||||||
|
|
||||||
void load();
|
void load();
|
||||||
void save();
|
void save();
|
||||||
|
|
||||||
protected:
|
|
||||||
void changeEvent( QEvent *event );
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
/**
|
/**
|
||||||
@brief Updates the video modes combo box, based on the current driver selection.
|
@brief Updates the video modes combo box, based on the current driver selection.
|
||||||
|
|
|
@ -20,22 +20,15 @@
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
#include <QTranslator>
|
#include <QTranslator>
|
||||||
|
|
||||||
const QString CGeneralSettingsWidget::languageCodes[ NUM_LANGUAGE_CODES ] =
|
#include <nel/misc/i18n.h>
|
||||||
{
|
|
||||||
"en",
|
|
||||||
"fr",
|
|
||||||
"de",
|
|
||||||
"hu"
|
|
||||||
};
|
|
||||||
|
|
||||||
CGeneralSettingsWidget::CGeneralSettingsWidget( QWidget *parent ) :
|
CGeneralSettingsWidget::CGeneralSettingsWidget( QWidget *parent ) :
|
||||||
CWidgetBase( parent )
|
CWidgetBase( parent )
|
||||||
{
|
{
|
||||||
currentTranslator = NULL;
|
|
||||||
setupUi( this );
|
setupUi( this );
|
||||||
load();
|
load();
|
||||||
|
|
||||||
connect( languageComboBox, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onLanguageChanged() ) );
|
connect( languageComboBox, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onSomethingChanged() ) );
|
||||||
connect( saveConfigOnQuitCheckBox, SIGNAL( stateChanged( int ) ), this, SLOT( onSomethingChanged() ) );
|
connect( saveConfigOnQuitCheckBox, SIGNAL( stateChanged( int ) ), this, SLOT( onSomethingChanged() ) );
|
||||||
connect( lowPriorityProcessCheckBox, SIGNAL( stateChanged( int ) ), this, SLOT( onSomethingChanged() ) );
|
connect( lowPriorityProcessCheckBox, SIGNAL( stateChanged( int ) ), this, SLOT( onSomethingChanged() ) );
|
||||||
}
|
}
|
||||||
|
@ -48,26 +41,37 @@ void CGeneralSettingsWidget::load()
|
||||||
{
|
{
|
||||||
CSystem &s = CSystem::GetInstance();
|
CSystem &s = CSystem::GetInstance();
|
||||||
|
|
||||||
sint32 cbIndex = getIndexForLanguageCode( QString::fromUtf8( s.config.getString( "LanguageCode" ).c_str() ) );
|
std::vector<std::string> codes = NLMISC::CI18N::getLanguageCodes();
|
||||||
if( cbIndex != -1 ){
|
std::vector<ucstring> names = NLMISC::CI18N::getLanguageNames();
|
||||||
languageComboBox->setCurrentIndex( cbIndex );
|
|
||||||
onLanguageChanged();
|
languageComboBox->clear();
|
||||||
|
|
||||||
|
for(uint i = 0; i < codes.size(); ++i)
|
||||||
|
{
|
||||||
|
languageComboBox->addItem(QString::fromUtf16(names[i].c_str()), QString::fromUtf8(codes[i].c_str()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if( s.config.getInt( "SaveConfig" ) )
|
sint32 cbIndex = getIndexForLanguageCode( QString::fromUtf8( s.config.getString( "LanguageCode" ).c_str() ) );
|
||||||
|
|
||||||
|
if (cbIndex != -1)
|
||||||
|
{
|
||||||
|
languageComboBox->setCurrentIndex( cbIndex );
|
||||||
|
}
|
||||||
|
|
||||||
|
if (s.config.getInt("SaveConfig"))
|
||||||
saveConfigOnQuitCheckBox->setChecked( true );
|
saveConfigOnQuitCheckBox->setChecked( true );
|
||||||
|
|
||||||
if( s.config.getInt( "ProcessPriority" ) == -1 )
|
if (s.config.getInt("ProcessPriority") == -1)
|
||||||
lowPriorityProcessCheckBox->setChecked( true );
|
lowPriorityProcessCheckBox->setChecked(true);
|
||||||
else
|
else
|
||||||
lowPriorityProcessCheckBox->setChecked( false );
|
lowPriorityProcessCheckBox->setChecked(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGeneralSettingsWidget::save()
|
void CGeneralSettingsWidget::save()
|
||||||
{
|
{
|
||||||
CSystem &s = CSystem::GetInstance();
|
CSystem &s = CSystem::GetInstance();
|
||||||
|
|
||||||
s.config.setString( "LanguageCode", std::string( languageCodes[ languageComboBox->currentIndex() ].toUtf8() ) );
|
s.config.setString( "LanguageCode", std::string(languageComboBox->itemData(languageComboBox->currentIndex()).toString().toUtf8()));
|
||||||
|
|
||||||
if( saveConfigOnQuitCheckBox->isChecked() )
|
if( saveConfigOnQuitCheckBox->isChecked() )
|
||||||
s.config.setInt( "SaveConfig", 1 );
|
s.config.setInt( "SaveConfig", 1 );
|
||||||
|
@ -80,43 +84,10 @@ void CGeneralSettingsWidget::save()
|
||||||
s.config.setInt( "ProcessPriority", 0 );
|
s.config.setInt( "ProcessPriority", 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGeneralSettingsWidget::onLanguageChanged()
|
|
||||||
{
|
|
||||||
sint32 i = languageComboBox->currentIndex();
|
|
||||||
|
|
||||||
if( currentTranslator != NULL )
|
|
||||||
{
|
|
||||||
qApp->removeTranslator( currentTranslator );
|
|
||||||
delete currentTranslator;
|
|
||||||
currentTranslator = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
currentTranslator = new QTranslator();
|
|
||||||
if( currentTranslator->load( QString( ":/translations/ryzom_configuration_%1" ).arg( languageCodes[ i ] ) ) )
|
|
||||||
qApp->installTranslator( currentTranslator );
|
|
||||||
|
|
||||||
emit changed();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CGeneralSettingsWidget::changeEvent( QEvent *event )
|
|
||||||
{
|
|
||||||
if( event->type() == QEvent::LanguageChange )
|
|
||||||
{
|
|
||||||
sint32 i = languageComboBox->currentIndex();
|
|
||||||
// Signals that are emitted on index change need to be disconnected, since retranslation cleans the widget
|
|
||||||
disconnect( languageComboBox, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onLanguageChanged() ) );
|
|
||||||
retranslateUi( this );
|
|
||||||
languageComboBox->setCurrentIndex( i );
|
|
||||||
connect( languageComboBox, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onLanguageChanged() ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
QWidget::changeEvent( event );
|
|
||||||
}
|
|
||||||
|
|
||||||
int CGeneralSettingsWidget::getIndexForLanguageCode(const QString &languageCode)
|
int CGeneralSettingsWidget::getIndexForLanguageCode(const QString &languageCode)
|
||||||
{
|
{
|
||||||
for( sint32 i = 0; i < NUM_LANGUAGE_CODES; i++ )
|
for( sint32 i = 0; i < languageComboBox->count(); i++ )
|
||||||
if( languageCode.compare( languageCodes[ i ] ) == 0 )
|
if( languageCode.compare(languageComboBox->itemData(i).toString()) == 0 )
|
||||||
return i;
|
return i;
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -22,11 +22,6 @@
|
||||||
|
|
||||||
class QTranslator;
|
class QTranslator;
|
||||||
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
NUM_LANGUAGE_CODES = 4
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief The general settings page of the configuration tool
|
@brief The general settings page of the configuration tool
|
||||||
*/
|
*/
|
||||||
|
@ -41,12 +36,6 @@ public:
|
||||||
void load();
|
void load();
|
||||||
void save();
|
void save();
|
||||||
|
|
||||||
private slots:
|
|
||||||
void onLanguageChanged();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void changeEvent( QEvent *event );
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
@brief Retrieves the language combobox index for the language code provided.
|
@brief Retrieves the language combobox index for the language code provided.
|
||||||
|
@ -54,12 +43,6 @@ private:
|
||||||
@return Returns the index on success, returns -1 if the language code cannot be found.
|
@return Returns the index on success, returns -1 if the language code cannot be found.
|
||||||
*/
|
*/
|
||||||
sint32 getIndexForLanguageCode(const QString &languageCode);
|
sint32 getIndexForLanguageCode(const QString &languageCode);
|
||||||
|
|
||||||
// Contains the language codes used in the config file
|
|
||||||
// They are in the same order as the options in languageComboBox
|
|
||||||
static const QString languageCodes[ NUM_LANGUAGE_CODES ];
|
|
||||||
|
|
||||||
QTranslator *currentTranslator;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // GENERALSETTINGWIDGET_H
|
#endif // GENERALSETTINGWIDGET_H
|
||||||
|
|
|
@ -28,14 +28,11 @@ class CSoundSettingsWidget : public CWidgetBase, public Ui::sound_settings_widge
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
CSoundSettingsWidget( QWidget *parent = NULL );
|
CSoundSettingsWidget( QWidget *parent = NULL );
|
||||||
~CSoundSettingsWidget();
|
virtual ~CSoundSettingsWidget();
|
||||||
|
|
||||||
void load();
|
void load();
|
||||||
void save();
|
void save();
|
||||||
|
|
||||||
protected:
|
|
||||||
void changeEvent( QEvent *event );
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onTracksSliderChange();
|
void onTracksSliderChange();
|
||||||
|
|
||||||
|
|
|
@ -34,12 +34,3 @@ CSysInfoD3DWidget::CSysInfoD3DWidget( QWidget *parent ) :
|
||||||
CSysInfoD3DWidget::~CSysInfoD3DWidget()
|
CSysInfoD3DWidget::~CSysInfoD3DWidget()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSysInfoD3DWidget::changeEvent( QEvent *event )
|
|
||||||
{
|
|
||||||
if( event->type() == QEvent::LanguageChange )
|
|
||||||
{
|
|
||||||
retranslateUi( this );
|
|
||||||
}
|
|
||||||
QWidget::changeEvent( event );
|
|
||||||
}
|
|
||||||
|
|
|
@ -29,10 +29,6 @@ class CSysInfoD3DWidget : public QWidget, public Ui::sys_info_d3d_widget
|
||||||
public:
|
public:
|
||||||
CSysInfoD3DWidget( QWidget *parent = NULL );
|
CSysInfoD3DWidget( QWidget *parent = NULL );
|
||||||
virtual ~CSysInfoD3DWidget();
|
virtual ~CSysInfoD3DWidget();
|
||||||
|
|
||||||
protected:
|
|
||||||
void changeEvent( QEvent *event );
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -33,12 +33,3 @@ CSysInfoOpenGLWidget::CSysInfoOpenGLWidget( QWidget *parent ) :
|
||||||
CSysInfoOpenGLWidget::~CSysInfoOpenGLWidget()
|
CSysInfoOpenGLWidget::~CSysInfoOpenGLWidget()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSysInfoOpenGLWidget::changeEvent( QEvent *event )
|
|
||||||
{
|
|
||||||
if( event->type() == QEvent::LanguageChange )
|
|
||||||
{
|
|
||||||
retranslateUi( this );
|
|
||||||
}
|
|
||||||
QWidget::changeEvent( event );
|
|
||||||
}
|
|
||||||
|
|
|
@ -28,10 +28,7 @@ class CSysInfoOpenGLWidget : public QWidget, public Ui::sys_info_opengl_widget
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
CSysInfoOpenGLWidget( QWidget *parent = NULL );
|
CSysInfoOpenGLWidget( QWidget *parent = NULL );
|
||||||
~CSysInfoOpenGLWidget();
|
virtual ~CSysInfoOpenGLWidget();
|
||||||
|
|
||||||
protected:
|
|
||||||
void changeEvent( QEvent *event );
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -37,12 +37,3 @@ CSysInfoWidget::CSysInfoWidget( QWidget *parent ) :
|
||||||
CSysInfoWidget::~CSysInfoWidget()
|
CSysInfoWidget::~CSysInfoWidget()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSysInfoWidget::changeEvent( QEvent *event )
|
|
||||||
{
|
|
||||||
if( event->type() == QEvent::LanguageChange )
|
|
||||||
{
|
|
||||||
retranslateUi( this );
|
|
||||||
}
|
|
||||||
QWidget::changeEvent( event );
|
|
||||||
}
|
|
||||||
|
|
|
@ -28,10 +28,7 @@ class CSysInfoWidget : public QWidget, public Ui::sys_info_widget
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
CSysInfoWidget( QWidget *parent = NULL );
|
CSysInfoWidget( QWidget *parent = NULL );
|
||||||
~CSysInfoWidget();
|
virtual ~CSysInfoWidget();
|
||||||
|
|
||||||
protected:
|
|
||||||
void changeEvent( QEvent *event );
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue