Changed: #1193 Update settings dialog, object viewer plugin and translations.

hg/feature/sound
dnk-88 14 years ago
parent 6ec8ebab4b
commit 50dccfa5e9

@ -15,7 +15,12 @@
//
// 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 "plugin_spec.h"
#include "iplugin.h"
#include "iplugin_manager.h"
#include "nel/misc/app_context.h"
#include <QtCore/QList>
#include <QtCore/QFile>
@ -23,11 +28,6 @@
#include <QtCore/QPluginLoader>
#include <QtCore/QCoreApplication>
#include "nel/misc/app_context.h"
#include "iplugin.h"
#include "iplugin_manager.h"
namespace ExtensionSystem
{

@ -138,8 +138,8 @@ bool MainWindow::showOptionsDialog(const QString &group,
void MainWindow::about()
{
QMessageBox::about(this, tr("About Object Viewer Qt"),
tr("<h2>Object Viewer Qt NG</h2>"
"<p> Author: dnk-88 <p>Compiled on %1 %2").arg(__DATE__).arg(__TIME__));
tr("<h2>Object Viewer Qt</h2>"
"<p> Ryzom Core team <p>Compiled on %1 %2").arg(__DATE__).arg(__TIME__));
}
void MainWindow::closeEvent(QCloseEvent *event)

@ -14,7 +14,6 @@ SET(OBJECT_VIEWER_PLUGIN_HDR object_viewer_plugin.h
graphics_viewport.h
animation_dialog.h
animation_set_dialog.h
settings_dialog.h
setup_fog_dialog.h
slot_manager_dialog.h
particle_control_dialog.h
@ -68,11 +67,13 @@ SET(OBJECT_VIEWER_PLUGIN_HDR object_viewer_plugin.h
vegetable_rotate_page.h
tune_mrm_dialog.h
tune_timer_dialog.h
camera_control.h)
camera_control.h
graphics_settings_page.h
sound_settings_page.h
vegetable_settings_page.h)
SET(OBJECT_VIEWER_PLUGIN_UIS animation_form.ui
animation_set_form.ui
settings_form.ui
setup_fog_form.ui
slot_form.ui
particle_control_form.ui
@ -116,7 +117,10 @@ SET(OBJECT_VIEWER_PLUGIN_UIS animation_form.ui
vegetable_rotate_form.ui
vegetable_scale_form.ui
tune_mrm_form.ui
tune_timer_form.ui)
tune_timer_form.ui
graphics_settings_page.ui
sound_settings_page.ui
vegetable_settings_page.ui)
SET(OBJECT_VIEWER_PLUGIN_RCS object_viewer.qrc)

@ -0,0 +1,147 @@
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
// Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
//
// 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/>.
// Project includes
#include "stdpch.h"
#include "graphics_settings_page.h"
#include "modules.h"
// Qt includes
#include <QtGui/QWidget>
#include <QtGui/QStyleFactory>
#include <QtGui/QStyle>
// NeL includes
#include <nel/3d/bloom_effect.h>
namespace NLQT
{
GraphicsSettingsPage::GraphicsSettingsPage(QObject *parent)
: IOptionsPage(parent),
m_page(0)
{
}
QString GraphicsSettingsPage::id() const
{
return QLatin1String("GraphicsPage");
}
QString GraphicsSettingsPage::trName() const
{
return tr("Graphics");
}
QString GraphicsSettingsPage::category() const
{
return QLatin1String("ObjectViewer");
}
QString GraphicsSettingsPage::trCategory() const
{
return tr("Object Viewer");
}
QWidget *GraphicsSettingsPage::createPage(QWidget *parent)
{
m_page = new QWidget(parent);
m_ui.setupUi(m_page);
Modules::config().setAndCallback("GraphicsDrivers", CConfigCallback(this, &GraphicsSettingsPage::cfcbGraphicsDrivers));
m_ui.enableBloomCheckBox->setChecked(Modules::objView().getBloomEffect());
m_ui.squareBloomCheckBox->setChecked(NL3D::CBloomEffect::instance().getSquareBloom());
m_ui.bloomDensityHorizontalSlider->setValue(NL3D::CBloomEffect::instance().getDensityBloom());
m_ui.styleComboBox->addItems(QStyleFactory::keys());
m_ui.styleComboBox->setCurrentIndex(m_ui.styleComboBox->findText(Modules::config().getValue("QtStyle", std::string("")).c_str()));
m_ui.paletteCheckBox->setChecked(Modules::config().getValue("QtPalette", false));
connect(m_ui.enableBloomCheckBox, SIGNAL(toggled(bool)), this, SLOT(setEnableBloom(bool)));
connect(m_ui.squareBloomCheckBox, SIGNAL(toggled(bool)), this, SLOT(setEnableSquareBloon(bool)));
connect(m_ui.bloomDensityHorizontalSlider, SIGNAL(valueChanged(int)), this, SLOT(setDensityBloom(int)));
#ifdef NL_OS_UNIX
m_ui.driverGraphComboBox->setEnabled(false);
#endif
return m_page;
}
void GraphicsSettingsPage::apply()
{
// save graphics settings to config file
Modules::config().getConfigFile().getVar("GraphicsDriver").setAsString(m_ui.driverGraphComboBox->currentText().toStdString());
Modules::config().getConfigFile().getVar("BloomEffect").setAsInt(m_ui.enableBloomCheckBox->isChecked());
Modules::config().getConfigFile().getVar("BloomSquare").setAsInt(m_ui.squareBloomCheckBox->isChecked());
Modules::config().getConfigFile().getVar("BloomDensity").setAsInt(m_ui.bloomDensityHorizontalSlider->value());
Modules::config().getConfigFile().getVar("QtStyle").setAsString(m_ui.styleComboBox->currentText().toStdString());
Modules::config().getConfigFile().getVar("QtPalette").setAsInt(m_ui.paletteCheckBox->isChecked());
QApplication::setStyle(QStyleFactory::create(m_ui.styleComboBox->currentText()));
if (m_ui.paletteCheckBox->isChecked())
QApplication::setPalette(QApplication::style()->standardPalette());
else
QApplication::setPalette(Modules::mainWin().getOriginalPalette());
// save config file
Modules::config().getConfigFile().save();
}
void GraphicsSettingsPage::finish()
{
Modules::config().dropCallback("GraphicsDrivers");
}
void GraphicsSettingsPage::setEnableBloom(bool state)
{
Modules::objView().setBloomEffect(state);
}
void GraphicsSettingsPage::setEnableSquareBloon(bool state)
{
NL3D::CBloomEffect::instance().setSquareBloom(state);
}
void GraphicsSettingsPage::setDensityBloom(int density)
{
NL3D::CBloomEffect::instance().setDensityBloom(density);
}
void GraphicsSettingsPage::cfcbGraphicsDrivers(NLMISC::CConfigFile::CVar &var)
{
while (m_ui.driverGraphComboBox->count())
m_ui.driverGraphComboBox->removeItem(0);
// load types graphics driver from the config file
for (uint i = 0; i < var.size(); ++i)
m_ui.driverGraphComboBox->addItem(var.asString(i).c_str());
// set graphics driver from the config file
QString value = Modules::config().getValue("GraphicsDriver", std::string("OpenGL")).c_str();
QString dn = value.toLower();
for (sint i = 0; i < m_ui.driverGraphComboBox->count(); ++i)
{
if (dn == m_ui.driverGraphComboBox->itemText(i).toLower())
{
m_ui.driverGraphComboBox->setCurrentIndex(i);
return;
}
}
}
} /* namespace NLQT */

@ -0,0 +1,66 @@
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
// Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
//
// 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 GRAPHICS_SETTINGS_PAGE_H
#define GRAPHICS_SETTINGS_PAGE_H
#include "ui_graphics_settings_page.h"
#include "../core/ioptions_page.h"
#include <QtCore/QObject>
#include <nel/misc/config_file.h>
class QWidget;
namespace NLQT
{
/**
@class GraphicsSettingsPage
*/
class GraphicsSettingsPage : public Core::IOptionsPage
{
Q_OBJECT
public:
GraphicsSettingsPage(QObject *parent = 0);
virtual ~GraphicsSettingsPage() {}
virtual QString id() const;
virtual QString trName() const;
virtual QString category() const;
virtual QString trCategory() const;
virtual QWidget *createPage(QWidget *parent);
virtual void apply();
virtual void finish();
private Q_SLOTS:
void setEnableBloom(bool state);
void setEnableSquareBloon(bool state);
void setDensityBloom(int density);
private:
void cfcbGraphicsDrivers(NLMISC::CConfigFile::CVar &var);
QWidget *m_page;
Ui::GraphicsSettingsPage m_ui;
};
} // namespace NLQT
#endif // GRAPHICS_SETTINGS_H

@ -0,0 +1,181 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>GraphicsSettingsPage</class>
<widget class="QWidget" name="GraphicsSettingsPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>540</width>
<height>326</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<property name="leftMargin">
<number>6</number>
</property>
<property name="topMargin">
<number>6</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
<number>3</number>
</property>
<item row="4" column="1">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>283</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="1">
<widget class="QGroupBox" name="qtStyleGroupBox">
<property name="title">
<string>Qt Style</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QLabel" name="label_6">
<property name="text">
<string>Style</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QComboBox" name="styleComboBox"/>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="paletteCheckBox">
<property name="text">
<string>Use style's standard palette</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="2" column="1">
<widget class="QGroupBox" name="graphicsGroupBox">
<property name="title">
<string>Graphics settings</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="driverGraphLabel">
<property name="text">
<string>Driver</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QComboBox" name="driverGraphComboBox">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="1" column="1">
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Bloom effect</string>
</property>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>Bloom density</string>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="bloomDensityHorizontalSlider">
<property name="maximum">
<number>255</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="squareBloomCheckBox">
<property name="text">
<string>Square bloom</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="enableBloomCheckBox">
<property name="text">
<string>Enable bloom effect</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="../../object_viewer_qt.qrc"/>
</resources>
<connections/>
</ui>

@ -32,7 +32,6 @@
// Project includes
#include "modules.h"
#include "settings_dialog.h"
#include "graphics_viewport.h"
#include "animation_dialog.h"
#include "animation_set_dialog.h"
@ -120,8 +119,9 @@ CMainWindow::CMainWindow(QWidget *parent)
_statusBarTimer = new QTimer(this);
connect(_statusBarTimer, SIGNAL(timeout()), this, SLOT(updateStatusBar()));
//_statusInfo = new QLabel(this);
// statusBar()->addPermanentWidget(_statusInfo);
_statusInfo = new QLabel(this);
_statusInfo->hide();
Core::ICore::instance()->mainWindow()->statusBar()->addPermanentWidget(_statusInfo);
}
CMainWindow::~CMainWindow()
@ -159,24 +159,23 @@ CMainWindow::~CMainWindow()
void CMainWindow::showEvent(QShowEvent *showEvent)
{
QWidget::showEvent(showEvent);
if (isVisible())
{
QMainWindow::setVisible(true);
Modules::objView().getDriver()->activate();
if (_isSoundInitialized)
Modules::sound().initGraphics();
_mainTimer->start();
//_statusBarTimer->start(1000);
}
else
{
_mainTimer->stop();
//_statusBarTimer->stop();
if (_isSoundInitialized)
Modules::sound().releaseGraphics();
QMainWindow::setVisible(false);
}
QMainWindow::showEvent(showEvent);
Modules::objView().getDriver()->activate();
if (_isSoundInitialized)
Modules::sound().initGraphics();
_mainTimer->start();
_statusBarTimer->start(1000);
_statusInfo->show();
}
void CMainWindow::hideEvent(QHideEvent *hideEvent)
{
_mainTimer->stop();
_statusBarTimer->stop();
_statusInfo->hide();
if (_isSoundInitialized)
Modules::sound().releaseGraphics();
QMainWindow::hideEvent(hideEvent);
}
int CMainWindow::getFrameRate()
@ -232,23 +231,16 @@ void CMainWindow::setInterval(int value)
_mainTimer->setInterval(value);
}
void CMainWindow::settings()
{
CSettingsDialog _settingsDialog(this);
_settingsDialog.show();
_settingsDialog.exec();
}
void CMainWindow::updateStatusBar()
{
/* if (_isGraphicsInitialized)
{
_statusInfo->setText(QString("%1, Nb tri: %2 , Texture used (Mb): %3 , fps: %4 ").arg(
Modules::objView().getDriver()->getVideocardInformation()).arg(
_numTri).arg(
_texMem, 0,'f',4).arg(
_fps, 0,'f',2));
}*/
if (_isGraphicsInitialized)
{
_statusInfo->setText(QString("%1, Nb tri: %2 , Texture used (Mb): %3 , fps: %4 ").arg(
Modules::objView().getDriver()->getVideocardInformation()).arg(
_numTri).arg(
_texMem, 0,'f',4).arg(
_fps, 0,'f',2));
}
}
void CMainWindow::createActions()
@ -275,11 +267,6 @@ void CMainWindow::createActions()
_saveScreenshotAction = _GraphicsViewport->createSaveScreenshotAction(this);
_saveScreenshotAction->setText(tr("Save &Screenshot"));
_saveScreenshotAction->setStatusTip(tr("Make a screenshot of the current viewport and save"));
_settingsAction = new QAction(tr("&Settings OV"), this);
_settingsAction->setIcon(QIcon(":/images/preferences.png"));
_settingsAction->setStatusTip(tr("Settings"));
connect(_settingsAction, SIGNAL(triggered()), this, SLOT(settings()));
}
void CMainWindow::createMenus()
@ -359,7 +346,6 @@ void CMainWindow::createMenus()
connect(_ParticleControlDialog->toggleViewAction(), SIGNAL(triggered(bool)),
_ParticleWorkspaceDialog->_PropertyDialog, SLOT(setVisible(bool)));
ovMenu->insertAction(settingsAction ,_settingsAction);
toolsMenu->insertSeparator(settingsAction);
}

