Revert "NOISSUE rework of minecraft log"

This reverts commit fc198dd308.
This commit is contained in:
Petr Mrázek 2016-08-10 08:41:58 +02:00
parent c60db13af7
commit e2f3652a0f
8 changed files with 195 additions and 451 deletions

View File

@ -119,8 +119,6 @@ set(LAUNCH_SOURCES
launch/LaunchTask.h launch/LaunchTask.h
launch/LoggedProcess.cpp launch/LoggedProcess.cpp
launch/LoggedProcess.h launch/LoggedProcess.h
launch/LogModel.cpp
launch/LogModel.h
launch/MessageLevel.cpp launch/MessageLevel.cpp
launch/MessageLevel.h launch/MessageLevel.h
) )

View File

@ -167,15 +167,6 @@ bool LaunchTask::abort()
return false; return false;
} }
shared_qobject_ptr<LogModel> LaunchTask::getLogModel()
{
if(!m_logModel)
{
m_logModel.reset(new LogModel());
}
return m_logModel;
}
void LaunchTask::onLogLines(const QStringList &lines, MessageLevel::Enum defaultLevel) void LaunchTask::onLogLines(const QStringList &lines, MessageLevel::Enum defaultLevel)
{ {
for (auto & line: lines) for (auto & line: lines)
@ -202,8 +193,7 @@ void LaunchTask::onLogLine(QString line, MessageLevel::Enum level)
// censor private user info // censor private user info
line = censorPrivateInfo(line); line = censorPrivateInfo(line);
auto &model = *getLogModel(); emit log(line, level);
model.append(level, line);
} }
void LaunchTask::emitSucceeded() void LaunchTask::emitSucceeded()

View File

@ -17,8 +17,6 @@
#pragma once #pragma once
#include <QProcess> #include <QProcess>
#include <QObjectPtr.h>
#include "LogModel.h"
#include "BaseInstance.h" #include "BaseInstance.h"
#include "MessageLevel.h" #include "MessageLevel.h"
#include "LoggedProcess.h" #include "LoggedProcess.h"
@ -82,8 +80,6 @@ public: /* methods */
*/ */
virtual bool abort() override; virtual bool abort() override;
shared_qobject_ptr<LogModel> getLogModel();
public: public:
QString substituteVariables(const QString &cmd) const; QString substituteVariables(const QString &cmd) const;
QString censorPrivateInfo(QString in); QString censorPrivateInfo(QString in);
@ -102,6 +98,13 @@ signals:
void requestLogging(); void requestLogging();
/**
* @brief emitted when we want to log something
* @param text the text to log
* @param level the level to log at
*/
void log(QString text, MessageLevel::Enum level = MessageLevel::MultiMC);
public slots: public slots:
void onLogLines(const QStringList& lines, MessageLevel::Enum defaultLevel = MessageLevel::MultiMC); void onLogLines(const QStringList& lines, MessageLevel::Enum defaultLevel = MessageLevel::MultiMC);
void onLogLine(QString line, MessageLevel::Enum defaultLevel = MessageLevel::MultiMC); void onLogLine(QString line, MessageLevel::Enum defaultLevel = MessageLevel::MultiMC);
@ -111,7 +114,6 @@ public slots:
protected: /* data */ protected: /* data */
InstancePtr m_instance; InstancePtr m_instance;
shared_qobject_ptr<LogModel> m_logModel;
QList <std::shared_ptr<LaunchStep>> m_steps; QList <std::shared_ptr<LaunchStep>> m_steps;
QMap<QString, QString> m_censorFilter; QMap<QString, QString> m_censorFilter;
int currentStep = -1; int currentStep = -1;

View File

