mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-20 17:58:18 +03:00
LibGUI: Rename ProgressBar property caption => text and expose to GML
This commit is contained in:
parent
92afdd0c86
commit
de08e7b8c9
Notes:
sideshowbarker
2024-07-19 00:43:55 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/de08e7b8c90
@ -48,6 +48,7 @@
|
||||
|
||||
@GUI::ProgressBar {
|
||||
name: "progressbar"
|
||||
text: "Generating thumbnails: "
|
||||
visible: false
|
||||
}
|
||||
}
|
||||
|
@ -341,7 +341,6 @@ int run_in_windowed_mode(RefPtr<Core::ConfigFile> config, String initial_locatio
|
||||
auto& statusbar = (GUI::StatusBar&)*widget.find_descendant_by_name("statusbar");
|
||||
|
||||
auto& progressbar = (GUI::ProgressBar&)*widget.find_descendant_by_name("progressbar");
|
||||
progressbar.set_caption("Generating thumbnails: ");
|
||||
progressbar.set_format(GUI::ProgressBar::Format::ValueSlashMax);
|
||||
progressbar.set_frame_shape(Gfx::FrameShape::Panel);
|
||||
progressbar.set_frame_shadow(Gfx::FrameShadow::Sunken);
|
||||
|
@ -34,6 +34,7 @@ namespace GUI {
|
||||
|
||||
ProgressBar::ProgressBar()
|
||||
{
|
||||
REGISTER_STRING_PROPERTY("text", text, set_text);
|
||||
}
|
||||
|
||||
ProgressBar::~ProgressBar()
|
||||
@ -70,7 +71,7 @@ void ProgressBar::paint_event(PaintEvent& event)
|
||||
// Then we draw the progress text over the gradient.
|
||||
// We draw it twice, once offset (1, 1) for a drop shadow look.
|
||||
StringBuilder builder;
|
||||
builder.append(m_caption);
|
||||
builder.append(m_text);
|
||||
if (m_format == Format::Percentage) {
|
||||
float range_size = m_max - m_min;
|
||||
float progress = (m_value - m_min) / range_size;
|
||||
|
@ -44,8 +44,8 @@ public:
|
||||
int min() const { return m_min; }
|
||||
int max() const { return m_max; }
|
||||
|
||||
String caption() const { return m_caption; }
|
||||
void set_caption(const StringView& caption) { m_caption = caption; }
|
||||
String text() const { return m_text; }
|
||||
void set_text(String text) { m_text = move(text); }
|
||||
|
||||
enum Format {
|
||||
NoText,
|
||||
@ -65,7 +65,7 @@ private:
|
||||
int m_min { 0 };
|
||||
int m_max { 100 };
|
||||
int m_value { 0 };
|
||||
String m_caption;
|
||||
String m_text;
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user