1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 20:17:44 +00:00

WindowServer+LibGUI+Taskbar: Store window progress as Optional<int>

We were previously using the magical constant -1 to signify that a
window had no progress state. Be more explicit an use an Optional. :^)
This commit is contained in:
Andreas Kling 2021-05-02 10:42:25 +02:00
parent 8af7cda17a
commit cc6db526a6
9 changed files with 20 additions and 21 deletions

View file

@ -48,7 +48,7 @@ public:
void set_modal(bool modal) { m_modal = modal; }
bool is_modal() const { return m_modal; }
void set_progress(int progress)
void set_progress(Optional<int> progress)
{
if (m_progress == progress)
return;
@ -57,7 +57,7 @@ public:
m_button->update();
}
int progress() const { return m_progress; }
Optional<int> progress() const { return m_progress; }
const Gfx::Bitmap* icon() const { return m_icon.ptr(); }
@ -71,7 +71,7 @@ private:
bool m_active { false };
bool m_minimized { false };
bool m_modal { false };
int m_progress { -1 };
Optional<int> m_progress;
};
class WindowList {