Merge with rc-botanic-webdev
This commit is contained in:
parent
932c23646e
commit
2f072fb60b
46 changed files with 3210 additions and 2551 deletions
|
@ -209,5 +209,6 @@ code/ryzom/server/src/ryzom_admin_service/ryzom_admin_service
|
|||
code/ryzom/server/src/ryzom_naming_service/ryzom_naming_service
|
||||
code/ryzom/server/src/ryzom_welcome_service/ryzom_welcome_service
|
||||
code/ryzom/server/src/tick_service/tick_service
|
||||
# WebTT temp dir
|
||||
# WebTT temp dir
|
||||
code/ryzom/tools/server/www/webtt/app/tmp
|
||||
code\ryzom\tools\server\ryzom_ams\old
|
|
@ -1,57 +1,57 @@
|
|||
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${QT_INCLUDES} )
|
||||
|
||||
FILE( GLOB SRC *.cpp *.h )
|
||||
|
||||
SET( CLIENT_CONFIG_HDR
|
||||
client_config_dialog.h
|
||||
display_settings_advanced_widget.h
|
||||
display_settings_details_widget.h
|
||||
display_settings_widget.h
|
||||
general_settings_widget.h
|
||||
sound_settings_widget.h
|
||||
sys_info_d3d_widget.h
|
||||
sys_info_opengl_widget.h
|
||||
sys_info_widget.h
|
||||
widget_base.h
|
||||
)
|
||||
|
||||
SET( CLIENT_CONFIG_UIS
|
||||
client_config_dialog.ui
|
||||
display_settings_advanced_widget.ui
|
||||
display_settings_details_widget.ui
|
||||
display_settings_widget.ui
|
||||
general_settings_widget.ui
|
||||
sound_settings_widget.ui
|
||||
sys_info_d3d_widget.ui
|
||||
sys_info_opengl_widget.ui
|
||||
sys_info_widget.ui
|
||||
)
|
||||
|
||||
SET( CLIENT_CONFIG_TRANS
|
||||
translations/ryzom_configuration_en.ts
|
||||
translations/ryzom_configuration_hu.ts
|
||||
)
|
||||
|
||||
CONFIGURE_FILE( translations/translations.qrc ${CMAKE_CURRENT_BINARY_DIR}/translations.qrc COPYONLY )
|
||||
SET( CLIENT_CONFIG_RCS resources.qrc ${CMAKE_CURRENT_BINARY_DIR}/translations.qrc )
|
||||
SET( QT_USE_QTGUI TRUE )
|
||||
SET( QT_USE_QTOPENGL TRUE )
|
||||
SET( QT_USE_QTCORE TRUE )
|
||||
QT4_ADD_TRANSLATION( CLIENT_CONFIG_QM ${CLIENT_CONFIG_TRANS} )
|
||||
QT4_ADD_RESOURCES( CLIENT_CONFIG_RC_SRCS ${CLIENT_CONFIG_RCS} )
|
||||
QT4_WRAP_CPP( CLIENT_CONFIG_MOC_SRC ${CLIENT_CONFIG_HDR} )
|
||||
QT4_WRAP_UI( CLIENT_CONFIG_UI_HDRS ${CLIENT_CONFIG_UIS} )
|
||||
SOURCE_GROUP( "Resources" FILES ${CLIENT_CONFIG_RCS} )
|
||||
SOURCE_GROUP( "Forms" FILES ${CLIENT_CONFIG_UIS} )
|
||||
SOURCE_GROUP( "Generated Files" FILES ${CLIENT_CONFIG_UI_HDRS} ${CLIENT_CONFIG_MOC_SRC} )
|
||||
SOURCE_GROUP( "Translation Files" FILES ${CLIENT_CONFIG_TRANS} )
|
||||
ADD_DEFINITIONS( ${QT_DEFINITIONS} )
|
||||
ADD_EXECUTABLE( ryzom_configuration_qt WIN32 MACOSX_BUNDLE ${SRC} ${CLIENT_CONFIG_MOC_SRC} ${CLIENT_CONFIG_UI_HDRS} ${CLIENT_CONFIG_RC_SRCS} ${CLIENT_CONFIG_TRANS} )
|
||||
NL_DEFAULT_PROPS( ryzom_configuration_qt "Ryzom, Tools: Ryzom Configuration Qt" )
|
||||
NL_ADD_RUNTIME_FLAGS( ryzom_configuration_qt )
|
||||
NL_ADD_LIB_SUFFIX( ryzom_configuration_qt )
|
||||
TARGET_LINK_LIBRARIES( ryzom_configuration_qt nelmisc nel3d ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTOPENGL_LIBRARY} ${OPENGL_gl_LIBRARY} )
|
||||
INSTALL( TARGETS ryzom_configuration_qt RUNTIME DESTINATION games COMPONENT client BUNDLE DESTINATION /Applications )
|
||||
|
||||
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${QT_INCLUDES} )
|
||||
|
||||
FILE( GLOB SRC *.cpp *.h )
|
||||
|
||||
SET( CLIENT_CONFIG_HDR
|
||||
client_config_dialog.h
|
||||
display_settings_advanced_widget.h
|
||||
display_settings_details_widget.h
|
||||
display_settings_widget.h
|
||||
general_settings_widget.h
|
||||
sound_settings_widget.h
|
||||
sys_info_d3d_widget.h
|
||||
sys_info_opengl_widget.h
|
||||
sys_info_widget.h
|
||||
widget_base.h
|
||||
)
|
||||
|
||||
SET( CLIENT_CONFIG_UIS
|
||||
client_config_dialog.ui
|
||||
display_settings_advanced_widget.ui
|
||||
display_settings_details_widget.ui
|
||||
display_settings_widget.ui
|
||||
general_settings_widget.ui
|
||||
sound_settings_widget.ui
|
||||
sys_info_d3d_widget.ui
|
||||
sys_info_opengl_widget.ui
|
||||
sys_info_widget.ui
|
||||
)
|
||||
|
||||
SET( CLIENT_CONFIG_TRANS
|
||||
translations/ryzom_configuration_en.ts
|
||||
translations/ryzom_configuration_hu.ts
|
||||
)
|
||||
|
||||
CONFIGURE_FILE( translations/translations.qrc ${CMAKE_CURRENT_BINARY_DIR}/translations.qrc COPYONLY )
|
||||
SET( CLIENT_CONFIG_RCS resources.qrc ${CMAKE_CURRENT_BINARY_DIR}/translations.qrc )
|
||||
SET( QT_USE_QTGUI TRUE )
|
||||
SET( QT_USE_QTOPENGL TRUE )
|
||||
SET( QT_USE_QTCORE TRUE )
|
||||
QT4_ADD_TRANSLATION( CLIENT_CONFIG_QM ${CLIENT_CONFIG_TRANS} )
|
||||
QT4_ADD_RESOURCES( CLIENT_CONFIG_RC_SRCS ${CLIENT_CONFIG_RCS} )
|
||||
QT4_WRAP_CPP( CLIENT_CONFIG_MOC_SRC ${CLIENT_CONFIG_HDR} )
|
||||
QT4_WRAP_UI( CLIENT_CONFIG_UI_HDRS ${CLIENT_CONFIG_UIS} )
|
||||
SOURCE_GROUP( "Resources" FILES ${CLIENT_CONFIG_RCS} )
|
||||
SOURCE_GROUP( "Forms" FILES ${CLIENT_CONFIG_UIS} )
|
||||
SOURCE_GROUP( "Generated Files" FILES ${CLIENT_CONFIG_UI_HDRS} ${CLIENT_CONFIG_MOC_SRC} )
|
||||
SOURCE_GROUP( "Translation Files" FILES ${CLIENT_CONFIG_TRANS} )
|
||||
ADD_DEFINITIONS( ${QT_DEFINITIONS} )
|
||||
ADD_EXECUTABLE( ryzom_configuration_qt WIN32 MACOSX_BUNDLE ${SRC} ${CLIENT_CONFIG_MOC_SRC} ${CLIENT_CONFIG_UI_HDRS} ${CLIENT_CONFIG_RC_SRCS} ${CLIENT_CONFIG_TRANS} )
|
||||
NL_DEFAULT_PROPS( ryzom_configuration_qt "Ryzom, Tools: Ryzom Configuration Qt" )
|
||||
NL_ADD_RUNTIME_FLAGS( ryzom_configuration_qt )
|
||||
NL_ADD_LIB_SUFFIX( ryzom_configuration_qt )
|
||||
TARGET_LINK_LIBRARIES( ryzom_configuration_qt nelmisc nel3d ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTOPENGL_LIBRARY} ${OPENGL_gl_LIBRARY} )
|
||||
INSTALL( TARGETS ryzom_configuration_qt RUNTIME DESTINATION games COMPONENT client BUNDLE DESTINATION /Applications )
|
||||
|
||||
|
|
|
@ -1,259 +1,259 @@
|
|||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "client_config_dialog.h"
|
||||
|
||||
#include "general_settings_widget.h"
|
||||
#include "display_settings_widget.h"
|
||||
#include "display_settings_details_widget.h"
|
||||
#include "display_settings_advanced_widget.h"
|
||||
#include "sound_settings_widget.h"
|
||||
#include "sys_info_widget.h"
|
||||
#include "sys_info_opengl_widget.h"
|
||||
#include "sys_info_d3d_widget.h"
|
||||
|
||||
#include "system.h"
|
||||
|
||||
#include <QtGui>
|
||||
|
||||
CClientConfigDialog::CClientConfigDialog( QWidget *parent ) :
|
||||
QDialog( parent )
|
||||
{
|
||||
setupUi( this );
|
||||
connect( buttonBox->button( QDialogButtonBox::Cancel ), SIGNAL( clicked() ), this, SLOT( close() ) );
|
||||
connect( buttonBox->button( QDialogButtonBox::Ok ), SIGNAL( clicked() ), this, SLOT( onClickOK() ) );
|
||||
connect( applyButton, SIGNAL( clicked() ), this, SLOT( onClickApply() ) );
|
||||
connect( defaultButton, SIGNAL( clicked() ), this, SLOT( onClickDefault() ) );
|
||||
connect( playButton, SIGNAL( clicked() ), this, SLOT( onClickPlay() ) );
|
||||
connect( treeWidget, SIGNAL( itemClicked( QTreeWidgetItem *, int ) ),
|
||||
this, SLOT( onClickCategory( QTreeWidgetItem * ) ) );
|
||||
|
||||
// General
|
||||
QTreeWidgetItem *item = treeWidget->topLevelItem( 0 );
|
||||
item->setData( 0, Qt::UserRole, 0 );
|
||||
|
||||
// Display
|
||||
item = treeWidget->topLevelItem( 1 );
|
||||
item->setData( 0, Qt::UserRole, 1 );
|
||||
|
||||
// Display details
|
||||
item = treeWidget->topLevelItem( 1 )->child( 0 );
|
||||
item->setData( 0, Qt::UserRole, 2 );
|
||||
|
||||
// Display advanced
|
||||
item = treeWidget->topLevelItem( 1 )->child( 1 );
|
||||
item->setData( 0, Qt::UserRole, 3 );
|
||||
|
||||
// Sound
|
||||
item = treeWidget->topLevelItem( 2 );
|
||||
item->setData( 0, Qt::UserRole, 4 );
|
||||
|
||||
// System information
|
||||
item = treeWidget->topLevelItem( 3 );
|
||||
item->setData( 0, Qt::UserRole, 5 );
|
||||
|
||||
// OpenGL info
|
||||
item = treeWidget->topLevelItem( 3 )->child( 0 );
|
||||
item->setData( 0, Qt::UserRole, 6 );
|
||||
|
||||
// Direct3D info
|
||||
item = treeWidget->topLevelItem( 3 )->child( 1 );
|
||||
item->setData( 0, Qt::UserRole, 7 );
|
||||
|
||||
|
||||
CategoryStackedWidget->addWidget( new CGeneralSettingsWidget( CategoryStackedWidget ) );
|
||||
CategoryStackedWidget->addWidget( new CDisplaySettingsWidget( CategoryStackedWidget ) );
|
||||
CategoryStackedWidget->addWidget( new CDisplaySettingsDetailsWidget( CategoryStackedWidget ) );
|
||||
CategoryStackedWidget->addWidget( new CDisplaySettingsAdvancedWidget( CategoryStackedWidget ) );
|
||||
CategoryStackedWidget->addWidget( new CSoundSettingsWidget( CategoryStackedWidget ) );
|
||||
CategoryStackedWidget->addWidget( new CSysInfoWidget( CategoryStackedWidget ) );
|
||||
CategoryStackedWidget->addWidget( new CSysInfoOpenGLWidget( CategoryStackedWidget ) );
|
||||
CategoryStackedWidget->addWidget( new CSysInfoD3DWidget( CategoryStackedWidget ) );
|
||||
|
||||
for( sint32 i = 0; i < CategoryStackedWidget->count(); i++ )
|
||||
{
|
||||
QWidget *w = CategoryStackedWidget->widget( i );
|
||||
|
||||
// The sysinfo pages are not derived from CWidgetBase, so they don't have this signal!
|
||||
if( qobject_cast< CWidgetBase * >( w ) == NULL )
|
||||
continue;
|
||||
|
||||
connect( w, SIGNAL( changed() ), this, SLOT( onSomethingChanged() ) );
|
||||
}
|
||||
|
||||
applyButton->setEnabled( false );
|
||||
}
|
||||
|
||||
CClientConfigDialog::~CClientConfigDialog()
|
||||
{
|
||||
}
|
||||
|
||||
void CClientConfigDialog::closeEvent( QCloseEvent *event )
|
||||
{
|
||||
if( isOKToQuit() )
|
||||
event->accept();
|
||||
else
|
||||
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();
|
||||
// Since we use the apply button's enabled state to check for unsaved changes on quit, we disable it
|
||||
applyButton->setEnabled( false );
|
||||
close();
|
||||
}
|
||||
|
||||
void CClientConfigDialog::onClickApply()
|
||||
{
|
||||
saveChanges();
|
||||
applyButton->setEnabled( false );
|
||||
}
|
||||
|
||||
void CClientConfigDialog::onClickDefault()
|
||||
{
|
||||
CSystem::GetInstance().config.revertToDefault();
|
||||
CSystem::GetInstance().config.save();
|
||||
reloadPages();
|
||||
applyButton->setEnabled( false );
|
||||
}
|
||||
|
||||
void CClientConfigDialog::onClickPlay()
|
||||
{
|
||||
bool started = false;
|
||||
|
||||
#ifdef WIN32
|
||||
started = QProcess::startDetached( "ryzom_client_r.exe" );
|
||||
if( !started )
|
||||
QProcess::startDetached( "ryzom_client_rd.exe" );
|
||||
if( !started )
|
||||
QProcess::startDetached( "ryzom_client_d.exe" );
|
||||
#else
|
||||
started = QProcess::startDetached( "./ryzom_client_r" );
|
||||
if( !started )
|
||||
QProcess::startDetached( "./ryzom_client_rd" );
|
||||
if( !started )
|
||||
QProcess::startDetached( "./ryzom_client_d" );
|
||||
#endif
|
||||
|
||||
onClickOK();
|
||||
}
|
||||
|
||||
void CClientConfigDialog::onClickCategory( QTreeWidgetItem *item )
|
||||
{
|
||||
if( item == NULL )
|
||||
return;
|
||||
|
||||
static const char *iconNames[] =
|
||||
{
|
||||
":/resources/general_icon.bmp",
|
||||
":/resources/display_icon.bmp",
|
||||
":/resources/display_properties_icon.bmp",
|
||||
":/resources/display_config_icon.bmp",
|
||||
":/resources/sound_icon.bmp",
|
||||
":/resources/general_icon.bmp",
|
||||
":/resources/card_icon.bmp",
|
||||
":/resources/card_icon.bmp"
|
||||
};
|
||||
|
||||
sint32 index = item->data( 0, Qt::UserRole ).toInt();
|
||||
|
||||
if( ( index < 0 ) || ( index > 7 ) )
|
||||
return;
|
||||
|
||||
CategoryStackedWidget->setCurrentIndex( index );
|
||||
categoryLabel->setText( item->text( 0 ) );
|
||||
topleftIcon->setPixmap( QPixmap( QString::fromUtf8( iconNames[ index ] ) ) );
|
||||
}
|
||||
|
||||
void CClientConfigDialog::onSomethingChanged()
|
||||
{
|
||||
applyButton->setEnabled( true );
|
||||
}
|
||||
|
||||
void CClientConfigDialog::saveChanges()
|
||||
{
|
||||
// First we tell the pages to save their changes into the cached config file
|
||||
for( sint32 i = 0; i < CategoryStackedWidget->count(); i++ )
|
||||
{
|
||||
QWidget *w = CategoryStackedWidget->widget( i );
|
||||
CWidgetBase *wb = qobject_cast< CWidgetBase * >( w );
|
||||
|
||||
// The system information pages are not derived from CWidgetBase, so they can't save!
|
||||
if( wb == NULL )
|
||||
continue;
|
||||
|
||||
wb->save();
|
||||
}
|
||||
|
||||
// Then we write the cache to the disk
|
||||
CSystem::GetInstance().config.save();
|
||||
}
|
||||
|
||||
void CClientConfigDialog::reloadPages()
|
||||
{
|
||||
for( sint32 i = 0; i < CategoryStackedWidget->count(); i++ )
|
||||
{
|
||||
QWidget *w = CategoryStackedWidget->widget( i );
|
||||
CWidgetBase *wb = qobject_cast< CWidgetBase * >( w );
|
||||
|
||||
// The system information pages are not derived from CWidgetBase, so they can't load!
|
||||
if( wb == NULL )
|
||||
continue;
|
||||
|
||||
wb->load();
|
||||
}
|
||||
}
|
||||
|
||||
bool CClientConfigDialog::isOKToQuit()
|
||||
{
|
||||
// If the apply button is enabled we have unsaved changes
|
||||
if( applyButton->isEnabled() )
|
||||
{
|
||||
sint32 r = QMessageBox::warning(
|
||||
this,
|
||||
tr( "Ryzom configuration" ),
|
||||
tr( "Are you sure you want to quit without saving the configuration?" ),
|
||||
QMessageBox::Yes | QMessageBox::No
|
||||
);
|
||||
|
||||
if( r == QMessageBox::No )
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "client_config_dialog.h"
|
||||
|
||||
#include "general_settings_widget.h"
|
||||
#include "display_settings_widget.h"
|
||||
#include "display_settings_details_widget.h"
|
||||
#include "display_settings_advanced_widget.h"
|
||||
#include "sound_settings_widget.h"
|
||||
#include "sys_info_widget.h"
|
||||
#include "sys_info_opengl_widget.h"
|
||||
#include "sys_info_d3d_widget.h"
|
||||
|
||||
#include "system.h"
|
||||
|
||||
#include <QtGui>
|
||||
|
||||
CClientConfigDialog::CClientConfigDialog( QWidget *parent ) :
|
||||
QDialog( parent )
|
||||
{
|
||||
setupUi( this );
|
||||
connect( buttonBox->button( QDialogButtonBox::Cancel ), SIGNAL( clicked() ), this, SLOT( close() ) );
|
||||
connect( buttonBox->button( QDialogButtonBox::Ok ), SIGNAL( clicked() ), this, SLOT( onClickOK() ) );
|
||||
connect( applyButton, SIGNAL( clicked() ), this, SLOT( onClickApply() ) );
|
||||
connect( defaultButton, SIGNAL( clicked() ), this, SLOT( onClickDefault() ) );
|
||||
connect( playButton, SIGNAL( clicked() ), this, SLOT( onClickPlay() ) );
|
||||
connect( treeWidget, SIGNAL( itemClicked( QTreeWidgetItem *, int ) ),
|
||||
this, SLOT( onClickCategory( QTreeWidgetItem * ) ) );
|
||||
|
||||
// General
|
||||
QTreeWidgetItem *item = treeWidget->topLevelItem( 0 );
|
||||
item->setData( 0, Qt::UserRole, 0 );
|
||||
|
||||
// Display
|
||||
item = treeWidget->topLevelItem( 1 );
|
||||
item->setData( 0, Qt::UserRole, 1 );
|
||||
|
||||
// Display details
|
||||
item = treeWidget->topLevelItem( 1 )->child( 0 );
|
||||
item->setData( 0, Qt::UserRole, 2 );
|
||||
|
||||
// Display advanced
|
||||
item = treeWidget->topLevelItem( 1 )->child( 1 );
|
||||
item->setData( 0, Qt::UserRole, 3 );
|
||||
|
||||
// Sound
|
||||
item = treeWidget->topLevelItem( 2 );
|
||||
item->setData( 0, Qt::UserRole, 4 );
|
||||
|
||||
// System information
|
||||
item = treeWidget->topLevelItem( 3 );
|
||||
item->setData( 0, Qt::UserRole, 5 );
|
||||
|
||||
// OpenGL info
|
||||
item = treeWidget->topLevelItem( 3 )->child( 0 );
|
||||
item->setData( 0, Qt::UserRole, 6 );
|
||||
|
||||
// Direct3D info
|
||||
item = treeWidget->topLevelItem( 3 )->child( 1 );
|
||||
item->setData( 0, Qt::UserRole, 7 );
|
||||
|
||||
|
||||
CategoryStackedWidget->addWidget( new CGeneralSettingsWidget( CategoryStackedWidget ) );
|
||||
CategoryStackedWidget->addWidget( new CDisplaySettingsWidget( CategoryStackedWidget ) );
|
||||
CategoryStackedWidget->addWidget( new CDisplaySettingsDetailsWidget( CategoryStackedWidget ) );
|
||||
CategoryStackedWidget->addWidget( new CDisplaySettingsAdvancedWidget( CategoryStackedWidget ) );
|
||||
CategoryStackedWidget->addWidget( new CSoundSettingsWidget( CategoryStackedWidget ) );
|
||||
CategoryStackedWidget->addWidget( new CSysInfoWidget( CategoryStackedWidget ) );
|
||||
CategoryStackedWidget->addWidget( new CSysInfoOpenGLWidget( CategoryStackedWidget ) );
|
||||
CategoryStackedWidget->addWidget( new CSysInfoD3DWidget( CategoryStackedWidget ) );
|
||||
|
||||
for( sint32 i = 0; i < CategoryStackedWidget->count(); i++ )
|
||||
{
|
||||
QWidget *w = CategoryStackedWidget->widget( i );
|
||||
|
||||
// The sysinfo pages are not derived from CWidgetBase, so they don't have this signal!
|
||||
if( qobject_cast< CWidgetBase * >( w ) == NULL )
|
||||
continue;
|
||||
|
||||
connect( w, SIGNAL( changed() ), this, SLOT( onSomethingChanged() ) );
|
||||
}
|
||||
|
||||
applyButton->setEnabled( false );
|
||||
}
|
||||
|
||||
CClientConfigDialog::~CClientConfigDialog()
|
||||
{
|
||||
}
|
||||
|
||||
void CClientConfigDialog::closeEvent( QCloseEvent *event )
|
||||
{
|
||||
if( isOKToQuit() )
|
||||
event->accept();
|
||||
else
|
||||
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();
|
||||
// Since we use the apply button's enabled state to check for unsaved changes on quit, we disable it
|
||||
applyButton->setEnabled( false );
|
||||
close();
|
||||
}
|
||||
|
||||
void CClientConfigDialog::onClickApply()
|
||||
{
|
||||
saveChanges();
|
||||
applyButton->setEnabled( false );
|
||||
}
|
||||
|
||||
void CClientConfigDialog::onClickDefault()
|
||||
{
|
||||
CSystem::GetInstance().config.revertToDefault();
|
||||
CSystem::GetInstance().config.save();
|
||||
reloadPages();
|
||||
applyButton->setEnabled( false );
|
||||
}
|
||||
|
||||
void CClientConfigDialog::onClickPlay()
|
||||
{
|
||||
bool started = false;
|
||||
|
||||
#ifdef WIN32
|
||||
started = QProcess::startDetached( "ryzom_client_r.exe" );
|
||||
if( !started )
|
||||
QProcess::startDetached( "ryzom_client_rd.exe" );
|
||||
if( !started )
|
||||
QProcess::startDetached( "ryzom_client_d.exe" );
|
||||
#else
|
||||
started = QProcess::startDetached( "./ryzom_client_r" );
|
||||
if( !started )
|
||||
QProcess::startDetached( "./ryzom_client_rd" );
|
||||
if( !started )
|
||||
QProcess::startDetached( "./ryzom_client_d" );
|
||||
#endif
|
||||
|
||||
onClickOK();
|
||||
}
|
||||
|
||||
void CClientConfigDialog::onClickCategory( QTreeWidgetItem *item )
|
||||
{
|
||||
if( item == NULL )
|
||||
return;
|
||||
|
||||
static const char *iconNames[] =
|
||||
{
|
||||
":/resources/general_icon.bmp",
|
||||
":/resources/display_icon.bmp",
|
||||
":/resources/display_properties_icon.bmp",
|
||||
":/resources/display_config_icon.bmp",
|
||||
":/resources/sound_icon.bmp",
|
||||
":/resources/general_icon.bmp",
|
||||
":/resources/card_icon.bmp",
|
||||
":/resources/card_icon.bmp"
|
||||
};
|
||||
|
||||
sint32 index = item->data( 0, Qt::UserRole ).toInt();
|
||||
|
||||
if( ( index < 0 ) || ( index > 7 ) )
|
||||
return;
|
||||
|
||||
CategoryStackedWidget->setCurrentIndex( index );
|
||||
categoryLabel->setText( item->text( 0 ) );
|
||||
topleftIcon->setPixmap( QPixmap( QString::fromUtf8( iconNames[ index ] ) ) );
|
||||
}
|
||||
|
||||
void CClientConfigDialog::onSomethingChanged()
|
||||
{
|
||||
applyButton->setEnabled( true );
|
||||
}
|
||||
|
||||
void CClientConfigDialog::saveChanges()
|
||||
{
|
||||
// First we tell the pages to save their changes into the cached config file
|
||||
for( sint32 i = 0; i < CategoryStackedWidget->count(); i++ )
|
||||
{
|
||||
QWidget *w = CategoryStackedWidget->widget( i );
|
||||
CWidgetBase *wb = qobject_cast< CWidgetBase * >( w );
|
||||
|
||||
// The system information pages are not derived from CWidgetBase, so they can't save!
|
||||
if( wb == NULL )
|
||||
continue;
|
||||
|
||||
wb->save();
|
||||
}
|
||||
|
||||
// Then we write the cache to the disk
|
||||
CSystem::GetInstance().config.save();
|
||||
}
|
||||
|
||||
void CClientConfigDialog::reloadPages()
|
||||
{
|
||||
for( sint32 i = 0; i < CategoryStackedWidget->count(); i++ )
|
||||
{
|
||||
QWidget *w = CategoryStackedWidget->widget( i );
|
||||
CWidgetBase *wb = qobject_cast< CWidgetBase * >( w );
|
||||
|
||||
// The system information pages are not derived from CWidgetBase, so they can't load!
|
||||
if( wb == NULL )
|
||||
continue;
|
||||
|
||||
wb->load();
|
||||
}
|
||||
}
|
||||
|
||||
bool CClientConfigDialog::isOKToQuit()
|
||||
{
|
||||
// If the apply button is enabled we have unsaved changes
|
||||
if( applyButton->isEnabled() )
|
||||
{
|
||||
sint32 r = QMessageBox::warning(
|
||||
this,
|
||||
tr( "Ryzom configuration" ),
|
||||
tr( "Are you sure you want to quit without saving the configuration?" ),
|
||||
QMessageBox::Yes | QMessageBox::No
|
||||
);
|
||||
|
||||
if( r == QMessageBox::No )
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,67 +1,67 @@
|
|||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef CLIENT_CONFIG_DIALOG_H
|
||||
#define CLIENT_CONFIG_DIALOG_H
|
||||
|
||||
#include "ui_client_config_dialog.h"
|
||||
|
||||
/**
|
||||
@brief The main dialog of the configuration tool
|
||||
@details Sets up and controls the configuration pages, sets up navigation,
|
||||
sets up the ok, cancel, apply, etc buttons.
|
||||
*/
|
||||
class CClientConfigDialog : public QDialog, public Ui::client_config_dialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CClientConfigDialog( QWidget *parent = NULL );
|
||||
~CClientConfigDialog();
|
||||
|
||||
protected:
|
||||
void closeEvent( QCloseEvent *event );
|
||||
void changeEvent( QEvent *event );
|
||||
|
||||
private slots:
|
||||
//////////////////////////// Main dialog buttons /////////////////////
|
||||
void onClickOK();
|
||||
void onClickApply();
|
||||
void onClickDefault();
|
||||
void onClickPlay();
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
void onClickCategory( QTreeWidgetItem *item );
|
||||
void onSomethingChanged();
|
||||
|
||||
private:
|
||||
/**
|
||||
@brief Tells the config pages to save their changes into the config file
|
||||
*/
|
||||
void saveChanges();
|
||||
|
||||
/**
|
||||
@brief Reloads the pages' contents from the config file.
|
||||
*/
|
||||
void reloadPages();
|
||||
|
||||
/**
|
||||
@brief Checks if it's OK to quit the application, may query the user
|
||||
@return Returns true if it's OK to quit, returns false otherwise.
|
||||
*/
|
||||
bool isOKToQuit();
|
||||
};
|
||||
|
||||
#endif // CLIENT_CONFIG_DIALOG_H
|
||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef CLIENT_CONFIG_DIALOG_H
|
||||
#define CLIENT_CONFIG_DIALOG_H
|
||||
|
||||
#include "ui_client_config_dialog.h"
|
||||
|
||||
/**
|
||||
@brief The main dialog of the configuration tool
|
||||
@details Sets up and controls the configuration pages, sets up navigation,
|
||||
sets up the ok, cancel, apply, etc buttons.
|
||||
*/
|
||||
class CClientConfigDialog : public QDialog, public Ui::client_config_dialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CClientConfigDialog( QWidget *parent = NULL );
|
||||
~CClientConfigDialog();
|
||||
|
||||
protected:
|
||||
void closeEvent( QCloseEvent *event );
|
||||
void changeEvent( QEvent *event );
|
||||
|
||||
private slots:
|
||||
//////////////////////////// Main dialog buttons /////////////////////
|
||||
void onClickOK();
|
||||
void onClickApply();
|
||||
void onClickDefault();
|
||||
void onClickPlay();
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
void onClickCategory( QTreeWidgetItem *item );
|
||||
void onSomethingChanged();
|
||||
|
||||
private:
|
||||
/**
|
||||
@brief Tells the config pages to save their changes into the config file
|
||||
*/
|
||||
void saveChanges();
|
||||
|
||||
/**
|
||||
@brief Reloads the pages' contents from the config file.
|
||||
*/
|
||||
void reloadPages();
|
||||
|
||||
/**
|
||||
@brief Checks if it's OK to quit the application, may query the user
|
||||
@return Returns true if it's OK to quit, returns false otherwise.
|
||||
*/
|
||||
bool isOKToQuit();
|
||||
};
|
||||
|
||||
#endif // CLIENT_CONFIG_DIALOG_H
|
||||
|
|
|
@ -1,255 +1,255 @@
|
|||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "Config.h"
|
||||
|
||||
CConfig::CConfig()
|
||||
{
|
||||
}
|
||||
|
||||
CConfig::~CConfig()
|
||||
{
|
||||
}
|
||||
|
||||
bool CConfig::load( const char *fileName )
|
||||
{
|
||||
try
|
||||
{
|
||||
cf.load( fileName );
|
||||
|
||||
std::string def = getString( "RootConfigFilename" );
|
||||
if( def.compare( "" ) != 0 )
|
||||
dcf.load( def );
|
||||
}
|
||||
catch( NLMISC::Exception &e )
|
||||
{
|
||||
nlwarning( "%s", e.what() );
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CConfig::reload()
|
||||
{
|
||||
try
|
||||
{
|
||||
cf.clear();
|
||||
cf.reparse();
|
||||
}
|
||||
catch( NLMISC::Exception &e )
|
||||
{
|
||||
nlwarning( "%s", e.what() );
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void CConfig::revertToDefault()
|
||||
{
|
||||
// If there's no default config, all we can do is revert the current changes
|
||||
if( !dcf.loaded() )
|
||||
{
|
||||
reload();
|
||||
return;
|
||||
}
|
||||
|
||||
// If there is a default config, we can however revert to the default!
|
||||
// Code taken from the original config tool
|
||||
uint32 count = cf.getNumVar();
|
||||
uint32 i = 0;
|
||||
for( i = 0; i < count; i++ )
|
||||
{
|
||||
NLMISC::CConfigFile::CVar *dst = cf.getVar( i );
|
||||
|
||||
// Comment from the original
|
||||
// Temp: avoid changing this variable (debug: binded to the actual texture set installed)
|
||||
if( dst->Name.compare( "HDTextureInstalled" ) == 0 )
|
||||
continue;
|
||||
|
||||
NLMISC::CConfigFile::CVar *src = dcf.getVarPtr( dst->Name );
|
||||
if( ( src != NULL ) && !dst->Root &&
|
||||
( ( src->Type == NLMISC::CConfigFile::CVar::T_INT ) && ( dst->Type == NLMISC::CConfigFile::CVar::T_INT ) ||
|
||||
( src->Type == NLMISC::CConfigFile::CVar::T_REAL ) && ( dst->Type == NLMISC::CConfigFile::CVar::T_INT ) ||
|
||||
( src->Type == NLMISC::CConfigFile::CVar::T_INT ) && ( dst->Type == NLMISC::CConfigFile::CVar::T_REAL ) ||
|
||||
( src->Type == NLMISC::CConfigFile::CVar::T_REAL ) && ( dst->Type == NLMISC::CConfigFile::CVar::T_REAL ) ||
|
||||
( src->Type == NLMISC::CConfigFile::CVar::T_STRING ) && ( dst->Type == NLMISC::CConfigFile::CVar::T_STRING ) ) )
|
||||
{
|
||||
|
||||
if( src->Type == NLMISC::CConfigFile::CVar::T_INT )
|
||||
{
|
||||
setInt( src->Name.c_str(), src->asInt() );
|
||||
}
|
||||
else if( src->Type == NLMISC::CConfigFile::CVar::T_REAL )
|
||||
{
|
||||
setFloat( src->Name.c_str(), src->asFloat() );
|
||||
}
|
||||
else if( src->Type == NLMISC::CConfigFile::CVar::T_STRING )
|
||||
{
|
||||
setString( src->Name.c_str(), src->asString() );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool CConfig::save()
|
||||
{
|
||||
try
|
||||
{
|
||||
cf.save();
|
||||
}
|
||||
catch( NLMISC::Exception &e )
|
||||
{
|
||||
nlwarning( "%s", e.what() );
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CConfig::getBool( const char *key )
|
||||
{
|
||||
NLMISC::CConfigFile::CVar *var = cf.getVarPtr( key );
|
||||
|
||||
if( var != NULL )
|
||||
{
|
||||
return var->asBool();
|
||||
}
|
||||
else
|
||||
{
|
||||
nlwarning( "Couldn't find key %s in %s.", key, cf.getFilename().c_str() );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
sint32 CConfig::getInt( const char *key )
|
||||
{
|
||||
NLMISC::CConfigFile::CVar *var = cf.getVarPtr( key );
|
||||
|
||||
if( var != NULL )
|
||||
{
|
||||
return var->asInt();
|
||||
}
|
||||
else
|
||||
{
|
||||
nlwarning( "Couldn't find key %s in %s.", key, cf.getFilename().c_str() );
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
float CConfig::getFloat( const char *key )
|
||||
{
|
||||
NLMISC::CConfigFile::CVar *var = cf.getVarPtr( key );
|
||||
|
||||
if( var != NULL )
|
||||
{
|
||||
return var->asFloat();
|
||||
}
|
||||
else
|
||||
{
|
||||
nlwarning( "Couldn't find key %s in %s.", key, cf.getFilename().c_str() );
|
||||
return 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
std::string CConfig::getString( const char *key )
|
||||
{
|
||||
NLMISC::CConfigFile::CVar *var = cf.getVarPtr( key );
|
||||
|
||||
if( var != NULL )
|
||||
{
|
||||
return var->asString();
|
||||
}
|
||||
else
|
||||
{
|
||||
nlwarning( "Couldn't find key %s in %s.", key, cf.getFilename().c_str() );
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
void CConfig::setBool( const char *key, bool value )
|
||||
{
|
||||
NLMISC::CConfigFile::CVar *var = cf.getVarPtr( key );
|
||||
|
||||
if( var != NULL )
|
||||
{
|
||||
if( var->Type == NLMISC::CConfigFile::CVar::T_BOOL )
|
||||
{
|
||||
if( value )
|
||||
var->setAsString( "true" );
|
||||
else
|
||||
var->setAsString( "false" );
|
||||
}
|
||||
else
|
||||
{
|
||||
nlwarning( "Key %s in %s is not a boolean.", key, cf.getFilename().c_str() );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
nlwarning( "Couldn't find key %s in %s.", key, cf.getFilename().c_str() );
|
||||
}
|
||||
}
|
||||
|
||||
void CConfig::setInt(const char *key, sint32 value)
|
||||
{
|
||||
NLMISC::CConfigFile::CVar *var = cf.getVarPtr( key );
|
||||
|
||||
if( var != NULL )
|
||||
{
|
||||
if( var->Type == NLMISC::CConfigFile::CVar::T_INT )
|
||||
var->setAsInt( value );
|
||||
else
|
||||
nlwarning( "Key %s in %s is not an integer.", key, cf.getFilename().c_str() );
|
||||
}
|
||||
else
|
||||
{
|
||||
nlwarning( "Couldn't find key %s in %s.", key, cf.getFilename().c_str() );
|
||||
}
|
||||
}
|
||||
|
||||
void CConfig::setFloat( const char *key, float value )
|
||||
{
|
||||
NLMISC::CConfigFile::CVar *var = cf.getVarPtr( key );
|
||||
|
||||
if( var != NULL )
|
||||
{
|
||||
if( var->Type == NLMISC::CConfigFile::CVar::T_REAL )
|
||||
var->setAsFloat( value );
|
||||
else
|
||||
nlwarning( "Key %s in %s is not a float.", key, cf.getFilename().c_str() );
|
||||
}
|
||||
else
|
||||
{
|
||||
nlwarning( "Couldn't find key %s in %s.", key, cf.getFilename().c_str() );
|
||||
}
|
||||
}
|
||||
|
||||
void CConfig::setString( const char *key, std::string &value )
|
||||
{
|
||||
NLMISC::CConfigFile::CVar *var = cf.getVarPtr( key );
|
||||
|
||||
if( var != NULL )
|
||||
{
|
||||
if( var->Type == NLMISC::CConfigFile::CVar::T_STRING )
|
||||
var->setAsString( value );
|
||||
else
|
||||
nlwarning( "Key %s in %s is not a string.", key, cf.getFilename().c_str() );
|
||||
}
|
||||
else
|
||||
{
|
||||
nlwarning( "Couldn't find key %s in %s.", key, cf.getFilename().c_str() );
|
||||
}
|
||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "Config.h"
|
||||
|
||||
CConfig::CConfig()
|
||||
{
|
||||
}
|
||||
|
||||
CConfig::~CConfig()
|
||||
{
|
||||
}
|
||||
|
||||
bool CConfig::load( const char *fileName )
|
||||
{
|
||||
try
|
||||
{
|
||||
cf.load( fileName );
|
||||
|
||||
std::string def = getString( "RootConfigFilename" );
|
||||
if( def.compare( "" ) != 0 )
|
||||
dcf.load( def );
|
||||
}
|
||||
catch( NLMISC::Exception &e )
|
||||
{
|
||||
nlwarning( "%s", e.what() );
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CConfig::reload()
|
||||
{
|
||||
try
|
||||
{
|
||||
cf.clear();
|
||||
cf.reparse();
|
||||
}
|
||||
catch( NLMISC::Exception &e )
|
||||
{
|
||||
nlwarning( "%s", e.what() );
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void CConfig::revertToDefault()
|
||||
{
|
||||
// If there's no default config, all we can do is revert the current changes
|
||||
if( !dcf.loaded() )
|
||||
{
|
||||
reload();
|
||||
return;
|
||||
}
|
||||
|
||||
// If there is a default config, we can however revert to the default!
|
||||
// Code taken from the original config tool
|
||||
uint32 count = cf.getNumVar();
|
||||
uint32 i = 0;
|
||||
for( i = 0; i < count; i++ )
|
||||
{
|
||||
NLMISC::CConfigFile::CVar *dst = cf.getVar( i );
|
||||
|
||||
// Comment from the original
|
||||
// Temp: avoid changing this variable (debug: binded to the actual texture set installed)
|
||||
if( dst->Name.compare( "HDTextureInstalled" ) == 0 )
|
||||
continue;
|
||||
|
||||
NLMISC::CConfigFile::CVar *src = dcf.getVarPtr( dst->Name );
|
||||
if( ( src != NULL ) && !dst->Root &&
|
||||
( ( src->Type == NLMISC::CConfigFile::CVar::T_INT ) && ( dst->Type == NLMISC::CConfigFile::CVar::T_INT ) ||
|
||||
( src->Type == NLMISC::CConfigFile::CVar::T_REAL ) && ( dst->Type == NLMISC::CConfigFile::CVar::T_INT ) ||
|
||||
( src->Type == NLMISC::CConfigFile::CVar::T_INT ) && ( dst->Type == NLMISC::CConfigFile::CVar::T_REAL ) ||
|
||||
( src->Type == NLMISC::CConfigFile::CVar::T_REAL ) && ( dst->Type == NLMISC::CConfigFile::CVar::T_REAL ) ||
|
||||
( src->Type == NLMISC::CConfigFile::CVar::T_STRING ) && ( dst->Type == NLMISC::CConfigFile::CVar::T_STRING ) ) )
|
||||
{
|
||||
|
||||
if( src->Type == NLMISC::CConfigFile::CVar::T_INT )
|
||||
{
|
||||
setInt( src->Name.c_str(), src->asInt() );
|
||||
}
|
||||
else if( src->Type == NLMISC::CConfigFile::CVar::T_REAL )
|
||||
{
|
||||
setFloat( src->Name.c_str(), src->asFloat() );
|
||||
}
|
||||
else if( src->Type == NLMISC::CConfigFile::CVar::T_STRING )
|
||||
{
|
||||
setString( src->Name.c_str(), src->asString() );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool CConfig::save()
|
||||
{
|
||||
try
|
||||
{
|
||||
cf.save();
|
||||
}
|
||||
catch( NLMISC::Exception &e )
|
||||
{
|
||||
nlwarning( "%s", e.what() );
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CConfig::getBool( const char *key )
|
||||
{
|
||||
NLMISC::CConfigFile::CVar *var = cf.getVarPtr( key );
|
||||
|
||||
if( var != NULL )
|
||||
{
|
||||
return var->asBool();
|
||||
}
|
||||
else
|
||||
{
|
||||
nlwarning( "Couldn't find key %s in %s.", key, cf.getFilename().c_str() );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
sint32 CConfig::getInt( const char *key )
|
||||
{
|
||||
NLMISC::CConfigFile::CVar *var = cf.getVarPtr( key );
|
||||
|
||||
if( var != NULL )
|
||||
{
|
||||
return var->asInt();
|
||||
}
|
||||
else
|
||||
{
|
||||
nlwarning( "Couldn't find key %s in %s.", key, cf.getFilename().c_str() );
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
float CConfig::getFloat( const char *key )
|
||||
{
|
||||
NLMISC::CConfigFile::CVar *var = cf.getVarPtr( key );
|
||||
|
||||
if( var != NULL )
|
||||
{
|
||||
return var->asFloat();
|
||||
}
|
||||
else
|
||||
{
|
||||
nlwarning( "Couldn't find key %s in %s.", key, cf.getFilename().c_str() );
|
||||
return 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
std::string CConfig::getString( const char *key )
|
||||
{
|
||||
NLMISC::CConfigFile::CVar *var = cf.getVarPtr( key );
|
||||
|
||||
if( var != NULL )
|
||||
{
|
||||
return var->asString();
|
||||
}
|
||||
else
|
||||
{
|
||||
nlwarning( "Couldn't find key %s in %s.", key, cf.getFilename().c_str() );
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
void CConfig::setBool( const char *key, bool value )
|
||||
{
|
||||
NLMISC::CConfigFile::CVar *var = cf.getVarPtr( key );
|
||||
|
||||
if( var != NULL )
|
||||
{
|
||||
if( var->Type == NLMISC::CConfigFile::CVar::T_BOOL )
|
||||
{
|
||||
if( value )
|
||||
var->setAsString( "true" );
|
||||
else
|
||||
var->setAsString( "false" );
|
||||
}
|
||||
else
|
||||
{
|
||||
nlwarning( "Key %s in %s is not a boolean.", key, cf.getFilename().c_str() );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
nlwarning( "Couldn't find key %s in %s.", key, cf.getFilename().c_str() );
|
||||
}
|
||||
}
|
||||
|
||||
void CConfig::setInt(const char *key, sint32 value)
|
||||
{
|
||||
NLMISC::CConfigFile::CVar *var = cf.getVarPtr( key );
|
||||
|
||||
if( var != NULL )
|
||||
{
|
||||
if( var->Type == NLMISC::CConfigFile::CVar::T_INT )
|
||||
var->setAsInt( value );
|
||||
else
|
||||
nlwarning( "Key %s in %s is not an integer.", key, cf.getFilename().c_str() );
|
||||
}
|
||||
else
|
||||
{
|
||||
nlwarning( "Couldn't find key %s in %s.", key, cf.getFilename().c_str() );
|
||||
}
|
||||
}
|
||||
|
||||
void CConfig::setFloat( const char *key, float value )
|
||||
{
|
||||
NLMISC::CConfigFile::CVar *var = cf.getVarPtr( key );
|
||||
|
||||
if( var != NULL )
|
||||
{
|
||||
if( var->Type == NLMISC::CConfigFile::CVar::T_REAL )
|
||||
var->setAsFloat( value );
|
||||
else
|
||||
nlwarning( "Key %s in %s is not a float.", key, cf.getFilename().c_str() );
|
||||
}
|
||||
else
|
||||
{
|
||||
nlwarning( "Couldn't find key %s in %s.", key, cf.getFilename().c_str() );
|
||||
}
|
||||
}
|
||||
|
||||
void CConfig::setString( const char *key, std::string &value )
|
||||
{
|
||||
NLMISC::CConfigFile::CVar *var = cf.getVarPtr( key );
|
||||
|
||||
if( var != NULL )
|
||||
{
|
||||
if( var->Type == NLMISC::CConfigFile::CVar::T_STRING )
|
||||
var->setAsString( value );
|
||||
else
|
||||
nlwarning( "Key %s in %s is not a string.", key, cf.getFilename().c_str() );
|
||||
}
|
||||
else
|
||||
{
|
||||
nlwarning( "Couldn't find key %s in %s.", key, cf.getFilename().c_str() );
|
||||
}
|
||||
}
|
|
@ -1,120 +1,120 @@
|
|||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef CONFIG_H
|
||||
#define CONFIG_H
|
||||
|
||||
#include <nel/misc/config_file.h>
|
||||
|
||||
/**
|
||||
@brief Wrapper for a Ryzom config file, allows setting and querying values.
|
||||
*/
|
||||
class CConfig
|
||||
{
|
||||
public:
|
||||
CConfig();
|
||||
~CConfig();
|
||||
|
||||
/**
|
||||
@brief Loads a config file.
|
||||
@param fileName - The file to load
|
||||
@return Returns true on success, returns false on failure.
|
||||
*/
|
||||
bool load( const char *fileName );
|
||||
|
||||
/**
|
||||
@brief Reloads the contents of the config file
|
||||
@return Return true on success, returns false on failure.
|
||||
*/
|
||||
bool reload();
|
||||
|
||||
/**
|
||||
@brief Reverts the config file to the default
|
||||
@details Reverts the config file to the default if possible.
|
||||
If there is no default config, it reverts the current changes only.
|
||||
*/
|
||||
void revertToDefault();
|
||||
|
||||
/**
|
||||
@brief Saves the configuration to the config file.
|
||||
@return Returns true on success, returns false on failure.
|
||||
*/
|
||||
bool save();
|
||||
|
||||
/**
|
||||
@brief Queries the value for the specified key.
|
||||
@param key - The key we are interested in
|
||||
@return Returns the value as a bool, returns false if the key doesn't exist.
|
||||
*/
|
||||
bool getBool( const char *key );
|
||||
|
||||
/**
|
||||
@brief Queries the value for the specified key.
|
||||
@param key - The key we are interested in
|
||||
@return Returns the value as an integer, returns 0 if the key doesn't exist.
|
||||
*/
|
||||
sint32 getInt( const char *key );
|
||||
|
||||
/**
|
||||
@brief Queries the value for the specified key.
|
||||
@param key - The key we are interested in
|
||||
@return Returns the value as a float, returns 0.0f if the key doesn't exist.
|
||||
*/
|
||||
float getFloat( const char *key );
|
||||
|
||||
/**
|
||||
@brief Queries the value for the specified key.
|
||||
@param key - The key we are interested in
|
||||
@return Returns the value as a std::string, returns an empty string if the key doesn't exist.
|
||||
*/
|
||||
std::string getString( const char *key );
|
||||
|
||||
/**
|
||||
@brief Sets the specified key to the specified value.
|
||||
@param key - the key we want to alter
|
||||
@param value - the value we want to set
|
||||
*/
|
||||
void setBool( const char *key, bool value );
|
||||
|
||||
/**
|
||||
@brief Sets the specified key to the specified value.
|
||||
@param key - the key we want to alter
|
||||
@param value - the value we want to set
|
||||
*/
|
||||
void setInt( const char *key, sint32 value );
|
||||
|
||||
/**
|
||||
@brief Sets the specified key to the specified value.
|
||||
@param key - the key we want to alter
|
||||
@param value - the value we want to set
|
||||
*/
|
||||
void setFloat( const char *key, float value );
|
||||
|
||||
/**
|
||||
@brief Sets the specified key to the specified value.
|
||||
@param key - the key we want to alter
|
||||
@param value - the value we want to set
|
||||
*/
|
||||
void setString( const char *key, std::string &value );
|
||||
|
||||
private:
|
||||
// config file
|
||||
NLMISC::CConfigFile cf;
|
||||
// default config file
|
||||
NLMISC::CConfigFile dcf;
|
||||
};
|
||||
|
||||
#endif
|
||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef CONFIG_H
|
||||
#define CONFIG_H
|
||||
|
||||
#include <nel/misc/config_file.h>
|
||||
|
||||
/**
|
||||
@brief Wrapper for a Ryzom config file, allows setting and querying values.
|
||||
*/
|
||||
class CConfig
|
||||
{
|
||||
public:
|
||||
CConfig();
|
||||
~CConfig();
|
||||
|
||||
/**
|
||||
@brief Loads a config file.
|
||||
@param fileName - The file to load
|
||||
@return Returns true on success, returns false on failure.
|
||||
*/
|
||||
bool load( const char *fileName );
|
||||
|
||||
/**
|
||||
@brief Reloads the contents of the config file
|
||||
@return Return true on success, returns false on failure.
|
||||
*/
|
||||
bool reload();
|
||||
|
||||
/**
|
||||
@brief Reverts the config file to the default
|
||||
@details Reverts the config file to the default if possible.
|
||||
If there is no default config, it reverts the current changes only.
|
||||
*/
|
||||
void revertToDefault();
|
||||
|
||||
/**
|
||||
@brief Saves the configuration to the config file.
|
||||
@return Returns true on success, returns false on failure.
|
||||
*/
|
||||
bool save();
|
||||
|
||||
/**
|
||||
@brief Queries the value for the specified key.
|
||||
@param key - The key we are interested in
|
||||
@return Returns the value as a bool, returns false if the key doesn't exist.
|
||||
*/
|
||||
bool getBool( const char *key );
|
||||
|
||||
/**
|
||||
@brief Queries the value for the specified key.
|
||||
@param key - The key we are interested in
|
||||
@return Returns the value as an integer, returns 0 if the key doesn't exist.
|
||||
*/
|
||||
sint32 getInt( const char *key );
|
||||
|
||||
/**
|
||||
@brief Queries the value for the specified key.
|
||||
@param key - The key we are interested in
|
||||
@return Returns the value as a float, returns 0.0f if the key doesn't exist.
|
||||
*/
|
||||
float getFloat( const char *key );
|
||||
|
||||
/**
|
||||
@brief Queries the value for the specified key.
|
||||
@param key - The key we are interested in
|
||||
@return Returns the value as a std::string, returns an empty string if the key doesn't exist.
|
||||
*/
|
||||
std::string getString( const char *key );
|
||||
|
||||
/**
|
||||
@brief Sets the specified key to the specified value.
|
||||
@param key - the key we want to alter
|
||||
@param value - the value we want to set
|
||||
*/
|
||||
void setBool( const char *key, bool value );
|
||||
|
||||
/**
|
||||
@brief Sets the specified key to the specified value.
|
||||
@param key - the key we want to alter
|
||||
@param value - the value we want to set
|
||||
*/
|
||||
void setInt( const char *key, sint32 value );
|
||||
|
||||
/**
|
||||
@brief Sets the specified key to the specified value.
|
||||
@param key - the key we want to alter
|
||||
@param value - the value we want to set
|
||||
*/
|
||||
void setFloat( const char *key, float value );
|
||||
|
||||
/**
|
||||
@brief Sets the specified key to the specified value.
|
||||
@param key - the key we want to alter
|
||||
@param value - the value we want to set
|
||||
*/
|
||||
void setString( const char *key, std::string &value );
|
||||
|
||||
private:
|
||||
// config file
|
||||
NLMISC::CConfigFile cf;
|
||||
// default config file
|
||||
NLMISC::CConfigFile dcf;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,86 +1,86 @@
|
|||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "display_settings_advanced_widget.h"
|
||||
#include "system.h"
|
||||
|
||||
CDisplaySettingsAdvancedWidget::CDisplaySettingsAdvancedWidget( QWidget *parent ) :
|
||||
CWidgetBase( parent )
|
||||
{
|
||||
setupUi( this );
|
||||
load();
|
||||
|
||||
connect( texcompressionCheckBox, SIGNAL( clicked( bool ) ), this, SLOT( onSomethingChanged() ) );
|
||||
connect( vertexshaderCheckBox, SIGNAL( clicked( bool ) ), this, SLOT( onSomethingChanged() ) );
|
||||
connect( verticesagpCheckBox, SIGNAL( clicked( bool ) ), this, SLOT( onSomethingChanged() ) );
|
||||
connect( pixelshadersCheckBox, SIGNAL( clicked( bool ) ), this, SLOT( onSomethingChanged() ) );
|
||||
}
|
||||
|
||||
CDisplaySettingsAdvancedWidget::~CDisplaySettingsAdvancedWidget()
|
||||
{
|
||||
}
|
||||
|
||||
void CDisplaySettingsAdvancedWidget::load()
|
||||
{
|
||||
CSystem &s = CSystem::GetInstance();
|
||||
|
||||
if( s.config.getInt( "ForceDXTC" ) == 1 )
|
||||
texcompressionCheckBox->setChecked( true );
|
||||
|
||||
if( s.config.getInt( "DisableVtxProgram" ) == 1 )
|
||||
vertexshaderCheckBox->setChecked( true );
|
||||
|
||||
if( s.config.getInt( "DisableVtxAGP" ) == 1 )
|
||||
verticesagpCheckBox->setChecked( true );
|
||||
|
||||
if( s.config.getInt( "DisableTextureShdr" ) == 1 )
|
||||
pixelshadersCheckBox->setChecked( true );
|
||||
}
|
||||
|
||||
void CDisplaySettingsAdvancedWidget::save()
|
||||
{
|
||||
CSystem &s = CSystem::GetInstance();
|
||||
|
||||
if( texcompressionCheckBox->isChecked() )
|
||||
s.config.setInt( "ForceDXTC", 1 );
|
||||
else
|
||||
s.config.setInt( "ForceDXTC", 0 );
|
||||
|
||||
if( vertexshaderCheckBox->isChecked() )
|
||||
s.config.setInt( "DisableVtxProgram", 1 );
|
||||
else
|
||||
s.config.setInt( "DisableVtxProgram", 0 );
|
||||
|
||||
if( verticesagpCheckBox->isChecked() )
|
||||
s.config.setInt( "DisableVtxAGP", 1 );
|
||||
else
|
||||
s.config.setInt( "DisableVtxAGP", 0 );
|
||||
|
||||
if( pixelshadersCheckBox->isChecked() )
|
||||
s.config.setInt( "DisableTextureShdr", 1 );
|
||||
else
|
||||
s.config.setInt( "DisableTextureShdr", 0 );
|
||||
}
|
||||
|
||||
void CDisplaySettingsAdvancedWidget::changeEvent( QEvent *event )
|
||||
{
|
||||
if( event->type() == QEvent::LanguageChange )
|
||||
{
|
||||
retranslateUi( this );
|
||||
}
|
||||
|
||||
QWidget::changeEvent( event );
|
||||
}
|
||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "display_settings_advanced_widget.h"
|
||||
#include "system.h"
|
||||
|
||||
CDisplaySettingsAdvancedWidget::CDisplaySettingsAdvancedWidget( QWidget *parent ) :
|
||||
CWidgetBase( parent )
|
||||
{
|
||||
setupUi( this );
|
||||
load();
|
||||
|
||||
connect( texcompressionCheckBox, SIGNAL( clicked( bool ) ), this, SLOT( onSomethingChanged() ) );
|
||||
connect( vertexshaderCheckBox, SIGNAL( clicked( bool ) ), this, SLOT( onSomethingChanged() ) );
|
||||
connect( verticesagpCheckBox, SIGNAL( clicked( bool ) ), this, SLOT( onSomethingChanged() ) );
|
||||
connect( pixelshadersCheckBox, SIGNAL( clicked( bool ) ), this, SLOT( onSomethingChanged() ) );
|
||||
}
|
||||
|
||||
CDisplaySettingsAdvancedWidget::~CDisplaySettingsAdvancedWidget()
|
||||
{
|
||||
}
|
||||
|
||||
void CDisplaySettingsAdvancedWidget::load()
|
||||
{
|
||||
CSystem &s = CSystem::GetInstance();
|
||||
|
||||
if( s.config.getInt( "ForceDXTC" ) == 1 )
|
||||
texcompressionCheckBox->setChecked( true );
|
||||
|
||||
if( s.config.getInt( "DisableVtxProgram" ) == 1 )
|
||||
vertexshaderCheckBox->setChecked( true );
|
||||
|
||||
if( s.config.getInt( "DisableVtxAGP" ) == 1 )
|
||||
verticesagpCheckBox->setChecked( true );
|
||||
|
||||
if( s.config.getInt( "DisableTextureShdr" ) == 1 )
|
||||
pixelshadersCheckBox->setChecked( true );
|
||||
}
|
||||
|
||||
void CDisplaySettingsAdvancedWidget::save()
|
||||
{
|
||||
CSystem &s = CSystem::GetInstance();
|
||||
|
||||
if( texcompressionCheckBox->isChecked() )
|
||||
s.config.setInt( "ForceDXTC", 1 );
|
||||
else
|
||||
s.config.setInt( "ForceDXTC", 0 );
|
||||
|
||||
if( vertexshaderCheckBox->isChecked() )
|
||||
s.config.setInt( "DisableVtxProgram", 1 );
|
||||
else
|
||||
s.config.setInt( "DisableVtxProgram", 0 );
|
||||
|
||||
if( verticesagpCheckBox->isChecked() )
|
||||
s.config.setInt( "DisableVtxAGP", 1 );
|
||||
else
|
||||
s.config.setInt( "DisableVtxAGP", 0 );
|
||||
|
||||
if( pixelshadersCheckBox->isChecked() )
|
||||
s.config.setInt( "DisableTextureShdr", 1 );
|
||||
else
|
||||
s.config.setInt( "DisableTextureShdr", 0 );
|
||||
}
|
||||
|
||||
void CDisplaySettingsAdvancedWidget::changeEvent( QEvent *event )
|
||||
{
|
||||
if( event->type() == QEvent::LanguageChange )
|
||||
{
|
||||
retranslateUi( this );
|
||||
}
|
||||
|
||||
QWidget::changeEvent( event );
|
||||
}
|
||||
|
|
|
@ -1,41 +1,41 @@
|
|||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef DISPLAYSETTINGSADVANCEDWIDGET_H
|
||||
#define DISPLAYSETTINGSADVANCEDWIDGET_H
|
||||
|
||||
#include "ui_display_settings_advanced_widget.h"
|
||||
#include "widget_base.h"
|
||||
|
||||
/**
|
||||
@brief The advanced display settings page of the configuration tool
|
||||
*/
|
||||
class CDisplaySettingsAdvancedWidget : public CWidgetBase, public Ui::display_settings_advanced_widget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CDisplaySettingsAdvancedWidget( QWidget *parent );
|
||||
~CDisplaySettingsAdvancedWidget();
|
||||
|
||||
void load();
|
||||
void save();
|
||||
|
||||
protected:
|
||||
void changeEvent( QEvent *event );
|
||||
|
||||
};
|
||||
|
||||
#endif // DISPLAYSETTINGSADVANCEDWIDGET_H
|
||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef DISPLAYSETTINGSADVANCEDWIDGET_H
|
||||
#define DISPLAYSETTINGSADVANCEDWIDGET_H
|
||||
|
||||
#include "ui_display_settings_advanced_widget.h"
|
||||
#include "widget_base.h"
|
||||
|
||||
/**
|
||||
@brief The advanced display settings page of the configuration tool
|
||||
*/
|
||||
class CDisplaySettingsAdvancedWidget : public CWidgetBase, public Ui::display_settings_advanced_widget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CDisplaySettingsAdvancedWidget( QWidget *parent );
|
||||
~CDisplaySettingsAdvancedWidget();
|
||||
|
||||
void load();
|
||||
void save();
|
||||
|
||||
protected:
|
||||
void changeEvent( QEvent *event );
|
||||
|
||||
};
|
||||
|
||||
#endif // DISPLAYSETTINGSADVANCEDWIDGET_H
|
||||
|
|
|
@ -1,268 +1,268 @@
|
|||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "system.h"
|
||||
#include "display_settings_details_widget.h"
|
||||
|
||||
CDisplaySettingsDetailsWidget::CDisplaySettingsDetailsWidget( QWidget *parent ) :
|
||||
CWidgetBase( parent )
|
||||
{
|
||||
setupUi( this );
|
||||
connect( landscapeSlider, SIGNAL( valueChanged( int ) ), this, SLOT( onLandscapeSliderChange( int ) ) );
|
||||
connect( charactersSlider, SIGNAL( valueChanged( int ) ), this, SLOT( onCharactersSliderChange( int ) ) );
|
||||
connect( fxSlider, SIGNAL( valueChanged( int ) ), this, SLOT( onFXSliderChange( int ) ) );
|
||||
connect( texturesSlider, SIGNAL( valueChanged( int ) ), this, SLOT( onTexturesSliderChange( int ) ) );
|
||||
load();
|
||||
}
|
||||
|
||||
CDisplaySettingsDetailsWidget::~CDisplaySettingsDetailsWidget()
|
||||
{
|
||||
}
|
||||
|
||||
void CDisplaySettingsDetailsWidget::load()
|
||||
{
|
||||
CSystem &s = CSystem::GetInstance();
|
||||
|
||||
landscapeSlider->setValue( getQuality( qualityToLandscapeThreshold, s.config.getFloat( "LandscapeThreshold" ) ) );
|
||||
landscapeSlider->setValue( std::min( landscapeSlider->value(), getQuality( qualityToZFar, s.config.getFloat( "Vision" ) ) ) );
|
||||
landscapeSlider->setValue( std::min( landscapeSlider->value(), getQuality( qualityToLandscapeTileNear, s.config.getFloat( "LandscapeTileNear" ) ) ) );
|
||||
landscapeSlider->setValue( std::min( landscapeSlider->value(), getQuality( qualityToMicrovegetDensity, s.config.getFloat( "MicroVegetDensity" ) ) ) );
|
||||
|
||||
charactersSlider->setValue( getQuality( qualityToSkinNbMaxPoly, s.config.getInt( "SkinNbMaxPoly" ) ) );
|
||||
charactersSlider->setValue( std::min( charactersSlider->value(), getQuality( qualityToNbMaxSkeletonNotCLod, s.config.getInt( "NbMaxSkeletonNotCLod" ) ) ) );
|
||||
charactersSlider->setValue( std::min( charactersSlider->value(), getQuality( qualityToCharacterFarClip, s.config.getFloat( "CharacterFarClip" ) ) ) );
|
||||
|
||||
fxSlider->setValue( getQuality( qualityToFxNbMaxPoly, s.config.getInt( "FxNbMaxPoly" ) ) );
|
||||
|
||||
int hdTextureInstalled = s.config.getInt( "HDTextureInstalled" );
|
||||
if( hdTextureInstalled == 1 )
|
||||
texturesSlider->setMaximum( QUALITY_NORMAL );
|
||||
else
|
||||
texturesSlider->setMaximum( QUALITY_MEDIUM );
|
||||
|
||||
// Comment taken from the original config tool:
|
||||
// NB: if the player changes its client.cfg, mixing HDEntityTexture=1 and DivideTextureSizeBy2=1, it will
|
||||
// result to a low quality!
|
||||
if( s.config.getInt( "DivideTextureSizeBy2" ) )
|
||||
texturesSlider->setValue( QUALITY_LOW );
|
||||
else if( s.config.getInt( "HDEntityTexture" ) && ( hdTextureInstalled == 1 ) )
|
||||
texturesSlider->setValue( QUALITY_NORMAL );
|
||||
else
|
||||
texturesSlider->setValue( QUALITY_MEDIUM );
|
||||
}
|
||||
|
||||
void CDisplaySettingsDetailsWidget::save()
|
||||
{
|
||||
CSystem &s = CSystem::GetInstance();
|
||||
|
||||
s.config.setFloat( "Vision", qualityToZFar[ landscapeSlider->value() ] );
|
||||
s.config.setFloat( "LandscapeTileNear", qualityToLandscapeTileNear[ landscapeSlider->value() ] );
|
||||
s.config.setFloat( "LandscapeThreshold", qualityToLandscapeThreshold[ landscapeSlider->value() ] );
|
||||
|
||||
if( landscapeSlider->value() > QUALITY_LOW )
|
||||
s.config.setInt( "MicroVeget", 1 );
|
||||
else
|
||||
s.config.setInt( "MicroVeget", 0 );
|
||||
|
||||
s.config.setFloat( "MicroVegetDensity", qualityToMicrovegetDensity[ landscapeSlider->value() ] );
|
||||
|
||||
|
||||
s.config.setInt( "SkinNbMaxPoly", qualityToSkinNbMaxPoly[ charactersSlider->value() ] );
|
||||
s.config.setInt( "NbMaxSkeletonNotCLod", qualityToNbMaxSkeletonNotCLod[ charactersSlider->value() ] );
|
||||
s.config.setFloat( "CharacterFarClip", qualityToCharacterFarClip[ charactersSlider->value() ] );
|
||||
|
||||
|
||||
s.config.setInt( "FxNbMaxPoly", qualityToFxNbMaxPoly[ fxSlider->value() ] );
|
||||
if( fxSlider->value() > QUALITY_LOW )
|
||||
{
|
||||
s.config.setInt( "Shadows", 1 );
|
||||
s.config.setInt( "Bloom", 1 );
|
||||
s.config.setInt( "SquareBloom", 1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
s.config.setInt( "Shadows", 0 );
|
||||
s.config.setInt( "Bloom", 0 );
|
||||
s.config.setInt( "SquareBloom", 0 );
|
||||
}
|
||||
|
||||
|
||||
if( texturesSlider->value() == QUALITY_NORMAL )
|
||||
s.config.setInt( "HDEntityTexture", 1 );
|
||||
else if( texturesSlider->value() == QUALITY_LOW )
|
||||
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 ) )
|
||||
return;
|
||||
|
||||
landscapeLabel->setText( getQualityString( value ) );
|
||||
emit changed();
|
||||
}
|
||||
|
||||
void CDisplaySettingsDetailsWidget::onCharactersSliderChange( int value )
|
||||
{
|
||||
if( ( value < 0 ) || ( value > 3 ) )
|
||||
return;
|
||||
|
||||
characterLabel->setText( getQualityString( value ) );
|
||||
emit changed();
|
||||
}
|
||||
|
||||
void CDisplaySettingsDetailsWidget::onFXSliderChange( int value )
|
||||
{
|
||||
if( ( value < 0 ) || ( value > 3 ) )
|
||||
return;
|
||||
|
||||
fxLabel->setText( getQualityString( value ) );
|
||||
emit changed();
|
||||
}
|
||||
|
||||
void CDisplaySettingsDetailsWidget::onTexturesSliderChange( int value )
|
||||
{
|
||||
if( ( value < 0 ) || ( value > 3 ) )
|
||||
return;
|
||||
|
||||
textureLabel->setText( getTextureQualityString( value ) );
|
||||
emit changed();
|
||||
}
|
||||
|
||||
const float CDisplaySettingsDetailsWidget::qualityToZFar[ QUALITY_STEP ] =
|
||||
{
|
||||
200.0f,
|
||||
400.0f,
|
||||
500.0f,
|
||||
800.0f
|
||||
};
|
||||
|
||||
const float CDisplaySettingsDetailsWidget::qualityToLandscapeTileNear[ QUALITY_STEP ] =
|
||||
{
|
||||
20.0f,
|
||||
100.0f,
|
||||
150.0f,
|
||||
200.0f
|
||||
};
|
||||
|
||||
const float CDisplaySettingsDetailsWidget::qualityToLandscapeThreshold[ QUALITY_STEP ] =
|
||||
{
|
||||
100.0f,
|
||||
1000.0f,
|
||||
2000.0f,
|
||||
3000.0f
|
||||
};
|
||||
|
||||
|
||||
const float CDisplaySettingsDetailsWidget::qualityToMicrovegetDensity[ QUALITY_STEP ] =
|
||||
{
|
||||
10.0f,
|
||||
30.0f,
|
||||
80.0f,
|
||||
100.0f
|
||||
};
|
||||
|
||||
|
||||
const sint32 CDisplaySettingsDetailsWidget::qualityToSkinNbMaxPoly[ QUALITY_STEP ] =
|
||||
{
|
||||
10000,
|
||||
70000,
|
||||
100000,
|
||||
200000
|
||||
};
|
||||
|
||||
const sint32 CDisplaySettingsDetailsWidget::qualityToNbMaxSkeletonNotCLod[ QUALITY_STEP ] =
|
||||
{
|
||||
10,
|
||||
50,
|
||||
125,
|
||||
255
|
||||
};
|
||||
|
||||
const float CDisplaySettingsDetailsWidget::qualityToCharacterFarClip[ QUALITY_STEP ] =
|
||||
{
|
||||
50.0f,
|
||||
100.0f,
|
||||
200.0f,
|
||||
500.0f
|
||||
};
|
||||
|
||||
const sint32 CDisplaySettingsDetailsWidget::qualityToFxNbMaxPoly[ QUALITY_STEP ] =
|
||||
{
|
||||
2000,
|
||||
10000,
|
||||
20000,
|
||||
50000
|
||||
};
|
||||
|
||||
QString CDisplaySettingsDetailsWidget::getQualityString( uint32 quality )
|
||||
{
|
||||
switch( quality )
|
||||
{
|
||||
case QUALITY_LOW:
|
||||
return tr( "Low" );
|
||||
break;
|
||||
case QUALITY_MEDIUM:
|
||||
return tr( "Medium" );
|
||||
break;
|
||||
case QUALITY_NORMAL:
|
||||
return tr( "Normal" );
|
||||
break;
|
||||
case QUALITY_HIGH:
|
||||
return tr( "High" );
|
||||
break;
|
||||
default:
|
||||
return "";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
QString CDisplaySettingsDetailsWidget::getTextureQualityString( uint32 quality )
|
||||
{
|
||||
switch( quality )
|
||||
{
|
||||
case TEXQUALITY_LOW:
|
||||
return tr( "Low (32 MB)" );
|
||||
break;
|
||||
|
||||
case TEXQUALITY_NORMAL:
|
||||
return tr( "Normal (64 MB)" );
|
||||
break;
|
||||
|
||||
case TEXQUALITY_HIGH:
|
||||
return tr( "High (128 MB)" );
|
||||
break;
|
||||
|
||||
default:
|
||||
return "";
|
||||
break;
|
||||
}
|
||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "system.h"
|
||||
#include "display_settings_details_widget.h"
|
||||
|
||||
CDisplaySettingsDetailsWidget::CDisplaySettingsDetailsWidget( QWidget *parent ) :
|
||||
CWidgetBase( parent )
|
||||
{
|
||||
setupUi( this );
|
||||
connect( landscapeSlider, SIGNAL( valueChanged( int ) ), this, SLOT( onLandscapeSliderChange( int ) ) );
|
||||
connect( charactersSlider, SIGNAL( valueChanged( int ) ), this, SLOT( onCharactersSliderChange( int ) ) );
|
||||
connect( fxSlider, SIGNAL( valueChanged( int ) ), this, SLOT( onFXSliderChange( int ) ) );
|
||||
connect( texturesSlider, SIGNAL( valueChanged( int ) ), this, SLOT( onTexturesSliderChange( int ) ) );
|
||||
load();
|
||||
}
|
||||
|
||||
CDisplaySettingsDetailsWidget::~CDisplaySettingsDetailsWidget()
|
||||
{
|
||||
}
|
||||
|
||||
void CDisplaySettingsDetailsWidget::load()
|
||||
{
|
||||
CSystem &s = CSystem::GetInstance();
|
||||
|
||||
landscapeSlider->setValue( getQuality( qualityToLandscapeThreshold, s.config.getFloat( "LandscapeThreshold" ) ) );
|
||||
landscapeSlider->setValue( std::min( landscapeSlider->value(), getQuality( qualityToZFar, s.config.getFloat( "Vision" ) ) ) );
|
||||
landscapeSlider->setValue( std::min( landscapeSlider->value(), getQuality( qualityToLandscapeTileNear, s.config.getFloat( "LandscapeTileNear" ) ) ) );
|
||||
landscapeSlider->setValue( std::min( landscapeSlider->value(), getQuality( qualityToMicrovegetDensity, s.config.getFloat( "MicroVegetDensity" ) ) ) );
|
||||
|
||||
charactersSlider->setValue( getQuality( qualityToSkinNbMaxPoly, s.config.getInt( "SkinNbMaxPoly" ) ) );
|
||||
charactersSlider->setValue( std::min( charactersSlider->value(), getQuality( qualityToNbMaxSkeletonNotCLod, s.config.getInt( "NbMaxSkeletonNotCLod" ) ) ) );
|
||||
charactersSlider->setValue( std::min( charactersSlider->value(), getQuality( qualityToCharacterFarClip, s.config.getFloat( "CharacterFarClip" ) ) ) );
|
||||
|
||||
fxSlider->setValue( getQuality( qualityToFxNbMaxPoly, s.config.getInt( "FxNbMaxPoly" ) ) );
|
||||
|
||||
int hdTextureInstalled = s.config.getInt( "HDTextureInstalled" );
|
||||
if( hdTextureInstalled == 1 )
|
||||
texturesSlider->setMaximum( QUALITY_NORMAL );
|
||||
else
|
||||
texturesSlider->setMaximum( QUALITY_MEDIUM );
|
||||
|
||||
// Comment taken from the original config tool:
|
||||
// NB: if the player changes its client.cfg, mixing HDEntityTexture=1 and DivideTextureSizeBy2=1, it will
|
||||
// result to a low quality!
|
||||
if( s.config.getInt( "DivideTextureSizeBy2" ) )
|
||||
texturesSlider->setValue( QUALITY_LOW );
|
||||
else if( s.config.getInt( "HDEntityTexture" ) && ( hdTextureInstalled == 1 ) )
|
||||
texturesSlider->setValue( QUALITY_NORMAL );
|
||||
else
|
||||
texturesSlider->setValue( QUALITY_MEDIUM );
|
||||
}
|
||||
|
||||
void CDisplaySettingsDetailsWidget::save()
|
||||
{
|
||||
CSystem &s = CSystem::GetInstance();
|
||||
|
||||
s.config.setFloat( "Vision", qualityToZFar[ landscapeSlider->value() ] );
|
||||
s.config.setFloat( "LandscapeTileNear", qualityToLandscapeTileNear[ landscapeSlider->value() ] );
|
||||
s.config.setFloat( "LandscapeThreshold", qualityToLandscapeThreshold[ landscapeSlider->value() ] );
|
||||
|
||||
if( landscapeSlider->value() > QUALITY_LOW )
|
||||
s.config.setInt( "MicroVeget", 1 );
|
||||
else
|
||||
s.config.setInt( "MicroVeget", 0 );
|
||||
|
||||
s.config.setFloat( "MicroVegetDensity", qualityToMicrovegetDensity[ landscapeSlider->value() ] );
|
||||
|
||||
|
||||
s.config.setInt( "SkinNbMaxPoly", qualityToSkinNbMaxPoly[ charactersSlider->value() ] );
|
||||
s.config.setInt( "NbMaxSkeletonNotCLod", qualityToNbMaxSkeletonNotCLod[ charactersSlider->value() ] );
|
||||
s.config.setFloat( "CharacterFarClip", qualityToCharacterFarClip[ charactersSlider->value() ] );
|
||||
|
||||
|
||||
s.config.setInt( "FxNbMaxPoly", qualityToFxNbMaxPoly[ fxSlider->value() ] );
|
||||
if( fxSlider->value() > QUALITY_LOW )
|
||||
{
|
||||
s.config.setInt( "Shadows", 1 );
|
||||
s.config.setInt( "Bloom", 1 );
|
||||
s.config.setInt( "SquareBloom", 1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
s.config.setInt( "Shadows", 0 );
|
||||
s.config.setInt( "Bloom", 0 );
|
||||
s.config.setInt( "SquareBloom", 0 );
|
||||
}
|
||||
|
||||
|
||||
if( texturesSlider->value() == QUALITY_NORMAL )
|
||||
s.config.setInt( "HDEntityTexture", 1 );
|
||||
else if( texturesSlider->value() == QUALITY_LOW )
|
||||
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 ) )
|
||||
return;
|
||||
|
||||
landscapeLabel->setText( getQualityString( value ) );
|
||||
emit changed();
|
||||
}
|
||||
|
||||
void CDisplaySettingsDetailsWidget::onCharactersSliderChange( int value )
|
||||
{
|
||||
if( ( value < 0 ) || ( value > 3 ) )
|
||||
return;
|
||||
|
||||
characterLabel->setText( getQualityString( value ) );
|
||||
emit changed();
|
||||
}
|
||||
|
||||
void CDisplaySettingsDetailsWidget::onFXSliderChange( int value )
|
||||
{
|
||||
if( ( value < 0 ) || ( value > 3 ) )
|
||||
return;
|
||||
|
||||
fxLabel->setText( getQualityString( value ) );
|
||||
emit changed();
|
||||
}
|
||||
|
||||
void CDisplaySettingsDetailsWidget::onTexturesSliderChange( int value )
|
||||
{
|
||||
if( ( value < 0 ) || ( value > 3 ) )
|
||||
return;
|
||||
|
||||
textureLabel->setText( getTextureQualityString( value ) );
|
||||
emit changed();
|
||||
}
|
||||
|
||||
const float CDisplaySettingsDetailsWidget::qualityToZFar[ QUALITY_STEP ] =
|
||||
{
|
||||
200.0f,
|
||||
400.0f,
|
||||
500.0f,
|
||||
800.0f
|
||||
};
|
||||
|
||||
const float CDisplaySettingsDetailsWidget::qualityToLandscapeTileNear[ QUALITY_STEP ] =
|
||||
{
|
||||
20.0f,
|
||||
100.0f,
|
||||
150.0f,
|
||||
200.0f
|
||||
};
|
||||
|
||||
const float CDisplaySettingsDetailsWidget::qualityToLandscapeThreshold[ QUALITY_STEP ] =
|
||||
{
|
||||
100.0f,
|
||||
1000.0f,
|
||||
2000.0f,
|
||||
3000.0f
|
||||
};
|
||||
|
||||
|
||||
const float CDisplaySettingsDetailsWidget::qualityToMicrovegetDensity[ QUALITY_STEP ] =
|
||||
{
|
||||
10.0f,
|
||||
30.0f,
|
||||
80.0f,
|
||||
100.0f
|
||||
};
|
||||
|
||||
|
||||
const sint32 CDisplaySettingsDetailsWidget::qualityToSkinNbMaxPoly[ QUALITY_STEP ] =
|
||||
{
|
||||
10000,
|
||||
70000,
|
||||
100000,
|
||||
200000
|
||||
};
|
||||
|
||||
const sint32 CDisplaySettingsDetailsWidget::qualityToNbMaxSkeletonNotCLod[ QUALITY_STEP ] =
|
||||
{
|
||||
10,
|
||||
50,
|
||||
125,
|
||||
255
|
||||
};
|
||||
|
||||
const float CDisplaySettingsDetailsWidget::qualityToCharacterFarClip[ QUALITY_STEP ] =
|
||||
{
|
||||
50.0f,
|
||||
100.0f,
|
||||
200.0f,
|
||||
500.0f
|
||||
};
|
||||
|
||||
const sint32 CDisplaySettingsDetailsWidget::qualityToFxNbMaxPoly[ QUALITY_STEP ] =
|
||||
{
|
||||
2000,
|
||||
10000,
|
||||
20000,
|
||||
50000
|
||||
};
|
||||
|
||||
QString CDisplaySettingsDetailsWidget::getQualityString( uint32 quality )
|
||||
{
|
||||
switch( quality )
|
||||
{
|
||||
case QUALITY_LOW:
|
||||
return tr( "Low" );
|
||||
break;
|
||||
case QUALITY_MEDIUM:
|
||||
return tr( "Medium" );
|
||||
break;
|
||||
case QUALITY_NORMAL:
|
||||
return tr( "Normal" );
|
||||
break;
|
||||
case QUALITY_HIGH:
|
||||
return tr( "High" );
|
||||
break;
|
||||
default:
|
||||
return "";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
QString CDisplaySettingsDetailsWidget::getTextureQualityString( uint32 quality )
|
||||
{
|
||||
switch( quality )
|
||||
{
|
||||
case TEXQUALITY_LOW:
|
||||
return tr( "Low (32 MB)" );
|
||||
break;
|
||||
|
||||
case TEXQUALITY_NORMAL:
|
||||
return tr( "Normal (64 MB)" );
|
||||
break;
|
||||
|
||||
case TEXQUALITY_HIGH:
|
||||
return tr( "High (128 MB)" );
|
||||
break;
|
||||
|
||||
default:
|
||||
return "";
|
||||
break;
|
||||
}
|
||||
}
|
|
@ -1,121 +1,121 @@
|
|||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef DISPLAYSETTINGSDETAILSWIDGET_H
|
||||
#define DISPLAYSETTINGSDETAILSWIDGET_H
|
||||
|
||||
#include "ui_display_settings_details_widget.h"
|
||||
#include "widget_base.h"
|
||||
#include <nel/misc/types_nl.h>
|
||||
|
||||
enum
|
||||
{
|
||||
QUALITY_LOW = 0,
|
||||
QUALITY_MEDIUM = 1,
|
||||
QUALITY_NORMAL = 2,
|
||||
QUALITY_HIGH = 3,
|
||||
QUALITY_STEP = 4
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
TEXQUALITY_LOW = 0,
|
||||
TEXQUALITY_NORMAL = 1,
|
||||
TEXQUALITY_HIGH = 2
|
||||
};
|
||||
|
||||
/**
|
||||
@brief The display details page of the configuration tool
|
||||
*/
|
||||
class CDisplaySettingsDetailsWidget : public CWidgetBase, public Ui::display_settings_details_widget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CDisplaySettingsDetailsWidget( QWidget *parent = NULL );
|
||||
~CDisplaySettingsDetailsWidget();
|
||||
|
||||
void load();
|
||||
void save();
|
||||
|
||||
protected:
|
||||
void changeEvent( QEvent *event );
|
||||
|
||||
private slots:
|
||||
void onLandscapeSliderChange( int value );
|
||||
void onCharactersSliderChange( int value );
|
||||
void onFXSliderChange( int value );
|
||||
void onTexturesSliderChange( int value );
|
||||
|
||||
private:
|
||||
/**
|
||||
@brief Looks up and returns the "quality" ( see the enums on the top), that belongs to the specified value.
|
||||
@param table - The lookup table you want to use.
|
||||
@param value - The value that we want to look up.
|
||||
@return Returns the "quality" that best fits the specified value.
|
||||
*/
|
||||
template< typename T >
|
||||
int getQuality( const T *table, T value )
|
||||
{
|
||||
if( table[ 0 ] < table[ QUALITY_STEP - 1 ] )
|
||||
{
|
||||
uint32 i = 0;
|
||||
while( ( i < QUALITY_STEP ) && ( table[ i ] < value ) )
|
||||
i++;
|
||||
return i;
|
||||
}
|
||||
else
|
||||
{
|
||||
uint32 i = 0;
|
||||
while( ( i < QUALITY_STEP ) && ( table[ i ] > value ) )
|
||||
i++;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@brief Retrieves the string that belongs to the specified quality.
|
||||
@param quality - The quality value
|
||||
@return Returns a string describing the quality value, Returns an empty string if an invalid value is specified.
|
||||
*/
|
||||
static QString getQualityString( uint32 quality );
|
||||
|
||||
|
||||
/**
|
||||
@brief Retrieves the string that belongs to the specified texture quality.
|
||||
@param quality - The texture quality value
|
||||
@return Returns a string describing the texture quality, Returns an empty string if an invalid value is specified.
|
||||
*/
|
||||
static QString getTextureQualityString( uint32 quality );
|
||||
|
||||
|
||||
///////////////////////// Landscape values ///////////////////////
|
||||
static const float qualityToZFar[ QUALITY_STEP ];
|
||||
static const float qualityToLandscapeTileNear[ QUALITY_STEP ];
|
||||
static const float qualityToLandscapeThreshold[ QUALITY_STEP ];
|
||||
static const float qualityToMicrovegetDensity[ QUALITY_STEP ];
|
||||
|
||||
//////////////////////// Character values ////////////////////////
|
||||
static const sint32 qualityToSkinNbMaxPoly[ QUALITY_STEP ];
|
||||
static const sint32 qualityToNbMaxSkeletonNotCLod[ QUALITY_STEP ];
|
||||
static const float qualityToCharacterFarClip[ QUALITY_STEP ];
|
||||
|
||||
/////////////////////// FX values ////////////////////////////////
|
||||
static const sint32 qualityToFxNbMaxPoly[ QUALITY_STEP ];
|
||||
|
||||
};
|
||||
|
||||
#endif // DISPLAYSETTINGSDETAILSWIDGET_H
|
||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef DISPLAYSETTINGSDETAILSWIDGET_H
|
||||
#define DISPLAYSETTINGSDETAILSWIDGET_H
|
||||
|
||||
#include "ui_display_settings_details_widget.h"
|
||||
#include "widget_base.h"
|
||||
#include <nel/misc/types_nl.h>
|
||||
|
||||
enum
|
||||
{
|
||||
QUALITY_LOW = 0,
|
||||
QUALITY_MEDIUM = 1,
|
||||
QUALITY_NORMAL = 2,
|
||||
QUALITY_HIGH = 3,
|
||||
QUALITY_STEP = 4
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
TEXQUALITY_LOW = 0,
|
||||
TEXQUALITY_NORMAL = 1,
|
||||
TEXQUALITY_HIGH = 2
|
||||
};
|
||||
|
||||
/**
|
||||
@brief The display details page of the configuration tool
|
||||
*/
|
||||
class CDisplaySettingsDetailsWidget : public CWidgetBase, public Ui::display_settings_details_widget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CDisplaySettingsDetailsWidget( QWidget *parent = NULL );
|
||||
~CDisplaySettingsDetailsWidget();
|
||||
|
||||
void load();
|
||||
void save();
|
||||
|
||||
protected:
|
||||
void changeEvent( QEvent *event );
|
||||
|
||||
private slots:
|
||||
void onLandscapeSliderChange( int value );
|
||||
void onCharactersSliderChange( int value );
|
||||
void onFXSliderChange( int value );
|
||||
void onTexturesSliderChange( int value );
|
||||
|
||||
private:
|
||||
/**
|
||||
@brief Looks up and returns the "quality" ( see the enums on the top), that belongs to the specified value.
|
||||
@param table - The lookup table you want to use.
|
||||
@param value - The value that we want to look up.
|
||||
@return Returns the "quality" that best fits the specified value.
|
||||
*/
|
||||
template< typename T >
|
||||
int getQuality( const T *table, T value )
|
||||
{
|
||||
if( table[ 0 ] < table[ QUALITY_STEP - 1 ] )
|
||||
{
|
||||
uint32 i = 0;
|
||||
while( ( i < QUALITY_STEP ) && ( table[ i ] < value ) )
|
||||
i++;
|
||||
return i;
|
||||
}
|
||||
else
|
||||
{
|
||||
uint32 i = 0;
|
||||
while( ( i < QUALITY_STEP ) && ( table[ i ] > value ) )
|
||||
i++;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@brief Retrieves the string that belongs to the specified quality.
|
||||
@param quality - The quality value
|
||||
@return Returns a string describing the quality value, Returns an empty string if an invalid value is specified.
|
||||
*/
|
||||
static QString getQualityString( uint32 quality );
|
||||
|
||||
|
||||
/**
|
||||
@brief Retrieves the string that belongs to the specified texture quality.
|
||||
@param quality - The texture quality value
|
||||
@return Returns a string describing the texture quality, Returns an empty string if an invalid value is specified.
|
||||
*/
|
||||
static QString getTextureQualityString( uint32 quality );
|
||||
|
||||
|
||||
///////////////////////// Landscape values ///////////////////////
|
||||
static const float qualityToZFar[ QUALITY_STEP ];
|
||||
static const float qualityToLandscapeTileNear[ QUALITY_STEP ];
|
||||
static const float qualityToLandscapeThreshold[ QUALITY_STEP ];
|
||||
static const float qualityToMicrovegetDensity[ QUALITY_STEP ];
|
||||
|
||||
//////////////////////// Character values ////////////////////////
|
||||
static const sint32 qualityToSkinNbMaxPoly[ QUALITY_STEP ];
|
||||
static const sint32 qualityToNbMaxSkeletonNotCLod[ QUALITY_STEP ];
|
||||
static const float qualityToCharacterFarClip[ QUALITY_STEP ];
|
||||
|
||||
/////////////////////// FX values ////////////////////////////////
|
||||
static const sint32 qualityToFxNbMaxPoly[ QUALITY_STEP ];
|
||||
|
||||
};
|
||||
|
||||
#endif // DISPLAYSETTINGSDETAILSWIDGET_H
|
||||
|
|
|
@ -1,227 +1,227 @@
|
|||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include "display_settings_widget.h"
|
||||
#include "system.h"
|
||||
#include <QRegExpValidator>
|
||||
|
||||
CDisplaySettingsWidget::CDisplaySettingsWidget( QWidget *parent ) :
|
||||
CWidgetBase( parent )
|
||||
{
|
||||
setupUi( this );
|
||||
widthLineEdit->setValidator( new QRegExpValidator( QRegExp( "[0-9]{1,6}" ), widthLineEdit ) );
|
||||
heightLineEdit->setValidator( new QRegExpValidator( QRegExp( "[0-9]{1,6}" ), heightLineEdit ) );
|
||||
xpositionLineEdit->setValidator( new QRegExpValidator( QRegExp( "[0-9]{1,6}" ), xpositionLineEdit ) );
|
||||
ypositionLineEdit->setValidator( new QRegExpValidator( QRegExp( "[0-9]{1,6}" ), ypositionLineEdit ) );
|
||||
load();
|
||||
|
||||
connect( autoRadioButton, SIGNAL( clicked( bool ) ), this, SLOT( onSomethingChanged() ) );
|
||||
connect( openglRadioButton, SIGNAL( clicked( bool ) ), this, SLOT( onSomethingChanged() ) );
|
||||
connect( direct3dRadioButton, SIGNAL( clicked( bool ) ), this, SLOT( onSomethingChanged() ) );
|
||||
connect( fullscreenRadioButton, SIGNAL( clicked( bool ) ), this, SLOT( onSomethingChanged() ) );
|
||||
connect( windowedRadioButton, SIGNAL( clicked( bool ) ), this, SLOT( onSomethingChanged() ) );
|
||||
connect( widthLineEdit, SIGNAL( textChanged( const QString & ) ), this, SLOT( onSomethingChanged() ) );
|
||||
connect( heightLineEdit, SIGNAL( textChanged( const QString & ) ), this, SLOT( onSomethingChanged() ) );
|
||||
connect( xpositionLineEdit, SIGNAL( textChanged( const QString & ) ), this, SLOT( onSomethingChanged() ) );
|
||||
connect( ypositionLineEdit, SIGNAL( textChanged( const QString & ) ), this, SLOT( onSomethingChanged() ) );
|
||||
connect( videomodeComboBox, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onSomethingChanged() ) );
|
||||
connect( autoRadioButton, SIGNAL( clicked( bool ) ), this, SLOT( updateVideoModes() ) );
|
||||
connect( openglRadioButton, SIGNAL( clicked( bool ) ), this, SLOT( updateVideoModes() ) );
|
||||
connect( direct3dRadioButton, SIGNAL( clicked( bool ) ), this, SLOT( updateVideoModes() ) );
|
||||
}
|
||||
|
||||
CDisplaySettingsWidget::~CDisplaySettingsWidget()
|
||||
{
|
||||
}
|
||||
|
||||
void CDisplaySettingsWidget::load()
|
||||
{
|
||||
CSystem &s = CSystem::GetInstance();
|
||||
|
||||
std::string driver = s.config.getString( "Driver3D" );
|
||||
switch( getDriverFromConfigString( driver ) )
|
||||
{
|
||||
case DRV_AUTO:
|
||||
autoRadioButton->setChecked( true );
|
||||
break;
|
||||
case DRV_OPENGL:
|
||||
openglRadioButton->setChecked( true );
|
||||
break;
|
||||
case DRV_DIRECT3D:
|
||||
direct3dRadioButton->setChecked( true );
|
||||
break;
|
||||
}
|
||||
|
||||
updateVideoModes();
|
||||
|
||||
|
||||
CVideoMode mode;
|
||||
mode.widht = s.config.getInt( "Width" );
|
||||
mode.height = s.config.getInt( "Height" );
|
||||
mode.depth = s.config.getInt( "Depth" );
|
||||
mode.frequency = s.config.getInt( "Frequency" );
|
||||
|
||||
if( s.config.getInt( "FullScreen" ) == 1 )
|
||||
{
|
||||
fullscreenRadioButton->setChecked( true );
|
||||
videomodeComboBox->setCurrentIndex( findVideoModeIndex( &mode ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
windowedRadioButton->setChecked( true );
|
||||
}
|
||||
|
||||
widthLineEdit->setText( QString( "%1" ).arg( mode.widht ) );
|
||||
heightLineEdit->setText( QString( "%1" ).arg( mode.height ) );
|
||||
xpositionLineEdit->setText( QString( "%1" ).arg( s.config.getInt( "PositionX" ) ) );
|
||||
ypositionLineEdit->setText( QString( "%1" ).arg( s.config.getInt( "PositionY" ) ) );
|
||||
|
||||
}
|
||||
|
||||
void CDisplaySettingsWidget::save()
|
||||
{
|
||||
CSystem &s = CSystem::GetInstance();
|
||||
|
||||
if( openglRadioButton->isChecked() )
|
||||
s.config.setString( "Driver3D", std::string( "OpenGL" ) );
|
||||
else if( direct3dRadioButton->isChecked() )
|
||||
s.config.setString( "Driver3D", std::string( "Direct3D" ) );
|
||||
else
|
||||
s.config.setString( "Driver3D", std::string( "Auto" ) );
|
||||
|
||||
if( fullscreenRadioButton->isChecked() )
|
||||
{
|
||||
s.config.setInt( "FullScreen", 1 );
|
||||
|
||||
sint32 index = videomodeComboBox->currentIndex();
|
||||
CVideoMode mode;
|
||||
|
||||
// OpenGL should be available everywhere!
|
||||
if( direct3dRadioButton->isChecked() )
|
||||
mode = s.d3dInfo.modes[ index ];
|
||||
else
|
||||
mode = s.openglInfo.modes[ index ];
|
||||
|
||||
s.config.setInt( "Width", mode.widht );
|
||||
s.config.setInt( "Height", mode.height );
|
||||
s.config.setInt( "Depth", mode.depth );
|
||||
s.config.setInt( "Frequency", mode.frequency );
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
s.config.setInt( "FullScreen", 0 );
|
||||
s.config.setInt( "Width", widthLineEdit->text().toInt() );
|
||||
s.config.setInt( "Height", heightLineEdit->text().toInt() );
|
||||
}
|
||||
|
||||
s.config.setInt( "PositionX", xpositionLineEdit->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()
|
||||
{
|
||||
CSystem &s = CSystem::GetInstance();
|
||||
|
||||
videomodeComboBox->clear();
|
||||
|
||||
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() );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 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() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint32 CDisplaySettingsWidget::findVideoModeIndex( CVideoMode *mode )
|
||||
{
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// WARNING:
|
||||
// This part relies on that the video mode combo box is filled as the following:
|
||||
//
|
||||
//| --------------------------------------|
|
||||
//| Selected driver | Modes |
|
||||
//| --------------------------------------|
|
||||
//| Auto | OpenGL modes |
|
||||
//| OpenGL | OpenGL modes |
|
||||
//| Direct3D | Direct3d modes |
|
||||
//| --------------------------------------|
|
||||
//
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CVideoMode &m = *mode;
|
||||
CSystem &s = CSystem::GetInstance();
|
||||
|
||||
if( direct3dRadioButton->isChecked() )
|
||||
{
|
||||
for( uint32 i = 0; i < s.d3dInfo.modes.size(); i++ )
|
||||
if( s.d3dInfo.modes[ i ] == m )
|
||||
return i;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Again OpenGL should be available everywhere!
|
||||
for( uint32 i = 0; i < s.openglInfo.modes.size(); i++ )
|
||||
if( s.openglInfo.modes[ i ] == m )
|
||||
return i;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
E3DDriver CDisplaySettingsWidget::getDriverFromConfigString(std::string &str) const
|
||||
{
|
||||
if( str.compare( "0" ) == 0 )
|
||||
return DRV_AUTO;
|
||||
if( str.compare( "1" ) == 0 )
|
||||
return DRV_OPENGL;
|
||||
if( str.compare( "2" ) == 0 )
|
||||
return DRV_DIRECT3D;
|
||||
if( str.compare( "OpenGL" ) == 0 )
|
||||
return DRV_OPENGL;
|
||||
if( str.compare( "Direct3D" ) == 0)
|
||||
return DRV_DIRECT3D;
|
||||
|
||||
|
||||
return DRV_AUTO;
|
||||
}
|
||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include "display_settings_widget.h"
|
||||
#include "system.h"
|
||||
#include <QRegExpValidator>
|
||||
|
||||
CDisplaySettingsWidget::CDisplaySettingsWidget( QWidget *parent ) :
|
||||
CWidgetBase( parent )
|
||||
{
|
||||
setupUi( this );
|
||||
widthLineEdit->setValidator( new QRegExpValidator( QRegExp( "[0-9]{1,6}" ), widthLineEdit ) );
|
||||
heightLineEdit->setValidator( new QRegExpValidator( QRegExp( "[0-9]{1,6}" ), heightLineEdit ) );
|
||||
xpositionLineEdit->setValidator( new QRegExpValidator( QRegExp( "[0-9]{1,6}" ), xpositionLineEdit ) );
|
||||
ypositionLineEdit->setValidator( new QRegExpValidator( QRegExp( "[0-9]{1,6}" ), ypositionLineEdit ) );
|
||||
load();
|
||||
|
||||
connect( autoRadioButton, SIGNAL( clicked( bool ) ), this, SLOT( onSomethingChanged() ) );
|
||||
connect( openglRadioButton, SIGNAL( clicked( bool ) ), this, SLOT( onSomethingChanged() ) );
|
||||
connect( direct3dRadioButton, SIGNAL( clicked( bool ) ), this, SLOT( onSomethingChanged() ) );
|
||||
connect( fullscreenRadioButton, SIGNAL( clicked( bool ) ), this, SLOT( onSomethingChanged() ) );
|
||||
connect( windowedRadioButton, SIGNAL( clicked( bool ) ), this, SLOT( onSomethingChanged() ) );
|
||||
connect( widthLineEdit, SIGNAL( textChanged( const QString & ) ), this, SLOT( onSomethingChanged() ) );
|
||||
connect( heightLineEdit, SIGNAL( textChanged( const QString & ) ), this, SLOT( onSomethingChanged() ) );
|
||||
connect( xpositionLineEdit, SIGNAL( textChanged( const QString & ) ), this, SLOT( onSomethingChanged() ) );
|
||||
connect( ypositionLineEdit, SIGNAL( textChanged( const QString & ) ), this, SLOT( onSomethingChanged() ) );
|
||||
connect( videomodeComboBox, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onSomethingChanged() ) );
|
||||
connect( autoRadioButton, SIGNAL( clicked( bool ) ), this, SLOT( updateVideoModes() ) );
|
||||
connect( openglRadioButton, SIGNAL( clicked( bool ) ), this, SLOT( updateVideoModes() ) );
|
||||
connect( direct3dRadioButton, SIGNAL( clicked( bool ) ), this, SLOT( updateVideoModes() ) );
|
||||
}
|
||||
|
||||
CDisplaySettingsWidget::~CDisplaySettingsWidget()
|
||||
{
|
||||
}
|
||||
|
||||
void CDisplaySettingsWidget::load()
|
||||
{
|
||||
CSystem &s = CSystem::GetInstance();
|
||||
|
||||
std::string driver = s.config.getString( "Driver3D" );
|
||||
switch( getDriverFromConfigString( driver ) )
|
||||
{
|
||||
case DRV_AUTO:
|
||||
autoRadioButton->setChecked( true );
|
||||
break;
|
||||
case DRV_OPENGL:
|
||||
openglRadioButton->setChecked( true );
|
||||
break;
|
||||
case DRV_DIRECT3D:
|
||||
direct3dRadioButton->setChecked( true );
|
||||
break;
|
||||
}
|
||||
|
||||
updateVideoModes();
|
||||
|
||||
|
||||
CVideoMode mode;
|
||||
mode.widht = s.config.getInt( "Width" );
|
||||
mode.height = s.config.getInt( "Height" );
|
||||
mode.depth = s.config.getInt( "Depth" );
|
||||
mode.frequency = s.config.getInt( "Frequency" );
|
||||
|
||||
if( s.config.getInt( "FullScreen" ) == 1 )
|
||||
{
|
||||
fullscreenRadioButton->setChecked( true );
|
||||
videomodeComboBox->setCurrentIndex( findVideoModeIndex( &mode ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
windowedRadioButton->setChecked( true );
|
||||
}
|
||||
|
||||
widthLineEdit->setText( QString( "%1" ).arg( mode.widht ) );
|
||||
heightLineEdit->setText( QString( "%1" ).arg( mode.height ) );
|
||||
xpositionLineEdit->setText( QString( "%1" ).arg( s.config.getInt( "PositionX" ) ) );
|
||||
ypositionLineEdit->setText( QString( "%1" ).arg( s.config.getInt( "PositionY" ) ) );
|
||||
|
||||
}
|
||||
|
||||
void CDisplaySettingsWidget::save()
|
||||
{
|
||||
CSystem &s = CSystem::GetInstance();
|
||||
|
||||
if( openglRadioButton->isChecked() )
|
||||
s.config.setString( "Driver3D", std::string( "OpenGL" ) );
|
||||
else if( direct3dRadioButton->isChecked() )
|
||||
s.config.setString( "Driver3D", std::string( "Direct3D" ) );
|
||||
else
|
||||
s.config.setString( "Driver3D", std::string( "Auto" ) );
|
||||
|
||||
if( fullscreenRadioButton->isChecked() )
|
||||
{
|
||||
s.config.setInt( "FullScreen", 1 );
|
||||
|
||||
sint32 index = videomodeComboBox->currentIndex();
|
||||
CVideoMode mode;
|
||||
|
||||
// OpenGL should be available everywhere!
|
||||
if( direct3dRadioButton->isChecked() )
|
||||
mode = s.d3dInfo.modes[ index ];
|
||||
else
|
||||
mode = s.openglInfo.modes[ index ];
|
||||
|
||||
s.config.setInt( "Width", mode.widht );
|
||||
s.config.setInt( "Height", mode.height );
|
||||
s.config.setInt( "Depth", mode.depth );
|
||||
s.config.setInt( "Frequency", mode.frequency );
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
s.config.setInt( "FullScreen", 0 );
|
||||
s.config.setInt( "Width", widthLineEdit->text().toInt() );
|
||||
s.config.setInt( "Height", heightLineEdit->text().toInt() );
|
||||
}
|
||||
|
||||
s.config.setInt( "PositionX", xpositionLineEdit->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()
|
||||
{
|
||||
CSystem &s = CSystem::GetInstance();
|
||||
|
||||
videomodeComboBox->clear();
|
||||
|
||||
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() );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 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() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint32 CDisplaySettingsWidget::findVideoModeIndex( CVideoMode *mode )
|
||||
{
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// WARNING:
|
||||
// This part relies on that the video mode combo box is filled as the following:
|
||||
//
|
||||
//| --------------------------------------|
|
||||
//| Selected driver | Modes |
|
||||
//| --------------------------------------|
|
||||
//| Auto | OpenGL modes |
|
||||
//| OpenGL | OpenGL modes |
|
||||
//| Direct3D | Direct3d modes |
|
||||
//| --------------------------------------|
|
||||
//
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CVideoMode &m = *mode;
|
||||
CSystem &s = CSystem::GetInstance();
|
||||
|
||||
if( direct3dRadioButton->isChecked() )
|
||||
{
|
||||
for( uint32 i = 0; i < s.d3dInfo.modes.size(); i++ )
|
||||
if( s.d3dInfo.modes[ i ] == m )
|
||||
return i;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Again OpenGL should be available everywhere!
|
||||
for( uint32 i = 0; i < s.openglInfo.modes.size(); i++ )
|
||||
if( s.openglInfo.modes[ i ] == m )
|
||||
return i;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
E3DDriver CDisplaySettingsWidget::getDriverFromConfigString(std::string &str) const
|
||||
{
|
||||
if( str.compare( "0" ) == 0 )
|
||||
return DRV_AUTO;
|
||||
if( str.compare( "1" ) == 0 )
|
||||
return DRV_OPENGL;
|
||||
if( str.compare( "2" ) == 0 )
|
||||
return DRV_DIRECT3D;
|
||||
if( str.compare( "OpenGL" ) == 0 )
|
||||
return DRV_OPENGL;
|
||||
if( str.compare( "Direct3D" ) == 0)
|
||||
return DRV_DIRECT3D;
|
||||
|
||||
|
||||
return DRV_AUTO;
|
||||
}
|
||||
|
|
|
@ -1,72 +1,72 @@
|
|||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef DISPLAYSETTINGSWIDGET_H
|
||||
#define DISPLAYSETTINGSWIDGET_H
|
||||
|
||||
#include "ui_display_settings_widget.h"
|
||||
#include "widget_base.h"
|
||||
#include <nel/misc/types_nl.h>
|
||||
|
||||
struct CVideoMode;
|
||||
|
||||
enum E3DDriver
|
||||
{
|
||||
DRV_AUTO,
|
||||
DRV_OPENGL,
|
||||
DRV_DIRECT3D
|
||||
};
|
||||
|
||||
/**
|
||||
@brief The display settings page of the configuration tool
|
||||
*/
|
||||
class CDisplaySettingsWidget : public CWidgetBase, public Ui::display_settings_widget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CDisplaySettingsWidget( QWidget *parent = NULL );
|
||||
~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.
|
||||
*/
|
||||
void updateVideoModes();
|
||||
|
||||
private:
|
||||
/**
|
||||
@brief Finds the proper index for the video mode combobox
|
||||
@param mode - the video mode read from config
|
||||
@return Returns the proper video mode index if found, returns 0 otherwise.
|
||||
*/
|
||||
uint32 findVideoModeIndex( CVideoMode *mode );
|
||||
|
||||
|
||||
/**
|
||||
@brief Retrieves the driver type from the config string.
|
||||
@param str - Reference to the driver string.
|
||||
@return Returns the driver type on success, rReturns E3DDriver::DRV_AUTO otherwise.
|
||||
*/
|
||||
E3DDriver getDriverFromConfigString( std::string &str ) const;
|
||||
};
|
||||
|
||||
#endif // DISPLAYSETTINGSWIDGET_H
|
||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef DISPLAYSETTINGSWIDGET_H
|
||||
#define DISPLAYSETTINGSWIDGET_H
|
||||
|
||||
#include "ui_display_settings_widget.h"
|
||||
#include "widget_base.h"
|
||||
#include <nel/misc/types_nl.h>
|
||||
|
||||
struct CVideoMode;
|
||||
|
||||
enum E3DDriver
|
||||
{
|
||||
DRV_AUTO,
|
||||
DRV_OPENGL,
|
||||
DRV_DIRECT3D
|
||||
};
|
||||
|
||||
/**
|
||||
@brief The display settings page of the configuration tool
|
||||
*/
|
||||
class CDisplaySettingsWidget : public CWidgetBase, public Ui::display_settings_widget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CDisplaySettingsWidget( QWidget *parent = NULL );
|
||||
~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.
|
||||
*/
|
||||
void updateVideoModes();
|
||||
|
||||
private:
|
||||
/**
|
||||
@brief Finds the proper index for the video mode combobox
|
||||
@param mode - the video mode read from config
|
||||
@return Returns the proper video mode index if found, returns 0 otherwise.
|
||||
*/
|
||||
uint32 findVideoModeIndex( CVideoMode *mode );
|
||||
|
||||
|
||||
/**
|
||||
@brief Retrieves the driver type from the config string.
|
||||
@param str - Reference to the driver string.
|
||||
@return Returns the driver type on success, rReturns E3DDriver::DRV_AUTO otherwise.
|
||||
*/
|
||||
E3DDriver getDriverFromConfigString( std::string &str ) const;
|
||||
};
|
||||
|
||||
#endif // DISPLAYSETTINGSWIDGET_H
|
||||
|
|
|
@ -1,121 +1,121 @@
|
|||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "general_settings_widget.h"
|
||||
#include "system.h"
|
||||
#include <QTranslator>
|
||||
|
||||
const QString CGeneralSettingsWidget::languageCodes[ NUM_LANGUAGE_CODES ] =
|
||||
{
|
||||
"en",
|
||||
"fr",
|
||||
"de",
|
||||
"hu"
|
||||
};
|
||||
|
||||
CGeneralSettingsWidget::CGeneralSettingsWidget( QWidget *parent ) :
|
||||
CWidgetBase( parent )
|
||||
{
|
||||
currentTranslator = NULL;
|
||||
setupUi( this );
|
||||
load();
|
||||
|
||||
connect( languageComboBox, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onLanguageChanged() ) );
|
||||
connect( saveConfigOnQuitCheckBox, SIGNAL( stateChanged( int ) ), this, SLOT( onSomethingChanged() ) );
|
||||
connect( lowPriorityProcessCheckBox, SIGNAL( stateChanged( int ) ), this, SLOT( onSomethingChanged() ) );
|
||||
}
|
||||
|
||||
CGeneralSettingsWidget::~CGeneralSettingsWidget()
|
||||
{
|
||||
}
|
||||
|
||||
void CGeneralSettingsWidget::load()
|
||||
{
|
||||
CSystem &s = CSystem::GetInstance();
|
||||
|
||||
sint32 cbIndex = getIndexForLanguageCode( QString( s.config.getString( "LanguageCode" ).c_str() ) );
|
||||
if( cbIndex != -1 ){
|
||||
languageComboBox->setCurrentIndex( cbIndex );
|
||||
onLanguageChanged();
|
||||
}
|
||||
|
||||
if( s.config.getInt( "SaveConfig" ) )
|
||||
saveConfigOnQuitCheckBox->setChecked( true );
|
||||
|
||||
if( s.config.getInt( "ProcessPriority" ) == -1 )
|
||||
lowPriorityProcessCheckBox->setChecked( true );
|
||||
else
|
||||
lowPriorityProcessCheckBox->setChecked( false );
|
||||
}
|
||||
|
||||
void CGeneralSettingsWidget::save()
|
||||
{
|
||||
CSystem &s = CSystem::GetInstance();
|
||||
|
||||
s.config.setString( "LanguageCode", std::string( languageCodes[ languageComboBox->currentIndex() ].toUtf8() ) );
|
||||
|
||||
if( saveConfigOnQuitCheckBox->isChecked() )
|
||||
s.config.setInt( "SaveConfig", 1 );
|
||||
else
|
||||
s.config.setInt( "SaveConfig", 0 );
|
||||
|
||||
if( lowPriorityProcessCheckBox->isChecked() )
|
||||
s.config.setInt( "ProcessPriority", -1 );
|
||||
else
|
||||
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( QString &languageCode )
|
||||
{
|
||||
for( sint32 i = 0; i < NUM_LANGUAGE_CODES; i++ )
|
||||
if( languageCode.compare( languageCodes[ i ] ) == 0 )
|
||||
return i;
|
||||
|
||||
return -1;
|
||||
}
|
||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "general_settings_widget.h"
|
||||
#include "system.h"
|
||||
#include <QTranslator>
|
||||
|
||||
const QString CGeneralSettingsWidget::languageCodes[ NUM_LANGUAGE_CODES ] =
|
||||
{
|
||||
"en",
|
||||
"fr",
|
||||
"de",
|
||||
"hu"
|
||||
};
|
||||
|
||||
CGeneralSettingsWidget::CGeneralSettingsWidget( QWidget *parent ) :
|
||||
CWidgetBase( parent )
|
||||
{
|
||||
currentTranslator = NULL;
|
||||
setupUi( this );
|
||||
load();
|
||||
|
||||
connect( languageComboBox, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onLanguageChanged() ) );
|
||||
connect( saveConfigOnQuitCheckBox, SIGNAL( stateChanged( int ) ), this, SLOT( onSomethingChanged() ) );
|
||||
connect( lowPriorityProcessCheckBox, SIGNAL( stateChanged( int ) ), this, SLOT( onSomethingChanged() ) );
|
||||
}
|
||||
|
||||
CGeneralSettingsWidget::~CGeneralSettingsWidget()
|
||||
{
|
||||
}
|
||||
|
||||
void CGeneralSettingsWidget::load()
|
||||
{
|
||||
CSystem &s = CSystem::GetInstance();
|
||||
|
||||
sint32 cbIndex = getIndexForLanguageCode( QString( s.config.getString( "LanguageCode" ).c_str() ) );
|
||||
if( cbIndex != -1 ){
|
||||
languageComboBox->setCurrentIndex( cbIndex );
|
||||
onLanguageChanged();
|
||||
}
|
||||
|
||||
if( s.config.getInt( "SaveConfig" ) )
|
||||
saveConfigOnQuitCheckBox->setChecked( true );
|
||||
|
||||
if( s.config.getInt( "ProcessPriority" ) == -1 )
|
||||
lowPriorityProcessCheckBox->setChecked( true );
|
||||
else
|
||||
lowPriorityProcessCheckBox->setChecked( false );
|
||||
}
|
||||
|
||||
void CGeneralSettingsWidget::save()
|
||||
{
|
||||
CSystem &s = CSystem::GetInstance();
|
||||
|
||||
s.config.setString( "LanguageCode", std::string( languageCodes[ languageComboBox->currentIndex() ].toUtf8() ) );
|
||||
|
||||
if( saveConfigOnQuitCheckBox->isChecked() )
|
||||
s.config.setInt( "SaveConfig", 1 );
|
||||
else
|
||||
s.config.setInt( "SaveConfig", 0 );
|
||||
|
||||
if( lowPriorityProcessCheckBox->isChecked() )
|
||||
s.config.setInt( "ProcessPriority", -1 );
|
||||
else
|
||||
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( QString &languageCode )
|
||||
{
|
||||
for( sint32 i = 0; i < NUM_LANGUAGE_CODES; i++ )
|
||||
if( languageCode.compare( languageCodes[ i ] ) == 0 )
|
||||
return i;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -1,66 +1,66 @@
|
|||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef GENERALSETTINGWIDGET_H
|
||||
#define GENERALSETTINGWIDGET_H
|
||||
|
||||
#include "ui_general_settings_widget.h"
|
||||
#include "widget_base.h"
|
||||
#include <nel/misc/types_nl.h>
|
||||
|
||||
class QTranslator;
|
||||
|
||||
enum
|
||||
{
|
||||
NUM_LANGUAGE_CODES = 4
|
||||
};
|
||||
|
||||
/**
|
||||
@brief The general settings page of the configuration tool
|
||||
*/
|
||||
class CGeneralSettingsWidget : public CWidgetBase, public Ui::general_settings_widget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CGeneralSettingsWidget( QWidget *parent = NULL );
|
||||
~CGeneralSettingsWidget();
|
||||
|
||||
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.
|
||||
@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 );
|
||||
|
||||
// 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
|
||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef GENERALSETTINGWIDGET_H
|
||||
#define GENERALSETTINGWIDGET_H
|
||||
|
||||
#include "ui_general_settings_widget.h"
|
||||
#include "widget_base.h"
|
||||
#include <nel/misc/types_nl.h>
|
||||
|
||||
class QTranslator;
|
||||
|
||||
enum
|
||||
{
|
||||
NUM_LANGUAGE_CODES = 4
|
||||
};
|
||||
|
||||
/**
|
||||
@brief The general settings page of the configuration tool
|
||||
*/
|
||||
class CGeneralSettingsWidget : public CWidgetBase, public Ui::general_settings_widget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CGeneralSettingsWidget( QWidget *parent = NULL );
|
||||
~CGeneralSettingsWidget();
|
||||
|
||||
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.
|
||||
@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 );
|
||||
|
||||
// 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
|
||||
|
|
|
@ -1,36 +1,36 @@
|
|||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <QtGui>
|
||||
#include "client_config_dialog.h"
|
||||
#include "system.h"
|
||||
|
||||
int main( sint32 argc, char **argv )
|
||||
{
|
||||
QApplication app( argc, argv );
|
||||
QPixmap pixmap( ":/resources/splash_screen.bmp" );
|
||||
QSplashScreen splash( pixmap );
|
||||
|
||||
splash.show();
|
||||
|
||||
CSystem::GetInstance().config.load( "client.cfg" );
|
||||
|
||||
CClientConfigDialog d;
|
||||
d.show();
|
||||
splash.finish( &d );
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <QtGui>
|
||||
#include "client_config_dialog.h"
|
||||
#include "system.h"
|
||||
|
||||
int main( sint32 argc, char **argv )
|
||||
{
|
||||
QApplication app( argc, argv );
|
||||
QPixmap pixmap( ":/resources/splash_screen.bmp" );
|
||||
QSplashScreen splash( pixmap );
|
||||
|
||||
splash.show();
|
||||
|
||||
CSystem::GetInstance().config.load( "client.cfg" );
|
||||
|
||||
CClientConfigDialog d;
|
||||
d.show();
|
||||
splash.finish( &d );
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
|
|
|
@ -1,99 +1,99 @@
|
|||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "sound_settings_widget.h"
|
||||
#include "system.h"
|
||||
|
||||
CSoundSettingsWidget::CSoundSettingsWidget( QWidget *parent ) :
|
||||
CWidgetBase( parent )
|
||||
{
|
||||
setupUi( this );
|
||||
load();
|
||||
|
||||
connect( tracksSlider, SIGNAL( valueChanged( int ) ), this, SLOT( onTracksSliderChange() ) );
|
||||
connect( soundCheckBox, SIGNAL( clicked( bool ) ), this, SLOT( onSomethingChanged() ) );
|
||||
connect( eaxCheckBox, SIGNAL( clicked( bool ) ), this, SLOT( onSomethingChanged() ) );
|
||||
connect( softwareCheckBox, SIGNAL( clicked( bool ) ), this, SLOT( onSomethingChanged() ) );
|
||||
connect( fmodCheckBox, SIGNAL( clicked( bool ) ), this, SLOT( onSomethingChanged() ) );
|
||||
}
|
||||
|
||||
CSoundSettingsWidget::~CSoundSettingsWidget()
|
||||
{
|
||||
}
|
||||
|
||||
void CSoundSettingsWidget::onTracksSliderChange()
|
||||
{
|
||||
updateTracksLabel();
|
||||
emit changed();
|
||||
}
|
||||
|
||||
void CSoundSettingsWidget::load()
|
||||
{
|
||||
CSystem &s = CSystem::GetInstance();
|
||||
|
||||
if( s.config.getInt( "SoundOn" ) == 1 )
|
||||
soundCheckBox->setChecked( true );
|
||||
|
||||
if( s.config.getInt( "UseEax" ) == 1 )
|
||||
eaxCheckBox->setChecked( true );
|
||||
|
||||
if( s.config.getInt( "SoundForceSoftwareBuffer" ) == 1 )
|
||||
softwareCheckBox->setChecked( true );
|
||||
|
||||
sint32 tracks = s.config.getInt( "MaxTrack" );
|
||||
if( tracks < 4 )
|
||||
tracks = 4;
|
||||
if( tracks > 32 )
|
||||
tracks = 32;
|
||||
tracksSlider->setValue( tracks / 4 );
|
||||
|
||||
if( s.config.getString( "DriverSound" ).compare( "FMod" ) == 0 )
|
||||
fmodCheckBox->setChecked( true );
|
||||
}
|
||||
|
||||
void CSoundSettingsWidget::save()
|
||||
{
|
||||
CSystem &s = CSystem::GetInstance();
|
||||
|
||||
if( soundCheckBox->isChecked() )
|
||||
s.config.setInt( "SoundOn", 1 );
|
||||
|
||||
if( eaxCheckBox->isChecked() )
|
||||
s.config.setInt( "UseEax", 1 );
|
||||
|
||||
if( softwareCheckBox->isChecked() )
|
||||
s.config.setInt( "SoundForceSoftwareBuffer", 1 );
|
||||
|
||||
s.config.setInt( "MaxTrack", tracksSlider->value() * 4 );
|
||||
|
||||
if( fmodCheckBox->isChecked() )
|
||||
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 ) );
|
||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "sound_settings_widget.h"
|
||||
#include "system.h"
|
||||
|
||||
CSoundSettingsWidget::CSoundSettingsWidget( QWidget *parent ) :
|
||||
CWidgetBase( parent )
|
||||
{
|
||||
setupUi( this );
|
||||
load();
|
||||
|
||||
connect( tracksSlider, SIGNAL( valueChanged( int ) ), this, SLOT( onTracksSliderChange() ) );
|
||||
connect( soundCheckBox, SIGNAL( clicked( bool ) ), this, SLOT( onSomethingChanged() ) );
|
||||
connect( eaxCheckBox, SIGNAL( clicked( bool ) ), this, SLOT( onSomethingChanged() ) );
|
||||
connect( softwareCheckBox, SIGNAL( clicked( bool ) ), this, SLOT( onSomethingChanged() ) );
|
||||
connect( fmodCheckBox, SIGNAL( clicked( bool ) ), this, SLOT( onSomethingChanged() ) );
|
||||
}
|
||||
|
||||
CSoundSettingsWidget::~CSoundSettingsWidget()
|
||||
{
|
||||
}
|
||||
|
||||
void CSoundSettingsWidget::onTracksSliderChange()
|
||||
{
|
||||
updateTracksLabel();
|
||||
emit changed();
|
||||
}
|
||||
|
||||
void CSoundSettingsWidget::load()
|
||||
{
|
||||
CSystem &s = CSystem::GetInstance();
|
||||
|
||||
if( s.config.getInt( "SoundOn" ) == 1 )
|
||||
soundCheckBox->setChecked( true );
|
||||
|
||||
if( s.config.getInt( "UseEax" ) == 1 )
|
||||
eaxCheckBox->setChecked( true );
|
||||
|
||||
if( s.config.getInt( "SoundForceSoftwareBuffer" ) == 1 )
|
||||
softwareCheckBox->setChecked( true );
|
||||
|
||||
sint32 tracks = s.config.getInt( "MaxTrack" );
|
||||
if( tracks < 4 )
|
||||
tracks = 4;
|
||||
if( tracks > 32 )
|
||||
tracks = 32;
|
||||
tracksSlider->setValue( tracks / 4 );
|
||||
|
||||
if( s.config.getString( "DriverSound" ).compare( "FMod" ) == 0 )
|
||||
fmodCheckBox->setChecked( true );
|
||||
}
|
||||
|
||||
void CSoundSettingsWidget::save()
|
||||
{
|
||||
CSystem &s = CSystem::GetInstance();
|
||||
|
||||
if( soundCheckBox->isChecked() )
|
||||
s.config.setInt( "SoundOn", 1 );
|
||||
|
||||
if( eaxCheckBox->isChecked() )
|
||||
s.config.setInt( "UseEax", 1 );
|
||||
|
||||
if( softwareCheckBox->isChecked() )
|
||||
s.config.setInt( "SoundForceSoftwareBuffer", 1 );
|
||||
|
||||
s.config.setInt( "MaxTrack", tracksSlider->value() * 4 );
|
||||
|
||||
if( fmodCheckBox->isChecked() )
|
||||
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 ) );
|
||||
}
|
|
@ -1,50 +1,50 @@
|
|||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef SOUNDSETTINGSWIDGET_H
|
||||
#define SOUNDSETTINGSWIDGET_H
|
||||
|
||||
#include "ui_sound_settings_widget.h"
|
||||
#include "widget_base.h"
|
||||
#include <nel/misc/types_nl.h>
|
||||
|
||||
/**
|
||||
@brief The sound settings page of the configuration tool
|
||||
*/
|
||||
class CSoundSettingsWidget : public CWidgetBase, public Ui::sound_settings_widget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CSoundSettingsWidget( QWidget *parent = NULL );
|
||||
~CSoundSettingsWidget();
|
||||
|
||||
void load();
|
||||
void save();
|
||||
|
||||
protected:
|
||||
void changeEvent( QEvent *event );
|
||||
|
||||
private slots:
|
||||
void onTracksSliderChange();
|
||||
|
||||
private:
|
||||
/**
|
||||
@brief Updates the text on the tracks label.
|
||||
*/
|
||||
void updateTracksLabel();
|
||||
};
|
||||
|
||||
#endif // SOUNDSETTINGSWIDGET_H
|
||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef SOUNDSETTINGSWIDGET_H
|
||||
#define SOUNDSETTINGSWIDGET_H
|
||||
|
||||
#include "ui_sound_settings_widget.h"
|
||||
#include "widget_base.h"
|
||||
#include <nel/misc/types_nl.h>
|
||||
|
||||
/**
|
||||
@brief The sound settings page of the configuration tool
|
||||
*/
|
||||
class CSoundSettingsWidget : public CWidgetBase, public Ui::sound_settings_widget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CSoundSettingsWidget( QWidget *parent = NULL );
|
||||
~CSoundSettingsWidget();
|
||||
|
||||
void load();
|
||||
void save();
|
||||
|
||||
protected:
|
||||
void changeEvent( QEvent *event );
|
||||
|
||||
private slots:
|
||||
void onTracksSliderChange();
|
||||
|
||||
private:
|
||||
/**
|
||||
@brief Updates the text on the tracks label.
|
||||
*/
|
||||
void updateTracksLabel();
|
||||
};
|
||||
|
||||
#endif // SOUNDSETTINGSWIDGET_H
|
||||
|
|
|
@ -1,41 +1,41 @@
|
|||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "sys_info_d3d_widget.h"
|
||||
#include "system.h"
|
||||
|
||||
CSysInfoD3DWidget::CSysInfoD3DWidget( QWidget *parent ) :
|
||||
QWidget( parent )
|
||||
{
|
||||
setupUi( this );
|
||||
|
||||
descriptionLabel->setText( CSystem::GetInstance().d3dInfo.device.c_str() );
|
||||
driverLabel->setText( CSystem::GetInstance().d3dInfo.driver.c_str() );
|
||||
versionLabel->setText( CSystem::GetInstance().d3dInfo.driverVersion.c_str() );
|
||||
}
|
||||
|
||||
CSysInfoD3DWidget::~CSysInfoD3DWidget()
|
||||
{
|
||||
}
|
||||
|
||||
void CSysInfoD3DWidget::changeEvent( QEvent *event )
|
||||
{
|
||||
if( event->type() == QEvent::LanguageChange )
|
||||
{
|
||||
retranslateUi( this );
|
||||
}
|
||||
QWidget::changeEvent( event );
|
||||
}
|
||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "sys_info_d3d_widget.h"
|
||||
#include "system.h"
|
||||
|
||||
CSysInfoD3DWidget::CSysInfoD3DWidget( QWidget *parent ) :
|
||||
QWidget( parent )
|
||||
{
|
||||
setupUi( this );
|
||||
|
||||
descriptionLabel->setText( CSystem::GetInstance().d3dInfo.device.c_str() );
|
||||
driverLabel->setText( CSystem::GetInstance().d3dInfo.driver.c_str() );
|
||||
versionLabel->setText( CSystem::GetInstance().d3dInfo.driverVersion.c_str() );
|
||||
}
|
||||
|
||||
CSysInfoD3DWidget::~CSysInfoD3DWidget()
|
||||
{
|
||||
}
|
||||
|
||||
void CSysInfoD3DWidget::changeEvent( QEvent *event )
|
||||
{
|
||||
if( event->type() == QEvent::LanguageChange )
|
||||
{
|
||||
retranslateUi( this );
|
||||
}
|
||||
QWidget::changeEvent( event );
|
||||
}
|
||||
|
|
|
@ -1,39 +1,39 @@
|
|||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef SYSINFOD3DWIDGET_H
|
||||
#define SYSINFOD3DWIDGET_H
|
||||
|
||||
#include "ui_sys_Info_d3d_widget.h"
|
||||
|
||||
|
||||
/**
|
||||
@brief The Direct3D information page of the configuration tool
|
||||
*/
|
||||
class CSysInfoD3DWidget : public QWidget, public Ui::sys_info_d3d_widget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CSysInfoD3DWidget( QWidget *parent = NULL );
|
||||
~CSysInfoD3DWidget();
|
||||
|
||||
protected:
|
||||
void changeEvent( QEvent *event );
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // SYSINFOD3DWIDGET_H
|
||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef SYSINFOD3DWIDGET_H
|
||||
#define SYSINFOD3DWIDGET_H
|
||||
|
||||
#include "ui_sys_Info_d3d_widget.h"
|
||||
|
||||
|
||||
/**
|
||||
@brief The Direct3D information page of the configuration tool
|
||||
*/
|
||||
class CSysInfoD3DWidget : public QWidget, public Ui::sys_info_d3d_widget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CSysInfoD3DWidget( QWidget *parent = NULL );
|
||||
~CSysInfoD3DWidget();
|
||||
|
||||
protected:
|
||||
void changeEvent( QEvent *event );
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // SYSINFOD3DWIDGET_H
|
||||
|
|
|
@ -1,42 +1,42 @@
|
|||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "sys_info_opengl_widget.h"
|
||||
#include "system.h"
|
||||
|
||||
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() );
|
||||
|
||||
}
|
||||
|
||||
CSysInfoOpenGLWidget::~CSysInfoOpenGLWidget()
|
||||
{
|
||||
}
|
||||
|
||||
void CSysInfoOpenGLWidget::changeEvent( QEvent *event )
|
||||
{
|
||||
if( event->type() == QEvent::LanguageChange )
|
||||
{
|
||||
retranslateUi( this );
|
||||
}
|
||||
QWidget::changeEvent( event );
|
||||
}
|
||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "sys_info_opengl_widget.h"
|
||||
#include "system.h"
|
||||
|
||||
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() );
|
||||
|
||||
}
|
||||
|
||||
CSysInfoOpenGLWidget::~CSysInfoOpenGLWidget()
|
||||
{
|
||||
}
|
||||
|
||||
void CSysInfoOpenGLWidget::changeEvent( QEvent *event )
|
||||
{
|
||||
if( event->type() == QEvent::LanguageChange )
|
||||
{
|
||||
retranslateUi( this );
|
||||
}
|
||||
QWidget::changeEvent( event );
|
||||
}
|
||||
|
|
|
@ -1,38 +1,38 @@
|
|||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef SYSINFOOPENGLWIDGET_H
|
||||
#define SYSINFOOPENGLWIDGET_H
|
||||
|
||||
#include "ui_sys_info_opengl_widget.h"
|
||||
|
||||
|
||||
/**
|
||||
@brief The OpenGL information page of the configuration tool
|
||||
*/
|
||||
class CSysInfoOpenGLWidget : public QWidget, public Ui::sys_info_opengl_widget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CSysInfoOpenGLWidget( QWidget *parent = NULL );
|
||||
~CSysInfoOpenGLWidget();
|
||||
|
||||
protected:
|
||||
void changeEvent( QEvent *event );
|
||||
|
||||
};
|
||||
|
||||
#endif // SYSINFOOPENGLWIDGET_H
|
||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef SYSINFOOPENGLWIDGET_H
|
||||
#define SYSINFOOPENGLWIDGET_H
|
||||
|
||||
#include "ui_sys_info_opengl_widget.h"
|
||||
|
||||
|
||||
/**
|
||||
@brief The OpenGL information page of the configuration tool
|
||||
*/
|
||||
class CSysInfoOpenGLWidget : public QWidget, public Ui::sys_info_opengl_widget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CSysInfoOpenGLWidget( QWidget *parent = NULL );
|
||||
~CSysInfoOpenGLWidget();
|
||||
|
||||
protected:
|
||||
void changeEvent( QEvent *event );
|
||||
|
||||
};
|
||||
|
||||
#endif // SYSINFOOPENGLWIDGET_H
|
||||
|
|
|
@ -1,46 +1,46 @@
|
|||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "sys_info_widget.h"
|
||||
#include "system.h"
|
||||
|
||||
CSysInfoWidget::CSysInfoWidget( QWidget *parent ) :
|
||||
QWidget( parent )
|
||||
{
|
||||
setupUi( this );
|
||||
|
||||
osLabel->setText( CSystem::GetInstance().sysInfo.osName.c_str() );
|
||||
cpuLabel->setText( CSystem::GetInstance().sysInfo.cpuName.c_str() );
|
||||
|
||||
ramLabel->setText(
|
||||
QString().setNum( CSystem::GetInstance().sysInfo.totalRAM ).append( " Mb" ) );
|
||||
|
||||
gfxcardLabel->setText( CSystem::GetInstance().sysInfo.videoDevice.c_str() );
|
||||
gfxdriverLabel->setText( CSystem::GetInstance().sysInfo.videoDriverVersion.c_str() );
|
||||
}
|
||||
|
||||
CSysInfoWidget::~CSysInfoWidget()
|
||||
{
|
||||
}
|
||||
|
||||
void CSysInfoWidget::changeEvent( QEvent *event )
|
||||
{
|
||||
if( event->type() == QEvent::LanguageChange )
|
||||
{
|
||||
retranslateUi( this );
|
||||
}
|
||||
QWidget::changeEvent( event );
|
||||
}
|
||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "sys_info_widget.h"
|
||||
#include "system.h"
|
||||
|
||||
CSysInfoWidget::CSysInfoWidget( QWidget *parent ) :
|
||||
QWidget( parent )
|
||||
{
|
||||
setupUi( this );
|
||||
|
||||
osLabel->setText( CSystem::GetInstance().sysInfo.osName.c_str() );
|
||||
cpuLabel->setText( CSystem::GetInstance().sysInfo.cpuName.c_str() );
|
||||
|
||||
ramLabel->setText(
|
||||
QString().setNum( CSystem::GetInstance().sysInfo.totalRAM ).append( " Mb" ) );
|
||||
|
||||
gfxcardLabel->setText( CSystem::GetInstance().sysInfo.videoDevice.c_str() );
|
||||
gfxdriverLabel->setText( CSystem::GetInstance().sysInfo.videoDriverVersion.c_str() );
|
||||
}
|
||||
|
||||
CSysInfoWidget::~CSysInfoWidget()
|
||||
{
|
||||
}
|
||||
|
||||
void CSysInfoWidget::changeEvent( QEvent *event )
|
||||
{
|
||||
if( event->type() == QEvent::LanguageChange )
|
||||
{
|
||||
retranslateUi( this );
|
||||
}
|
||||
QWidget::changeEvent( event );
|
||||
}
|
||||
|
|
|
@ -1,38 +1,38 @@
|
|||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef SYSINFOWIDGET_H
|
||||
#define SYSINFOWIDGET_H
|
||||
|
||||
#include "ui_sys_info_widget.h"
|
||||
|
||||
|
||||
/**
|
||||
@brief The system information page of the configuration tool
|
||||
*/
|
||||
class CSysInfoWidget : public QWidget, public Ui::sys_info_widget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CSysInfoWidget( QWidget *parent = NULL );
|
||||
~CSysInfoWidget();
|
||||
|
||||
protected:
|
||||
void changeEvent( QEvent *event );
|
||||
|
||||
};
|
||||
|
||||
#endif // SYSINFOWIDGET_H
|
||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef SYSINFOWIDGET_H
|
||||
#define SYSINFOWIDGET_H
|
||||
|
||||
#include "ui_sys_info_widget.h"
|
||||
|
||||
|
||||
/**
|
||||
@brief The system information page of the configuration tool
|
||||
*/
|
||||
class CSysInfoWidget : public QWidget, public Ui::sys_info_widget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CSysInfoWidget( QWidget *parent = NULL );
|
||||
~CSysInfoWidget();
|
||||
|
||||
protected:
|
||||
void changeEvent( QEvent *event );
|
||||
|
||||
};
|
||||
|
||||
#endif // SYSINFOWIDGET_H
|
||||
|
|
|
@ -1,181 +1,181 @@
|
|||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "system.h"
|
||||
#include <sstream>
|
||||
#include <nel/3d/driver.h>
|
||||
#include <nel/3d/dru.h>
|
||||
#include <QtOpenGL/QGLWidget>
|
||||
|
||||
CSystem *CSystem::instance = NULL;
|
||||
|
||||
CSystem::CSystem()
|
||||
{
|
||||
GatherSysInfo();
|
||||
#ifdef WIN32
|
||||
GatherD3DInfo();
|
||||
#endif
|
||||
GatherOpenGLInfo();
|
||||
}
|
||||
|
||||
CSystem::~CSystem()
|
||||
{
|
||||
instance = 0;
|
||||
}
|
||||
|
||||
|
||||
void CSystem::GatherSysInfo()
|
||||
{
|
||||
std::string device;
|
||||
uint64 driver;
|
||||
|
||||
if( NLMISC::CSystemInfo::getVideoInfo( device, driver ) )
|
||||
{
|
||||
sysInfo.videoDevice = device;
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
// FIXME
|
||||
// This is taken from the original configuration tool, and
|
||||
// it generates the same *wrong* version number
|
||||
//////////////////////////////////////////////////////////////
|
||||
uint32 version = static_cast< uint32 >( driver & 0xffff );
|
||||
std::stringstream ss;
|
||||
|
||||
ss << ( version / 1000 % 10 );
|
||||
ss << ".";
|
||||
ss << ( version / 100 % 10 );
|
||||
ss << ".";
|
||||
ss << ( version / 10 % 10 );
|
||||
ss << ".";
|
||||
ss << ( version % 10 );
|
||||
|
||||
sysInfo.videoDriverVersion = ss.str();
|
||||
//////////////////////////////////////////////////////////////
|
||||
}
|
||||
else
|
||||
{
|
||||
sysInfo.videoDevice = "video card";
|
||||
sysInfo.videoDriverVersion = "0.0.0.0";
|
||||
}
|
||||
|
||||
sysInfo.osName = NLMISC::CSystemInfo::getOS();
|
||||
sysInfo.cpuName = NLMISC::CSystemInfo::getProc();
|
||||
sysInfo.totalRAM = NLMISC::CSystemInfo::totalPhysicalMemory();
|
||||
sysInfo.totalRAM /= ( 1024 * 1024 );
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
void CSystem::GatherD3DInfo()
|
||||
{
|
||||
NL3D::IDriver *driver = NULL;
|
||||
try
|
||||
{
|
||||
driver = NL3D::CDRU::createD3DDriver();
|
||||
|
||||
NL3D::IDriver::CAdapter adapter;
|
||||
|
||||
if( driver->getAdapter( 0xffffffff, adapter ) )
|
||||
{
|
||||
d3dInfo.device = adapter.Description;
|
||||
d3dInfo.driver = adapter.Driver;
|
||||
|
||||
sint64 ver = adapter.DriverVersion;
|
||||
std::stringstream ss;
|
||||
ss << static_cast< uint16 >( ver >> 48 );
|
||||
ss << ".";
|
||||
ss << static_cast< uint16 >( ver >> 32 );
|
||||
ss << ".";
|
||||
ss << static_cast< uint16 >( ver >> 16 );
|
||||
ss << ".";
|
||||
ss << static_cast< uint16 >( ver & 0xFFFF );
|
||||
d3dInfo.driverVersion = ss.str();
|
||||
}
|
||||
|
||||
GetVideoModes( d3dInfo.modes, driver );
|
||||
|
||||
driver->release();
|
||||
}
|
||||
|
||||
catch( NLMISC::Exception &e )
|
||||
{
|
||||
nlwarning( e.what() );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void CSystem::GatherOpenGLInfo()
|
||||
{
|
||||
QGLWidget *gl = new QGLWidget();
|
||||
|
||||
gl->makeCurrent();
|
||||
|
||||
const char *s = NULL;
|
||||
s = reinterpret_cast< const char * >( glGetString( GL_VENDOR ) );
|
||||
if( s != NULL )
|
||||
openglInfo.vendor.assign( s );
|
||||
|
||||
s = reinterpret_cast< const char * >( glGetString( GL_RENDERER ) );
|
||||
if( s != NULL )
|
||||
openglInfo.renderer.assign( s );
|
||||
|
||||
s = reinterpret_cast< const char * >( glGetString( GL_VERSION ) );
|
||||
if( s != NULL )
|
||||
openglInfo.driverVersion.assign( s );
|
||||
|
||||
s = reinterpret_cast< const char * >( glGetString( GL_EXTENSIONS ) );
|
||||
if( s != NULL )
|
||||
{
|
||||
openglInfo.extensions.assign( s );
|
||||
for( std::string::iterator itr = openglInfo.extensions.begin(); itr != openglInfo.extensions.end(); ++itr )
|
||||
if( *itr == ' ' )
|
||||
*itr = '\n';
|
||||
}
|
||||
|
||||
delete gl;
|
||||
|
||||
NL3D::IDriver *driver = NULL;
|
||||
try
|
||||
{
|
||||
driver = NL3D::CDRU::createGlDriver();
|
||||
GetVideoModes( openglInfo.modes, driver );
|
||||
driver->release();
|
||||
}
|
||||
|
||||
catch( NLMISC::Exception &e )
|
||||
{
|
||||
nlwarning( e.what() );
|
||||
}
|
||||
}
|
||||
|
||||
void CSystem::GetVideoModes( std::vector< CVideoMode > &dst, NL3D::IDriver *driver ) const
|
||||
{
|
||||
std::vector< NL3D::GfxMode > modes;
|
||||
driver->getModes( modes );
|
||||
|
||||
for( std::vector< NL3D::GfxMode >::iterator itr = modes.begin(); itr != modes.end(); ++itr )
|
||||
{
|
||||
if( ( itr->Width >= 800 ) && ( itr->Height >= 600 ) && ( itr->Depth == 32 ) && ( itr->Frequency >= 60 ) )
|
||||
{
|
||||
CVideoMode mode;
|
||||
mode.depth = itr->Depth;
|
||||
mode.widht = itr->Width;
|
||||
mode.height = itr->Height;
|
||||
mode.frequency = itr->Frequency;
|
||||
|
||||
dst.push_back( mode );
|
||||
}
|
||||
}
|
||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "system.h"
|
||||
#include <sstream>
|
||||
#include <nel/3d/driver.h>
|
||||
#include <nel/3d/dru.h>
|
||||
#include <QtOpenGL/QGLWidget>
|
||||
|
||||
CSystem *CSystem::instance = NULL;
|
||||
|
||||
CSystem::CSystem()
|
||||
{
|
||||
GatherSysInfo();
|
||||
#ifdef WIN32
|
||||
GatherD3DInfo();
|
||||
#endif
|
||||
GatherOpenGLInfo();
|
||||
}
|
||||
|
||||
CSystem::~CSystem()
|
||||
{
|
||||
instance = 0;
|
||||
}
|
||||
|
||||
|
||||
void CSystem::GatherSysInfo()
|
||||
{
|
||||
std::string device;
|
||||
uint64 driver;
|
||||
|
||||
if( NLMISC::CSystemInfo::getVideoInfo( device, driver ) )
|
||||
{
|
||||
sysInfo.videoDevice = device;
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
// FIXME
|
||||
// This is taken from the original configuration tool, and
|
||||
// it generates the same *wrong* version number
|
||||
//////////////////////////////////////////////////////////////
|
||||
uint32 version = static_cast< uint32 >( driver & 0xffff );
|
||||
std::stringstream ss;
|
||||
|
||||
ss << ( version / 1000 % 10 );
|
||||
ss << ".";
|
||||
ss << ( version / 100 % 10 );
|
||||
ss << ".";
|
||||
ss << ( version / 10 % 10 );
|
||||
ss << ".";
|
||||
ss << ( version % 10 );
|
||||
|
||||
sysInfo.videoDriverVersion = ss.str();
|
||||
//////////////////////////////////////////////////////////////
|
||||
}
|
||||
else
|
||||
{
|
||||
sysInfo.videoDevice = "video card";
|
||||
sysInfo.videoDriverVersion = "0.0.0.0";
|
||||
}
|
||||
|
||||
sysInfo.osName = NLMISC::CSystemInfo::getOS();
|
||||
sysInfo.cpuName = NLMISC::CSystemInfo::getProc();
|
||||
sysInfo.totalRAM = NLMISC::CSystemInfo::totalPhysicalMemory();
|
||||
sysInfo.totalRAM /= ( 1024 * 1024 );
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
void CSystem::GatherD3DInfo()
|
||||
{
|
||||
NL3D::IDriver *driver = NULL;
|
||||
try
|
||||
{
|
||||
driver = NL3D::CDRU::createD3DDriver();
|
||||
|
||||
NL3D::IDriver::CAdapter adapter;
|
||||
|
||||
if( driver->getAdapter( 0xffffffff, adapter ) )
|
||||
{
|
||||
d3dInfo.device = adapter.Description;
|
||||
d3dInfo.driver = adapter.Driver;
|
||||
|
||||
sint64 ver = adapter.DriverVersion;
|
||||
std::stringstream ss;
|
||||
ss << static_cast< uint16 >( ver >> 48 );
|
||||
ss << ".";
|
||||
ss << static_cast< uint16 >( ver >> 32 );
|
||||
ss << ".";
|
||||
ss << static_cast< uint16 >( ver >> 16 );
|
||||
ss << ".";
|
||||
ss << static_cast< uint16 >( ver & 0xFFFF );
|
||||
d3dInfo.driverVersion = ss.str();
|
||||
}
|
||||
|
||||
GetVideoModes( d3dInfo.modes, driver );
|
||||
|
||||
driver->release();
|
||||
}
|
||||
|
||||
catch( NLMISC::Exception &e )
|
||||
{
|
||||
nlwarning( e.what() );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void CSystem::GatherOpenGLInfo()
|
||||
{
|
||||
QGLWidget *gl = new QGLWidget();
|
||||
|
||||
gl->makeCurrent();
|
||||
|
||||
const char *s = NULL;
|
||||
s = reinterpret_cast< const char * >( glGetString( GL_VENDOR ) );
|
||||
if( s != NULL )
|
||||
openglInfo.vendor.assign( s );
|
||||
|
||||
s = reinterpret_cast< const char * >( glGetString( GL_RENDERER ) );
|
||||
if( s != NULL )
|
||||
openglInfo.renderer.assign( s );
|
||||
|
||||
s = reinterpret_cast< const char * >( glGetString( GL_VERSION ) );
|
||||
if( s != NULL )
|
||||
openglInfo.driverVersion.assign( s );
|
||||
|
||||
s = reinterpret_cast< const char * >( glGetString( GL_EXTENSIONS ) );
|
||||
if( s != NULL )
|
||||
{
|
||||
openglInfo.extensions.assign( s );
|
||||
for( std::string::iterator itr = openglInfo.extensions.begin(); itr != openglInfo.extensions.end(); ++itr )
|
||||
if( *itr == ' ' )
|
||||
*itr = '\n';
|
||||
}
|
||||
|
||||
delete gl;
|
||||
|
||||
NL3D::IDriver *driver = NULL;
|
||||
try
|
||||
{
|
||||
driver = NL3D::CDRU::createGlDriver();
|
||||
GetVideoModes( openglInfo.modes, driver );
|
||||
driver->release();
|
||||
}
|
||||
|
||||
catch( NLMISC::Exception &e )
|
||||
{
|
||||
nlwarning( e.what() );
|
||||
}
|
||||
}
|
||||
|
||||
void CSystem::GetVideoModes( std::vector< CVideoMode > &dst, NL3D::IDriver *driver ) const
|
||||
{
|
||||
std::vector< NL3D::GfxMode > modes;
|
||||
driver->getModes( modes );
|
||||
|
||||
for( std::vector< NL3D::GfxMode >::iterator itr = modes.begin(); itr != modes.end(); ++itr )
|
||||
{
|
||||
if( ( itr->Width >= 800 ) && ( itr->Height >= 600 ) && ( itr->Depth == 32 ) && ( itr->Frequency >= 60 ) )
|
||||
{
|
||||
CVideoMode mode;
|
||||
mode.depth = itr->Depth;
|
||||
mode.widht = itr->Width;
|
||||
mode.height = itr->Height;
|
||||
mode.frequency = itr->Frequency;
|
||||
|
||||
dst.push_back( mode );
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,112 +1,112 @@
|
|||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef SYSTEM_H
|
||||
#define SYSTEM_H
|
||||
|
||||
#include <nel/misc/system_info.h>
|
||||
#include "config.h"
|
||||
|
||||
namespace NL3D
|
||||
{
|
||||
class IDriver;
|
||||
}
|
||||
|
||||
struct CVideoMode
|
||||
{
|
||||
unsigned int widht;
|
||||
unsigned int height;
|
||||
unsigned int depth;
|
||||
unsigned int frequency;
|
||||
|
||||
CVideoMode()
|
||||
{
|
||||
widht = 0;
|
||||
height = 0;
|
||||
depth = 0;
|
||||
frequency = 0;
|
||||
}
|
||||
|
||||
bool operator==( CVideoMode &o )
|
||||
{
|
||||
if( ( o.widht == widht ) && ( o.height == height ) && ( o.depth == depth ) && ( o.frequency == frequency ) )
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
@brief Singleton class that holds the system information, configs, etc
|
||||
*/
|
||||
class CSystem
|
||||
{
|
||||
public:
|
||||
CSystem();
|
||||
~CSystem();
|
||||
|
||||
static CSystem &GetInstance()
|
||||
{
|
||||
if( instance == 0 )
|
||||
{
|
||||
instance = new CSystem;
|
||||
}
|
||||
return *instance;
|
||||
}
|
||||
|
||||
struct CSysInfo
|
||||
{
|
||||
std::string videoDevice;
|
||||
std::string videoDriverVersion;
|
||||
std::string osName;
|
||||
std::string cpuName;
|
||||
uint64 totalRAM;
|
||||
} sysInfo;
|
||||
|
||||
#ifdef WIN32
|
||||
struct CD3DInfo
|
||||
{
|
||||
std::string device;
|
||||
std::string driver;
|
||||
std::string driverVersion;
|
||||
std::vector< CVideoMode > modes;
|
||||
} d3dInfo;
|
||||
#endif
|
||||
|
||||
struct COpenGLInfo
|
||||
{
|
||||
std::string vendor;
|
||||
std::string renderer;
|
||||
std::string driverVersion;
|
||||
std::string extensions;
|
||||
std::vector< CVideoMode > modes;
|
||||
} openglInfo;
|
||||
|
||||
CConfig config;
|
||||
|
||||
private:
|
||||
void GatherSysInfo();
|
||||
#ifdef WIN32
|
||||
void GatherD3DInfo();
|
||||
#endif
|
||||
void GatherOpenGLInfo();
|
||||
|
||||
void GetVideoModes( std::vector< CVideoMode > &dst, NL3D::IDriver *driver ) const;
|
||||
|
||||
static CSystem *instance;
|
||||
};
|
||||
|
||||
#endif // SYSTEM_H
|
||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef SYSTEM_H
|
||||
#define SYSTEM_H
|
||||
|
||||
#include <nel/misc/system_info.h>
|
||||
#include "config.h"
|
||||
|
||||
namespace NL3D
|
||||
{
|
||||
class IDriver;
|
||||
}
|
||||
|
||||
struct CVideoMode
|
||||
{
|
||||
unsigned int widht;
|
||||
unsigned int height;
|
||||
unsigned int depth;
|
||||
unsigned int frequency;
|
||||
|
||||
CVideoMode()
|
||||
{
|
||||
widht = 0;
|
||||
height = 0;
|
||||
depth = 0;
|
||||
frequency = 0;
|
||||
}
|
||||
|
||||
bool operator==( CVideoMode &o )
|
||||
{
|
||||
if( ( o.widht == widht ) && ( o.height == height ) && ( o.depth == depth ) && ( o.frequency == frequency ) )
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
@brief Singleton class that holds the system information, configs, etc
|
||||
*/
|
||||
class CSystem
|
||||
{
|
||||
public:
|
||||
CSystem();
|
||||
~CSystem();
|
||||
|
||||
static CSystem &GetInstance()
|
||||
{
|
||||
if( instance == 0 )
|
||||
{
|
||||
instance = new CSystem;
|
||||
}
|
||||
return *instance;
|
||||
}
|
||||
|
||||
struct CSysInfo
|
||||
{
|
||||
std::string videoDevice;
|
||||
std::string videoDriverVersion;
|
||||
std::string osName;
|
||||
std::string cpuName;
|
||||
uint64 totalRAM;
|
||||
} sysInfo;
|
||||
|
||||
#ifdef WIN32
|
||||
struct CD3DInfo
|
||||
{
|
||||
std::string device;
|
||||
std::string driver;
|
||||
std::string driverVersion;
|
||||
std::vector< CVideoMode > modes;
|
||||
} d3dInfo;
|
||||
#endif
|
||||
|
||||
struct COpenGLInfo
|
||||
{
|
||||
std::string vendor;
|
||||
std::string renderer;
|
||||
std::string driverVersion;
|
||||
std::string extensions;
|
||||
std::vector< CVideoMode > modes;
|
||||
} openglInfo;
|
||||
|
||||
CConfig config;
|
||||
|
||||
private:
|
||||
void GatherSysInfo();
|
||||
#ifdef WIN32
|
||||
void GatherD3DInfo();
|
||||
#endif
|
||||
void GatherOpenGLInfo();
|
||||
|
||||
void GetVideoModes( std::vector< CVideoMode > &dst, NL3D::IDriver *driver ) const;
|
||||
|
||||
static CSystem *instance;
|
||||
};
|
||||
|
||||
#endif // SYSTEM_H
|
||||
|
|
|
@ -1,61 +1,61 @@
|
|||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef WIDGETBASE_H
|
||||
#define WIDGETBASE_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
/**
|
||||
@brief Base class for the config tool's settings page widgets.
|
||||
*/
|
||||
class CWidgetBase : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CWidgetBase( QWidget *parent = NULL ) : QWidget( parent ) {}
|
||||
~CWidgetBase() {}
|
||||
|
||||
/**
|
||||
@brief Tells the widget to load it's values from the config.
|
||||
*/
|
||||
virtual void load() = 0;
|
||||
|
||||
/**
|
||||
@brief Tells the widget to save it's values into the config.
|
||||
*/
|
||||
virtual void save() = 0;
|
||||
|
||||
signals:
|
||||
/**
|
||||
@brief Emitted when the user changes a setting.
|
||||
*/
|
||||
void changed();
|
||||
|
||||
|
||||
private slots:
|
||||
/**
|
||||
@brief Triggered when something changes in the widget, emits the Changed() signal.
|
||||
*/
|
||||
void onSomethingChanged()
|
||||
{
|
||||
emit changed();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef WIDGETBASE_H
|
||||
#define WIDGETBASE_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
/**
|
||||
@brief Base class for the config tool's settings page widgets.
|
||||
*/
|
||||
class CWidgetBase : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CWidgetBase( QWidget *parent = NULL ) : QWidget( parent ) {}
|
||||
~CWidgetBase() {}
|
||||
|
||||
/**
|
||||
@brief Tells the widget to load it's values from the config.
|
||||
*/
|
||||
virtual void load() = 0;
|
||||
|
||||
/**
|
||||
@brief Tells the widget to save it's values into the config.
|
||||
*/
|
||||
virtual void save() = 0;
|
||||
|
||||
signals:
|
||||
/**
|
||||
@brief Emitted when the user changes a setting.
|
||||
*/
|
||||
void changed();
|
||||
|
||||
|
||||
private slots:
|
||||
/**
|
||||
@brief Triggered when something changes in the widget, emits the Changed() signal.
|
||||
*/
|
||||
void onSomethingChanged()
|
||||
{
|
||||
emit changed();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -69,7 +69,7 @@
|
|||
{
|
||||
$nel_user = null;
|
||||
nt_auth_stop_session();
|
||||
nt_common_redirect('index.php');
|
||||
nt_common_redirect('');
|
||||
exit();
|
||||
}
|
||||
elseif (isset($NELTOOL['SESSION_VARS']['nelid']) && !empty($NELTOOL['SESSION_VARS']['nelid']))
|
||||
|
@ -138,9 +138,12 @@
|
|||
if (isset($nel_user['new_login']))
|
||||
{
|
||||
$default_user_application_id = 0;
|
||||
if ($nel_user['user_default_application_id'] > 0) $default_user_application_id = $nel_user['user_default_application_id'];
|
||||
elseif ($nel_user['group_default_application_id'] > 0) $default_user_application_id = $nel_user['group_default_application_id'];
|
||||
|
||||
if (isset( $nel_user['user_default_application_id']) &&($nel_user['user_default_application_id'] > 0)) {
|
||||
$default_user_application_id = $nel_user['user_default_application_id'];
|
||||
}elseif (isset( $nel_user['group_default_application_id']) &&($nel_user['group_default_application_id'] > 0)) {
|
||||
$default_user_application_id = $nel_user['group_default_application_id'];
|
||||
}
|
||||
|
||||
if ($default_user_application_id > 0)
|
||||
{
|
||||
nt_common_add_debug("default application : user:". $nel_user['user_default_application_id'] ." group:". $nel_user['group_default_application_id']);
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
define('NELTOOL_DBNAME','nel_tool');
|
||||
|
||||
// site paths definitions
|
||||
define('NELTOOL_SITEBASE','http://open.ryzom.com/');
|
||||
define('NELTOOL_SYSTEMBASE','/home/nevrax/hg/code/ryzom/tools/server/admin/');
|
||||
define('NELTOOL_SITEBASE',$_SERVER['PHP_SELF']);
|
||||
define('NELTOOL_SYSTEMBASE',dirname( dirname(__FILE__) ) . '/admin/');
|
||||
define('NELTOOL_LOGBASE', NELTOOL_SYSTEMBASE .'/logs/');
|
||||
define('NELTOOL_IMGBASE', NELTOOL_SYSTEMBASE .'/imgs/');
|
||||
|
||||
|
|
|
@ -114,7 +114,7 @@ class sql_db
|
|||
}
|
||||
else
|
||||
{
|
||||
return ( $transaction == END_TRANSACTION ) ? true : false;
|
||||
return ( $transaction == 'END_TRANSACTION' ) ? true : false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
$refresh_rates = array( /* // there values are for debug purposes only
|
||||
$refresh_rates = array(
|
||||
array('desc' => 'Every 5 secs',
|
||||
'secs' => 5,
|
||||
),
|
||||
array('desc' => 'Every 30 secs',
|
||||
'secs' => 30,
|
||||
),*/
|
||||
),
|
||||
array('desc' => 'Every 1 min.',
|
||||
'secs' => 60,
|
||||
),
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
$tpl->assign("tool_v_login", $nel_user['user_name']);
|
||||
$tpl->assign("tool_v_user_id", $nel_user['user_id']);
|
||||
$tpl->assign("tool_v_menu", $nel_user['user_menu_style']);
|
||||
$tpl->assign("tool_v_application", $nel_user['user_default_application_id']);
|
||||
$tpl->assign("tool_v_application", isset($nel_user['user_default_application_id']) ? $nel_user['user_default_application_id']:'') ;
|
||||
|
||||
if (isset($NELTOOL['POST_VARS']['tool_form_user_id']))
|
||||
{
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
class Helpers{
|
||||
|
||||
public function loadTemplate( $template, $vars = array () )
|
||||
{
|
||||
extract( $vars );
|
||||
include( $template );
|
||||
}
|
||||
|
||||
public function check_if_game_client()
|
||||
{
|
||||
// if HTTP_USER_AGENT is not set then its ryzom core
|
||||
if ( !isset( $_SERVER['HTTP_USER_AGENT'] ) ){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
11
code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/sql.php
Normal file
11
code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/sql.php
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
class Sql{
|
||||
|
||||
public function db_query( $query, $values = array() )
|
||||
{
|
||||
echo "tst";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
180
code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/users.php
Normal file
180
code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/users.php
Normal file
|
@ -0,0 +1,180 @@
|
|||
<?php
|
||||
class Users {
|
||||
|
||||
/**
|
||||
*
|
||||
* Function checkUser
|
||||
*
|
||||
* @takes $username
|
||||
* @return string
|
||||
*
|
||||
* Info: Returns a string based on if the username is valid, if valid then "success" is returned
|
||||
*
|
||||
*/
|
||||
public function checkUser($username)
|
||||
{
|
||||
if (isset($username)) {
|
||||
if (strlen($username) > 12) {
|
||||
return "Username must be no more than 12 characters.";
|
||||
} elseif (strlen($username) < 5) {
|
||||
return "Username must be 5 or more characters.";
|
||||
} elseif (!preg_match('/^[a-z0-9\.]*$/', $username)) {
|
||||
return "Username can only contain numbers and letters.";
|
||||
} elseif (sql::db_query("SELECT COUNT(*) FROM {users} WHERE name = :name", array(
|
||||
':name' => $username
|
||||
))->fetchField()) {
|
||||
return "Username " . $username . " is in use.";
|
||||
} else {
|
||||
return "success";
|
||||
}
|
||||
} else {
|
||||
return "success";
|
||||
}
|
||||
return "fail";
|
||||
}
|
||||
/**
|
||||
*
|
||||
* Function checkPassword
|
||||
*
|
||||
* @takes $pass
|
||||
* @return string
|
||||
*
|
||||
* Info: Returns a string based on if the password is valid, if valid then "success" is returned
|
||||
*
|
||||
*/
|
||||
public function checkPassword($pass)
|
||||
{
|
||||
if (isset($pass)) {
|
||||
if (strlen($pass) > 20) {
|
||||
return "Password must be no more than 20 characters.";
|
||||
} elseif (strlen($pass) < 5) {
|
||||
return "Password must be more than 5 characters.";
|
||||
} else {
|
||||
return "success";
|
||||
}
|
||||
}
|
||||
return "fail";
|
||||
}
|
||||
/**
|
||||
*
|
||||
* Function confirmPassword
|
||||
*
|
||||
* @takes $pass
|
||||
* @return string
|
||||
*
|
||||
* Info: Verify's $_POST["Password"] is the same as $_POST["ConfirmPass"]
|
||||
*
|
||||
*/
|
||||
public function confirmPassword()
|
||||
{
|
||||
if (($_POST["Password"]) != ($_POST["ConfirmPass"])) {
|
||||
return "Passwords do not match.";
|
||||
} else {
|
||||
return "success";
|
||||
}
|
||||
return "fail";
|
||||
}
|
||||
/**
|
||||
*
|
||||
* Function checkEmail
|
||||
*
|
||||
* @takes $email
|
||||
* @return
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
public function checkEmail($email)
|
||||
{
|
||||
if (isset($email)) {
|
||||
if (!validEmail($email)) {
|
||||
return "Email address is not valid.";
|
||||
} elseif (db_query("SELECT COUNT(*) FROM {users} WHERE mail = :mail", array(
|
||||
':mail' => $email
|
||||
))->fetchField()) {
|
||||
return "Email is in use.";
|
||||
} else {
|
||||
return "success";
|
||||
}
|
||||
} else {
|
||||
return "success";
|
||||
}
|
||||
return "fail";
|
||||
}
|
||||
public function validEmail($email)
|
||||
{
|
||||
$isValid = true;
|
||||
$atIndex = strrpos($email, "@");
|
||||
if (is_bool($atIndex) && !$atIndex) {
|
||||
$isValid = false;
|
||||
} else {
|
||||
$domain = substr($email, $atIndex + 1);
|
||||
$local = substr($email, 0, $atIndex);
|
||||
$localLen = strlen($local);
|
||||
$domainLen = strlen($domain);
|
||||
if ($localLen < 1 || $localLen > 64) {
|
||||
// local part length exceeded
|
||||
$isValid = false;
|
||||
} else if ($domainLen < 1 || $domainLen > 255) {
|
||||
// domain part length exceeded
|
||||
$isValid = false;
|
||||
} else if ($local[0] == '.' || $local[$localLen - 1] == '.') {
|
||||
// local part starts or ends with '.'
|
||||
$isValid = false;
|
||||
} else if (preg_match('/\\.\\./', $local)) {
|
||||
// local part has two consecutive dots
|
||||
$isValid = false;
|
||||
} else if (!preg_match('/^[A-Za-z0-9\\-\\.]+$/', $domain)) {
|
||||
// character not valid in domain part
|
||||
$isValid = false;
|
||||
} else if (preg_match('/\\.\\./', $domain)) {
|
||||
// domain part has two consecutive dots
|
||||
$isValid = false;
|
||||
} else if (!preg_match('/^(\\\\.|[A-Za-z0-9!#%&`_=\\/$\'*+?^{}|~.-])+$/', str_replace("\\\\", "", $local))) {
|
||||
// character not valid in local part unless
|
||||
// local part is quoted
|
||||
if (!preg_match('/^"(\\\\"|[^"])+"$/', str_replace("\\\\", "", $local))) {
|
||||
$isValid = false;
|
||||
}
|
||||
}
|
||||
if ($isValid && !(checkdnsrr($domain, "MX") || checkdnsrr($domain, "A"))) {
|
||||
// domain not found in DNS
|
||||
$isValid = false;
|
||||
}
|
||||
}
|
||||
return $isValid;
|
||||
}
|
||||
public function generateSALT($length = 2)
|
||||
{
|
||||
// start with a blank salt
|
||||
$salt = "";
|
||||
// define possible characters - any character in this string can be
|
||||
// picked for use in the salt, so if you want to put vowels back in
|
||||
// or add special characters such as exclamation marks, this is where
|
||||
// you should do it
|
||||
$possible = "2346789bcdfghjkmnpqrtvwxyzBCDFGHJKLMNPQRTVWXYZ";
|
||||
// we refer to the length of $possible a few times, so let's grab it now
|
||||
$maxlength = strlen($possible);
|
||||
// check for length overflow and truncate if necessary
|
||||
if ($length > $maxlength) {
|
||||
$length = $maxlength;
|
||||
}
|
||||
// set up a counter for how many characters are in the salt so far
|
||||
$i = 0;
|
||||
// add random characters to $salt until $length is reached
|
||||
while ($i < $length) {
|
||||
// pick a random character from the possible ones
|
||||
$char = substr($possible, mt_rand(0, $maxlength - 1), 1);
|
||||
// have we already used this character in $salt?
|
||||
if (!strstr($salt, $char)) {
|
||||
// no, so it's OK to add it onto the end of whatever we've already got...
|
||||
$salt .= $char;
|
||||
// ... and increase the counter by one
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
// done!
|
||||
return $salt;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,117 @@
|
|||
<div class="title">
|
||||
aRYZOM CORE INGAME REGISTRATION
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<?php echo $WELCOME_MESSAGE; ?>
|
||||
</div>
|
||||
|
||||
<form name="Page1"
|
||||
method="post"
|
||||
>
|
||||
<table>
|
||||
<tr>
|
||||
<td width="33%" <?php if ($USERNAME_ERROR == "TRUE"){ echo 'class="error"';}?> id="caption-Username">Desired Username: </td>
|
||||
|
||||
<td width="25%">
|
||||
<input type="text"
|
||||
name="Username"
|
||||
value=""
|
||||
maxlength="12"
|
||||
onfocus=
|
||||
"javascript:showTooltip('5-12 lower-case characters and numbers. The login (username) you create here will be your login name. The name of your game characters will be chosen later on.', this);" />
|
||||
</td>
|
||||
|
||||
<td id="comment-Username" <?php if ($USERNAME_ERROR == "TRUE"){ echo 'class="error"';}?> width="42%"><?php if ($USERNAME_ERROR == "TRUE"){ echo $USERNAME;}?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td width="33%" <?php if ($PASSWORD_ERROR == "TRUE"){ echo 'class="error"';}?> id="caption-Password">Desired Password:</td>
|
||||
|
||||
<td width="25%">
|
||||
<input type="password"
|
||||
name="Password"
|
||||
value=""
|
||||
maxlength="20"
|
||||
onkeyup=
|
||||
"testPassword(document.Page1.Password.value, 'comment-Password')"
|
||||
onfocus="javascript:showTooltip(' 5-20 characters.', this);" />
|
||||
</td>
|
||||
|
||||
<td id="comment-Password" <?php if ($PASSWORD_ERROR == "TRUE"){ echo 'class="error"';}?> width="42%"><?php if ($PASSWORD_ERROR == "TRUE"){ echo $PASSWORD;}?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td width="33%"<?php if ($CPASSWORD_ERROR == "TRUE"){ echo 'class="error"';}?> id="caption-ConfirmPass">Confirm Password:</td>
|
||||
|
||||
<td width="25%"><input type="password"
|
||||
name="ConfirmPass"
|
||||
value=""
|
||||
maxlength="20"
|
||||
onfocus="javascript:showTooltip('Retype your Password', this);" />
|
||||
</td>
|
||||
|
||||
<td id="comment-ConfirmPass" <?php if ($CPASSWORD_ERROR == "TRUE"){ echo 'class="error"';}?>width="42%"><?php if ($CPASSWORD_ERROR == "TRUE"){ echo $CPASSWORD;}?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td width="33%" <?php if ($EMAIL_ERROR == "TRUE"){ echo 'class="error"';}?> id="caption-Email">Email Address (to which a confirmation email will be sent):</td>
|
||||
|
||||
<td width="25%">
|
||||
<input type="text"
|
||||
name="Email"
|
||||
value=""
|
||||
maxlength="255"
|
||||
onfocus=
|
||||
"javascript:showTooltip('Please verify that the e-mail address you enter here is valid and will remain valid in the future. It will only be used to manage your <?php echo $GAME_NAME; ?> account.', this);" />
|
||||
</td>
|
||||
|
||||
<td id="comment-Email" <?php if ($EMAIL_ERROR == "TRUE"){ echo 'class="error"';}?> width="42%"><?php if ($EMAIL_ERROR == "TRUE"){ echo $EMAIL;}?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td width=
|
||||
"33%" <?php if ($TAC_ERROR == "TRUE"){ echo 'class="error"';}?>
|
||||
colspan="2"><input type="checkbox"
|
||||
name="TaC"
|
||||
value="1"
|
||||
onfocus="javascript:showTooltip('', this);" /><span id=
|
||||
"caption-TaC">YES, I agree to the terms of
|
||||
service</span></td><?php if ($TAC_ERROR == "TRUE"){
|
||||
echo '<td id="comment-TaC" class="error" width="42%">You must accept the Terms of Service</td>';}
|
||||
else {
|
||||
echo '<td width="42%" id="comment-TaC" >';}; ?>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div class="c1">
|
||||
<input type="submit"
|
||||
name="Submit"
|
||||
value="Continue" />
|
||||
</div>
|
||||
<input type="hidden" name="function" value="add_user">
|
||||
</form>
|
||||
|
||||
<div id="signupTooltip"
|
||||
class="c2"
|
||||
inset=""></div>
|
||||
|
||||
<div id="tooltip-Username">
|
||||
5-12 lower-case characters and numbers. The login (username) you create here will be
|
||||
your login name. The name of your game characters will be chosen later on.
|
||||
</div>
|
||||
|
||||
<div id="tooltip-Password">
|
||||
5-20 characters.
|
||||
</div>
|
||||
|
||||
<div id="tooltip-ConfirmPass">
|
||||
Retype your Password
|
||||
</div>
|
||||
|
||||
<div id="tooltip-Email">
|
||||
Please verify that the e-mail address you enter here is valid and will remain valid
|
||||
in the future. It will be used to manage your <?php echo $GAME_NAME; ?> account.
|
||||
</div>
|
||||
|
||||
<div id="tooltip-TaC"></div>
|
8
code/ryzom/tools/server/ryzom_ams/ams_lib/libinclude.php
Normal file
8
code/ryzom/tools/server/ryzom_ams/ams_lib/libinclude.php
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
// ***********************************************
|
||||
// Base include file for library functions for AMS
|
||||
// ***********************************************
|
||||
function __autoload( $className ){
|
||||
require_once 'autoload/' . $className . '.php';
|
||||
}
|
||||
|
1
code/ryzom/tools/server/ryzom_ams/doc.txt
Normal file
1
code/ryzom/tools/server/ryzom_ams/doc.txt
Normal file
|
@ -0,0 +1 @@
|
|||
The following variables are required and must be set to a variable (not constant) and called before including ams_lib/libinclude.php
|
81
code/ryzom/tools/server/ryzom_ams/www/config.php
Normal file
81
code/ryzom/tools/server/ryzom_ams/www/config.php
Normal file
|
@ -0,0 +1,81 @@
|
|||
<?php
|
||||
|
||||
// This file contains all variables needed by other php scripts
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// Variables for database access
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// where we can find the mysql database
|
||||
$DBHOST = 'localhost' ;
|
||||
$DBNAME = 'nel' ;
|
||||
$DBUSERNAME = 'shard' ;
|
||||
$DBPASSWORD = '' ;
|
||||
|
||||
$RINGDBNAME = 'ring_open' ;
|
||||
$RINGDBUSERNAME = 'shard' ;
|
||||
$RINGDBPASSWORD = '' ;
|
||||
|
||||
$NTDBName = 'nel_tool' ;
|
||||
$NTUserName = 'shard' ;
|
||||
$NTPassword = '' ;
|
||||
|
||||
$SITETITLE = 'Ryzom Core AMS' ;
|
||||
|
||||
$LOGRELATIVEPATH = 'logs/' ;
|
||||
|
||||
// If true= the server will add automatically unknown user in the database
|
||||
// (in nel.user= nel.permission= ring.ring_user and ring.characters
|
||||
$ALLOW_UNKNOWN = true ;
|
||||
// if true= the login service automaticaly create a ring user and a editor character if needed
|
||||
$CREATE_RING = true ;
|
||||
|
||||
// site paths definitions
|
||||
$NELTOOL_SITEBASE = dirname( __FILE__ ) . '/html/' ;
|
||||
$NELTOOL_SYSTEMBASE = dirname( dirname( __FILE__ ) ) . '/admin/' ;
|
||||
$NELTOOL_LOGBASE = $NELTOOL_SYSTEMBASE . '/logs/' ;
|
||||
$NELTOOL_IMGBASE = $NELTOOL_SYSTEMBASE . '/imgs/' ;
|
||||
|
||||
$NELTOOL_RRDTOOL = '/usr/bin/rrdtool' ;
|
||||
$NELTOOL_RRDSYSBASE = $NELTOOL_SYSTEMBASE . 'graphs_output/' ;
|
||||
$NELTOOL_RRDWEBBASE = $NELTOOL_SITEBASE . 'graphs_output/' ;
|
||||
|
||||
// SQL table names
|
||||
$NELDB_PREFIX = 'neltool_' ;
|
||||
|
||||
// for later use
|
||||
// the config table will gather some of the settings
|
||||
// that are currently written in this config.php file
|
||||
$NELDB_CONFIG_TABLE = $NELDB_PREFIX . 'config';
|
||||
$NELDB_USER_TABLE = $NELDB_PREFIX . 'users' ;
|
||||
$NELDB_GROUP_TABLE = $NELDB_PREFIX . 'groups' ;
|
||||
|
||||
$NELDB_LOG_TABLE = $NELDB_PREFIX . 'logs' ;
|
||||
$NELDB_NOTE_TABLE = $NELDB_PREFIX . 'notes' ;
|
||||
|
||||
$NELDB_STAT_HD_TIME_TABLE = $NELDB_PREFIX . 'stats_hd_times' ;
|
||||
$NELDB_STAT_HD_TABLE = $NELDB_PREFIX . 'stats_hd_datas' ;
|
||||
|
||||
$NELDB_ANNOTATION_TABLE = $NELDB_PREFIX . 'annotations' ;
|
||||
$NELDB_LOCK_TABLE = $NELDB_PREFIX . 'locks' ;
|
||||
|
||||
$NELDB_APPLICATION_TABLE = $NELDB_PREFIX . 'applications' ;
|
||||
$NELDB_GROUP_APPLICATION_TABLE = $NELDB_PREFIX . 'group_applications' ;
|
||||
$NELDB_USER_APPLICATION_TABLE = $NELDB_PREFIX . 'user_applications' ;
|
||||
|
||||
$NELDB_DOMAIN_TABLE = $NELDB_PREFIX . 'domains' ;
|
||||
$NELDB_USER_DOMAIN_TABLE = $NELDB_PREFIX . 'user_domains' ;
|
||||
$NELDB_GROUP_DOMAIN_TABLE = $NELDB_PREFIX . 'group_domains' ;
|
||||
|
||||
$NELDB_SHARD_TABLE = $NELDB_PREFIX . 'shards' ;
|
||||
$NELDB_USER_SHARD_TABLE = $NELDB_PREFIX . 'user_shards' ;
|
||||
$NELDB_GROUP_SHARD_TABLE = $NELDB_PREFIX . 'group_shards' ;
|
||||
|
||||
$NELDB_RESTART_GROUP_TABLE = $NELDB_PREFIX . 'restart_groups' ;
|
||||
$NELDB_RESTART_MESSAGE_TABLE = $NELDB_PREFIX . 'restart_messages' ;
|
||||
$NELDB_RESTART_SEQUENCE_TABLE = $NELDB_PREFIX . 'restart_sequences' ;
|
||||
|
||||
$VIEW_DELAY = 0 ;
|
||||
$HARDWARE_REFRESH = 600 ;
|
||||
$LOCK_TIMEOUT = 1800 ;
|
||||
$BG_IMG = 'imgs/bg_live.png' ;
|
||||
$GAME_NAME = 'Ryzom Core';
|
||||
$WELCOME_MESSAGE = 'Welcome! Please fill in the following fields to get your new '.$GAME_NAME.' account:';
|
|
@ -0,0 +1,71 @@
|
|||
<?php
|
||||
require( '../config.php' );
|
||||
// check if values exist
|
||||
if ( isset( $_POST["Username"] ) and isset( $_POST["Password"] ) and isset( $_POST["Email"] ) )
|
||||
{
|
||||
// check values
|
||||
$user = users :: checkUser( $_POST["Username"] );
|
||||
$pass = users :: checkPassword( $_POST["Password"] );
|
||||
$cpass = users :: confirmPassword();
|
||||
$email = users :: checkEmail( $_POST["Email"] );
|
||||
}else{
|
||||
$user = "";
|
||||
$pass = "";
|
||||
$cpass = "";
|
||||
$email = "";
|
||||
}
|
||||
// if all are good then create user
|
||||
if ( ( $user == "success" ) and ( $pass == "success" ) and ( $cpass == "success" ) and ( $email == "success" ) and ( isset( $_POST["TaC"] ) ) ){
|
||||
$edit = array(
|
||||
'name' => $_POST["Username"],
|
||||
'pass' => $_POST["Password"],
|
||||
'mail' => $_POST["Email"],
|
||||
'init' => $_POST["Email"],
|
||||
'unhashpass' => $_POST["Password"],
|
||||
'status' => 1,
|
||||
'access' => REQUEST_TIME
|
||||
);
|
||||
user_save( NULL, $edit );
|
||||
header( 'Location: email_sent.php' );
|
||||
exit;
|
||||
}else{
|
||||
$pageElements = array(
|
||||
'GAME_NAME' => $GAME_NAME,
|
||||
'WELCOME_MESSAGE' => $WELCOME_MESSAGE,
|
||||
'USERNAME' => $user,
|
||||
'PASSWORD' => $pass,
|
||||
'CPASSWORD' => $cpass,
|
||||
'EMAIL' => $email
|
||||
);
|
||||
if ( $user != "success" ){
|
||||
$pageElements['USERNAME_ERROR'] = 'TRUE';
|
||||
}else{
|
||||
$pageElements['USERNAME_ERROR'] = 'FALSE';
|
||||
}
|
||||
|
||||
if ( $pass != "success" ){
|
||||
$pageElements['PASSWORD_ERROR'] = 'TRUE';
|
||||
}else{
|
||||
$pageElements['PASSWORD_ERROR'] = 'FALSE';
|
||||
}
|
||||
if ( $cpass != "success" ){
|
||||
$pageElements['CPASSWORD_ERROR'] = 'TRUE';
|
||||
}else{
|
||||
$pageElements['CPASSWORD_ERROR'] = 'FALSE';
|
||||
}
|
||||
if ( $email != "success" ){
|
||||
$pageElements['EMAIL_ERROR'] = 'TRUE';
|
||||
}else{
|
||||
$pageElements['EMAIL_ERROR'] = 'FALSE';
|
||||
}
|
||||
if ( isset( $_POST["TaC"] ) ){
|
||||
$pageElements['TAC_ERROR'] = 'FALSE';
|
||||
}else{
|
||||
$pageElements['TAC_ERROR'] = 'TRUE';
|
||||
}
|
||||
if ( helpers :: check_if_game_client() ){
|
||||
helpers :: loadtemplate( '../../ams_lib/ingame_templates/register.phtml', $pageElements );
|
||||
}else{
|
||||
helpers :: loadtemplate( 'templates/register.phtml', $pageElements );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
function add_user(){
|
||||
echo "test";
|
||||
}
|
||||
|
||||
function checkUser(){
|
||||
|
||||
|
||||
}
|
24
code/ryzom/tools/server/ryzom_ams/www/html/index.php
Normal file
24
code/ryzom/tools/server/ryzom_ams/www/html/index.php
Normal file
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
require( '../config.php' );
|
||||
|
||||
require( '../../ams_lib/libinclude.php' );
|
||||
|
||||
if (isset($_POST["function"])){
|
||||
require("inc/".$_POST["function"].".php");
|
||||
$_POST["function"]();
|
||||
}
|
||||
|
||||
function loadpage ($page){
|
||||
require_once('autoload/'.$page.'.php');
|
||||
}
|
||||
|
||||
$page = 'home';
|
||||
if (isset($_GET["page"])) {
|
||||
$page = $_GET["page"];
|
||||
}
|
||||
|
||||
|
||||
helpers::loadtemplate('templates/header.phtml');
|
||||
loadpage($page);
|
||||
helpers::loadtemplate('templates/footer.phtml');
|
|
@ -0,0 +1,4 @@
|
|||
<hr />
|
||||
This is a footer
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
This is a header
|
||||
<div class="ryzomuserbar"><a href="?page=register">Register</a></div>
|
||||
<hr />
|
|
@ -0,0 +1 @@
|
|||
mainpage welcome!
|
|
@ -0,0 +1,117 @@
|
|||
<div class="title">
|
||||
RYZOM CORE INGAME REGISTRATION
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<?php echo $WELCOME_MESSAGE; ?>
|
||||
</div>
|
||||
|
||||
<form name="Page1"
|
||||
method="post"
|
||||
>
|
||||
<table>
|
||||
<tr>
|
||||
<td width="33%" <?php if ($USERNAME_ERROR == "TRUE"){ echo 'class="error"';}?> id="caption-Username">Desired Username: </td>
|
||||
|
||||
<td width="25%">
|
||||
<input type="text"
|
||||
name="Username"
|
||||
value=""
|
||||
maxlength="12"
|
||||
onfocus=
|
||||
"javascript:showTooltip('5-12 lower-case characters and numbers. The login (username) you create here will be your login name. The name of your game characters will be chosen later on.', this);" />
|
||||
</td>
|
||||
|
||||
<td id="comment-Username" <?php if ($USERNAME_ERROR == "TRUE"){ echo 'class="error"';}?> width="42%"><?php if ($USERNAME_ERROR == "TRUE"){ echo $USERNAME;}?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td width="33%" <?php if ($PASSWORD_ERROR == "TRUE"){ echo 'class="error"';}?> id="caption-Password">Desired Password:</td>
|
||||
|
||||
<td width="25%">
|
||||
<input type="password"
|
||||
name="Password"
|
||||
value=""
|
||||
maxlength="20"
|
||||
onkeyup=
|
||||
"testPassword(document.Page1.Password.value, 'comment-Password')"
|
||||
onfocus="javascript:showTooltip(' 5-20 characters.', this);" />
|
||||
</td>
|
||||
|
||||
<td id="comment-Password" <?php if ($PASSWORD_ERROR == "TRUE"){ echo 'class="error"';}?> width="42%"><?php if ($PASSWORD_ERROR == "TRUE"){ echo $PASSWORD;}?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td width="33%"<?php if ($CPASSWORD_ERROR == "TRUE"){ echo 'class="error"';}?> id="caption-ConfirmPass">Confirm Password:</td>
|
||||
|
||||
<td width="25%"><input type="password"
|
||||
name="ConfirmPass"
|
||||
value=""
|
||||
maxlength="20"
|
||||
onfocus="javascript:showTooltip('Retype your Password', this);" />
|
||||
</td>
|
||||
|
||||
<td id="comment-ConfirmPass" <?php if ($CPASSWORD_ERROR == "TRUE"){ echo 'class="error"';}?>width="42%"><?php if ($CPASSWORD_ERROR == "TRUE"){ echo $CPASSWORD;}?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td width="33%" <?php if ($EMAIL_ERROR == "TRUE"){ echo 'class="error"';}?> id="caption-Email">Email Address (to which a confirmation email will be sent):</td>
|
||||
|
||||
<td width="25%">
|
||||
<input type="text"
|
||||
name="Email"
|
||||
value=""
|
||||
maxlength="255"
|
||||
onfocus=
|
||||
"javascript:showTooltip('Please verify that the e-mail address you enter here is valid and will remain valid in the future. It will only be used to manage your <?php echo $GAME_NAME; ?> account.', this);" />
|
||||
</td>
|
||||
|
||||
<td id="comment-Email" <?php if ($EMAIL_ERROR == "TRUE"){ echo 'class="error"';}?> width="42%"><?php if ($EMAIL_ERROR == "TRUE"){ echo $EMAIL;}?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td width=
|
||||
"33%" <?php if ($TAC_ERROR == "TRUE"){ echo 'class="error"';}?>
|
||||
colspan="2"><input type="checkbox"
|
||||
name="TaC"
|
||||
value="1"
|
||||
onfocus="javascript:showTooltip('', this);" /><span id=
|
||||
"caption-TaC">YES, I agree to the terms of
|
||||
service</span></td><?php if ($TAC_ERROR == "TRUE"){
|
||||
echo '<td id="comment-TaC" class="error" width="42%">You must accept the Terms of Service</td>';}
|
||||
else {
|
||||
echo '<td width="42%" id="comment-TaC" >';}; ?>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div class="c1">
|
||||
<input type="submit"
|
||||
name="Submit"
|
||||
value="Continue" />
|
||||
</div>
|
||||
<input type="hidden" name="function" value="add_user">
|
||||
</form>
|
||||
|
||||
<div id="signupTooltip"
|
||||
class="c2"
|
||||
inset=""></div>
|
||||
|
||||
<div id="tooltip-Username">
|
||||
5-12 lower-case characters and numbers. The login (username) you create here will be
|
||||
your login name. The name of your game characters will be chosen later on.
|
||||
</div>
|
||||
|
||||
<div id="tooltip-Password">
|
||||
5-20 characters.
|
||||
</div>
|
||||
|
||||
<div id="tooltip-ConfirmPass">
|
||||
Retype your Password
|
||||
</div>
|
||||
|
||||
<div id="tooltip-Email">
|
||||
Please verify that the e-mail address you enter here is valid and will remain valid
|
||||
in the future. It will be used to manage your <?php echo $GAME_NAME; ?> account.
|
||||
</div>
|
||||
|
||||
<div id="tooltip-TaC"></div>
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
// This file contains all variables needed by other php scripts
|
||||
|
||||
$LogRelativePath = './';
|
||||
$LogRelativePath = 'logs/';
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// Variables for nel database access
|
||||
|
|
Loading…
Reference in a new issue