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,23 +25,22 @@
|
|||||||
App::App()
|
App::App()
|
||||||
:
|
:
|
||||||
BApplication("application/x-vnd.Haiku-LaunchBox"),
|
BApplication("application/x-vnd.Haiku-LaunchBox"),
|
||||||
fSettingsChanged(false),
|
|
||||||
fNamePanelSize(200, 50),
|
fNamePanelSize(200, 50),
|
||||||
fAutoStart(false)
|
fAutoStart(false)
|
||||||
{
|
{
|
||||||
SetPulseRate(3000000);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
App::~App()
|
App::~App()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
App::QuitRequested()
|
App::QuitRequested()
|
||||||
{
|
{
|
||||||
_StoreSettingsIfNeeded();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,14 +100,15 @@ App::MessageReceived(BMessage* message)
|
|||||||
if (wasCloned)
|
if (wasCloned)
|
||||||
window->MoveBy(10, 10);
|
window->MoveBy(10, 10);
|
||||||
window->Show();
|
window->Show();
|
||||||
fSettingsChanged = true;
|
_StoreSettings();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MSG_TOGGLE_AUTOSTART:
|
case MSG_TOGGLE_AUTOSTART:
|
||||||
ToggleAutoStart();
|
fAutoStart = !AutoStart();
|
||||||
|
_StoreSettings();
|
||||||
break;
|
break;
|
||||||
case MSG_SETTINGS_CHANGED:
|
case MSG_SETTINGS_CHANGED:
|
||||||
fSettingsChanged = true;
|
_StoreSettings();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
BApplication::MessageReceived(message);
|
BApplication::MessageReceived(message);
|
||||||
@@ -117,13 +117,6 @@ App::MessageReceived(BMessage* message)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
App::Pulse()
|
|
||||||
{
|
|
||||||
_StoreSettingsIfNeeded();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
App::SetNamePanelSize(const BSize& size)
|
App::SetNamePanelSize(const BSize& size)
|
||||||
{
|
{
|
||||||
@@ -134,14 +127,6 @@ App::SetNamePanelSize(const BSize& size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
App::ToggleAutoStart()
|
|
||||||
{
|
|
||||||
fSettingsChanged = true;
|
|
||||||
fAutoStart = !AutoStart();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
BSize
|
BSize
|
||||||
App::NamePanelSize()
|
App::NamePanelSize()
|
||||||
{
|
{
|
||||||
@@ -155,11 +140,8 @@ App::NamePanelSize()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
App::_StoreSettingsIfNeeded()
|
App::_StoreSettings()
|
||||||
{
|
{
|
||||||
if (!fSettingsChanged)
|
|
||||||
return;
|
|
||||||
|
|
||||||
BMessage settings('sett');
|
BMessage settings('sett');
|
||||||
for (int32 i = 0; BWindow* window = WindowAt(i); i++) {
|
for (int32 i = 0; BWindow* window = WindowAt(i); i++) {
|
||||||
if (MainWindow* padWindow = dynamic_cast<MainWindow*>(window)) {
|
if (MainWindow* padWindow = dynamic_cast<MainWindow*>(window)) {
|
||||||
@@ -177,6 +159,4 @@ App::_StoreSettingsIfNeeded()
|
|||||||
settings.AddBool("autostart", AutoStart());
|
settings.AddBool("autostart", AutoStart());
|
||||||
|
|
||||||
save_settings(&settings, "main_settings", "LaunchBox");
|
save_settings(&settings, "main_settings", "LaunchBox");
|
||||||
|
|
||||||
fSettingsChanged = false;
|
|
||||||
}
|
}
|
||||||
@@ -22,17 +22,13 @@ public:
|
|||||||
virtual bool QuitRequested();
|
virtual bool QuitRequested();
|
||||||
virtual void ReadyToRun();
|
virtual void ReadyToRun();
|
||||||
virtual void MessageReceived(BMessage* message);
|
virtual void MessageReceived(BMessage* message);
|
||||||
virtual void Pulse();
|
|
||||||
|
|
||||||
void SetNamePanelSize(const BSize& size);
|
void SetNamePanelSize(const BSize& size);
|
||||||
BSize NamePanelSize();
|
BSize NamePanelSize();
|
||||||
void ToggleAutoStart();
|
|
||||||
bool AutoStart() { return fAutoStart; }
|
bool AutoStart() { return fAutoStart; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void _StoreSettingsIfNeeded();
|
void _StoreSettings();
|
||||||
|
|
||||||
bool fSettingsChanged;
|
|
||||||
|
|
||||||
BSize fNamePanelSize;
|
BSize fNamePanelSize;
|
||||||
bool fAutoStart;
|
bool fAutoStart;
|
||||||
|
|||||||
Reference in New Issue
Block a user