launchbox: remove ::Pulse, simplify settings storage
Change-Id: Ie1a6ccb083498f7405909911e4f202ee11a8ac0b Reviewed-on: https://review.haiku-os.org/c/haiku/+/9878 Tested-by: Commit checker robot <[email protected]> Reviewed-by: nephele nephele <[email protected]>
This commit is contained in:
committed by
nephele nephele
parent
8d82659f43
commit
234a85bb17
@@ -25,24 +25,23 @@
|
||||
App::App()
|
||||
:
|
||||
BApplication("application/x-vnd.Haiku-LaunchBox"),
|
||||
fSettingsChanged(false),
|
||||
fNamePanelSize(200, 50),
|
||||
fAutoStart(false)
|
||||
{
|
||||
SetPulseRate(3000000);
|
||||
|
||||
}
|
||||
|
||||
|
||||
App::~App()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
App::QuitRequested()
|
||||
{
|
||||
_StoreSettingsIfNeeded();
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -101,14 +100,15 @@ App::MessageReceived(BMessage* message)
|
||||
if (wasCloned)
|
||||
window->MoveBy(10, 10);
|
||||
window->Show();
|
||||
fSettingsChanged = true;
|
||||
_StoreSettings();
|
||||
break;
|
||||
}
|
||||
case MSG_TOGGLE_AUTOSTART:
|
||||
ToggleAutoStart();
|
||||
fAutoStart = !AutoStart();
|
||||
_StoreSettings();
|
||||
break;
|
||||
case MSG_SETTINGS_CHANGED:
|
||||
fSettingsChanged = true;
|
||||
_StoreSettings();
|
||||
break;
|
||||
default:
|
||||
BApplication::MessageReceived(message);
|
||||
@@ -117,13 +117,6 @@ App::MessageReceived(BMessage* message)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
App::Pulse()
|
||||
{
|
||||
_StoreSettingsIfNeeded();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
App::SetNamePanelSize(const BSize& size)
|
||||
{
|
||||
@@ -134,14 +127,6 @@ App::SetNamePanelSize(const BSize& size)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
App::ToggleAutoStart()
|
||||
{
|
||||
fSettingsChanged = true;
|
||||
fAutoStart = !AutoStart();
|
||||
}
|
||||
|
||||
|
||||
BSize
|
||||
App::NamePanelSize()
|
||||
{
|
||||
@@ -155,11 +140,8 @@ App::NamePanelSize()
|
||||
|
||||
|
||||
void
|
||||
App::_StoreSettingsIfNeeded()
|
||||
App::_StoreSettings()
|
||||
{
|
||||
if (!fSettingsChanged)
|
||||
return;
|
||||
|
||||
BMessage settings('sett');
|
||||
for (int32 i = 0; BWindow* window = WindowAt(i); i++) {
|
||||
if (MainWindow* padWindow = dynamic_cast<MainWindow*>(window)) {
|
||||
@@ -177,6 +159,4 @@ App::_StoreSettingsIfNeeded()
|
||||
settings.AddBool("autostart", AutoStart());
|
||||
|
||||
save_settings(&settings, "main_settings", "LaunchBox");
|
||||
|
||||
fSettingsChanged = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,21 +22,17 @@ public:
|
||||
virtual bool QuitRequested();
|
||||
virtual void ReadyToRun();
|
||||
virtual void MessageReceived(BMessage* message);
|
||||
virtual void Pulse();
|
||||
|
||||
void SetNamePanelSize(const BSize& size);
|
||||
BSize NamePanelSize();
|
||||
void ToggleAutoStart();
|
||||
bool AutoStart() { return fAutoStart; }
|
||||
|
||||
private:
|
||||
void _StoreSettingsIfNeeded();
|
||||
|
||||
bool fSettingsChanged;
|
||||
void _StoreSettings();
|
||||
|
||||
BSize fNamePanelSize;
|
||||
bool fAutoStart;
|
||||
};
|
||||
|
||||
|
||||
#endif // APP_H
|
||||
#endif // APP_H
|
||||
|
||||
Reference in New Issue
Block a user