@ -80,13 +80,13 @@ private Q_SLOTS:
void open();
void resetScene();
void reloadTextures();
void settings();
void updateStatusBar();
void updateRender();
void setInterval(int value);
protected:
virtual void showEvent(QShowEvent *showEvent);
virtual void hideEvent(QHideEvent *hideEvent);
private:
void createActions();
@ -138,7 +138,6 @@ private:
QAction *_reloadTexturesAction;
QAction *_resetSceneAction;
QAction *_saveScreenshotAction;
QAction *_settingsAction;
QLabel *_statusInfo;
float _fps;

@ -1,5 +1,8 @@
// Project includes
#include "object_viewer_plugin.h"
#include "graphics_settings_page.h"
#include "sound_settings_page.h"
#include "vegetable_settings_page.h"
#include "modules.h"
#include "../core/core_constants.h"
@ -28,6 +31,9 @@ bool ObjectViewerPlugin::initialize(ExtensionSystem::IPluginManager *pluginManag
_plugMan = pluginManager;
Modules::init();
addAutoReleasedObject(new CObjectViewerContext());
addAutoReleasedObject(new GraphicsSettingsPage());
addAutoReleasedObject(new SoundSettingsPage());
addAutoReleasedObject(new VegetableSettingsPage());
return true;
}

@ -1,309 +0,0 @@
/*
Object Viewer Qt
Copyright (C) 2010 Dzmitry Kamiahin <dnk-88@tut.by>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "stdpch.h"
#include "settings_dialog.h"
// Qt includes
#include <QtGui/QWidget>
#include <QtGui/QMessageBox>
#include <QtGui/QFileDialog>
#include <QtGui/QStyleFactory>
#include <QtGui/QStyle>
// NeL includes
#include <nel/misc/path.h>
#include <nel/3d/bloom_effect.h>
// Project includes
#include "modules.h"
using namespace NLMISC;
namespace NLQT
{
CSettingsDialog::CSettingsDialog(QWidget *parent)
: QDialog(parent)
{
ui.setupUi(this);
loadGraphicsSettings();
loadSoundSettings();
loadVegetableSettings();
connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(applyPressed()));
connect(ui.enableBloomCheckBox, SIGNAL(toggled(bool)), this, SLOT(setEnableBloom(bool)));
connect(ui.squareBloomCheckBox, SIGNAL(toggled(bool)), this, SLOT(setEnableSquareBloon(bool)));
connect(ui.bloomDensityHorizontalSlider, SIGNAL(valueChanged(int)), this, SLOT(setDensityBloom(int)));
connect(ui.tileBankToolButton, SIGNAL(clicked()), this, SLOT(setTileBank()));
connect(ui.tileFarBankToolButton, SIGNAL(clicked()), this, SLOT(setTileFarBank()));
connect(ui.vegetTexToolButton, SIGNAL(clicked()), this, SLOT(setTextureVegetable()));
connect(ui.addZoneToolButton, SIGNAL(clicked()), this, SLOT(addZone()));
connect(ui.removeZoneToolButton, SIGNAL(clicked()), this, SLOT(removeZone()));
#ifdef NL_OS_UNIX
ui.driverGraphComboBox->setEnabled(false);
#endif
}
CSettingsDialog::~CSettingsDialog()
{
Modules::config().dropCallback("GraphicsDrivers");
Modules::config().dropCallback("SoundDrivers");
}
void CSettingsDialog::applyPressed()
{
// settings take after restart the program
QMessageBox::warning(this, tr("Settings"),
tr("Graphics and sound settings "
"take after restart the program"),
QMessageBox::Ok);
saveGraphicsSettings();
saveSoundSettings();
saveVegetableSettings();
// save config file
Modules::config().getConfigFile().save();
}
void CSettingsDialog::setTileBank()
{
QString fileName = QFileDialog::getOpenFileName(this, tr("Set new tile bank"),
ui.tileBankLineEdit->text(),
tr("Tile Bank file (*.smallbank *.bank);;"));
if (!fileName.isEmpty())
{
ui.tileBankLineEdit->setText(fileName);
}
}
void CSettingsDialog::setTileFarBank()
{
QString fileName = QFileDialog::getOpenFileName(this, tr("Set new tile far bank"),
ui.tileFarBankLineEdit->text(),
tr("Tile Far Bank file (*.farbank);;"));
if (!fileName.isEmpty())
{
ui.tileFarBankLineEdit->setText(fileName);
}
}
void CSettingsDialog::setTextureVegetable()
{
QString fileName = QFileDialog::getOpenFileName(this, tr("Set MicroVegetable texture"),
ui.vegetTextureLineEdit->text(),
tr("Texture file (*.tga *.png *.jpg *.dds);;"));
if (!fileName.isEmpty())
{
ui.vegetTextureLineEdit->setText(fileName);
}
}
void CSettingsDialog::addZone()
{
QStringList fileNames = QFileDialog::getOpenFileNames(this,
tr("Add zone files"), ".",
tr("Zonel files (*.zonel *.zone);;"));
if (!fileNames.isEmpty())
{
QStringList list = fileNames;
QStringList::Iterator it = list.begin();
while(it != list.end())
{
QListWidgetItem *newItem = new QListWidgetItem;
newItem->setText(*it);
newItem->setFlags(Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable);
ui.zonesListWidget->addItem(newItem);
++it;
}
}
}
void CSettingsDialog::removeZone()
{
QListWidgetItem *removeItem = ui.zonesListWidget->takeItem(ui.zonesListWidget->currentRow());
if (!removeItem) delete removeItem;
}
void CSettingsDialog::setEnableBloom(bool state)
{
Modules::objView().setBloomEffect(state);
}
void CSettingsDialog::setEnableSquareBloon(bool state)
{
NL3D::CBloomEffect::instance().setSquareBloom(state);
}
void CSettingsDialog::setDensityBloom(int density)
{
NL3D::CBloomEffect::instance().setDensityBloom(density);
}
void CSettingsDialog::cfcbGraphicsDrivers(NLMISC::CConfigFile::CVar &var)
{
while (ui.driverGraphComboBox->count())
ui.driverGraphComboBox->removeItem(0);
// load types graphics driver from the config file
for (uint i = 0; i < var.size(); ++i)
ui.driverGraphComboBox->addItem(var.asString(i).c_str());
// set graphics driver from the config file
QString value = Modules::config().getValue("GraphicsDriver",std::string("OpenGL")).c_str();
QString dn = value.toLower();
for (sint i = 0; i < ui.driverGraphComboBox->count(); ++i)
{
if (dn == ui.driverGraphComboBox->itemText(i).toLower())
{
ui.driverGraphComboBox->setCurrentIndex(i);
return;
}
}
}
void CSettingsDialog::cfcbSoundDrivers(NLMISC::CConfigFile::CVar& var)
{
while (ui.driverSndComboBox->count())
ui.driverSndComboBox->removeItem(0);
// load types sound driver from the config file
for (uint i = 0; i < var.size(); ++i)
ui.driverSndComboBox->addItem(var.asString(i).c_str());
// set sound driver from the config file
QString value = Modules::config().getValue("SoundDriver",std::string("Auto")).c_str();
QString dn = value.toLower();
for (sint i = 0; i < ui.driverSndComboBox->count(); ++i)
{
if (dn == ui.driverSndComboBox->itemText(i).toLower())
{
ui.driverSndComboBox->setCurrentIndex(i);
return;
}
}
}
void CSettingsDialog::loadGraphicsSettings()
{
// setup config file callbacks and initialize values
Modules::config().setAndCallback("GraphicsDrivers", CConfigCallback(this, &CSettingsDialog::cfcbGraphicsDrivers));
ui.enableBloomCheckBox->setChecked(Modules::objView().getBloomEffect());
ui.squareBloomCheckBox->setChecked(NL3D::CBloomEffect::instance().getSquareBloom());
ui.bloomDensityHorizontalSlider->setValue(NL3D::CBloomEffect::instance().getDensityBloom());
ui.styleComboBox->addItems(QStyleFactory::keys());
ui.styleComboBox->setCurrentIndex(ui.styleComboBox->findText(Modules::config().getValue("QtStyle", std::string("")).c_str()));
ui.paletteCheckBox->setChecked(Modules::config().getValue("QtPalette", false));
}
void CSettingsDialog::loadSoundSettings()
{
// setup config file callbacks and initialize values
Modules::config().setAndCallback("SoundDrivers", CConfigCallback(this, &CSettingsDialog::cfcbSoundDrivers));
// load settings from the config file
ui.autoLoadSampleCheckBox->setChecked(Modules::config().getValue("SoundAutoLoadSample", true));
ui.enableOccludeObstructCheckBox->setChecked(Modules::config().getValue("SoundEnableOccludeObstruct", true));
ui.enableReverbCheckBox->setChecked(Modules::config().getValue("SoundEnableReverb", true));
ui.manualRolloffCheckBox->setChecked(Modules::config().getValue("SoundManualRolloff", true));
ui.forceSoftwareCheckBox->setChecked(Modules::config().getValue("SoundForceSoftware", false));
ui.useADPCMCheckBox->setChecked(Modules::config().getValue("SoundUseADPCM", false));
ui.maxTrackSpinBox->setValue(Modules::config().getValue("SoundMaxTrack", 48));
}
void CSettingsDialog::loadVegetableSettings()
{
ui.tileBankLineEdit->setText(Modules::config().getConfigFile().getVar("VegetTileBank").asString().c_str());
ui.tileFarBankLineEdit->setText(Modules::config().getConfigFile().getVar("VegetTileFarBank").asString().c_str());
ui.vegetTextureLineEdit->setText(Modules::config().getConfigFile().getVar("VegetTexture").asString().c_str());
ui.zonesListWidget->clear();
// load vegetable landscape zone paths from config file
NLMISC::CConfigFile::CVar &var = Modules::config().getConfigFile().getVar("VegetLandscapeZones");
for (uint i = 0; i < var.size(); ++i)
{
ui.zonesListWidget->addItem(var.asString(i).c_str());
ui.zonesListWidget->item(i)->setFlags(Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable);
}
}
void CSettingsDialog::saveGraphicsSettings()
{
// save graphics settings to config file
Modules::config().getConfigFile().getVar("GraphicsDriver").setAsString(ui.driverGraphComboBox->currentText().toStdString());
Modules::config().getConfigFile().getVar("BloomEffect").setAsInt(ui.enableBloomCheckBox->isChecked());
Modules::config().getConfigFile().getVar("BloomSquare").setAsInt(ui.squareBloomCheckBox->isChecked());
Modules::config().getConfigFile().getVar("BloomDensity").setAsInt(ui.bloomDensityHorizontalSlider->value());
Modules::config().getConfigFile().getVar("QtStyle").setAsString(ui.styleComboBox->currentText().toStdString());
Modules::config().getConfigFile().getVar("QtPalette").setAsInt(ui.paletteCheckBox->isChecked());
QApplication::setStyle(QStyleFactory::create(ui.styleComboBox->currentText()));
if (ui.paletteCheckBox->isChecked())
QApplication::setPalette(QApplication::style()->standardPalette());
else
QApplication::setPalette(Modules::mainWin().getOriginalPalette());
}
void CSettingsDialog::saveSoundSettings()
{
// save sound settings to config file
Modules::config().getConfigFile().getVar("SoundDriver").setAsString(ui.driverSndComboBox->currentText().toStdString());
Modules::config().getConfigFile().getVar("SoundAutoLoadSample").setAsInt(ui.autoLoadSampleCheckBox->isChecked());
Modules::config().getConfigFile().getVar("SoundEnableOccludeObstruct").setAsInt(ui.enableOccludeObstructCheckBox->isChecked());
Modules::config().getConfigFile().getVar("SoundEnableReverb").setAsInt(ui.enableReverbCheckBox->isChecked());
Modules::config().getConfigFile().getVar("SoundManualRolloff").setAsInt(ui.manualRolloffCheckBox->isChecked());
Modules::config().getConfigFile().getVar("SoundForceSoftware").setAsInt(ui.forceSoftwareCheckBox->isChecked());
Modules::config().getConfigFile().getVar("SoundUseADPCM").setAsInt(ui.useADPCMCheckBox->isChecked());
Modules::config().getConfigFile().getVar("SoundMaxTrack").setAsInt(ui.maxTrackSpinBox->value());
}
void CSettingsDialog::saveVegetableSettings()
{
Modules::config().getConfigFile().getVar("VegetTileBank").setAsString(ui.tileBankLineEdit->text().toStdString());
Modules::config().getConfigFile().getVar("VegetTileFarBank").setAsString(ui.tileFarBankLineEdit->text().toStdString());
Modules::config().getConfigFile().getVar("VegetTexture").setAsString(ui.vegetTextureLineEdit->text().toStdString());
std::vector<std::string> list;
for (sint i = 0; i < ui.zonesListWidget->count(); ++i)
{
std::string str = ui.zonesListWidget->item(i)->text().toStdString();
list.push_back(str);
}
Modules::config().getConfigFile().getVar("VegetLandscapeZones").Type = NLMISC::CConfigFile::CVar::T_STRING;
Modules::config().getConfigFile().getVar("VegetLandscapeZones").setAsString(list);
}
} /* namespace NLQT */

