From f07496ac6d42986266f3bff5093fa0009521ecd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Tue, 11 Oct 2016 21:34:02 +0200 Subject: [PATCH] GH-1675 reimplement suspesion of log watch --- api/logic/launch/LogModel.cpp | 9 +++++++++ api/logic/launch/LogModel.h | 2 ++ application/pages/LogPage.cpp | 2 +- application/pages/LogPage.h | 6 ------ 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/api/logic/launch/LogModel.cpp b/api/logic/launch/LogModel.cpp index c12a0488..869c00f9 100644 --- a/api/logic/launch/LogModel.cpp +++ b/api/logic/launch/LogModel.cpp @@ -34,6 +34,10 @@ QVariant LogModel::data(const QModelIndex &index, int role) const void LogModel::append(MessageLevel::Enum level, QString line) { + if(m_suspended) + { + return; + } int lineNum = (m_firstLine + m_numLines) % m_maxLines; // overflow if(m_numLines == m_maxLines) @@ -60,6 +64,11 @@ void LogModel::append(MessageLevel::Enum level, QString line) endInsertRows(); } +void LogModel::suspend(bool suspend) +{ + m_suspended = suspend; +} + void LogModel::clear() { beginResetModel(); diff --git a/api/logic/launch/LogModel.h b/api/logic/launch/LogModel.h index 87e6b583..558242d8 100644 --- a/api/logic/launch/LogModel.h +++ b/api/logic/launch/LogModel.h @@ -17,6 +17,7 @@ public: void append(MessageLevel::Enum, QString line); void clear(); + void suspend(bool suspend); QString toPlainText(); @@ -45,6 +46,7 @@ private: /* data */ int m_numLines = 0; bool m_stopOnOverflow = false; QString m_overflowMessage = "OVERFLOW"; + bool m_suspended = false; private: Q_DISABLE_COPY(LogModel) diff --git a/application/pages/LogPage.cpp b/application/pages/LogPage.cpp index e7b670ea..19d1c7fe 100644 --- a/application/pages/LogPage.cpp +++ b/application/pages/LogPage.cpp @@ -240,7 +240,7 @@ void LogPage::on_btnBottom_clicked() void LogPage::on_trackLogCheckbox_clicked(bool checked) { - m_write_active = checked; + m_model->suspend(!checked); } void LogPage::on_wrapCheckbox_clicked(bool checked) diff --git a/application/pages/LogPage.h b/application/pages/LogPage.h index f98b5ecf..37679327 100644 --- a/application/pages/LogPage.h +++ b/application/pages/LogPage.h @@ -76,12 +76,6 @@ private: Ui::LogPage *ui; InstancePtr m_instance; std::shared_ptr m_process; - int m_last_scroll_value = 0; - bool m_scroll_active = true; - int m_saved_offset = 0; - bool m_write_active = true; - bool m_stopOnOverflow = true; - bool m_autoScroll = false; BasePageContainer * m_parentContainer; LogFormatProxyModel * m_proxy;