Error appearance of upload notification and dividing lines with lesser impotance of spaces

This commit is contained in:
David Kocik 2021-04-11 11:47:20 +02:00
parent d7b385f144
commit 429675db2d
2 changed files with 157 additions and 55 deletions

View file

@ -240,11 +240,9 @@ private:
EState get_state() const { return m_state; }
bool is_hovered() const { return m_state == EState::Hovered; }
void set_hovered() { if (m_state != EState::Finished && m_state != EState::ClosePending && m_state != EState::Hidden && m_state != EState::Unknown) m_state = EState::Hovered; }
protected:
// Call after every size change
virtual void init();
// Part of init()
virtual void count_spaces();
// Calculetes correct size but not se it in imgui!
virtual void set_next_window_size(ImGuiWrapper& imgui);
virtual void render_text(ImGuiWrapper& imgui,
@ -258,13 +256,20 @@ private:
const std::string text,
bool more = false);
// Left sign could be error or warning sign
void render_left_sign(ImGuiWrapper& imgui);
virtual void render_left_sign(ImGuiWrapper& imgui);
virtual void render_minimize_button(ImGuiWrapper& imgui,
const float win_pos_x, const float win_pos_y);
// Hypertext action, returns true if notification should close.
// Action is stored in NotificationData::callback as std::function<bool(wxEvtHandler*)>
virtual bool on_text_click();
protected:
// Part of init(), counts horizontal spacing like left indentation
virtual void count_spaces();
// Part of init(), counts end lines
virtual void count_lines();
// returns true if PopStyleColor should be called later to pop this push
virtual bool push_background_color();
const NotificationData m_data;
// For reusing ImGUI windows.
NotificationIDProvider &m_id_provider;
@ -367,7 +372,8 @@ private:
virtual void set_percentage(float percent) { m_percentage = percent; }
protected:
virtual void init() override;
virtual void count_spaces() override;
virtual void count_lines() override;
virtual void render_text(ImGuiWrapper& imgui,
const float win_size_x, const float win_size_y,
const float win_pos_x, const float win_pos_y) override;
@ -378,6 +384,8 @@ private:
const float win_size_x, const float win_size_y,
const float win_pos_x, const float win_pos_y)
{}
virtual void render_minimize_button(ImGuiWrapper& imgui,
const float win_pos_x, const float win_pos_y) override {}
float m_percentage;
bool m_has_cancel_button {false};
@ -404,20 +412,23 @@ private:
{
m_has_cancel_button = true;
}
virtual void init() override;
static std::string get_upload_job_text(int id, const std::string& filename, const std::string& host) { return /*"[" + std::to_string(id) + "] " + */filename + " -> " + host; }
virtual void set_percentage(float percent) override;
void cancel() { m_uj_state = UploadJobState::PB_CANCELLED; m_has_cancel_button = false; }
void error() { m_uj_state = UploadJobState::PB_ERROR; m_has_cancel_button = false; }
void error() { m_uj_state = UploadJobState::PB_ERROR; m_has_cancel_button = false; init(); }
bool compare_job_id(const int other_id) const { return m_job_id == other_id; }
virtual bool compare_text(const std::string& text) const override { return false; }
protected:
virtual void init() override;
virtual void count_spaces() override;
virtual bool push_background_color() override;
virtual void render_bar(ImGuiWrapper& imgui,
const float win_size_x, const float win_size_y,
const float win_pos_x, const float win_pos_y) override;
virtual void render_cancel_button(ImGuiWrapper& imgui,
const float win_size_x, const float win_size_y,
const float win_pos_x, const float win_pos_y) override;
virtual void render_left_sign(ImGuiWrapper& imgui) override;
// Identifies job in cancel callback
int m_job_id;
// Size of uploaded size to be displayed in MB