mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-09 08:21:29 +12:00
Qt: Allow to filter the log multiple times
This commit is contained in:
parent
127ad508b4
commit
f24b0c2ffe
2 changed files with 20 additions and 9 deletions
|
@ -71,6 +71,7 @@ void log_viewer::show_context_menu(const QPoint& pos)
|
||||||
connect(clear, &QAction::triggered, this, [this]()
|
connect(clear, &QAction::triggered, this, [this]()
|
||||||
{
|
{
|
||||||
m_log_text->clear();
|
m_log_text->clear();
|
||||||
|
m_full_log.clear();
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(open, &QAction::triggered, this, [this]()
|
connect(open, &QAction::triggered, this, [this]()
|
||||||
|
@ -106,13 +107,14 @@ void log_viewer::show_context_menu(const QPoint& pos)
|
||||||
menu.exec(origin);
|
menu.exec(origin);
|
||||||
}
|
}
|
||||||
|
|
||||||
void log_viewer::show_log() const
|
void log_viewer::show_log()
|
||||||
{
|
{
|
||||||
if (m_path_last.isEmpty())
|
if (m_path_last.isEmpty())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_full_log.clear();
|
||||||
m_log_text->clear();
|
m_log_text->clear();
|
||||||
m_log_text->setPlainText(tr("Loading file..."));
|
m_log_text->setPlainText(tr("Loading file..."));
|
||||||
QApplication::processEvents();
|
QApplication::processEvents();
|
||||||
|
@ -137,18 +139,26 @@ void log_viewer::filter_log()
|
||||||
{
|
{
|
||||||
if (m_filter_term.isEmpty())
|
if (m_filter_term.isEmpty())
|
||||||
{
|
{
|
||||||
|
if (!m_full_log.isEmpty())
|
||||||
|
{
|
||||||
|
m_log_text->setPlainText(m_full_log);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString result;
|
if (m_full_log.isEmpty())
|
||||||
QString text = m_log_text->toPlainText();
|
{
|
||||||
|
m_full_log = m_log_text->toPlainText();
|
||||||
|
|
||||||
if (text.isEmpty())
|
if (m_full_log.isEmpty())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QTextStream stream(&text);
|
QString result;
|
||||||
|
|
||||||
|
QTextStream stream(&m_full_log);
|
||||||
for (QString line = stream.readLine(); !line.isNull(); line = stream.readLine())
|
for (QString line = stream.readLine(); !line.isNull(); line = stream.readLine())
|
||||||
{
|
{
|
||||||
if (line.contains(m_filter_term))
|
if (line.contains(m_filter_term))
|
||||||
|
|
|
@ -15,7 +15,7 @@ class log_viewer : public QWidget
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit log_viewer(std::shared_ptr<gui_settings> gui_settings);
|
explicit log_viewer(std::shared_ptr<gui_settings> gui_settings);
|
||||||
void show_log() const;
|
void show_log();
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void show_context_menu(const QPoint& pos);
|
void show_context_menu(const QPoint& pos);
|
||||||
|
@ -27,6 +27,7 @@ private:
|
||||||
std::shared_ptr<gui_settings> m_gui_settings;
|
std::shared_ptr<gui_settings> m_gui_settings;
|
||||||
QString m_path_last;
|
QString m_path_last;
|
||||||
QString m_filter_term;
|
QString m_filter_term;
|
||||||
|
QString m_full_log;
|
||||||
QPlainTextEdit* m_log_text;
|
QPlainTextEdit* m_log_text;
|
||||||
LogHighlighter* m_log_highlighter;
|
LogHighlighter* m_log_highlighter;
|
||||||
std::unique_ptr<find_dialog> m_find_dialog;
|
std::unique_ptr<find_dialog> m_find_dialog;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue