NOISSUE rework of minecraft log

Now uses a model and a list view instead of text
This lets mmc keep track of the contents regardless of whether the instance windows are open

This is currently missing a way to select and copy text from the log.
This commit is contained in:
Petr Mrázek
2016-08-08 00:00:11 +02:00
parent 74b4343c43
commit fc198dd308
8 changed files with 453 additions and 197 deletions

View File

@ -21,13 +21,13 @@
#include "launch/LaunchTask.h"
#include "BasePage.h"
#include <MultiMC.h>
#include <ColorCache.h>
namespace Ui
{
class LogPage;
}
class QTextCharFormat;
class LogFormatProxyModel;
class LogPage : public QWidget, public BasePage
{
@ -57,13 +57,6 @@ public:
virtual void setParentContainer(BasePageContainer *) override;
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_btnCopy_clicked();
void on_btnClear_clicked();
@ -79,6 +72,12 @@ private slots:
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:
Ui::LogPage *ui;
InstancePtr m_instance;
@ -88,8 +87,9 @@ private:
int m_saved_offset = 0;
bool m_write_active = true;
bool m_stopOnOverflow = true;
bool m_autoScroll = false;
QTextCharFormat * defaultFormat;
BasePageContainer * m_parentContainer;
std::unique_ptr<LogColorCache> m_colors;
LogFormatProxyModel * m_proxy;
shared_qobject_ptr <LogModel> m_model;
};