Save window rects & tab selection

This commit is contained in:
Jaidyn Ann 2021-03-02 19:41:26 -06:00
parent faccada3f0
commit c87faea937
7 changed files with 33 additions and 13 deletions

View File

@ -25,9 +25,6 @@ Important improvements:
Nice Improvements: Nice Improvements:
* Save window positions
* Main window
* Subscription-edit window
* Proper scripting support * Proper scripting support
* Show in desktray * Show in desktray
* Store feeds in kEnqueueFeeds/etc messages as paths? hmm * Store feeds in kEnqueueFeeds/etc messages as paths? hmm
@ -35,12 +32,5 @@ Nice Improvements:
processing, the changes will be applied. processing, the changes will be applied.
* Move the provisional BList download queue to a BJob + JobQueue system * Move the provisional BList download queue to a BJob + JobQueue system
* This might add some more flexibility * This might add some more flexibility
* Multiple downloads at once? * Multiple downloads at once
* Array of thread_ids for multiple DL threads? * Array of thread_ids for multiple DL threads?
* In which case, it'd probably make sense to only spin them
up as necessary, and kill when everything's done.
* That'd require a proper queue system, instead of just
spamming data to the download thread lol
* Using a proper queue list would give faster
results to Notifer about how many feeds are
enqueued (so things *feel* faster)

View File

@ -21,7 +21,7 @@
FeedEditWindow::FeedEditWindow() FeedEditWindow::FeedEditWindow()
: :
BWindow(BRect(BPoint(-1000.0, -1000.0), BSize(500, 150)), "New Feed", BWindow(((App*)be_app)->fPreferences->fFeedEditRect, "New Feed",
B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE) B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE)
{ {
_InitInterface(); _InitInterface();
@ -53,6 +53,12 @@ FeedEditWindow::FeedEditWindow(FeedListItem* feedItem)
} }
FeedEditWindow::~FeedEditWindow()
{
((App*)be_app)->fPreferences->fFeedEditRect = ConvertToScreen(Bounds());
}
void void
FeedEditWindow::MessageReceived(BMessage* msg) FeedEditWindow::MessageReceived(BMessage* msg)
{ {

View File

@ -26,6 +26,7 @@ public:
FeedEditWindow(); FeedEditWindow();
FeedEditWindow(BEntry feedEntry); FeedEditWindow(BEntry feedEntry);
FeedEditWindow(FeedListItem* feedItem); FeedEditWindow(FeedListItem* feedItem);
~FeedEditWindow();
void MessageReceived(BMessage* msg); void MessageReceived(BMessage* msg);

View File

@ -25,7 +25,7 @@
MainWindow::MainWindow() MainWindow::MainWindow()
: :
BWindow(BRect(BPoint(-1000.0, -1000.0), BSize(520, 380)), "Pogger", BWindow(((App*)be_app)->fPreferences->fMainWindowRect, "Pogger",
B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE) B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE)
{ {
_InitInterface(); _InitInterface();
@ -33,6 +33,13 @@ MainWindow::MainWindow()
} }
MainWindow::~MainWindow()
{
((App*)be_app)->fPreferences->fMainWindowRect = ConvertToScreen(Bounds());
((App*)be_app)->fPreferences->fTabSelection = fTabView->Selection();
}
void void
MainWindow::MessageReceived(BMessage *msg) MainWindow::MessageReceived(BMessage *msg)
{ {
@ -92,6 +99,7 @@ MainWindow::_InitInterface()
fTabView->AddTab(fEntriesView); fTabView->AddTab(fEntriesView);
fTabView->AddTab(fUpdatesView); fTabView->AddTab(fUpdatesView);
fTabView->SetBorder(B_NO_BORDER); fTabView->SetBorder(B_NO_BORDER);
fTabView->Select(((App*)be_app)->fPreferences->fTabSelection);
fBaseView->AddChild(fTabView); fBaseView->AddChild(fTabView);
// Bottom bar // Bottom bar

View File

@ -16,6 +16,7 @@ class UpdatesView;
class MainWindow : public BWindow { class MainWindow : public BWindow {
public: public:
MainWindow(); MainWindow();
~MainWindow();
void MessageReceived(BMessage*); void MessageReceived(BMessage*);

View File

@ -40,6 +40,12 @@ Preferences::Load()
fNewNotify = storage.GetBool("notifyNew", true); fNewNotify = storage.GetBool("notifyNew", true);
fFailureNotify = storage.GetBool("notifyFailure", true); fFailureNotify = storage.GetBool("notifyFailure", true);
fUpdateInterval = storage.GetInt8("updateInterval", 1); fUpdateInterval = storage.GetInt8("updateInterval", 1);
fMainWindowRect = storage.GetRect("mainWindow",
BRect(BPoint(-1000.0, -1000.0), BSize(520, 380)));
fFeedEditRect = storage.GetRect("feedEditWindow",
BRect(BPoint(-1000.0, -1000.0), BSize(500, 150)));
fTabSelection = storage.GetInt32("tabSelection", 0);
} }
@ -73,6 +79,10 @@ Preferences::Save()
storage.AddBool("notifyFailure", fFailureNotify); storage.AddBool("notifyFailure", fFailureNotify);
storage.AddInt8("updateInterval", fUpdateInterval); storage.AddInt8("updateInterval", fUpdateInterval);
storage.AddRect("mainWindow", fMainWindowRect);
storage.AddRect("feedEditWindow", fFeedEditRect);
storage.AddInt32("tabSelection", fTabSelection);
storage.Flatten(file); storage.Flatten(file);
} }

View File

@ -44,6 +44,10 @@ public:
bool fFailureNotify; bool fFailureNotify;
int8 fOpenAs; int8 fOpenAs;
BRect fMainWindowRect;
BRect fFeedEditRect;
int32 fTabSelection;
private: private:
int8 fUpdateInterval; int8 fUpdateInterval;