GH-1675 reimplement suspesion of log watch

This commit is contained in:
Petr Mrázek 2016-10-11 21:34:02 +02:00
parent 6e80f03409
commit f07496ac6d
4 changed files with 12 additions and 7 deletions

View File

@ -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();

View File

@ -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)

View File

@ -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)

View File

@ -76,12 +76,6 @@ private:
Ui::LogPage *ui;
InstancePtr m_instance;
std::shared_ptr<LaunchTask> 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;