@ -1,78 +0,0 @@
/*
Object Viewer Qt
Copyright (C) 2010 Dzmitry Kamiahin <dnk-88@tut.by>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SETTINGS_DIALOG_H
#define SETTINGS_DIALOG_H
#include <nel/misc/types_nl.h>
#include "ui_settings_form.h"
// STL includes
// NeL includes
#include <nel/misc/config_file.h>
// Project includes
namespace NLQT
{
/**
@class CSettingsDialog
@brief Settings dialog (graphics/sound/search path/vegetable).
*/
class CSettingsDialog: public QDialog
{
Q_OBJECT
public:
CSettingsDialog(QWidget *parent = 0);
~CSettingsDialog();
private Q_SLOTS:
void applyPressed();
void setTileBank();
void setTileFarBank();
void setTextureVegetable();
void addZone();
void removeZone();
void setEnableBloom(bool state);
void setEnableSquareBloon(bool state);
void setDensityBloom(int density);
private:
void cfcbGraphicsDrivers(NLMISC::CConfigFile::CVar &var);
void cfcbSoundDrivers(NLMISC::CConfigFile::CVar &var);
void loadGraphicsSettings();
void loadSoundSettings();
void loadVegetableSettings();
void saveGraphicsSettings();
void saveSoundSettings();
void saveVegetableSettings();
Ui::CSettingsDialog ui;
}; /* class CSettingsDialog */
} /* namespace NLQT */
#endif // SETTINGS_DIALOG_H