@ -1,135 +0,0 @@
#include "LogModel.h"
LogModel::LogModel(QObject *parent):QAbstractListModel(parent)
{
m_content.resize(m_maxLines);
}
int LogModel::rowCount(const QModelIndex &parent) const
{
if (parent.isValid())
return 0;
return m_numLines;
}
QVariant LogModel::data(const QModelIndex &index, int role) const
{
if (index.row() < 0 || index.row() >= m_numLines)
return QVariant();
auto row = index.row();
auto realRow = (row + m_firstLine) % m_maxLines;
if (role == Qt::DisplayRole || role == Qt::EditRole)
{
return m_content[realRow].line;
}
if(role == LevelRole)
{
return m_content[realRow].level;
}
return QVariant();
}
void LogModel::append(MessageLevel::Enum level, QString line)
{
int lineNum = (m_firstLine + m_numLines) % m_maxLines;
// overflow
if(m_numLines == m_maxLines)
{
if(m_stopOnOverflow)
{
// nothing more to do, the buffer is full
return;
}
beginRemoveRows(QModelIndex(), 0, 0);
m_firstLine = (m_firstLine + 1) % m_maxLines;
m_numLines --;
endRemoveRows();
}
else if (m_numLines == m_maxLines - 1 && m_stopOnOverflow)
{
level = MessageLevel::Fatal;
line = m_overflowMessage;
}
beginInsertRows(QModelIndex(), m_numLines, m_numLines);
m_numLines ++;
m_content[lineNum].level = level;
m_content[lineNum].line = line;
endInsertRows();
}
void LogModel::clear()
{
beginResetModel();
m_firstLine = 0;
m_numLines = 0;
endResetModel();
}
QString LogModel::toPlainText()
{
QString out;
out.reserve(m_numLines * 80);
for(int i = 0; i < m_numLines; i++)
{
QString & line = m_content[(m_firstLine + i) % m_maxLines].line;
out.append(line + '\n');
}
out.squeeze();
return out;
}
void LogModel::setMaxLines(int maxLines)
{
// no-op
if(maxLines == m_maxLines)
{
return;
}
// if it all still fits in the buffer, just resize it
if(m_firstLine + m_numLines < maxLines)
{
m_maxLines = maxLines;
m_content.resize(maxLines);
return;
}
// otherwise, we need to reorganize the data because it crosses the wrap boundary
QVector<entry> newContent;
newContent.resize(maxLines);
if(m_numLines <= maxLines)
{
// if it all fits in the new buffer, just copy it over
for(int i = 0; i < m_numLines; i++)
{
newContent[i] = m_content[(m_firstLine + i) % m_maxLines];
}
m_content.swap(newContent);
}
else
{
// if it doesn't fit, part of the data needs to be thrown away (the oldest log messages)
int lead = m_numLines - maxLines;
beginRemoveRows(QModelIndex(), 0, lead - 1);
for(int i = 0; i < maxLines; i++)
{
newContent[i] = m_content[(m_firstLine + lead + i) % m_maxLines];
}
m_numLines = m_maxLines;
m_content.swap(newContent);
endRemoveRows();
}
m_firstLine = 0;
m_maxLines = maxLines;
}
void LogModel::setStopOnOverflow(bool stop)
{
m_stopOnOverflow = stop;
}
void LogModel::setOverflowMessage(const QString& overflowMessage)
{
m_overflowMessage = overflowMessage;
}

View File

@ -1,51 +0,0 @@
#pragma once
#include <QAbstractListModel>
#include <QString>
#include "MessageLevel.h"
#include <multimc_logic_export.h>
class MULTIMC_LOGIC_EXPORT LogModel : public QAbstractListModel
{
Q_OBJECT
public:
explicit LogModel(QObject *parent = 0);
int rowCount(const QModelIndex &parent = QModelIndex()) const;
QVariant data(const QModelIndex &index, int role) const;
void append(MessageLevel::Enum, QString line);
void clear();
QString toPlainText();
void setMaxLines(int maxLines);
void setStopOnOverflow(bool stop);
void setOverflowMessage(const QString & overflowMessage);
enum Roles
{
LevelRole = Qt::UserRole
};
private /* types */:
struct entry
{
MessageLevel::Enum level;
QString line;
};
private: /* data */
QVector <entry> m_content;
int m_maxLines = 1000;
// first line in the circular buffer
int m_firstLine = 0;
// number of lines occupied in the circular buffer
int m_numLines = 0;
bool m_stopOnOverflow = false;
QString m_overflowMessage = "OVERFLOW";
private:
Q_DISABLE_COPY(LogModel)
};

