Files
remote-ui/UI/ui_status_bar.hpp
sani7 514b3e402a UI
move type names over to enum
2026-04-06 18:55:43 +02:00

63 lines
1.5 KiB
C++

#pragma once
#include "ui_item.hpp"
/**
* @brief Class representing a UI status bar
*
*/
class UI_status_bar : public UI_item
{
Q_OBJECT
public:
/**
* @brief Construct a UI status bar object
*
* @param parent The parent QObject
*/
explicit UI_status_bar(QObject *parent = nullptr);
/**
* @brief Construct a UI status bar object
*
* @param message The initial message
* @param parent The parent QObject
*/
UI_status_bar(std::string message, QObject *parent = nullptr);
/**
* @brief Show a message on the status bar
*
* @param message The message to show
* @param timeout The timeout in milliseconds (0 for no timeout)
*/
void show_message(std::string message, size_t timeout = 0);
/**
* @brief Get the current message
*
* @return std::string The current message
*/
std::string message() const &;
/**
* @brief Get the timeout for the current message
*
* @return size_t The timeout in milliseconds
*/
size_t timeout() const;
/**
* @brief Deserialize the status bar from JSON
*
* @param j The JSON object
*/
void from_json(const json &j) override;
/**
* @brief Serialize the status bar to JSON
*
* @param id The id of the status bar
* @return json The JSON representation of the status bar
*/
json to_json(size_t id) const override;
private:
size_t m_timeout;
};