@ -1,617 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CSettingsDialog</class>
<widget class="QDialog" name="CSettingsDialog">
<property name="windowModality">
<enum>Qt::NonModal</enum>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>684</width>
<height>557</height>
</rect>
</property>
<property name="windowTitle">
<string>Settings</string>
</property>
<property name="windowIcon">
<iconset resource="object_viewer.qrc">
<normaloff>:/images/preferences.png</normaloff>:/images/preferences.png</iconset>
</property>
<property name="modal">
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" rowspan="2">
<widget class="QListWidget" name="listWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>120</width>
<height>16777215</height>
</size>
</property>
<item>
<property name="text">
<string>Graphics</string>
</property>
</item>
<item>
<property name="text">
<string>Sound</string>
</property>
</item>
<item>
<property name="text">
<string>Vegetable</string>
</property>
</item>
</widget>
</item>
<item row="0" column="1">
<widget class="QStackedWidget" name="stackedWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="graphicsPage">
<layout class="QGridLayout" name="gridLayout_10">
<item row="0" column="0">
<widget class="QGroupBox" name="graphicsGroupBox">
<property name="title">
<string>Graphics settings</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="driverGraphLabel">
<property name="text">
<string>Driver</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QComboBox" name="driverGraphComboBox">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Bloom effect</string>
</property>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>Bloom density</string>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="bloomDensityHorizontalSlider">
<property name="maximum">
<number>255</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="squareBloomCheckBox">
<property name="text">
<string>Square bloom</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="enableBloomCheckBox">
<property name="text">
<string>Enable bloom effect</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="2" column="0">
<widget class="QGroupBox" name="qtStyleGroupBox">
<property name="title">
<string>Qt Style</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QLabel" name="label_6">
<property name="text">
<string>Style</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QComboBox" name="styleComboBox"/>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="paletteCheckBox">
<property name="text">
<string>Use style's standard palette</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="3" column="0">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>283</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="soundPage">
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QGroupBox" name="soundGroupBox">
<property name="title">
<string>Sound settings</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="driverSndLabel">
<property name="text">
<string>Driver</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QComboBox" name="driverSndComboBox">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="autoLoadSampleCheckBox">
<property name="text">
<string>SoundAutoLoadSample</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="enableOccludeObstructCheckBox">
<property name="text">
<string>SoundEnableOccludeObstruct</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="enableReverbCheckBox">
<property name="text">
<string>SoundEnableReverb</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="manualRolloffCheckBox">
<property name="text">
<string>SoundManualRolloff</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="forceSoftwareCheckBox">
<property name="text">
<string>SoundForceSoftware</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="useADPCMCheckBox">
<property name="text">
<string>SoundUseADPCM</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="maxTrackLabel">
<property name="text">
<string>SoundMaxTrack</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QSpinBox" name="maxTrackSpinBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="specialValueText">
<string notr="true"/>
</property>
<property name="suffix">
<string notr="true"/>
</property>
<property name="prefix">
<string notr="true"/>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>89</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="page">
<layout class="QGridLayout" name="gridLayout_8">
<item row="0" column="1">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Setup Landscape</string>
</property>
<layout class="QGridLayout" name="gridLayout_9">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Tile bank:</string>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2">
<widget class="QLineEdit" name="tileBankLineEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QToolButton" name="tileBankToolButton">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Tile far bank:</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2">
<widget class="QLineEdit" name="tileFarBankLineEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QToolButton" name="tileFarBankToolButton">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Vegetable texture:</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="QLineEdit" name="vegetTextureLineEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QToolButton" name="vegetTexToolButton">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Landscape zones:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>118</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="2" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<property name="sizeConstraint">
<enum>QLayout::SetMinimumSize</enum>
</property>
<item>
<widget class="QToolButton" name="addZoneToolButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="object_viewer.qrc">
<normaloff>:/images/list-add.png</normaloff>:/images/list-add.png</iconset>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="removeZoneToolButton">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="object_viewer.qrc">
<normaloff>:/images/list-remove.png</normaloff>:/images/list-remove.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
<item row="4" column="0" colspan="4">
<widget class="QListWidget" name="zonesListWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item row="1" column="1">
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<tabstops>
<tabstop>listWidget</tabstop>
<tabstop>driverGraphComboBox</tabstop>
<tabstop>driverSndComboBox</tabstop>
<tabstop>autoLoadSampleCheckBox</tabstop>
<tabstop>enableOccludeObstructCheckBox</tabstop>
<tabstop>enableReverbCheckBox</tabstop>
<tabstop>manualRolloffCheckBox</tabstop>
<tabstop>forceSoftwareCheckBox</tabstop>
<tabstop>useADPCMCheckBox</tabstop>
<tabstop>maxTrackSpinBox</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources>
<include location="object_viewer.qrc"/>
</resources>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>CSettingsDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>222</x>
<y>385</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>CSettingsDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>290</x>
<y>391</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>listWidget</sender>
<signal>currentRowChanged(int)</signal>
<receiver>stackedWidget</receiver>
<slot>setCurrentIndex(int)</slot>
<hints>
<hint type="sourcelabel">
<x>69</x>
<y>96</y>
</hint>
<hint type="destinationlabel">
<x>226</x>
<y>360</y>
</hint>
</hints>
</connection>
</connections>
</ui>