View File

@ -12,113 +12,39 @@
#include "GuiUtil.h" #include "GuiUtil.h"
#include <ColorCache.h> #include <ColorCache.h>
class LogFormatProxyModel : public QIdentityProxyModel
{
public:
LogFormatProxyModel(QObject* parent = nullptr) : QIdentityProxyModel(parent)
{
}
QVariant data(const QModelIndex &index, int role) const override
{
switch(role)
{
case Qt::FontRole:
return m_font;
case Qt::TextColorRole:
{
MessageLevel::Enum level = (MessageLevel::Enum) QIdentityProxyModel::data(index, LogModel::LevelRole).toInt();
return m_colors->getFront(level);
}
case Qt::BackgroundRole:
{
MessageLevel::Enum level = (MessageLevel::Enum) QIdentityProxyModel::data(index, LogModel::LevelRole).toInt();
return m_colors->getBack(level);
}
default:
return QIdentityProxyModel::data(index, role);
}
}
void setFont(QFont font)
{
m_font = font;
}
void setColors(LogColorCache* colors)
{
m_colors.reset(colors);
}
QModelIndex find(const QModelIndex &start, const QString &value, bool reverse) const
{
QModelIndex parentIndex = parent(start);
auto compare = [&](int r) -> QModelIndex
{
QModelIndex idx = index(r, start.column(), parentIndex);
if (!idx.isValid() || idx == start)
{
return QModelIndex();
}
QVariant v = data(idx, Qt::DisplayRole);
QString t = v.toString();
if (t.contains(value, Qt::CaseInsensitive))
return idx;
return QModelIndex();
};
if(reverse)
{
int from = start.row();
int to = 0;
for (int i = 0; i < 2; ++i)
{
for (int r = from; (r >= to); --r)
{
auto idx = compare(r);
if(idx.isValid())
return idx;
}
// prepare for the next iteration
from = rowCount() - 1;
to = start.row();
}
}
else
{
int from = start.row();
int to = rowCount(parentIndex);
for (int i = 0; i < 2; ++i)
{
for (int r = from; (r < to); ++r)
{
auto idx = compare(r);
if(idx.isValid())
return idx;
}
// prepare for the next iteration
from = 0;
to = start.row();
}
}
return QModelIndex();
}
private:
QFont m_font;
std::unique_ptr<LogColorCache> m_colors;
};
LogPage::LogPage(InstancePtr instance, QWidget *parent) LogPage::LogPage(InstancePtr instance, QWidget *parent)
: QWidget(parent), ui(new Ui::LogPage), m_instance(instance) : QWidget(parent), ui(new Ui::LogPage), m_instance(instance)
{ {
ui->setupUi(this); ui->setupUi(this);
ui->tabWidget->tabBar()->hide(); ui->tabWidget->tabBar()->hide();
m_proxy = new LogFormatProxyModel(this); // create the format and set its font
connect(m_proxy, &QAbstractItemModel::rowsAboutToBeInserted, this, &LogPage::rowsAboutToBeInserted); {
connect(m_proxy, &QAbstractItemModel::rowsInserted, this, &LogPage::rowsInserted); defaultFormat = new QTextCharFormat(ui->text->currentCharFormat());
QString fontFamily = MMC->settings()->get("ConsoleFont").toString();
bool conversionOk = false;
int fontSize = MMC->settings()->get("ConsoleFontSize").toInt(&conversionOk);
if(!conversionOk)
{
fontSize = 11;
}
defaultFormat->setFont(QFont(fontFamily, fontSize));
}
ui->textView->setModel(m_proxy); // ensure we don't eat all the RAM
{
auto lineSetting = MMC->settings()->getSetting("ConsoleMaxLines");
bool conversionOk = false;
int maxLines = lineSetting->get().toInt(&conversionOk);
if(!conversionOk)
{
maxLines = lineSetting->defValue().toInt();
qWarning() << "ConsoleMaxLines has nonsensical value, defaulting to" << maxLines;
}
ui->text->setMaximumBlockCount(maxLines);
m_stopOnOverflow = MMC->settings()->get("ConsoleOverflowStop").toBool();
}
// set up instance and launch process recognition // set up instance and launch process recognition
{ {
@ -131,28 +57,13 @@ LogPage::LogPage(InstancePtr instance, QWidget *parent)
this, &LogPage::on_InstanceLaunchTask_changed); this, &LogPage::on_InstanceLaunchTask_changed);
} }
// set up text colors in the log proxy and adapt them to the current theme foreground and background // set up text colors and adapt them to the current theme foreground and background
{ {
auto origForeground = ui->textView->palette().color(ui->textView->foregroundRole()); auto origForeground = ui->text->palette().color(ui->text->foregroundRole());
auto origBackground = ui->textView->palette().color(ui->textView->backgroundRole()); auto origBackground = ui->text->palette().color(ui->text->backgroundRole());
m_proxy->setColors(new LogColorCache(origForeground, origBackground)); m_colors.reset(new LogColorCache(origForeground, origBackground));
} }
// set up fonts in the log proxy
{
QString fontFamily = MMC->settings()->get("ConsoleFont").toString();
bool conversionOk = false;
int fontSize = MMC->settings()->get("ConsoleFontSize").toInt(&conversionOk);
if(!conversionOk)
{
fontSize = 11;
}
m_proxy->setFont(QFont(fontFamily, fontSize));
}
ui->textView->setWordWrap(true);
ui->textView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
auto findShortcut = new QShortcut(QKeySequence(QKeySequence::Find), this); auto findShortcut = new QShortcut(QKeySequence(QKeySequence::Find), this);
connect(findShortcut, SIGNAL(activated()), SLOT(findActivated())); connect(findShortcut, SIGNAL(activated()), SLOT(findActivated()));
auto findNextShortcut = new QShortcut(QKeySequence(QKeySequence::FindNext), this); auto findNextShortcut = new QShortcut(QKeySequence(QKeySequence::FindNext), this);
@ -165,33 +76,20 @@ LogPage::LogPage(InstancePtr instance, QWidget *parent)
LogPage::~LogPage() LogPage::~LogPage()
{ {
delete ui; delete ui;
delete defaultFormat;
} }
void LogPage::on_InstanceLaunchTask_changed(std::shared_ptr<LaunchTask> proc) void LogPage::on_InstanceLaunchTask_changed(std::shared_ptr<LaunchTask> proc)
{ {
if(m_process)
{
disconnect(m_process.get(), &LaunchTask::log, this, &LogPage::write);
}
m_process = proc; m_process = proc;
if(m_process) if(m_process)
{ {
m_model = proc->getLogModel(); ui->text->clear();
auto lineSetting = MMC->settings()->getSetting("ConsoleMaxLines"); connect(m_process.get(), &LaunchTask::log, this, &LogPage::write);
bool conversionOk = false;
int maxLines = lineSetting->get().toInt(&conversionOk);
if(!conversionOk)
{
maxLines = lineSetting->defValue().toInt();
qWarning() << "ConsoleMaxLines has nonsensical value, defaulting to" << maxLines;
}
m_model->setMaxLines(maxLines);
m_model->setStopOnOverflow(MMC->settings()->get("ConsoleOverflowStop").toBool());
m_model->setOverflowMessage(tr("MultiMC stopped watching the game log because the log length surpassed %1 lines.\n"
"You may have to fix your mods because the game is still loggging to files and"
" likely wasting harddrive space at an alarming rate!").arg(maxLines));
m_proxy->setSourceModel(m_model.get());
}
else
{
m_proxy->setSourceModel(nullptr);
m_model.reset();
} }
} }
@ -202,50 +100,38 @@ bool LogPage::apply()
bool LogPage::shouldDisplay() const bool LogPage::shouldDisplay() const
{ {
return m_instance->isRunning() || m_proxy->rowCount() > 0; return m_instance->isRunning() || ui->text->blockCount() > 1;
} }
void LogPage::on_btnPaste_clicked() void LogPage::on_btnPaste_clicked()
{ {
if(!m_model)
return;
//FIXME: turn this into a proper task and move the upload logic out of GuiUtil! //FIXME: turn this into a proper task and move the upload logic out of GuiUtil!
m_model->append(MessageLevel::MultiMC, tr("MultiMC: Log upload triggered at: %1").arg(QDateTime::currentDateTime().toString(Qt::RFC2822Date))); write(tr("MultiMC: Log upload triggered at: %1").arg(QDateTime::currentDateTime().toString(Qt::RFC2822Date)), MessageLevel::MultiMC);
auto url = GuiUtil::uploadPaste(m_model->toPlainText(), this); auto url = GuiUtil::uploadPaste(ui->text->toPlainText(), this);
if(!url.isEmpty()) if(!url.isEmpty())
{ {
m_model->append(MessageLevel::MultiMC, tr("MultiMC: Log uploaded to: %1").arg(url)); write(tr("MultiMC: Log uploaded to: %1").arg(url), MessageLevel::MultiMC);
} }
else else
{ {
m_model->append(MessageLevel::Error, tr("MultiMC: Log upload failed!")); write(tr("MultiMC: Log upload failed!"), MessageLevel::Error);
} }
} }
void LogPage::on_btnCopy_clicked() void LogPage::on_btnCopy_clicked()
{ {
if(!m_model) write(QString("Clipboard copy at: %1").arg(QDateTime::currentDateTime().toString(Qt::RFC2822Date)), MessageLevel::MultiMC);
return; GuiUtil::setClipboardText(ui->text->toPlainText());
m_model->append(MessageLevel::MultiMC, QString("Clipboard copy at: %1").arg(QDateTime::currentDateTime().toString(Qt::RFC2822Date)));
GuiUtil::setClipboardText(m_model->toPlainText());
} }
void LogPage::on_btnClear_clicked() void LogPage::on_btnClear_clicked()
{ {
if(!m_model) ui->text->clear();
return;
m_model->clear();
} }
void LogPage::on_btnBottom_clicked() void LogPage::on_btnBottom_clicked()
{ {
/* ui->text->verticalScrollBar()->setSliderPosition(ui->text->verticalScrollBar()->maximum());
ui->textView->verticalScrollBar()->setSliderPosition(ui->textView->verticalScrollBar()->maximum());
*/
auto numRows = m_proxy->rowCount(QModelIndex());
auto lastIndex = m_proxy->index(numRows - 1, 0 , QModelIndex());
ui->textView->scrollTo(lastIndex, QAbstractItemView::ScrollHint::EnsureVisible);
} }
void LogPage::on_trackLogCheckbox_clicked(bool checked) void LogPage::on_trackLogCheckbox_clicked(bool checked)
@ -257,52 +143,25 @@ void LogPage::on_wrapCheckbox_clicked(bool checked)
{ {
if(checked) if(checked)
{ {
ui->textView->setWordWrap(true); ui->text->setWordWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);
ui->textView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
} }
else else
{ {
ui->textView->setWordWrap(false); ui->text->setWordWrapMode(QTextOption::WrapMode::NoWrap);
ui->textView->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
}
}
void LogPage::findImpl(bool reverse)
{
auto toSearch = ui->searchBar->text();
if (toSearch.size())
{
auto index = ui->textView->currentIndex();
if(!index.isValid())
{
index = m_proxy->index(0,0);
}
if(!index.isValid())
{
// just give up
return;
}
auto found = m_proxy->find(index, toSearch, reverse);
if(found.isValid())
ui->textView->setCurrentIndex(found);
} }
} }
void LogPage::on_findButton_clicked() void LogPage::on_findButton_clicked()
{ {
auto modifiers = QApplication::keyboardModifiers(); auto modifiers = QApplication::keyboardModifiers();
bool reverse = modifiers & Qt::ShiftModifier; if (modifiers & Qt::ShiftModifier)
findImpl(reverse); {
} findPreviousActivated();
}
void LogPage::findNextActivated() else
{ {
findImpl(false); findNextActivated();
} }
void LogPage::findPreviousActivated()
{
findImpl(true);
} }
void LogPage::findActivated() void LogPage::findActivated()
@ -310,29 +169,118 @@ void LogPage::findActivated()
// focus the search bar if it doesn't have focus // focus the search bar if it doesn't have focus
if (!ui->searchBar->hasFocus()) if (!ui->searchBar->hasFocus())
{ {
auto searchForCursor = ui->text->textCursor();
auto searchForString = searchForCursor.selectedText();
if (searchForString.size())
{
ui->searchBar->setText(searchForString);
}
ui->searchBar->setFocus(); ui->searchBar->setFocus();
ui->searchBar->selectAll(); ui->searchBar->selectAll();
} }
} }
void LogPage::findNextActivated()
{
auto toSearch = ui->searchBar->text();
if (toSearch.size())
{
ui->text->find(toSearch);
}
}
void LogPage::findPreviousActivated()
{
auto toSearch = ui->searchBar->text();
if (toSearch.size())
{
ui->text->find(toSearch, QTextDocument::FindBackward);
}
}
void LogPage::setParentContainer(BasePageContainer * container) void LogPage::setParentContainer(BasePageContainer * container)
{ {
m_parentContainer = container; m_parentContainer = container;
} }
void LogPage::rowsAboutToBeInserted(const QModelIndex& parent, int first, int last) void LogPage::write(QString data, MessageLevel::Enum mode)
{ {
auto numRows = m_proxy->rowCount(QModelIndex()); if (!m_write_active)
auto lastIndex = m_proxy->index(numRows - 1, 0 , QModelIndex());
auto rect = ui->textView->visualRect(lastIndex);
auto viewPortRect = ui->textView->viewport()->rect();
m_autoScroll = rect.intersects(viewPortRect);
}
void LogPage::rowsInserted(const QModelIndex& parent, int first, int last)
{
if(m_autoScroll)
{ {
QMetaObject::invokeMethod(this, "on_btnBottom_clicked", Qt::QueuedConnection); if (mode != MessageLevel::MultiMC)
{
return;
}
} }
if(m_stopOnOverflow && m_write_active)
{
if(mode != MessageLevel::MultiMC)
{
if(ui->text->blockCount() >= ui->text->maximumBlockCount())
{
m_write_active = false;
data = tr("MultiMC stopped watching the game log because the log length surpassed %1 lines.\n"
"You may have to fix your mods because the game is still loggging to files and"
" likely wasting harddrive space at an alarming rate!")
.arg(ui->text->maximumBlockCount());
mode = MessageLevel::Fatal;
ui->trackLogCheckbox->setCheckState(Qt::Unchecked);
if(!isVisible())
{
m_parentContainer->selectPage(id());
}
}
}
}
// save the cursor so it can be restored.
auto savedCursor = ui->text->cursor();
QScrollBar *bar = ui->text->verticalScrollBar();
int max_bar = bar->maximum();
int val_bar = bar->value();
if (isVisible())
{
if (m_scroll_active)
{
m_scroll_active = (max_bar - val_bar) <= 1;
}
else
{
m_scroll_active = val_bar == max_bar;
}
}
if (data.endsWith('\n'))
data = data.left(data.length() - 1);
QStringList paragraphs = data.split('\n');
QStringList filtered;
for (QString &paragraph : paragraphs)
{
//TODO: implement filtering here.
filtered.append(paragraph);
}
QListIterator<QString> iter(filtered);
QTextCharFormat format(*defaultFormat);
format.setForeground(m_colors->getFront(mode));
format.setBackground(m_colors->getBack(mode));
while (iter.hasNext())
{
// append a paragraph/line
auto workCursor = ui->text->textCursor();
workCursor.movePosition(QTextCursor::End);
workCursor.insertText(iter.next(), format);
workCursor.insertBlock();
}
if (isVisible())
{
if (m_scroll_active)
{
bar->setValue(bar->maximum());
}
m_last_scroll_value = bar->value();
}
ui->text->setCursor(savedCursor);
} }

