mirror of
https://github.com/Sani7/remote-ui.git
synced 2026-10-27 06:01:14 +01:00
UI status bar
Uses base class text for status bar message
This commit is contained in:
@@ -2,36 +2,37 @@
|
|||||||
|
|
||||||
UI_status_bar::UI_status_bar(QObject *parent) : UI_item{UI_STATUS_BAR_TYPE, parent}
|
UI_status_bar::UI_status_bar(QObject *parent) : UI_item{UI_STATUS_BAR_TYPE, parent}
|
||||||
{
|
{
|
||||||
|
setup_item(true, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
UI_status_bar::UI_status_bar(std::string message, QObject *parent)
|
UI_status_bar::UI_status_bar(std::string message, QObject *parent)
|
||||||
: UI_item(UI_STATUS_BAR_TYPE, parent), m_current_message(message)
|
: UI_item(UI_STATUS_BAR_TYPE, parent)
|
||||||
{
|
{
|
||||||
|
m_text = message;
|
||||||
|
setup_item(true, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UI_status_bar::show_message(std::string message, size_t timeout)
|
void UI_status_bar::show_message(std::string message, size_t timeout)
|
||||||
{
|
{
|
||||||
m_current_message = message;
|
m_text = message;
|
||||||
m_timeout = timeout;
|
m_timeout = timeout;
|
||||||
emit ui_changed();
|
emit ui_changed();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string UI_status_bar::message() const
|
std::string UI_status_bar::message() const
|
||||||
{
|
{
|
||||||
return m_current_message;
|
return m_text;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UI_status_bar::from_json(const json &j)
|
void UI_status_bar::from_json(const json &j)
|
||||||
{
|
{
|
||||||
UI_item::from_json(j);
|
UI_item::from_json(j);
|
||||||
m_current_message = j.at("current_message");
|
|
||||||
m_timeout = j.at("timeout");
|
m_timeout = j.at("timeout");
|
||||||
}
|
}
|
||||||
|
|
||||||
json UI_status_bar::to_json(size_t id) const
|
json UI_status_bar::to_json(size_t id) const
|
||||||
{
|
{
|
||||||
json j = UI_item::to_json(id);
|
json j = UI_item::to_json(id);
|
||||||
j["current_message"] = m_current_message;
|
|
||||||
j["timeout"] = m_timeout;
|
j["timeout"] = m_timeout;
|
||||||
return j;
|
return j;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,5 @@ class UI_status_bar : public UI_item
|
|||||||
json to_json(size_t id) const override;
|
json to_json(size_t id) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string m_current_message;
|
|
||||||
size_t m_timeout;
|
size_t m_timeout;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -775,9 +775,9 @@ void Simulator_base::process_ui_status_bar(json &ui_item, QWidget *widget)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status_bar->currentMessage() != QString::fromStdString(ui_item.at("current_message")))
|
if (status_bar->currentMessage() != QString::fromStdString(ui_item.at("text")))
|
||||||
{
|
{
|
||||||
status_bar->showMessage(QString::fromStdString(ui_item.at("current_message")), ui_item.at("timeout"));
|
status_bar->showMessage(QString::fromStdString(ui_item.at("text")), ui_item.at("timeout"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user