[haiku-commits] haiku: hrev45345 - src/apps/activitymonitor

  • From: leavengood@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 7 Mar 2013 14:40:15 +0100 (CET)

hrev45345 adds 1 changeset to branch 'master'
old head: b58ffb0b4af5504e251c09b30885823cd384fcd4
new head: f4b00418348b564b3daf32e0c7f937c2a47a5ea3
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=f4b0041+%5Eb58ffb0

----------------------------------------------------------------------------

f4b0041: Save always on top setting and fix style issues.

                                  [ Ryan Leavengood <leavengood@xxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev45345
Commit:      f4b00418348b564b3daf32e0c7f937c2a47a5ea3
URL:         http://cgit.haiku-os.org/haiku/commit/?id=f4b0041
Author:      Ryan Leavengood <leavengood@xxxxxxxxx>
Date:        Thu Mar  7 13:39:27 2013 UTC

----------------------------------------------------------------------------

2 files changed, 25 insertions(+), 7 deletions(-)
src/apps/activitymonitor/ActivityWindow.cpp | 23 ++++++++++++++++++++---
src/apps/activitymonitor/ActivityWindow.h   |  9 +++++----

----------------------------------------------------------------------------

diff --git a/src/apps/activitymonitor/ActivityWindow.cpp 
b/src/apps/activitymonitor/ActivityWindow.cpp
index f74a907..c103c16 100644
--- a/src/apps/activitymonitor/ActivityWindow.cpp
+++ b/src/apps/activitymonitor/ActivityWindow.cpp
@@ -29,9 +29,10 @@
 #undef B_TRANSLATION_CONTEXT
 #define B_TRANSLATION_CONTEXT "ActivityWindow"
 
+
 static const uint32 kMsgAddView = 'advw';
-static const uint32 kMsgShowSettings = 'shst';
 static const uint32 kMsgAlwaysOnTop = 'alot';
+static const uint32 kMsgShowSettings = 'shst';
 
 
 ActivityWindow::ActivityWindow()
@@ -132,9 +133,14 @@ ActivityWindow::ActivityWindow()
        menu = new BMenu(B_TRANSLATE("Settings"));
        menu->AddItem(new BMenuItem(B_TRANSLATE("Settings" B_UTF8_ELLIPSIS),
                new BMessage(kMsgShowSettings)));
+
        menu->AddSeparatorItem();
        fAlwaysOnTop = new BMenuItem(B_TRANSLATE("Always on top"), new 
BMessage(kMsgAlwaysOnTop));
+       bool alwaysOnTop = false;
+       if (settings.FindBool("always on top", &alwaysOnTop) == B_OK)
+               _SetAlwaysOnTop(alwaysOnTop);
        menu->AddItem(fAlwaysOnTop);
+
        menu->SetTargetForItems(this);
        menuBar->AddItem(menu);
 }
@@ -207,8 +213,7 @@ ActivityWindow::MessageReceived(BMessage* message)
 
                case kMsgAlwaysOnTop:
                {
-                       SetFeel(this->IsFloating() ? B_NORMAL_WINDOW_FEEL : 
B_FLOATING_ALL_WINDOW_FEEL);
-                       fAlwaysOnTop->SetMarked(!fAlwaysOnTop->IsMarked());
+                       _SetAlwaysOnTop(!fAlwaysOnTop->IsMarked());
                        break;
                }
 
@@ -311,6 +316,10 @@ ActivityWindow::_SaveSettings()
        if (status != B_OK)
                return status;
 
+       status = settings.AddBool("always on top", fAlwaysOnTop->IsMarked());
+       if (status != B_OK)
+               return status;
+
 #ifdef __HAIKU__
        BView* top = fLayout->View();
 #else
@@ -379,3 +388,11 @@ ActivityWindow::_MessageDropped(BMessage* message)
        }
 }
 
+
+void
+ActivityWindow::_SetAlwaysOnTop(bool alwaysOnTop)
+{
+       SetFeel(alwaysOnTop ? B_FLOATING_ALL_WINDOW_FEEL : 
B_NORMAL_WINDOW_FEEL);
+       fAlwaysOnTop->SetMarked(alwaysOnTop);
+}
+
diff --git a/src/apps/activitymonitor/ActivityWindow.h 
b/src/apps/activitymonitor/ActivityWindow.h
index e7a97d2..0232cd8 100644
--- a/src/apps/activitymonitor/ActivityWindow.h
+++ b/src/apps/activitymonitor/ActivityWindow.h
@@ -31,19 +31,20 @@ public:
                        bigtime_t       RefreshInterval() const;
 
 private:
-                       BMenuItem*      fAlwaysOnTop;
-
                        status_t        _OpenSettings(BFile& file, uint32 mode);
                        status_t        _LoadSettings(BMessage& settings);
                        status_t        _SaveSettings();
 
                        void            _AddDefaultView();
                        void            _MessageDropped(BMessage *message);
+                       void            _SetAlwaysOnTop(bool alwaysOnTop);
 
+       BMenuItem*                      fAlwaysOnTop;
 #ifdef __HAIKU__
-       BGroupLayout*   fLayout;
+       BGroupLayout*           fLayout;
 #endif
-       BMessenger              fSettingsWindow;
+       BMessenger                      fSettingsWindow;
+
 };
 
 static const uint32 kMsgRemoveView = 'rmvw';


Other related posts:

  • » [haiku-commits] haiku: hrev45345 - src/apps/activitymonitor - leavengood