View File

@ -21,13 +21,13 @@
#include "launch/LaunchTask.h" #include "launch/LaunchTask.h"
#include "BasePage.h" #include "BasePage.h"
#include <MultiMC.h> #include <MultiMC.h>
#include <ColorCache.h>
namespace Ui namespace Ui
{ {
class LogPage; class LogPage;
} }
class QTextCharFormat; class QTextCharFormat;
class LogFormatProxyModel;
class LogPage : public QWidget, public BasePage class LogPage : public QWidget, public BasePage
{ {
@ -57,6 +57,13 @@ public:
virtual void setParentContainer(BasePageContainer *) override; virtual void setParentContainer(BasePageContainer *) override;
private slots: private slots:
/**
* @brief write a string
* @param data the string
* @param level the @MessageLevel the string should be written under
* lines have to be put through this as a whole!
*/
void write(QString data, MessageLevel::Enum level = MessageLevel::MultiMC);
void on_btnPaste_clicked(); void on_btnPaste_clicked();
void on_btnCopy_clicked(); void on_btnCopy_clicked();
void on_btnClear_clicked(); void on_btnClear_clicked();
@ -72,12 +79,6 @@ private slots:
void on_InstanceLaunchTask_changed(std::shared_ptr<LaunchTask> proc); void on_InstanceLaunchTask_changed(std::shared_ptr<LaunchTask> proc);
void rowsAboutToBeInserted(const QModelIndex &parent, int first, int last);
void rowsInserted(const QModelIndex &parent, int first, int last);
private: /* methods */
void findImpl(bool reverse);
private: private:
Ui::LogPage *ui; Ui::LogPage *ui;
InstancePtr m_instance; InstancePtr m_instance;
@ -87,9 +88,8 @@ private:
int m_saved_offset = 0; int m_saved_offset = 0;
bool m_write_active = true; bool m_write_active = true;
bool m_stopOnOverflow = true; bool m_stopOnOverflow = true;
bool m_autoScroll = false;
QTextCharFormat * defaultFormat;
BasePageContainer * m_parentContainer; BasePageContainer * m_parentContainer;
LogFormatProxyModel * m_proxy; std::unique_ptr<LogColorCache> m_colors;
shared_qobject_ptr <LogModel> m_model;
}; };

View File

@ -33,6 +33,25 @@
<string notr="true">Tab 1</string> <string notr="true">Tab 1</string>
</attribute> </attribute>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="1" column="0" colspan="5">
<widget class="QPlainTextEdit" name="text">
<property name="undoRedoEnabled">
<bool>false</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
<property name="plainText">
<string notr="true"/>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
<property name="centerOnScroll">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="0" colspan="5"> <item row="0" column="0" colspan="5">
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
@ -134,34 +153,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0" colspan="5">
<widget class="QListView" name="textView">
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOn</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="showDropIndicator" stdset="0">
<bool>false</bool>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::ExtendedSelection</enum>
</property>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
</property>
<property name="verticalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</widget> </widget>
@ -175,6 +166,7 @@
<tabstop>btnCopy</tabstop> <tabstop>btnCopy</tabstop>
<tabstop>btnPaste</tabstop> <tabstop>btnPaste</tabstop>
<tabstop>btnClear</tabstop> <tabstop>btnClear</tabstop>
<tabstop>text</tabstop>
<tabstop>searchBar</tabstop> <tabstop>searchBar</tabstop>
<tabstop>findButton</tabstop> <tabstop>findButton</tabstop>
</tabstops> </tabstops>