Disable Touchpad preferences.
Show warning in the touchpad preference dialog box when user is not connected and also disable touchpad preferences except touchpad view. Change-Id: I52b80e834ee3bb37d568aa065942eae405001343 Reviewed-on: https://review.haiku-os.org/c/1344 Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
This commit is contained in:
parent
9f7fb0e5c9
commit
5012906434
@ -37,7 +37,8 @@ public:
|
||||
|
||||
touchpad_settings& Settings()
|
||||
{ return fSettings; }
|
||||
|
||||
bool IsTouchpadConnected()
|
||||
{ return fConnected; }
|
||||
status_t UpdateSettings();
|
||||
|
||||
private:
|
||||
|
@ -271,6 +271,13 @@ TouchpadPrefView::TouchpadPrefView()
|
||||
SetupView();
|
||||
// set view values
|
||||
SetValues(&fTouchpadPref.Settings());
|
||||
if (fTouchpadPref.IsTouchpadConnected() == false) {
|
||||
DisablePref();
|
||||
fShowWarning->SetText(B_TRANSLATE("No touchpad found, the settings "
|
||||
"will have no effect."));
|
||||
}
|
||||
else
|
||||
fShowWarning->Hide();
|
||||
}
|
||||
|
||||
|
||||
@ -457,8 +464,11 @@ TouchpadPrefView::SetupView()
|
||||
new BMessage(REVERT_SETTINGS));
|
||||
fRevertButton->SetEnabled(false);
|
||||
|
||||
fShowWarning = new BStringView("warning", "");
|
||||
|
||||
BLayoutBuilder::Group<>(this, B_VERTICAL)
|
||||
.SetInsets(B_USE_WINDOW_SPACING)
|
||||
.Add(fShowWarning)
|
||||
.Add(scrollBox)
|
||||
.Add(tapBox)
|
||||
.AddGroup(B_HORIZONTAL)
|
||||
@ -485,3 +495,17 @@ TouchpadPrefView::SetValues(touchpad_settings* settings)
|
||||
fScrollAccelSlider->SetValue(settings->scroll_acceleration);
|
||||
fTapSlider->SetValue(settings->tapgesture_sensibility);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TouchpadPrefView::DisablePref()
|
||||
{
|
||||
fTwoFingerBox->SetEnabled(false);
|
||||
fTwoFingerHorizontalBox->SetEnabled(false);
|
||||
fRevertButton->SetEnabled(false);
|
||||
fDefaultButton->SetEnabled(false);
|
||||
fTapSlider->SetEnabled(false);
|
||||
fScrollAccelSlider->SetEnabled(false);
|
||||
fScrollStepXSlider->SetEnabled(false);
|
||||
fScrollStepYSlider->SetEnabled(false);
|
||||
}
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include <Slider.h>
|
||||
#include <View.h>
|
||||
#include <GroupView.h>
|
||||
#include <StringView.h>
|
||||
|
||||
#include "TouchpadPref.h"
|
||||
#include "touchpad_settings.h"
|
||||
@ -91,6 +92,8 @@ public:
|
||||
void SetValues(touchpad_settings *settings);
|
||||
|
||||
private:
|
||||
void DisablePref();
|
||||
|
||||
TouchpadView* fTouchpadView;
|
||||
BCheckBox* fTwoFingerBox;
|
||||
BCheckBox* fTwoFingerHorizontalBox;
|
||||
@ -100,6 +103,7 @@ private:
|
||||
BSlider* fTapSlider;
|
||||
BButton* fDefaultButton;
|
||||
BButton* fRevertButton;
|
||||
BStringView* fShowWarning;
|
||||
|
||||
TouchpadPref fTouchpadPref;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user