Fixed: Compilation under Linux

This commit is contained in:
kervala 2013-09-29 13:49:07 +02:00
parent dcd26e09f9
commit 16d0137b8a
7 changed files with 28 additions and 19 deletions

View file

@ -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() );
}
}
}

View file

@ -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

View file

@ -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++ )

View file

@ -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 )

View file

@ -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

View file

@ -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()

View file

@ -17,7 +17,7 @@
#ifndef SYSINFOD3DWIDGET_H
#define SYSINFOD3DWIDGET_H
#include "ui_sys_Info_d3d_widget.h"
#include "ui_sys_info_d3d_widget.h"
/**