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 <[email protected]>
This commit is contained in:
committed by
Adrien Destugues
parent
9f7fb0e5c9
commit
5012906434
@@ -37,7 +37,8 @@ public:
|
|||||||
|
|
||||||
touchpad_settings& Settings()
|
touchpad_settings& Settings()
|
||||||
{ return fSettings; }
|
{ return fSettings; }
|
||||||
|
bool IsTouchpadConnected()
|
||||||
|
{ return fConnected; }
|
||||||
status_t UpdateSettings();
|
status_t UpdateSettings();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -271,6 +271,13 @@ TouchpadPrefView::TouchpadPrefView()
|
|||||||
SetupView();
|
SetupView();
|
||||||
// set view values
|
// set view values
|
||||||
SetValues(&fTouchpadPref.Settings());
|
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));
|
new BMessage(REVERT_SETTINGS));
|
||||||
fRevertButton->SetEnabled(false);
|
fRevertButton->SetEnabled(false);
|
||||||
|
|
||||||
|
fShowWarning = new BStringView("warning", "");
|
||||||
|
|
||||||
BLayoutBuilder::Group<>(this, B_VERTICAL)
|
BLayoutBuilder::Group<>(this, B_VERTICAL)
|
||||||
.SetInsets(B_USE_WINDOW_SPACING)
|
.SetInsets(B_USE_WINDOW_SPACING)
|
||||||
|
.Add(fShowWarning)
|
||||||
.Add(scrollBox)
|
.Add(scrollBox)
|
||||||
.Add(tapBox)
|
.Add(tapBox)
|
||||||
.AddGroup(B_HORIZONTAL)
|
.AddGroup(B_HORIZONTAL)
|
||||||
@@ -485,3 +495,17 @@ TouchpadPrefView::SetValues(touchpad_settings* settings)
|
|||||||
fScrollAccelSlider->SetValue(settings->scroll_acceleration);
|
fScrollAccelSlider->SetValue(settings->scroll_acceleration);
|
||||||
fTapSlider->SetValue(settings->tapgesture_sensibility);
|
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 <Slider.h>
|
||||||
#include <View.h>
|
#include <View.h>
|
||||||
#include <GroupView.h>
|
#include <GroupView.h>
|
||||||
|
#include <StringView.h>
|
||||||
|
|
||||||
#include "TouchpadPref.h"
|
#include "TouchpadPref.h"
|
||||||
#include "touchpad_settings.h"
|
#include "touchpad_settings.h"
|
||||||
@@ -91,6 +92,8 @@ public:
|
|||||||
void SetValues(touchpad_settings *settings);
|
void SetValues(touchpad_settings *settings);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void DisablePref();
|
||||||
|
|
||||||
TouchpadView* fTouchpadView;
|
TouchpadView* fTouchpadView;
|
||||||
BCheckBox* fTwoFingerBox;
|
BCheckBox* fTwoFingerBox;
|
||||||
BCheckBox* fTwoFingerHorizontalBox;
|
BCheckBox* fTwoFingerHorizontalBox;
|
||||||
@@ -100,6 +103,7 @@ private:
|
|||||||
BSlider* fTapSlider;
|
BSlider* fTapSlider;
|
||||||
BButton* fDefaultButton;
|
BButton* fDefaultButton;
|
||||||
BButton* fRevertButton;
|
BButton* fRevertButton;
|
||||||
|
BStringView* fShowWarning;
|
||||||
|
|
||||||
TouchpadPref fTouchpadPref;
|
TouchpadPref fTouchpadPref;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user