Fix #3545
This commit is contained in:
parent
2a9c7c5b21
commit
7b3540e4ee
@ -5,14 +5,12 @@
|
||||
<model id="model" width="100%" layout="horizontal-row" height="100%">
|
||||
</model>
|
||||
</div>
|
||||
<div width="20%" height="fit" text-align="left" layout="horizontal-row" >
|
||||
<checkbox id="toggle-slider" />
|
||||
<spacer width="40"/>
|
||||
<label id="toggle-text"/>
|
||||
<div width="40%" height="fit" text-align="left" layout="horizontal-row" >
|
||||
<spinner id="toggle-slider" width="100%" min_value="0" max_value="1" wrap_around="true"/>
|
||||
</div>
|
||||
<spacer height="30" width="10"/>
|
||||
<div height="fit" width="100%" layout="horizontal-row">
|
||||
<gauge id="color-slider" min_value="1" max_value="100" proportion="1"/>
|
||||
<gauge id="color-slider" min_value="1" max_value="100" proportion="1" wrap_around="true"/>
|
||||
</div>
|
||||
<spacer height="30" width="10"/>
|
||||
<button id="close" text="Apply" align="center"/>
|
||||
|
@ -25,7 +25,6 @@
|
||||
#include "graphics/irr_driver.hpp"
|
||||
#include "graphics/render_info.hpp"
|
||||
#include "guiengine/engine.hpp"
|
||||
#include "guiengine/widgets/check_box_widget.hpp"
|
||||
#include "guiengine/widgets/label_widget.hpp"
|
||||
#include "guiengine/widgets/model_view_widget.hpp"
|
||||
#include "guiengine/widgets/spinner_widget.hpp"
|
||||
@ -41,14 +40,17 @@ KartColorSliderDialog::KartColorSliderDialog(PlayerProfile* pp)
|
||||
m_player_profile = pp;
|
||||
|
||||
// I18N: In kart color choosing dialog
|
||||
m_original_color = _("Use original color");
|
||||
core::stringw original_color = _("Use original color");
|
||||
// I18N: In kart color choosing dialog
|
||||
m_choose_color = _("Pick a color from slider");
|
||||
core::stringw choose_color = _("Pick a color from slider");
|
||||
|
||||
m_toggle_slider->clearLabels();
|
||||
m_toggle_slider->addLabel(original_color);
|
||||
m_toggle_slider->addLabel(choose_color);
|
||||
|
||||
if (m_player_profile->getDefaultKartColor() != 0.0f)
|
||||
{
|
||||
m_toggle_slider->setState(true);
|
||||
m_toggle_text->setText(m_choose_color, false);
|
||||
m_toggle_slider->setValue(1);
|
||||
m_color_slider->setActive(true);
|
||||
m_color_slider->setValue(int(
|
||||
m_player_profile->getDefaultKartColor() * 100.0f));
|
||||
@ -57,8 +59,7 @@ KartColorSliderDialog::KartColorSliderDialog(PlayerProfile* pp)
|
||||
}
|
||||
else
|
||||
{
|
||||
m_toggle_slider->setState(false);
|
||||
m_toggle_text->setText(m_original_color, false);
|
||||
m_toggle_slider->setValue(0);
|
||||
m_color_slider->setActive(false);
|
||||
m_model_view->getModelViewRenderInfo()->setHue(0.0f);
|
||||
}
|
||||
@ -148,26 +149,23 @@ void KartColorSliderDialog::beforeAddingWidgets()
|
||||
|
||||
m_model_view->setRotateContinuously(35.0f);
|
||||
m_model_view->update(0);
|
||||
m_toggle_slider = getWidget<CheckBoxWidget>("toggle-slider");
|
||||
m_toggle_text = getWidget<LabelWidget>("toggle-text");
|
||||
m_toggle_slider = getWidget<SpinnerWidget>("toggle-slider");
|
||||
m_color_slider = getWidget<SpinnerWidget>("color-slider");
|
||||
} // beforeAddingWidgets
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
void KartColorSliderDialog::toggleSlider()
|
||||
{
|
||||
if (m_toggle_slider->getState())
|
||||
if (m_toggle_slider->getValue() == 1)
|
||||
{
|
||||
m_color_slider->setActive(true);
|
||||
m_color_slider->setValue(100);
|
||||
m_model_view->getModelViewRenderInfo()->setHue(1.0f);
|
||||
m_toggle_text->setText(m_choose_color, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_color_slider->setActive(false);
|
||||
m_model_view->getModelViewRenderInfo()->setHue(0.0f);
|
||||
m_toggle_text->setText(m_original_color, false);
|
||||
}
|
||||
} // toggleSlider
|
||||
|
||||
@ -187,7 +185,7 @@ GUIEngine::EventPropagation
|
||||
else if (eventSource == "close")
|
||||
{
|
||||
float color = 0.0f;
|
||||
if (m_toggle_slider->getState())
|
||||
if (m_toggle_slider->getValue() == 1)
|
||||
color = float(m_color_slider->getValue()) / 100.0f;
|
||||
m_player_profile->setDefaultKartColor(color);
|
||||
ModalDialog::dismiss();
|
||||
|
@ -26,7 +26,6 @@ class PlayerProfile;
|
||||
namespace GUIEngine
|
||||
{
|
||||
class CheckBoxWidget;
|
||||
class LabelWidget;
|
||||
class ModelViewWidget;
|
||||
class SpinnerWidget;
|
||||
}
|
||||
@ -39,16 +38,12 @@ class KartColorSliderDialog : public GUIEngine::ModalDialog
|
||||
private:
|
||||
PlayerProfile* m_player_profile;
|
||||
|
||||
GUIEngine::CheckBoxWidget* m_toggle_slider;
|
||||
|
||||
GUIEngine::LabelWidget* m_toggle_text;
|
||||
GUIEngine::SpinnerWidget* m_toggle_slider;
|
||||
|
||||
GUIEngine::ModelViewWidget* m_model_view;
|
||||
|
||||
GUIEngine::SpinnerWidget* m_color_slider;
|
||||
|
||||
core::stringw m_original_color, m_choose_color;
|
||||
|
||||
void toggleSlider();
|
||||
public:
|
||||
KartColorSliderDialog(PlayerProfile* pp);
|
||||
|
Loading…
Reference in New Issue
Block a user