diff --git a/code/nel/tools/3d/object_viewer_qt/src/CMakeLists.txt b/code/nel/tools/3d/object_viewer_qt/src/CMakeLists.txt index ab7b12d51..5a690018f 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/CMakeLists.txt +++ b/code/nel/tools/3d/object_viewer_qt/src/CMakeLists.txt @@ -22,7 +22,7 @@ SET(OBJECT_VIEWER_HDR main_window.h graphics_viewport.h animation_dialog.h vegetable_dialog.h global_wind_dialog.h day_night_dialog.h sun_color_dialog.h vegetable_noise_value_widget.h vegetable_density_page.h vegetable_landscape_page.h vegetable_scale_page.h vegetable_appearance_page.h vegetable_rotate_page.h - tune_mrm_dialog.h + tune_mrm_dialog.h tune_timer_dialog.h extension_system/iplugin_manager.h extension_system/plugin_manager.h) SET(OBJECT_VIEWER_UIS animation_form.ui animation_set_form.ui settings_form.ui @@ -36,7 +36,7 @@ SET(OBJECT_VIEWER_UIS animation_form.ui animation_set_form.ui settings_form.ui particle_link_skeleton_form.ui water_pool_form.ui vegetable_dialog_form.ui vegetable_noise_value_form.ui global_wind_form.ui sun_color_form.ui day_night_form.ui vegetable_density_form.ui vegetable_apperance_form.ui vegetable_landscape_form.ui - vegetable_rotate_form.ui vegetable_scale_form.ui tune_mrm_form.ui) + vegetable_rotate_form.ui vegetable_scale_form.ui tune_mrm_form.ui tune_timer_form.ui) SET(OBJECT_VIEWER_RCS object_viewer_qt.qrc) diff --git a/code/nel/tools/3d/object_viewer_qt/src/main_window.cpp b/code/nel/tools/3d/object_viewer_qt/src/main_window.cpp index a283eea3a..ece609dac 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/main_window.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/main_window.cpp @@ -48,6 +48,7 @@ #include "day_night_dialog.h" #include "sun_color_dialog.h" #include "tune_mrm_dialog.h" +#include "tune_timer_dialog.h" using namespace std; using namespace NLMISC; @@ -109,6 +110,8 @@ CMainWindow::CMainWindow(QWidget *parent) // This can be used to do heavy work while providing a snappy user interface. _mainTimer = new QTimer(this); connect(_mainTimer, SIGNAL(timeout()), this, SLOT(updateRender())); + connect(_TuneTimerDialog, SIGNAL(changeInterval(int)), this, SLOT(setInterval(int))); + _TuneTimerDialog->setInterval(settings.value("TimerInterval", 25).toInt()); _statusBarTimer = new QTimer(this); connect(_statusBarTimer, SIGNAL(timeout()), this, SLOT(updateStatusBar())); @@ -127,6 +130,7 @@ CMainWindow::~CMainWindow() settings.setValue("QtWindowState", saveState()); settings.setValue("QtWindowGeometry", saveGeometry()); settings.endGroup(); + settings.setValue("TimerInterval", _mainTimer->interval()); Modules::config().dropCallback("SoundEnabled"); Modules::config().dropCallback("QtPalette"); @@ -137,6 +141,7 @@ CMainWindow::~CMainWindow() delete _SlotManagerDialog; delete _SetupFog; delete _TuneMRMDialog; + delete _TuneTimerDialog; delete _ParticleControlDialog; delete _ParticleWorkspaceDialog; @@ -158,7 +163,7 @@ void CMainWindow::setVisible(bool visible) QMainWindow::setVisible(true); if (_isSoundInitialized) Modules::sound().initGraphics(); - _mainTimer->start(23); + _mainTimer->start(); _statusBarTimer->start(1000); } else @@ -257,6 +262,11 @@ void CMainWindow::reloadTextures() Modules::objView().reloadTextures(); } +void CMainWindow::setInterval(int value) +{ + _mainTimer->setInterval(value); +} + void CMainWindow::settings() { CSettingsDialog _settingsDialog(this); @@ -396,6 +406,9 @@ void CMainWindow::createMenus() _toolsMenu->addAction(_SkeletonScaleDialog->toggleViewAction()); _SkeletonScaleDialog->toggleViewAction()->setIcon(QIcon(":/images/ico_skelscale.png")); + _toolsMenu->addAction(_TuneTimerDialog->toggleViewAction()); + _TuneTimerDialog->toggleViewAction()->setIcon(QIcon(":/images/ico_framedelay.png")); + _toolsMenu->addAction(_SunColorDialog->toggleViewAction()); _toolsMenu->addAction(_TuneMRMDialog->toggleViewAction()); @@ -441,6 +454,7 @@ void CMainWindow::createToolBars() _toolsBar->addAction(_WaterPoolDialog->toggleViewAction()); _toolsBar->addAction(_VegetableDialog->toggleViewAction()); _toolsBar->addAction(_GlobalWindDialog->toggleViewAction()); + _toolsBar->addAction(_TuneTimerDialog->toggleViewAction()); _toolsBar->addAction(_SkeletonScaleDialog->toggleViewAction()); _toolsBar->addAction(_TuneMRMDialog->toggleViewAction()); } @@ -521,6 +535,10 @@ void CMainWindow::createDialogs() addDockWidget(Qt::BottomDockWidgetArea, _TuneMRMDialog); _TuneMRMDialog->setVisible(false); + _TuneTimerDialog = new CTuneTimerDialog(this); + addDockWidget(Qt::TopDockWidgetArea, _TuneTimerDialog); + _TuneTimerDialog->setVisible(false); + connect(_ParticleControlDialog, SIGNAL(changeState()), _ParticleWorkspaceDialog, SLOT(setNewState())); connect(_ParticleWorkspaceDialog, SIGNAL(changeActiveNode()), _ParticleControlDialog, SLOT(updateActiveNode())); connect(_AnimationSetDialog->ui.setLengthPushButton, SIGNAL(clicked()), _AnimationDialog, SLOT(changeAnimLength())); diff --git a/code/nel/tools/3d/object_viewer_qt/src/main_window.h b/code/nel/tools/3d/object_viewer_qt/src/main_window.h index 94b8b74cc..9cc146aee 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/main_window.h +++ b/code/nel/tools/3d/object_viewer_qt/src/main_window.h @@ -54,6 +54,7 @@ class CGlobalWindDialog; class CDayNightDialog; class CSunColorDialog; class CTuneMRMDialog; +class CTuneTimerDialog; class CMainWindow : public QMainWindow { @@ -86,6 +87,7 @@ private Q_SLOTS: void about(); void updateStatusBar(); void updateRender(); + void setInterval(int value); private: void createActions(); @@ -118,6 +120,7 @@ private: CSunColorDialog *_SunColorDialog; CTuneMRMDialog *_TuneMRMDialog; CSkeletonTreeModel *_SkeletonTreeModel; + CTuneTimerDialog *_TuneTimerDialog; QPalette _originalPalette; QString _lastDir; diff --git a/code/nel/tools/3d/object_viewer_qt/src/tune_mrm_dialog.cpp b/code/nel/tools/3d/object_viewer_qt/src/tune_mrm_dialog.cpp index 493cfb577..33088a064 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/tune_mrm_dialog.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/tune_mrm_dialog.cpp @@ -49,7 +49,7 @@ CTuneMRMDialog::~CTuneMRMDialog() void CTuneMRMDialog::setMaxValue(int value) { int actualMaxValue = value * sliderStepSize; - int actualValue = float(actualMaxValue) * _ui.currentValueSlider->value() / _ui.currentValueSlider->maximum(); + int actualValue = float(actualMaxValue) * _ui.currentValueSlider->value() / _ui.currentValueSlider->maximum(); _ui.currentValueSlider->setMaximum(actualMaxValue); _ui.currentValueSlider->setValue(actualValue); diff --git a/code/nel/tools/3d/object_viewer_qt/src/tune_timer_dialog.cpp b/code/nel/tools/3d/object_viewer_qt/src/tune_timer_dialog.cpp new file mode 100644 index 000000000..3582798a2 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/tune_timer_dialog.cpp @@ -0,0 +1,46 @@ +/* + Object Viewer Qt + Copyright (C) 2010 Dzmitry Kamiahin + + 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 . + +*/ + +#include "stdpch.h" +#include "tune_timer_dialog.h" + +// Project includes +#include "modules.h" + +namespace NLQT +{ + +CTuneTimerDialog::CTuneTimerDialog(QWidget *parent) + : QDockWidget(parent) +{ + _ui.setupUi(this); + + connect(_ui.horizontalSlider, SIGNAL(valueChanged(int)), this, SIGNAL(changeInterval(int))); +} + +CTuneTimerDialog::~CTuneTimerDialog() +{ +} + +void CTuneTimerDialog::setInterval(int value) +{ + _ui.horizontalSlider->setValue(value); +} + +} /* namespace NLQT */ diff --git a/code/nel/tools/3d/object_viewer_qt/src/tune_timer_dialog.h b/code/nel/tools/3d/object_viewer_qt/src/tune_timer_dialog.h new file mode 100644 index 000000000..e0a31db61 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/tune_timer_dialog.h @@ -0,0 +1,55 @@ +/* + Object Viewer Qt + Copyright (C) 2010 Dzmitry Kamiahin + + 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 . + +*/ + +#ifndef TUNE_TIMER_DIALOG_H +#define TUNE_TIMER_DIALOG_H + +#include "ui_tune_timer_form.h" + +// STL includes + +// NeL includes + +// Project includes + +namespace NLQT +{ + +class CTuneTimerDialog: public QDockWidget +{ + Q_OBJECT + +public: + CTuneTimerDialog(QWidget *parent = 0); + ~CTuneTimerDialog(); + + void setInterval(int value); + +Q_SIGNALS: + void changeInterval(int value); + +private: + + Ui::CTuneTimerDialog _ui; + +}; /* class CTuneTimerDialog */ + +} /* namespace NLQT */ + +#endif // TUNE_TIMER_DIALOG_H diff --git a/code/nel/tools/3d/object_viewer_qt/src/tune_timer_form.ui b/code/nel/tools/3d/object_viewer_qt/src/tune_timer_form.ui new file mode 100644 index 000000000..852c7f58e --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/tune_timer_form.ui @@ -0,0 +1,84 @@ + + + CTuneTimerDialog + + + + 0 + 0 + 460 + 64 + + + + + 86 + 64 + + + + QDockWidget::AllDockWidgetFeatures + + + Time interval update render + + + + + + + 1000 + + + Qt::Horizontal + + + QSlider::TicksAbove + + + 100 + + + + + + + true + + + true + + + QAbstractSpinBox::NoButtons + + + ms + + + 10000 + + + + + + + + + + horizontalSlider + valueChanged(int) + spinBox + setValue(int) + + + 167 + 93 + + + 319 + 75 + + + + +