@ -0,0 +1,119 @@
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
// Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
//
// 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/>.
// Project includes
#include "stdpch.h"
#include "sound_settings_page.h"
#include "modules.h"
// Qt includes
#include <QtGui/QWidget>
namespace NLQT
{
SoundSettingsPage::SoundSettingsPage(QObject *parent)
: IOptionsPage(parent),
m_page(0)
{
}
QString SoundSettingsPage::id() const
{
return QLatin1String("SoundPage");
}
QString SoundSettingsPage::trName() const
{
return tr("Sound");
}
QString SoundSettingsPage::category() const
{
return QLatin1String("ObjectViewer");
}
QString SoundSettingsPage::trCategory() const
{
return tr("Object Viewer");
}
QWidget *SoundSettingsPage::createPage(QWidget *parent)
{
m_page = new QWidget(parent);
m_ui.setupUi(m_page);
// setup config file callbacks and initialize values
Modules::config().setAndCallback("SoundDrivers", CConfigCallback(this, &SoundSettingsPage::cfcbSoundDrivers));
// load settings from the config file
m_ui.autoLoadSampleCheckBox->setChecked(Modules::config().getValue("SoundAutoLoadSample", true));
m_ui.enableOccludeObstructCheckBox->setChecked(Modules::config().getValue("SoundEnableOccludeObstruct", true));
m_ui.enableReverbCheckBox->setChecked(Modules::config().getValue("SoundEnableReverb", true));
m_ui.manualRolloffCheckBox->setChecked(Modules::config().getValue("SoundManualRolloff", true));
m_ui.forceSoftwareCheckBox->setChecked(Modules::config().getValue("SoundForceSoftware", false));
m_ui.useADPCMCheckBox->setChecked(Modules::config().getValue("SoundUseADPCM", false));
m_ui.maxTrackSpinBox->setValue(Modules::config().getValue("SoundMaxTrack", 48));
return m_page;
}
void SoundSettingsPage::apply()
{
// save sound settings to config file
Modules::config().getConfigFile().getVar("SoundDriver").setAsString(m_ui.driverSndComboBox->currentText().toStdString());
Modules::config().getConfigFile().getVar("SoundAutoLoadSample").setAsInt(m_ui.autoLoadSampleCheckBox->isChecked());
Modules::config().getConfigFile().getVar("SoundEnableOccludeObstruct").setAsInt(m_ui.enableOccludeObstructCheckBox->isChecked());
Modules::config().getConfigFile().getVar("SoundEnableReverb").setAsInt(m_ui.enableReverbCheckBox->isChecked());
Modules::config().getConfigFile().getVar("SoundManualRolloff").setAsInt(m_ui.manualRolloffCheckBox->isChecked());
Modules::config().getConfigFile().getVar("SoundForceSoftware").setAsInt(m_ui.forceSoftwareCheckBox->isChecked());
Modules::config().getConfigFile().getVar("SoundUseADPCM").setAsInt(m_ui.useADPCMCheckBox->isChecked());
Modules::config().getConfigFile().getVar("SoundMaxTrack").setAsInt(m_ui.maxTrackSpinBox->value());
// save config file
Modules::config().getConfigFile().save();
}
void SoundSettingsPage::finish()
{
Modules::config().dropCallback("SoundDrivers");
}
void SoundSettingsPage::cfcbSoundDrivers(NLMISC::CConfigFile::CVar& var)
{
while (m_ui.driverSndComboBox->count())
m_ui.driverSndComboBox->removeItem(0);
// load types sound driver from the config file
for (uint i = 0; i < var.size(); ++i)
m_ui.driverSndComboBox->addItem(var.asString(i).c_str());
// set sound driver from the config file
QString value = Modules::config().getValue("SoundDriver",std::string("Auto")).c_str();
QString dn = value.toLower();
for (sint i = 0; i < m_ui.driverSndComboBox->count(); ++i)
{
if (dn == m_ui.driverSndComboBox->itemText(i).toLower())
{
m_ui.driverSndComboBox->setCurrentIndex(i);
return;
}
}
}
} /* namespace NLQT */

