mirror of
https://github.com/Sani7/remote-ui.git
synced 2026-10-26 21:51:13 +01:00
UI statusbar
add timeout read fix for not initializing timeout
This commit is contained in:
@@ -1,12 +1,11 @@
|
|||||||
#include "ui_status_bar.hpp"
|
#include "ui_status_bar.hpp"
|
||||||
|
|
||||||
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), m_timeout(0)
|
||||||
{
|
{
|
||||||
setup_item(true, false, false);
|
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_timeout(0)
|
||||||
: UI_item(UI_STATUS_BAR_TYPE, parent)
|
|
||||||
{
|
{
|
||||||
m_text = message;
|
m_text = message;
|
||||||
setup_item(true, false, false);
|
setup_item(true, false, false);
|
||||||
@@ -14,6 +13,7 @@ UI_status_bar::UI_status_bar(std::string message, QObject *parent)
|
|||||||
|
|
||||||
void UI_status_bar::show_message(std::string message, size_t timeout)
|
void UI_status_bar::show_message(std::string message, size_t timeout)
|
||||||
{
|
{
|
||||||
|
// This should work because the message gets only send once when it changes
|
||||||
m_text = message;
|
m_text = message;
|
||||||
m_timeout = timeout;
|
m_timeout = timeout;
|
||||||
emit ui_changed();
|
emit ui_changed();
|
||||||
@@ -24,6 +24,11 @@ std::string UI_status_bar::message() const
|
|||||||
return m_text;
|
return m_text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t UI_status_bar::timeout() const
|
||||||
|
{
|
||||||
|
return m_timeout;
|
||||||
|
}
|
||||||
|
|
||||||
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);
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ class UI_status_bar : public UI_item
|
|||||||
|
|
||||||
void show_message(std::string message, size_t timeout = 0);
|
void show_message(std::string message, size_t timeout = 0);
|
||||||
std::string message() const;
|
std::string message() const;
|
||||||
|
size_t timeout() const;
|
||||||
|
|
||||||
void from_json(const json &j) override;
|
void from_json(const json &j) override;
|
||||||
json to_json(size_t id) const override;
|
json to_json(size_t id) const override;
|
||||||
|
|||||||
Reference in New Issue
Block a user