From b8111b7a22dbc0506442e49b0e8b635aa5758edc Mon Sep 17 00:00:00 2001 From: Jaidyn Ann Date: Thu, 18 Feb 2021 22:38:59 -0600 Subject: [PATCH] Progress bar during updates --- README.txt | 2 +- src/App.cpp | 2 +- src/MainWindow.cpp | 16 ++++++++-------- src/MainWindow.h | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/README.txt b/README.txt index 96d1a4b..7f0b80a 100644 --- a/README.txt +++ b/README.txt @@ -64,5 +64,5 @@ point soon. BORING INFO -------------------------------------------------- Pogger is under the MIT license. -https://git.feneas.org/detruota/pogger +https://github.com/JadedCtrl/Pogger jadedctrl@teknik.io diff --git a/src/App.cpp b/src/App.cpp index a11d268..43b7e1a 100644 --- a/src/App.cpp +++ b/src/App.cpp @@ -80,7 +80,7 @@ App::MessageReceived(BMessage* msg) case kFeedsEdited: case kProgress: { - fMainWindow->MessageReceived(msg); + fMainWindow->PostMessage(msg); break; } case kClearQueue: diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index a849168..8910920 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -60,8 +60,7 @@ MainWindow::MessageReceived(BMessage *msg) if (msg->FindInt32("max", &max) == B_OK && msg->FindInt32("current", ¤t) == B_OK) { - int32 prog = max - current; - printf("%i / %i\n", prog, max); + _UpdateProgress(max, current); } break; } @@ -115,13 +114,14 @@ MainWindow::_InitInterface() void -MainWindow::_UpdateProgress() +MainWindow::_UpdateProgress(int32 max, int32 current) { - fStatusBar->SetTo(50.0); -// if (fInProgress == 0) -// printf("Done!\n"); -// else -// printf("Current: %i\n", fInProgress); + int32 prog = max - current; + + fStatusBar->SetMaxValue(max); + fStatusBar->SetTo(prog); + + printf("%i / %i\n", prog, max); } diff --git a/src/MainWindow.h b/src/MainWindow.h index fb96ad0..1fd0955 100644 --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -22,7 +22,7 @@ public: private: void _InitInterface(); - void _UpdateProgress(); + void _UpdateProgress(int32 max, int32 current); BGroupView* fBaseView; BTabView* fTabView;