diff --git a/code/ryzom/tools/client/client_config_qt/client_config_dialog.cpp b/code/ryzom/tools/client/client_config_qt/client_config_dialog.cpp index 4d1fc2060..a744b82f8 100644 --- a/code/ryzom/tools/client/client_config_qt/client_config_dialog.cpp +++ b/code/ryzom/tools/client/client_config_qt/client_config_dialog.cpp @@ -111,26 +111,6 @@ void CClientConfigDialog::closeEvent( QCloseEvent *event ) 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() { saveChanges(); diff --git a/code/ryzom/tools/client/client_config_qt/client_config_dialog.h b/code/ryzom/tools/client/client_config_qt/client_config_dialog.h index d9855afc0..c098491dc 100644 --- a/code/ryzom/tools/client/client_config_qt/client_config_dialog.h +++ b/code/ryzom/tools/client/client_config_qt/client_config_dialog.h @@ -30,11 +30,10 @@ class CClientConfigDialog : public QDialog, public Ui::client_config_dialog public: CClientConfigDialog( QWidget *parent = NULL ); - ~CClientConfigDialog(); + virtual ~CClientConfigDialog(); protected: void closeEvent( QCloseEvent *event ); - void changeEvent( QEvent *event ); private slots: //////////////////////////// Main dialog buttons ///////////////////// diff --git a/code/ryzom/tools/client/client_config_qt/display_settings_advanced_widget.cpp b/code/ryzom/tools/client/client_config_qt/display_settings_advanced_widget.cpp index 0e0293555..a60211849 100644 --- a/code/ryzom/tools/client/client_config_qt/display_settings_advanced_widget.cpp +++ b/code/ryzom/tools/client/client_config_qt/display_settings_advanced_widget.cpp @@ -76,13 +76,3 @@ void CDisplaySettingsAdvancedWidget::save() else s.config.setInt( "DisableTextureShdr", 0 ); } - -void CDisplaySettingsAdvancedWidget::changeEvent( QEvent *event ) -{ - if( event->type() == QEvent::LanguageChange ) - { - retranslateUi( this ); - } - - QWidget::changeEvent( event ); -} diff --git a/code/ryzom/tools/client/client_config_qt/display_settings_advanced_widget.h b/code/ryzom/tools/client/client_config_qt/display_settings_advanced_widget.h index 3f956f626..efdd83695 100644 --- a/code/ryzom/tools/client/client_config_qt/display_settings_advanced_widget.h +++ b/code/ryzom/tools/client/client_config_qt/display_settings_advanced_widget.h @@ -28,14 +28,10 @@ class CDisplaySettingsAdvancedWidget : public CWidgetBase, public Ui::display_se Q_OBJECT public: CDisplaySettingsAdvancedWidget( QWidget *parent ); - ~CDisplaySettingsAdvancedWidget(); + virtual ~CDisplaySettingsAdvancedWidget(); void load(); void save(); - -protected: - void changeEvent( QEvent *event ); - }; #endif // DISPLAYSETTINGSADVANCEDWIDGET_H diff --git a/code/ryzom/tools/client/client_config_qt/display_settings_details_widget.cpp b/code/ryzom/tools/client/client_config_qt/display_settings_details_widget.cpp index 74b48cc45..1e1e19521 100644 --- a/code/ryzom/tools/client/client_config_qt/display_settings_details_widget.cpp +++ b/code/ryzom/tools/client/client_config_qt/display_settings_details_widget.cpp @@ -108,21 +108,6 @@ void CDisplaySettingsDetailsWidget::save() 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 ) { if( ( value < 0 ) || ( value > 3 ) ) diff --git a/code/ryzom/tools/client/client_config_qt/display_settings_details_widget.h b/code/ryzom/tools/client/client_config_qt/display_settings_details_widget.h index 001189432..2ae1de132 100644 --- a/code/ryzom/tools/client/client_config_qt/display_settings_details_widget.h +++ b/code/ryzom/tools/client/client_config_qt/display_settings_details_widget.h @@ -45,14 +45,11 @@ class CDisplaySettingsDetailsWidget : public CWidgetBase, public Ui::display_set Q_OBJECT public: CDisplaySettingsDetailsWidget( QWidget *parent = NULL ); - ~CDisplaySettingsDetailsWidget(); + virtual ~CDisplaySettingsDetailsWidget(); void load(); void save(); -protected: - void changeEvent( QEvent *event ); - private slots: void onLandscapeSliderChange( int value ); void onCharactersSliderChange( int value ); diff --git a/code/ryzom/tools/client/client_config_qt/display_settings_widget.cpp b/code/ryzom/tools/client/client_config_qt/display_settings_widget.cpp index f0dba2a07..ae8b1a590 100644 --- a/code/ryzom/tools/client/client_config_qt/display_settings_widget.cpp +++ b/code/ryzom/tools/client/client_config_qt/display_settings_widget.cpp @@ -142,17 +142,6 @@ void CDisplaySettingsWidget::save() 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() { CSystem &s = CSystem::GetInstance(); diff --git a/code/ryzom/tools/client/client_config_qt/display_settings_widget.h b/code/ryzom/tools/client/client_config_qt/display_settings_widget.h index f67ec8b15..b1bb04a48 100644 --- a/code/ryzom/tools/client/client_config_qt/display_settings_widget.h +++ b/code/ryzom/tools/client/client_config_qt/display_settings_widget.h @@ -38,14 +38,11 @@ class CDisplaySettingsWidget : public CWidgetBase, public Ui::display_settings_w Q_OBJECT public: CDisplaySettingsWidget( QWidget *parent = NULL ); - ~CDisplaySettingsWidget(); + virtual ~CDisplaySettingsWidget(); void load(); void save(); -protected: - void changeEvent( QEvent *event ); - private slots: /** @brief Updates the video modes combo box, based on the current driver selection. diff --git a/code/ryzom/tools/client/client_config_qt/general_settings_widget.cpp b/code/ryzom/tools/client/client_config_qt/general_settings_widget.cpp index bb402b328..f38e5299b 100644 --- a/code/ryzom/tools/client/client_config_qt/general_settings_widget.cpp +++ b/code/ryzom/tools/client/client_config_qt/general_settings_widget.cpp @@ -20,22 +20,15 @@ #include "system.h" #include -const QString CGeneralSettingsWidget::languageCodes[ NUM_LANGUAGE_CODES ] = -{ - "en", - "fr", - "de", - "hu" -}; +#include CGeneralSettingsWidget::CGeneralSettingsWidget( QWidget *parent ) : CWidgetBase( parent ) { - currentTranslator = NULL; setupUi( this ); 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( lowPriorityProcessCheckBox, SIGNAL( stateChanged( int ) ), this, SLOT( onSomethingChanged() ) ); } @@ -48,26 +41,37 @@ void CGeneralSettingsWidget::load() { CSystem &s = CSystem::GetInstance(); - sint32 cbIndex = getIndexForLanguageCode( QString::fromUtf8( s.config.getString( "LanguageCode" ).c_str() ) ); - if( cbIndex != -1 ){ - languageComboBox->setCurrentIndex( cbIndex ); - onLanguageChanged(); + std::vector codes = NLMISC::CI18N::getLanguageCodes(); + std::vector names = NLMISC::CI18N::getLanguageNames(); + + 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 ); - if( s.config.getInt( "ProcessPriority" ) == -1 ) - lowPriorityProcessCheckBox->setChecked( true ); + if (s.config.getInt("ProcessPriority") == -1) + lowPriorityProcessCheckBox->setChecked(true); else - lowPriorityProcessCheckBox->setChecked( false ); + lowPriorityProcessCheckBox->setChecked(false); } void CGeneralSettingsWidget::save() { 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() ) s.config.setInt( "SaveConfig", 1 ); @@ -80,43 +84,10 @@ void CGeneralSettingsWidget::save() 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) { - for( sint32 i = 0; i < NUM_LANGUAGE_CODES; i++ ) - if( languageCode.compare( languageCodes[ i ] ) == 0 ) + for( sint32 i = 0; i < languageComboBox->count(); i++ ) + if( languageCode.compare(languageComboBox->itemData(i).toString()) == 0 ) return i; return -1; diff --git a/code/ryzom/tools/client/client_config_qt/general_settings_widget.h b/code/ryzom/tools/client/client_config_qt/general_settings_widget.h index 412658a72..8cd400b3b 100644 --- a/code/ryzom/tools/client/client_config_qt/general_settings_widget.h +++ b/code/ryzom/tools/client/client_config_qt/general_settings_widget.h @@ -22,11 +22,6 @@ class QTranslator; -enum -{ - NUM_LANGUAGE_CODES = 4 -}; - /** @brief The general settings page of the configuration tool */ @@ -41,12 +36,6 @@ public: void load(); void save(); -private slots: - void onLanguageChanged(); - -protected: - void changeEvent( QEvent *event ); - private: /** @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. */ 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 diff --git a/code/ryzom/tools/client/client_config_qt/sound_settings_widget.cpp b/code/ryzom/tools/client/client_config_qt/sound_settings_widget.cpp index be637f8d8..b820a696f 100644 --- a/code/ryzom/tools/client/client_config_qt/sound_settings_widget.cpp +++ b/code/ryzom/tools/client/client_config_qt/sound_settings_widget.cpp @@ -62,6 +62,8 @@ void CSoundSettingsWidget::load() tracks = 32; tracksSlider->setValue( tracks / 4 ); + updateTracksLabel(); + if( s.config.getString( "DriverSound" ).compare( "FMod" ) == 0 ) fmodCheckBox->setChecked( true ); } @@ -85,16 +87,6 @@ void CSoundSettingsWidget::save() s.config.setString( "DriverSound", std::string( "FMod" ) ); } -void CSoundSettingsWidget::changeEvent( QEvent *event ) -{ - if( event->type() == QEvent::LanguageChange ) - { - retranslateUi( this ); - updateTracksLabel(); - } - QWidget::changeEvent( event ); -} - void CSoundSettingsWidget::updateTracksLabel() { tracksLabel->setText( tr( "%1 tracks" ).arg( tracksSlider->value() * 4 ) ); diff --git a/code/ryzom/tools/client/client_config_qt/sound_settings_widget.h b/code/ryzom/tools/client/client_config_qt/sound_settings_widget.h index c995f1206..e50bd8256 100644 --- a/code/ryzom/tools/client/client_config_qt/sound_settings_widget.h +++ b/code/ryzom/tools/client/client_config_qt/sound_settings_widget.h @@ -28,14 +28,11 @@ class CSoundSettingsWidget : public CWidgetBase, public Ui::sound_settings_widge Q_OBJECT public: CSoundSettingsWidget( QWidget *parent = NULL ); - ~CSoundSettingsWidget(); + virtual ~CSoundSettingsWidget(); void load(); void save(); -protected: - void changeEvent( QEvent *event ); - private slots: void onTracksSliderChange(); diff --git a/code/ryzom/tools/client/client_config_qt/sys_info_d3d_widget.cpp b/code/ryzom/tools/client/client_config_qt/sys_info_d3d_widget.cpp index 140a75adc..ddc001d4c 100644 --- a/code/ryzom/tools/client/client_config_qt/sys_info_d3d_widget.cpp +++ b/code/ryzom/tools/client/client_config_qt/sys_info_d3d_widget.cpp @@ -25,21 +25,12 @@ CSysInfoD3DWidget::CSysInfoD3DWidget( QWidget *parent ) : setupUi( this ); #ifdef Q_OS_WIN32 - descriptionLabel->setText( CSystem::GetInstance().d3dInfo.device.c_str() ); - driverLabel->setText( CSystem::GetInstance().d3dInfo.driver.c_str() ); - versionLabel->setText( CSystem::GetInstance().d3dInfo.driverVersion.c_str() ); + descriptionLabel->setText(QString::fromUtf8(CSystem::GetInstance().d3dInfo.device.c_str())); + driverLabel->setText(QString::fromUtf8(CSystem::GetInstance().d3dInfo.driver.c_str())); + versionLabel->setText(QString::fromUtf8(CSystem::GetInstance().d3dInfo.driverVersion.c_str())); #endif } CSysInfoD3DWidget::~CSysInfoD3DWidget() { } - -void CSysInfoD3DWidget::changeEvent( QEvent *event ) -{ - if( event->type() == QEvent::LanguageChange ) - { - retranslateUi( this ); - } - QWidget::changeEvent( event ); -} diff --git a/code/ryzom/tools/client/client_config_qt/sys_info_d3d_widget.h b/code/ryzom/tools/client/client_config_qt/sys_info_d3d_widget.h index a77d89fa9..875112234 100644 --- a/code/ryzom/tools/client/client_config_qt/sys_info_d3d_widget.h +++ b/code/ryzom/tools/client/client_config_qt/sys_info_d3d_widget.h @@ -29,10 +29,6 @@ class CSysInfoD3DWidget : public QWidget, public Ui::sys_info_d3d_widget public: CSysInfoD3DWidget( QWidget *parent = NULL ); virtual ~CSysInfoD3DWidget(); - -protected: - void changeEvent( QEvent *event ); - }; diff --git a/code/ryzom/tools/client/client_config_qt/sys_info_opengl_widget.cpp b/code/ryzom/tools/client/client_config_qt/sys_info_opengl_widget.cpp index 55deea24e..007786398 100644 --- a/code/ryzom/tools/client/client_config_qt/sys_info_opengl_widget.cpp +++ b/code/ryzom/tools/client/client_config_qt/sys_info_opengl_widget.cpp @@ -23,22 +23,12 @@ CSysInfoOpenGLWidget::CSysInfoOpenGLWidget( QWidget *parent ) : QWidget( parent ) { setupUi( this ); - vendorLabel->setText( CSystem::GetInstance().openglInfo.vendor.c_str() ); - rendererLabel->setText( CSystem::GetInstance().openglInfo.renderer.c_str() ); - versionLabel->setText( CSystem::GetInstance().openglInfo.driverVersion.c_str() ); - extensionsBox->setPlainText( CSystem::GetInstance().openglInfo.extensions.c_str() ); - + vendorLabel->setText(QString::fromUtf8(CSystem::GetInstance().openglInfo.vendor.c_str())); + rendererLabel->setText(QString::fromUtf8( CSystem::GetInstance().openglInfo.renderer.c_str())); + versionLabel->setText(QString::fromUtf8( CSystem::GetInstance().openglInfo.driverVersion.c_str())); + extensionsBox->setPlainText(QString::fromUtf8( CSystem::GetInstance().openglInfo.extensions.c_str())); } CSysInfoOpenGLWidget::~CSysInfoOpenGLWidget() { } - -void CSysInfoOpenGLWidget::changeEvent( QEvent *event ) -{ - if( event->type() == QEvent::LanguageChange ) - { - retranslateUi( this ); - } - QWidget::changeEvent( event ); -} diff --git a/code/ryzom/tools/client/client_config_qt/sys_info_opengl_widget.h b/code/ryzom/tools/client/client_config_qt/sys_info_opengl_widget.h index f1d396f51..241a31867 100644 --- a/code/ryzom/tools/client/client_config_qt/sys_info_opengl_widget.h +++ b/code/ryzom/tools/client/client_config_qt/sys_info_opengl_widget.h @@ -28,10 +28,7 @@ class CSysInfoOpenGLWidget : public QWidget, public Ui::sys_info_opengl_widget Q_OBJECT public: CSysInfoOpenGLWidget( QWidget *parent = NULL ); - ~CSysInfoOpenGLWidget(); - -protected: - void changeEvent( QEvent *event ); + virtual ~CSysInfoOpenGLWidget(); }; diff --git a/code/ryzom/tools/client/client_config_qt/sys_info_widget.cpp b/code/ryzom/tools/client/client_config_qt/sys_info_widget.cpp index fcc0940dd..fa1e746bd 100644 --- a/code/ryzom/tools/client/client_config_qt/sys_info_widget.cpp +++ b/code/ryzom/tools/client/client_config_qt/sys_info_widget.cpp @@ -24,25 +24,15 @@ CSysInfoWidget::CSysInfoWidget( QWidget *parent ) : { setupUi( this ); - osLabel->setText( CSystem::GetInstance().sysInfo.osName.c_str() ); - cpuLabel->setText( CSystem::GetInstance().sysInfo.cpuName.c_str() ); + osLabel->setText(QString::fromUtf8(CSystem::GetInstance().sysInfo.osName.c_str())); + cpuLabel->setText(QString::fromUtf8(CSystem::GetInstance().sysInfo.cpuName.c_str())); - ramLabel->setText( - QString().setNum( CSystem::GetInstance().sysInfo.totalRAM ).append( " Mb" ) ); + ramLabel->setText(QString(tr("%1 MB").arg(CSystem::GetInstance().sysInfo.totalRAM))); - gfxcardLabel->setText( CSystem::GetInstance().sysInfo.videoDevice.c_str() ); - gfxdriverLabel->setText( CSystem::GetInstance().sysInfo.videoDriverVersion.c_str() ); + gfxcardLabel->setText(QString::fromUtf8(CSystem::GetInstance().sysInfo.videoDevice.c_str())); + gfxdriverLabel->setText(QString::fromUtf8(CSystem::GetInstance().sysInfo.videoDriverVersion.c_str())); } CSysInfoWidget::~CSysInfoWidget() { } - -void CSysInfoWidget::changeEvent( QEvent *event ) -{ - if( event->type() == QEvent::LanguageChange ) - { - retranslateUi( this ); - } - QWidget::changeEvent( event ); -} diff --git a/code/ryzom/tools/client/client_config_qt/sys_info_widget.h b/code/ryzom/tools/client/client_config_qt/sys_info_widget.h index d266c119d..9c1cad962 100644 --- a/code/ryzom/tools/client/client_config_qt/sys_info_widget.h +++ b/code/ryzom/tools/client/client_config_qt/sys_info_widget.h @@ -28,10 +28,7 @@ class CSysInfoWidget : public QWidget, public Ui::sys_info_widget Q_OBJECT public: CSysInfoWidget( QWidget *parent = NULL ); - ~CSysInfoWidget(); - -protected: - void changeEvent( QEvent *event ); + virtual ~CSysInfoWidget(); }; diff --git a/code/ryzom/tools/client/client_config_qt/translations/ryzom_configuration_fr.ts b/code/ryzom/tools/client/client_config_qt/translations/ryzom_configuration_fr.ts index 9e3b9929d..c79de4087 100644 --- a/code/ryzom/tools/client/client_config_qt/translations/ryzom_configuration_fr.ts +++ b/code/ryzom/tools/client/client_config_qt/translations/ryzom_configuration_fr.ts @@ -19,7 +19,7 @@ Low - Bas + Faible @@ -34,12 +34,12 @@ High - Haut + Elevé Low (32 MB) - Bas (32 Mo) + Faible (32 Mo) @@ -49,7 +49,7 @@ High (128 MB) - Haut (128 Mo) + Elevé (128 Mo) @@ -188,7 +188,7 @@ Low - Bas + Faible @@ -329,7 +329,7 @@ Slow down the game ( process low priority ) - Ralentir le jeu (priorité basse au processus) + Ralentir le jeu (priorité basse du processus)