Changed: #1193 Tune timer dialog.

This commit is contained in:
dnk-88 2011-01-28 00:17:11 +02:00
parent ab163d8c8e
commit fa63539729
7 changed files with 210 additions and 4 deletions

View file

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

View file

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

View file

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

View file

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

View file

@ -0,0 +1,46 @@
/*
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 "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 */

View file

@ -0,0 +1,55 @@
/*
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 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

View file

@ -0,0 +1,84 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CTuneTimerDialog</class>
<widget class="QDockWidget" name="CTuneTimerDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>460</width>
<height>64</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>86</width>
<height>64</height>
</size>
</property>
<property name="features">
<set>QDockWidget::AllDockWidgetFeatures</set>
</property>
<property name="windowTitle">
<string>Time interval update render</string>
</property>
<widget class="QWidget" name="dockWidgetContents">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QSlider" name="horizontalSlider">
<property name="maximum">
<number>1000</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::TicksAbove</enum>
</property>
<property name="tickInterval">
<number>100</number>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="spinBox">
<property name="frame">
<bool>true</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
<property name="buttonSymbols">
<enum>QAbstractSpinBox::NoButtons</enum>
</property>
<property name="suffix">
<string> ms</string>
</property>
<property name="maximum">
<number>10000</number>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<resources/>
<connections>
<connection>
<sender>horizontalSlider</sender>
<signal>valueChanged(int)</signal>
<receiver>spinBox</receiver>
<slot>setValue(int)</slot>
<hints>
<hint type="sourcelabel">
<x>167</x>
<y>93</y>
</hint>
<hint type="destinationlabel">
<x>319</x>
<y>75</y>
</hint>
</hints>
</connection>
</connections>
</ui>