Save weights of main window's SplitViews
This commit is contained in:
parent
ebc9d4041f
commit
7ec20a45ad
|
@ -46,6 +46,9 @@ AppPreferences::Load()
|
|||
IgnoreEmoticons = settings.GetBool("IgnoreEmoticons", true);
|
||||
HideOffline = settings.GetBool("HideOffline", false);
|
||||
|
||||
MainWindowListWeight = settings.GetFloat("MainWindowListWeight", 1);
|
||||
MainWindowChatWeight = settings.GetFloat("MainWindowChatWeight", 5);
|
||||
|
||||
MainWindowRect = settings.GetRect("MainWindowRect", BRect(0, 0, 600, 400));
|
||||
}
|
||||
|
||||
|
@ -54,7 +57,7 @@ void
|
|||
AppPreferences::Save()
|
||||
{
|
||||
const char* path = _PreferencesPath();
|
||||
BFile file(_PreferencesPath(), B_WRITE_ONLY);
|
||||
BFile file(_PreferencesPath(), B_WRITE_ONLY | B_CREATE_FILE);
|
||||
|
||||
BMessage settings;
|
||||
settings.AddBool("MoveToCurrentWorkpace", MoveToCurrentWorkspace);
|
||||
|
@ -70,6 +73,9 @@ AppPreferences::Save()
|
|||
settings.AddBool("IgnoreEmoticons", IgnoreEmoticons);
|
||||
settings.AddBool("HideOffline", HideOffline);
|
||||
|
||||
settings.AddFloat("MainWindowListWeight", MainWindowListWeight);
|
||||
settings.AddFloat("MainWindowChatWeight", MainWindowChatWeight);
|
||||
|
||||
settings.AddRect("MainWindowRect", MainWindowRect);
|
||||
|
||||
if (file.InitCheck() == B_OK)
|
||||
|
|
|
@ -34,6 +34,9 @@ public:
|
|||
|
||||
bool HideOffline;
|
||||
|
||||
float MainWindowListWeight;
|
||||
float MainWindowChatWeight;
|
||||
|
||||
BRect MainWindowRect;
|
||||
|
||||
private:
|
||||
|
|
|
@ -87,6 +87,8 @@ MainWindow::QuitRequested()
|
|||
}
|
||||
|
||||
AppPreferences::Get()->MainWindowRect = Frame();
|
||||
AppPreferences::Get()->MainWindowListWeight = fSplitView->ItemWeight(0);
|
||||
AppPreferences::Get()->MainWindowChatWeight = fSplitView->ItemWeight(1);
|
||||
|
||||
if(button_index == 0) {
|
||||
fServer->Quit();
|
||||
|
@ -376,6 +378,9 @@ MainWindow::SetConversation(Conversation* chat)
|
|||
chatMenu->AddItem(item);
|
||||
}
|
||||
}
|
||||
|
||||
fSplitView->SetItemWeight(0, AppPreferences::Get()->MainWindowListWeight, true);
|
||||
fSplitView->SetItemWeight(1, AppPreferences::Get()->MainWindowChatWeight, true);
|
||||
}
|
||||
|
||||
|
||||
|
@ -411,6 +416,7 @@ MainWindow::_InitInterface()
|
|||
// Left side of window, Roomlist + Status
|
||||
fListView = new ConversationListView("roomList");
|
||||
fStatusView = new StatusView("statusView");
|
||||
fSplitView = new BSplitView(B_HORIZONTAL, 0);
|
||||
|
||||
// Right-side of window, Chat + Textbox
|
||||
fRightView = new BSplitView(B_VERTICAL, 0);
|
||||
|
@ -420,7 +426,7 @@ MainWindow::_InitInterface()
|
|||
.Add((fMenuBar = _CreateMenuBar()))
|
||||
.AddGroup(B_HORIZONTAL)
|
||||
.SetInsets(5, 5, 0, 10)
|
||||
.AddSplit(B_HORIZONTAL, 0)
|
||||
.AddSplit(fSplitView)
|
||||
.AddGroup(B_VERTICAL)
|
||||
.Add(fListView, 1)
|
||||
.Add(fStatusView)
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
|
||||
#include "Observer.h"
|
||||
|
||||
//class BMenubar;
|
||||
class BSplitView;
|
||||
class BTextView;
|
||||
|
||||
|
@ -66,6 +65,7 @@ private:
|
|||
// Left panel, chat list
|
||||
ConversationListView* fListView;
|
||||
StatusView* fStatusView;
|
||||
BSplitView* fSplitView;
|
||||
|
||||
// Right panel, chat
|
||||
BSplitView* fRightView;
|
||||
|
|
Ŝarĝante…
Reference in New Issue