forked from mirror/openmw-tes3mp
Allow setting precision of double preferences. Also increase precision of camera sensitivity.
This commit is contained in:
parent
35ff4ec4b1
commit
08d055ca23
3 changed files with 12 additions and 2 deletions
|
@ -15,10 +15,16 @@
|
||||||
CSMPrefs::DoubleSetting::DoubleSetting (Category *parent, Settings::Manager *values,
|
CSMPrefs::DoubleSetting::DoubleSetting (Category *parent, Settings::Manager *values,
|
||||||
QMutex *mutex, const std::string& key, const std::string& label, double default_)
|
QMutex *mutex, const std::string& key, const std::string& label, double default_)
|
||||||
: Setting (parent, values, mutex, key, label),
|
: Setting (parent, values, mutex, key, label),
|
||||||
mMin (0), mMax (std::numeric_limits<double>::max()),
|
mPrecision(2), mMin (0), mMax (std::numeric_limits<double>::max()),
|
||||||
mDefault (default_)
|
mDefault (default_)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
CSMPrefs::DoubleSetting& CSMPrefs::DoubleSetting::setPrecision(int precision)
|
||||||
|
{
|
||||||
|
mPrecision = precision;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
CSMPrefs::DoubleSetting& CSMPrefs::DoubleSetting::setRange (double min, double max)
|
CSMPrefs::DoubleSetting& CSMPrefs::DoubleSetting::setRange (double min, double max)
|
||||||
{
|
{
|
||||||
mMin = min;
|
mMin = min;
|
||||||
|
@ -49,6 +55,7 @@ std::pair<QWidget *, QWidget *> CSMPrefs::DoubleSetting::makeWidgets (QWidget *p
|
||||||
QLabel *label = new QLabel (QString::fromUtf8 (getLabel().c_str()), parent);
|
QLabel *label = new QLabel (QString::fromUtf8 (getLabel().c_str()), parent);
|
||||||
|
|
||||||
QDoubleSpinBox *widget = new QDoubleSpinBox (parent);
|
QDoubleSpinBox *widget = new QDoubleSpinBox (parent);
|
||||||
|
widget->setDecimals(mPrecision);
|
||||||
widget->setRange (mMin, mMax);
|
widget->setRange (mMin, mMax);
|
||||||
widget->setValue (mDefault);
|
widget->setValue (mDefault);
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ namespace CSMPrefs
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
int mPrecision;
|
||||||
double mMin;
|
double mMin;
|
||||||
double mMax;
|
double mMax;
|
||||||
std::string mTooltip;
|
std::string mTooltip;
|
||||||
|
@ -21,6 +22,8 @@ namespace CSMPrefs
|
||||||
double default_);
|
double default_);
|
||||||
|
|
||||||
// defaults to [0, std::numeric_limits<double>::max()]
|
// defaults to [0, std::numeric_limits<double>::max()]
|
||||||
|
DoubleSetting& setPrecision (int precision);
|
||||||
|
|
||||||
DoubleSetting& setRange (double min, double max);
|
DoubleSetting& setRange (double min, double max);
|
||||||
|
|
||||||
DoubleSetting& setMin (double min);
|
DoubleSetting& setMin (double min);
|
||||||
|
|
|
@ -172,7 +172,7 @@ void CSMPrefs::State::declare()
|
||||||
inputButtons.add (left).add (cLeft).add (right).add (cRight).add (middle).add (cMiddle);
|
inputButtons.add (left).add (cLeft).add (right).add (cRight).add (middle).add (cMiddle);
|
||||||
declareEnum ("p-navi", "Primary Camera Navigation Button", left).addValues (inputButtons);
|
declareEnum ("p-navi", "Primary Camera Navigation Button", left).addValues (inputButtons);
|
||||||
declareEnum ("s-navi", "Secondary Camera Navigation Button", cLeft).addValues (inputButtons);
|
declareEnum ("s-navi", "Secondary Camera Navigation Button", cLeft).addValues (inputButtons);
|
||||||
declareDouble ("p-navi-sensitivity", "Camera Sensitivity", 1/650.).setRange(-2.0, 2.0);
|
declareDouble ("p-navi-sensitivity", "Camera Sensitivity", 1/650.).setPrecision(4).setRange(-2.0, 2.0);
|
||||||
declareDouble ("s-navi-sensitivity", "Secondary Camera Movement Sensitivity", 50.0).setRange(-1000.0, 1000.0);
|
declareDouble ("s-navi-sensitivity", "Secondary Camera Movement Sensitivity", 50.0).setRange(-1000.0, 1000.0);
|
||||||
declareDouble ("navi-wheel-factor", "Camera Zoom Sensitivity", 8).setRange(-100.0, 100.0);
|
declareDouble ("navi-wheel-factor", "Camera Zoom Sensitivity", 8).setRange(-100.0, 100.0);
|
||||||
declareDouble ("navi-free-lin-speed", "Free Camera Linear Speed", 1000.0).setRange(1.0, 10000.0);
|
declareDouble ("navi-free-lin-speed", "Free Camera Linear Speed", 1000.0).setRange(1.0, 10000.0);
|
||||||
|
|
Loading…
Reference in a new issue