mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-05 02:33:03 +00:00
FileManager+LibGUI: Show thumbnail generation progress in the statusbar.
This commit is contained in:
parent
32191b0d4b
commit
614dafea32
Notes:
sideshowbarker
2024-07-19 14:56:55 +09:00
Author: https://github.com/awesomekling
Commit: 614dafea32
9 changed files with 63 additions and 11 deletions
|
@ -10,6 +10,7 @@
|
|||
#include <LibGUI/GLabel.h>
|
||||
#include <LibGUI/GInputBox.h>
|
||||
#include <LibGUI/GMessageBox.h>
|
||||
#include <LibGUI/GProgressBar.h>
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
|
@ -50,6 +51,11 @@ int main(int argc, char** argv)
|
|||
auto* directory_view = new DirectoryView(widget);
|
||||
auto* statusbar = new GStatusBar(widget);
|
||||
|
||||
auto* progressbar = new GProgressBar(statusbar);
|
||||
progressbar->set_caption("Generating thumbnails: ");
|
||||
progressbar->set_format(GProgressBar::Format::ValueSlashMax);
|
||||
progressbar->set_visible(false);
|
||||
|
||||
location_textbox->on_return_pressed = [directory_view] (auto& editor) {
|
||||
directory_view->open(editor.text());
|
||||
};
|
||||
|
@ -138,6 +144,16 @@ int main(int argc, char** argv)
|
|||
statusbar->set_text(move(message));
|
||||
};
|
||||
|
||||
directory_view->on_thumbnail_progress = [&] (int done, int total) {
|
||||
if (done == total) {
|
||||
progressbar->set_visible(false);
|
||||
return;
|
||||
}
|
||||
progressbar->set_range(0, total);
|
||||
progressbar->set_value(done);
|
||||
progressbar->set_visible(true);
|
||||
};
|
||||
|
||||
directory_view->open("/");
|
||||
directory_view->set_focus(true);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue