Added some scenewidget user settings but noticed during testing that the spinbox view resets the value if enter key is pressed.

deque
cc9cii 10 years ago
parent d41230a0c5
commit 67503c93b2

@ -208,6 +208,57 @@ sh::Factory::getInstance ().setSharedParameter ("vpRow2Fix", sh::makeProperty<sh
#endif #endif
} }
page = "Scene";
{
Setting *fastFactor = createSetting (Type_SpinBox, page, "fast factor");
fastFactor->setDefaultValue(4);
fastFactor->setEditorSetting(false);
fastFactor->setColumnSpan (1);
fastFactor->setMinimum (1); // FIXME: this function appears to be broken
fastFactor->setMaximum (100); // FIXME: not sure what the max value should be
fastFactor->setWidgetWidth (10);
fastFactor->setViewLocation(1, 2);
Setting *ffText = createSetting (Type_Undefined, page, "ffText");
ffText->setSpecialValueText("Fast Factor"); // hack to place text labels
ffText->setEditorSetting(false);
ffText->setSerializable (false);
ffText->setColumnSpan (1);
ffText->setWidgetWidth (10);
ffText->setViewLocation(1, 1);
Setting *farClipDist = createSetting (Type_SpinBox, page, "far clip distance");
farClipDist->setDefaultValue(300000);
farClipDist->setEditorSetting(false);
farClipDist->setColumnSpan (1);
farClipDist->setMinimum (0);
farClipDist->setMaximum (1000000); // FIXME: not sure what the max value should be
farClipDist->setWidgetWidth (10);
farClipDist->setViewLocation(2, 2);
Setting *fcText = createSetting (Type_Undefined, page, "fcText");
fcText->setSpecialValueText("Far Clip Distance"); // hack to place text labels
fcText->setEditorSetting(false);
fcText->setSerializable (false);
fcText->setColumnSpan (1);
fcText->setWidgetWidth (10);
fcText->setViewLocation(2, 1);
Setting *timerStart = createSetting (Type_SpinBox, page, "timer start");
timerStart->setDefaultValue(20);
timerStart->setEditorSetting(false);
timerStart->setColumnSpan (1);
timerStart->setMinimum (0);
timerStart->setMaximum (100); // FIXME: not sure what the max value should be
timerStart->setWidgetWidth (10);
timerStart->setViewLocation(3, 2);
Setting *tsText = createSetting (Type_Undefined, page, "tsText");
tsText->setSpecialValueText("Timer Start"); // hack to place text labels
tsText->setEditorSetting(false);
tsText->setSerializable (false);
tsText->setColumnSpan (1);
tsText->setWidgetWidth (10);
tsText->setViewLocation(3, 1);
}
#if 0 #if 0
page = "Window Size"; page = "Window Size";
{ {

@ -13,6 +13,7 @@
#include <OgreViewport.h> #include <OgreViewport.h>
#include "../widget/scenetoolmode.hpp" #include "../widget/scenetoolmode.hpp"
#include "../../model/settings/usersettings.hpp"
#include "navigation.hpp" #include "navigation.hpp"
#include "lighting.hpp" #include "lighting.hpp"
@ -27,7 +28,7 @@ namespace CSVRender
, mKeyForward (false), mKeyBackward (false), mKeyLeft (false), mKeyRight (false) , mKeyForward (false), mKeyBackward (false), mKeyLeft (false), mKeyRight (false)
, mKeyRollLeft (false), mKeyRollRight (false) , mKeyRollLeft (false), mKeyRollRight (false)
, mFast (false), mDragging (false), mMod1 (false) , mFast (false), mDragging (false), mMod1 (false)
, mFastFactor (4) /// \todo make this configurable , mFastFactor (4)
, mDefaultAmbient (0, 0, 0, 0), mHasDefaultAmbient (false) , mDefaultAmbient (0, 0, 0, 0), mHasDefaultAmbient (false)
{ {
setAttribute(Qt::WA_PaintOnScreen); setAttribute(Qt::WA_PaintOnScreen);
@ -44,7 +45,20 @@ namespace CSVRender
mCamera->setPosition (300, 0, 0); mCamera->setPosition (300, 0, 0);
mCamera->lookAt (0, 0, 0); mCamera->lookAt (0, 0, 0);
mCamera->setNearClipDistance (0.1); mCamera->setNearClipDistance (0.1);
mCamera->setFarClipDistance (300000); ///< \todo make this configurable
CSMSettings::UserSettings &userSettings = CSMSettings::UserSettings::instance();
int farClipDist = 300000;
if(userSettings.hasSettingDefinitions("Scene/far clip distance"))
farClipDist = userSettings.settingValue("Scene/far clip distance").toInt();
else
userSettings.setDefinitions("Scene/far clip distance", (QStringList() << QString(farClipDist)));
mCamera->setFarClipDistance (farClipDist);
if(userSettings.hasSettingDefinitions("Scene/fast factor"))
mFastFactor = userSettings.settingValue("Scene/fast factor").toInt();
else
userSettings.setDefinitions("Scene/fast factor", (QStringList() << QString(mFastFactor)));
mCamera->roll (Ogre::Degree (90)); mCamera->roll (Ogre::Degree (90));
setLighting (&mLightingDay); setLighting (&mLightingDay);
@ -52,7 +66,13 @@ namespace CSVRender
QTimer *timer = new QTimer (this); QTimer *timer = new QTimer (this);
connect (timer, SIGNAL (timeout()), this, SLOT (update())); connect (timer, SIGNAL (timeout()), this, SLOT (update()));
timer->start (20); ///< \todo make this configurable
int timerStart = 20;
if(userSettings.hasSettingDefinitions("Scene/timer start"))
timerStart = userSettings.settingValue("Scene/timer start").toInt();
else
userSettings.setDefinitions("Scene/timer start", (QStringList() << QString(timerStart)));
timer->start (timerStart);
/// \todo make shortcut configurable /// \todo make shortcut configurable
QShortcut *focusToolbar = new QShortcut (Qt::Key_T, this, 0, 0, Qt::WidgetWithChildrenShortcut); QShortcut *focusToolbar = new QShortcut (Qt::Key_T, this, 0, 0, Qt::WidgetWithChildrenShortcut);

Loading…
Cancel
Save