From e010a87a9ebffbcdee72939f18db3546f9a1cce4 Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 12 Mar 2016 14:46:13 +0100 Subject: [PATCH 1/4] Fixed: 0x0 is Auto mode --- .../client_config_qt/display_settings_widget.cpp | 13 ++++++++++++- code/ryzom/tools/client/client_config_qt/system.cpp | 10 ++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/code/ryzom/tools/client/client_config_qt/display_settings_widget.cpp b/code/ryzom/tools/client/client_config_qt/display_settings_widget.cpp index ae8b1a590..49e841631 100644 --- a/code/ryzom/tools/client/client_config_qt/display_settings_widget.cpp +++ b/code/ryzom/tools/client/client_config_qt/display_settings_widget.cpp @@ -166,7 +166,18 @@ void CDisplaySettingsWidget::updateVideoModes() while(itr != iend) { - videomodeComboBox->addItem(QString("%1x%2 %3 bit @%4").arg(itr->width).arg(itr->height).arg(itr->depth).arg(itr->frequency)); + if (itr->frequency) + { + videomodeComboBox->addItem(QString("%1x%2 %3 bit @%4").arg(itr->width).arg(itr->height).arg(itr->depth).arg(itr->frequency)); + } + else if (itr->width) + { + videomodeComboBox->addItem(QString("%1x%2 %3 bit").arg(itr->width).arg(itr->height).arg(itr->depth)); + } + else + { + videomodeComboBox->addItem(tr("Auto")); + } ++itr; } diff --git a/code/ryzom/tools/client/client_config_qt/system.cpp b/code/ryzom/tools/client/client_config_qt/system.cpp index 8ef5a930b..635800878 100644 --- a/code/ryzom/tools/client/client_config_qt/system.cpp +++ b/code/ryzom/tools/client/client_config_qt/system.cpp @@ -160,6 +160,16 @@ void CSystem::GetVideoModes( std::vector< CVideoMode > &dst, NL3D::IDriver *driv std::vector< NL3D::GfxMode > modes; driver->getModes( modes ); + { + // auto mode + CVideoMode mode; + mode.depth = 0; + mode.width = 0; + mode.height = 0; + mode.frequency = 0; + dst.push_back( mode ); + } + for( std::vector< NL3D::GfxMode >::iterator itr = modes.begin(); itr != modes.end(); ++itr ) { if( ( itr->Width >= 800 ) && ( itr->Height >= 600 ) && ( itr->Depth >= 16 ) ) From b571de42b7964589ac5c8a1e1305cbb0b8ab8d79 Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 12 Mar 2016 14:47:13 +0100 Subject: [PATCH 2/4] Changed: Declare CCmdArgs outside of main() to be able to use it in other files --- .../client_config_qt/client_config_dialog.cpp | 4 ++++ .../tools/client/client_config_qt/main.cpp | 17 +++++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/code/ryzom/tools/client/client_config_qt/client_config_dialog.cpp b/code/ryzom/tools/client/client_config_qt/client_config_dialog.cpp index bfa9bbc58..4b3cf0648 100644 --- a/code/ryzom/tools/client/client_config_qt/client_config_dialog.cpp +++ b/code/ryzom/tools/client/client_config_qt/client_config_dialog.cpp @@ -31,6 +31,10 @@ #include #include +#include "nel/misc/cmd_args.h" + +extern NLMISC::CCmdArgs Args; + CClientConfigDialog::CClientConfigDialog( QWidget *parent ) : QDialog( parent ) { diff --git a/code/ryzom/tools/client/client_config_qt/main.cpp b/code/ryzom/tools/client/client_config_qt/main.cpp index 2967ce4a0..b99cde6c1 100644 --- a/code/ryzom/tools/client/client_config_qt/main.cpp +++ b/code/ryzom/tools/client/client_config_qt/main.cpp @@ -37,6 +37,8 @@ #endif +NLMISC::CCmdArgs Args; + int main(sint32 argc, char **argv) { NLMISC::CApplicationContext applicationContext; @@ -44,11 +46,10 @@ int main(sint32 argc, char **argv) QApplication app(argc, argv); // parse command-line arguments - NLMISC::CCmdArgs args; - args.setDescription("Ryzom Configuration"); - args.addArg("p", "profile", "id", "Use this profile to determine what directory to use by default"); + Args.setDescription("Ryzom Configuration"); + Args.addArg("p", "profile", "id", "Use this profile to determine what directory to use by default"); - if (!args.parse(argc, argv)) return 1; + if (!Args.parse(argc, argv)) return 1; QApplication::setWindowIcon(QIcon(":/resources/welcome_icon.png")); QPixmap pixmap(":/resources/splash_screen.png" ); @@ -82,16 +83,16 @@ int main(sint32 argc, char **argv) // default paths std::string ryzomDir = NLMISC::CPath::standardizePath(NLMISC::CPath::getApplicationDirectory("Ryzom")); - std::string currentDir = args.getStartupPath(); - std::string executableDir = args.getProgramPath(); + std::string currentDir = Args.getStartupPath(); + std::string executableDir = Args.getProgramPath(); std::string configFilename = "client.cfg"; std::string configPath; // search client.cfg file in config directory (Ryzom Installer) - if (args.haveArg("p")) + if (Args.haveArg("p")) { - ryzomDir = NLMISC::CPath::standardizePath(ryzomDir + args.getArg("p").front()); + ryzomDir = NLMISC::CPath::standardizePath(ryzomDir + Args.getArg("p").front()); // client.cfg is always in profile directory if using -p argument configPath = ryzomDir + configFilename; From 1562a5dddfb0a41e45ed7465561da845e8a1ffc7 Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 12 Mar 2016 14:48:18 +0100 Subject: [PATCH 3/4] Fixed: Use full path to launch Ryzom client and pass profile argument --- .../client_config_qt/client_config_dialog.cpp | 25 ++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/code/ryzom/tools/client/client_config_qt/client_config_dialog.cpp b/code/ryzom/tools/client/client_config_qt/client_config_dialog.cpp index 4b3cf0648..5f645857d 100644 --- a/code/ryzom/tools/client/client_config_qt/client_config_dialog.cpp +++ b/code/ryzom/tools/client/client_config_qt/client_config_dialog.cpp @@ -149,15 +149,28 @@ void CClientConfigDialog::onClickPlay() { bool started = false; + QStringList arguments; + + if (Args.haveArg("p")) + { + arguments << "-p" << QString::fromUtf8(Args.getArg("p").front().c_str()); + } + + QString clientFullPath = QString::fromUtf8(Args.getProgramPath().c_str()); + #ifdef Q_OS_WIN32 - started = QProcess::startDetached( "ryzom_client_r.exe" ); - if( !started ) - QProcess::startDetached( "ryzom_client_d.exe" ); -#elif defined(Q_OS_MAC) - started = QProcess::startDetached( "./Ryzom.app" ); +#ifdef _DEBUG + clientFullPath += "ryzom_client_d.exe"; #else - started = QProcess::startDetached( "./ryzom_client" ); + clientFullPath += "ryzom_client_r.exe"; #endif +#elif defined(Q_OS_MAC) + clientFullPath += "Ryzom"; +#else + clientFullPath += "ryzom_client"; +#endif + + started = QProcess::startDetached(clientFullPath, arguments); onClickOK(); } From 861472b799e7252f6b95a36569390fb0455af95f Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 12 Mar 2016 14:49:04 +0100 Subject: [PATCH 4/4] Changed: Use QString::number() instead of QString("%1") to convert an int to QString --- .../client_config_qt/display_settings_widget.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/code/ryzom/tools/client/client_config_qt/display_settings_widget.cpp b/code/ryzom/tools/client/client_config_qt/display_settings_widget.cpp index 49e841631..7e05f83bd 100644 --- a/code/ryzom/tools/client/client_config_qt/display_settings_widget.cpp +++ b/code/ryzom/tools/client/client_config_qt/display_settings_widget.cpp @@ -90,10 +90,10 @@ void CDisplaySettingsWidget::load() windowedRadioButton->setChecked( true ); } - widthLineEdit->setText( QString( "%1" ).arg( mode.width ) ); - 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" ) ) ); + widthLineEdit->setText(QString::number(mode.width)); + heightLineEdit->setText(QString::number(mode.height)); + xpositionLineEdit->setText(QString::number(s.config.getInt("PositionX"))); + ypositionLineEdit->setText(QString::number(s.config.getInt("PositionY"))); } @@ -194,7 +194,7 @@ uint32 CDisplaySettingsWidget::findVideoModeIndex( CVideoMode *mode ) //| --------------------------------------| //| Auto | OpenGL modes | //| OpenGL | OpenGL modes | - //| Direct3D | Direct3d modes | + //| Direct3D | Direct3D modes | //| --------------------------------------| // //