@ -0,0 +1,64 @@
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
// Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
//
// 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 SOUND_SETTINGS_PAGE_H
#define SOUND_SETTINGS_PAGE_H
// Project includes
#include "../core/ioptions_page.h"
#include "ui_sound_settings_page.h"
// Qt includes
#include <QtCore/QObject>
// NeL includes
#include <nel/misc/config_file.h>
class QWidget;
namespace NLQT
{
/**
@class SoundSettingsPage
*/
class SoundSettingsPage : public Core::IOptionsPage
{
Q_OBJECT
public:
SoundSettingsPage(QObject *parent = 0);
virtual ~SoundSettingsPage() {}
virtual QString id() const;
virtual QString trName() const;
virtual QString category() const;
virtual QString trCategory() const;
virtual QWidget *createPage(QWidget *parent);
virtual void apply();
virtual void finish();
private:
void cfcbSoundDrivers(NLMISC::CConfigFile::CVar &var);
QWidget *m_page;
Ui::SoundSettingsPage m_ui;
};
} // namespace NLQT
#endif // SOUND_SETTINGS_H

@ -0,0 +1,161 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SoundSettingsPage</class>
<widget class="QWidget" name="SoundSettingsPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>326</width>
<height>268</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="margin">
<number>6</number>
</property>
<property name="spacing">
<number>3</number>
</property>
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="driverSndLabel">
<property name="text">
<string>Driver</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QComboBox" name="driverSndComboBox">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="autoLoadSampleCheckBox">
<property name="text">
<string>SoundAutoLoadSample</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="enableOccludeObstructCheckBox">
<property name="text">
<string>SoundEnableOccludeObstruct</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="enableReverbCheckBox">
<property name="text">
<string>SoundEnableReverb</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="manualRolloffCheckBox">
<property name="text">
<string>SoundManualRolloff</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QCheckBox" name="forceSoftwareCheckBox">
<property name="text">
<string>SoundForceSoftware</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QCheckBox" name="useADPCMCheckBox">
<property name="text">
<string>SoundUseADPCM</string>
</property>
</widget>
</item>
<item row="7" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="maxTrackLabel">
<property name="text">
<string>SoundMaxTrack</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QSpinBox" name="maxTrackSpinBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="specialValueText">
<string notr="true"/>
</property>
<property name="suffix">
<string notr="true"/>
</property>
<property name="prefix">
<string notr="true"/>
</property>
</widget>
</item>
</layout>
</item>
<item row="8" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>83</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources>
<include location="../../object_viewer_qt.qrc"/>
</resources>
<connections/>
</ui>

@ -185,7 +185,7 @@ bool CVegetableEditor::createVegetableLandscape()
_VegetableLandscape->Landscape.setupVegetableLighting(_VegetableAmbient, _VegetableDiffuse, _VegetableLightDir);
_VegetableLandscape->Landscape.setVegetableWind(_VegetableWindDir, _VegetableWindFreq, _VegetableWindPower, _VegetableWindBendMin);
_VegetableLandscape->Landscape.setUpdateLightingFrequency(1);
_VegetableLandscape->enableAdditive(true);
// Load the zones.
// ================
// landscape recentering.

