From 16d0137b8a55c71515ba06cd2945eb1085b17fcf Mon Sep 17 00:00:00 2001 From: kervala Date: Sun, 29 Sep 2013 13:49:07 +0200 Subject: [PATCH] Fixed: Compilation under Linux --- .../tools/client/client_config_qt/config.cpp | 4 +-- .../tools/client/client_config_qt/config.h | 2 +- .../display_settings_widget.cpp | 31 ++++++++++++------- .../general_settings_widget.cpp | 4 +-- .../general_settings_widget.h | 2 +- .../client_config_qt/sys_info_d3d_widget.cpp | 2 ++ .../client_config_qt/sys_info_d3d_widget.h | 2 +- 7 files changed, 28 insertions(+), 19 deletions(-) diff --git a/code/ryzom/tools/client/client_config_qt/config.cpp b/code/ryzom/tools/client/client_config_qt/config.cpp index 73f52bca1..55854862f 100644 --- a/code/ryzom/tools/client/client_config_qt/config.cpp +++ b/code/ryzom/tools/client/client_config_qt/config.cpp @@ -238,7 +238,7 @@ void CConfig::setFloat( const char *key, float value ) } } -void CConfig::setString( const char *key, std::string &value ) +void CConfig::setString( const char *key, const std::string &value ) { NLMISC::CConfigFile::CVar *var = cf.getVarPtr( key ); @@ -253,4 +253,4 @@ void CConfig::setString( const char *key, std::string &value ) { nlwarning( "Couldn't find key %s in %s.", key, cf.getFilename().c_str() ); } -} \ No newline at end of file +} diff --git a/code/ryzom/tools/client/client_config_qt/config.h b/code/ryzom/tools/client/client_config_qt/config.h index df48e19e0..d9ddb536e 100644 --- a/code/ryzom/tools/client/client_config_qt/config.h +++ b/code/ryzom/tools/client/client_config_qt/config.h @@ -108,7 +108,7 @@ public: @param key - the key we want to alter @param value - the value we want to set */ - void setString( const char *key, std::string &value ); + void setString( const char *key, const std::string &value ); private: // config file 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 e2e2d882e..164778a3a 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 @@ -112,9 +112,11 @@ void CDisplaySettingsWidget::save() CVideoMode mode; // OpenGL should be available everywhere! +#ifdef Q_OS_WIN32 if( direct3dRadioButton->isChecked() ) mode = s.d3dInfo.modes[ index ]; else +#endif mode = s.openglInfo.modes[ index ]; s.config.setInt( "Width", mode.width ); @@ -151,24 +153,27 @@ void CDisplaySettingsWidget::updateVideoModes() videomodeComboBox->clear(); + std::vector< CVideoMode >::iterator itr, iend; + +#ifdef Q_OS_WIN32 if( direct3dRadioButton->isChecked() ) { - for( std::vector< CVideoMode >::iterator itr = s.d3dInfo.modes.begin(); itr != s.d3dInfo.modes.end(); ++itr ) - { - std::stringstream ss; - ss << itr->widht << "x" << itr->height << " " << itr->depth << " bit @" << itr->frequency; - videomodeComboBox->addItem( ss.str().c_str() ); - } + itr = s.d3dInfo.modes.begin(); + iend = s.d3dInfo.modes.end(); } else +#endif { // OpenGL should be available everywhere! - for( std::vector< CVideoMode >::iterator itr = s.openglInfo.modes.begin(); itr != s.openglInfo.modes.end(); ++itr ) - { - std::stringstream ss; - ss << itr->widht << "x" << itr->height << " " << itr->depth << " bit @" << itr->frequency; - videomodeComboBox->addItem( ss.str().c_str() ); - } + itr = s.openglInfo.modes.begin(); + iend = s.openglInfo.modes.end(); + } + + while(itr != iend) + { + videomodeComboBox->addItem(QString("%1x%2 %3 bit @%4").arg(itr->width).arg(itr->height).arg(itr->depth).arg(itr->frequency)); + + ++itr; } } @@ -192,6 +197,7 @@ uint32 CDisplaySettingsWidget::findVideoModeIndex( CVideoMode *mode ) CVideoMode &m = *mode; CSystem &s = CSystem::GetInstance(); +#ifdef Q_OS_WIN32 if( direct3dRadioButton->isChecked() ) { for( uint32 i = 0; i < s.d3dInfo.modes.size(); i++ ) @@ -199,6 +205,7 @@ uint32 CDisplaySettingsWidget::findVideoModeIndex( CVideoMode *mode ) return i; } else +#endif { // Again OpenGL should be available everywhere! for( uint32 i = 0; i < s.openglInfo.modes.size(); i++ ) 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 b874b60ed..6e4a039c5 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 @@ -47,7 +47,7 @@ void CGeneralSettingsWidget::load() { CSystem &s = CSystem::GetInstance(); - sint32 cbIndex = getIndexForLanguageCode( QString( s.config.getString( "LanguageCode" ).c_str() ) ); + sint32 cbIndex = getIndexForLanguageCode( QString::fromUtf8( s.config.getString( "LanguageCode" ).c_str() ) ); if( cbIndex != -1 ){ languageComboBox->setCurrentIndex( cbIndex ); onLanguageChanged(); @@ -112,7 +112,7 @@ void CGeneralSettingsWidget::changeEvent( QEvent *event ) QWidget::changeEvent( event ); } -int CGeneralSettingsWidget::getIndexForLanguageCode( QString &languageCode ) +int CGeneralSettingsWidget::getIndexForLanguageCode(const QString &languageCode) { for( sint32 i = 0; i < NUM_LANGUAGE_CODES; i++ ) if( languageCode.compare( languageCodes[ i ] ) == 0 ) 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 792219751..419175b06 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 @@ -53,7 +53,7 @@ private: @param languageCode - Reference to the language code, we are trying to find. @return Returns the index on success, returns -1 if the language code cannot be found. */ - sint32 getIndexForLanguageCode( 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 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 39ac4cfc6..140a75adc 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 @@ -24,9 +24,11 @@ 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() ); +#endif } CSysInfoD3DWidget::~CSysInfoD3DWidget() 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 6f79782ae..944cf41b2 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 @@ -17,7 +17,7 @@ #ifndef SYSINFOD3DWIDGET_H #define SYSINFOD3DWIDGET_H -#include "ui_sys_Info_d3d_widget.h" +#include "ui_sys_info_d3d_widget.h" /**