summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-12-20 12:29:40 +0100
committerAndreas Kling <kling@serenityos.org>2020-12-20 12:29:40 +0100
commitde08e7b8c90e2eba14e3ed6e05355f1a81f61298 (patch)
tree48e3c1f2677bd53d7d1fb7d92e63478197069889
parent92afdd0c869d9943836492929c8146aa071289f7 (diff)
downloadserenity-de08e7b8c90e2eba14e3ed6e05355f1a81f61298.zip
LibGUI: Rename ProgressBar property caption => text and expose to GML
-rw-r--r--Applications/FileManager/FileManagerWindow.gml1
-rw-r--r--Applications/FileManager/main.cpp1
-rw-r--r--Libraries/LibGUI/ProgressBar.cpp3
-rw-r--r--Libraries/LibGUI/ProgressBar.h6
4 files changed, 6 insertions, 5 deletions
diff --git a/Applications/FileManager/FileManagerWindow.gml b/Applications/FileManager/FileManagerWindow.gml
index bc6c403724..3e38c907f0 100644
--- a/Applications/FileManager/FileManagerWindow.gml
+++ b/Applications/FileManager/FileManagerWindow.gml
@@ -48,6 +48,7 @@
@GUI::ProgressBar {
name: "progressbar"
+ text: "Generating thumbnails: "
visible: false
}
}
diff --git a/Applications/FileManager/main.cpp b/Applications/FileManager/main.cpp
index 8edaa8211d..99d387217d 100644
--- a/Applications/FileManager/main.cpp
+++ b/Applications/FileManager/main.cpp
@@ -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);
diff --git a/Libraries/LibGUI/ProgressBar.cpp b/Libraries/LibGUI/ProgressBar.cpp
index a193f61b48..f09f262248 100644
--- a/Libraries/LibGUI/ProgressBar.cpp
+++ b/Libraries/LibGUI/ProgressBar.cpp
@@ -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;
diff --git a/Libraries/LibGUI/ProgressBar.h b/Libraries/LibGUI/ProgressBar.h
index 9ba6f21297..9c9fddacd7 100644
--- a/Libraries/LibGUI/ProgressBar.h
+++ b/Libraries/LibGUI/ProgressBar.h
@@ -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;
};
}