@ -0,0 +1,172 @@
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
// Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
//
// 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/>.
// Project includes
#include "stdpch.h"
#include "vegetable_settings_page.h"
#include "modules.h"
// Qt includes
#include <QtGui/QWidget>
#include <QtGui/QMessageBox>
#include <QtGui/QFileDialog>
// NeL includes
#include <nel/misc/config_file.h>
namespace NLQT
{
VegetableSettingsPage::VegetableSettingsPage(QObject *parent)
: IOptionsPage(parent),
m_page(0)
{
}
QString VegetableSettingsPage::id() const
{
return QLatin1String("VegetablePage");
}
QString VegetableSettingsPage::trName() const
{
return tr("Vegetable");
}
QString VegetableSettingsPage::category() const
{
return QLatin1String("ObjectViewer");
}
QString VegetableSettingsPage::trCategory() const
{
return tr("Object Viewer");
}
QWidget *VegetableSettingsPage::createPage(QWidget *parent)
{
m_page = new QWidget(parent);
m_ui.setupUi(m_page);
m_ui.tileBankLineEdit->setText(Modules::config().getConfigFile().getVar("VegetTileBank").asString().c_str());
m_ui.tileFarBankLineEdit->setText(Modules::config().getConfigFile().getVar("VegetTileFarBank").asString().c_str());
m_ui.vegetTextureLineEdit->setText(Modules::config().getConfigFile().getVar("VegetTexture").asString().c_str());
m_ui.zonesListWidget->clear();
// load vegetable landscape zone paths from config file
NLMISC::CConfigFile::CVar &var = Modules::config().getConfigFile().getVar("VegetLandscapeZones");
for (uint i = 0; i < var.size(); ++i)
{
m_ui.zonesListWidget->addItem(var.asString(i).c_str());
m_ui.zonesListWidget->item(i)->setFlags(Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable);
}
connect(m_ui.tileBankToolButton, SIGNAL(clicked()), this, SLOT(setTileBank()));
connect(m_ui.tileFarBankToolButton, SIGNAL(clicked()), this, SLOT(setTileFarBank()));
connect(m_ui.vegetTexToolButton, SIGNAL(clicked()), this, SLOT(setTextureVegetable()));
connect(m_ui.addZoneToolButton, SIGNAL(clicked()), this, SLOT(addZone()));
connect(m_ui.removeZoneToolButton, SIGNAL(clicked()), this, SLOT(removeZone()));
return m_page;
}
void VegetableSettingsPage::apply()
{
Modules::config().getConfigFile().getVar("VegetTileBank").setAsString(m_ui.tileBankLineEdit->text().toStdString());
Modules::config().getConfigFile().getVar("VegetTileFarBank").setAsString(m_ui.tileFarBankLineEdit->text().toStdString());
Modules::config().getConfigFile().getVar("VegetTexture").setAsString(m_ui.vegetTextureLineEdit->text().toStdString());
std::vector<std::string> list;
for (sint i = 0; i < m_ui.zonesListWidget->count(); ++i)
{
std::string str = m_ui.zonesListWidget->item(i)->text().toStdString();
list.push_back(str);
}
Modules::config().getConfigFile().getVar("VegetLandscapeZones").Type = NLMISC::CConfigFile::CVar::T_STRING;
Modules::config().getConfigFile().getVar("VegetLandscapeZones").setAsString(list);
Modules::config().getConfigFile().save();
}
void VegetableSettingsPage::finish()
{
}
void VegetableSettingsPage::setTileBank()
{
QString fileName = QFileDialog::getOpenFileName(0, tr("Set new tile bank"),
m_ui.tileBankLineEdit->text(),
tr("Tile Bank file (*.smallbank *.bank);;"));
if (!fileName.isEmpty())
{
m_ui.tileBankLineEdit->setText(fileName);
}
}
void VegetableSettingsPage::setTileFarBank()
{
QString fileName = QFileDialog::getOpenFileName(0, tr("Set new tile far bank"),
m_ui.tileFarBankLineEdit->text(),
tr("Tile Far Bank file (*.farbank);;"));
if (!fileName.isEmpty())
{
m_ui.tileFarBankLineEdit->setText(fileName);
}
}
void VegetableSettingsPage::setTextureVegetable()
{
QString fileName = QFileDialog::getOpenFileName(0, tr("Set MicroVegetable texture"),
m_ui.vegetTextureLineEdit->text(),
tr("Texture file (*.tga *.png *.jpg *.dds);;"));
if (!fileName.isEmpty())
{
m_ui.vegetTextureLineEdit->setText(fileName);
}
}
void VegetableSettingsPage::addZone()
{
QStringList fileNames = QFileDialog::getOpenFileNames(0,
tr("Add zone files"), ".",
tr("Zonel files (*.zonel *.zone);;"));
if (!fileNames.isEmpty())
{
QStringList list = fileNames;
QStringList::Iterator it = list.begin();
while(it != list.end())
{
QListWidgetItem *newItem = new QListWidgetItem;
newItem->setText(*it);
newItem->setFlags(Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable);
m_ui.zonesListWidget->addItem(newItem);
++it;
}
}
}
void VegetableSettingsPage::removeZone()
{
QListWidgetItem *removeItem = m_ui.zonesListWidget->takeItem(m_ui.zonesListWidget->currentRow());
if (!removeItem)
delete removeItem;
}
} /* namespace NLQT */

@ -0,0 +1,65 @@
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
// Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
//
// 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 VEGETABLE_SETTINGS_PAGE_H
#define VEGETABLE_SETTINGS_PAGE_H
#include <QtCore/QObject>
#include "../core/ioptions_page.h"
#include "ui_vegetable_settings_page.h"
class QWidget;
namespace NLQT
{
/**
@class VegetableSettingsPage
*/
class VegetableSettingsPage : public Core::IOptionsPage
{
Q_OBJECT
public:
VegetableSettingsPage(QObject *parent = 0);
virtual ~VegetableSettingsPage() {}
virtual QString id() const;
virtual QString trName() const;
virtual QString category() const;
virtual QString trCategory() const;
virtual QWidget *createPage(QWidget *parent);
virtual void apply();
virtual void finish();
public Q_SLOTS:
void setTileBank();
void setTileFarBank();
void setTextureVegetable();
void addZone();
void removeZone();
private:
QWidget *m_page;
Ui::VegetableSettingsPage m_ui;
};
} // namespace NLQT
#endif // VEGETABLE_SETTINGS_H

@ -0,0 +1,203 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>VegetableSettingsPage</class>
<widget class="QWidget" name="VegetableSettingsPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>479</width>
<height>309</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="margin">
<number>6</number>
</property>
<property name="spacing">
<number>3</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Tile bank:</string>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2">
<widget class="QLineEdit" name="tileBankLineEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QToolButton" name="tileBankToolButton">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Tile far bank:</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2">
<widget class="QLineEdit" name="tileFarBankLineEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QToolButton" name="tileFarBankToolButton">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Vegetable texture:</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="QLineEdit" name="vegetTextureLineEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QToolButton" name="vegetTexToolButton">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_7">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Coarse mesh texture</string>
</property>
</widget>
</item>
<item row="3" column="1" colspan="2">
<widget class="QLineEdit" name="coarseLineEdit">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="QToolButton" name="coarseToolButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Landscape zones:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>303</width>
<height>21</height>
</size>
</property>
</spacer>
</item>
<item row="4" column="2" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<property name="sizeConstraint">
<enum>QLayout::SetMinimumSize</enum>
</property>
<item>
<widget class="QToolButton" name="addZoneToolButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="object_viewer.qrc">
<normaloff>:/images/list-add.png</normaloff>:/images/list-add.png</iconset>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="removeZoneToolButton">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="object_viewer.qrc">
<normaloff>:/images/list-remove.png</normaloff>:/images/list-remove.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
<item row="5" column="0" colspan="4">
<widget class="QListWidget" name="zonesListWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="../../object_viewer_qt.qrc"/>
<include location="object_viewer.qrc"/>
</resources>
<connections/>
</ui>
Loading…
Cancel
Save