diff options
| author | isanae <14251494+isanae@users.noreply.github.com> | 2019-11-24 19:39:26 -0500 |
|---|---|---|
| committer | isanae <14251494+isanae@users.noreply.github.com> | 2019-11-24 19:39:26 -0500 |
| commit | f5476531ae39fdae8c3adc63d4c4a11f92600ff8 (patch) | |
| tree | 3e2d988ac0e6877fdcb8e402e45362ae41e3ec4a /src/loot.cpp | |
| parent | 54b18e88159738a3054c71d5a4827646caad4ded (diff) | |
basic html loot report
Diffstat (limited to 'src/loot.cpp')
| -rw-r--r-- | src/loot.cpp | 53 |
1 files changed, 46 insertions, 7 deletions
diff --git a/src/loot.cpp b/src/loot.cpp index c315056b..c73dcaa7 100644 --- a/src/loot.cpp +++ b/src/loot.cpp @@ -32,14 +32,13 @@ log::Levels levelFromLoot(lootcli::LogLevels level) } } - class LootDialog : public QDialog { public: LootDialog(QWidget* parent, OrganizerCore& core, Loot& loot) : QDialog(parent), m_core(core), m_loot(loot), - m_label(nullptr), m_progress(nullptr), m_buttons(nullptr), - m_report(nullptr), m_output(nullptr), + m_label(nullptr), m_progress(nullptr), + m_report(nullptr), m_output(nullptr), m_buttons(nullptr), m_finished(false), m_cancelling(false) { createUI(); @@ -143,9 +142,10 @@ private: Loot& m_loot; QLabel* m_label; QProgressBar* m_progress; - QDialogButtonBox* m_buttons; + QTextEdit* m_messages; QPushButton* m_report; QPlainTextEdit* m_output; + QDialogButtonBox* m_buttons; bool m_finished; bool m_cancelling; @@ -164,6 +164,9 @@ private: m_progress = new QProgressBar; ly->addWidget(m_progress); + m_messages = new QTextEdit; + ly->addWidget(m_messages); + auto* more = createMoreUI(); ly->addWidget(more); @@ -253,10 +256,46 @@ private: addLineOutput(""); } - for (auto&& m : report.messages) { - log(m.type, m.text); + QString html; + + if (!report.messages.empty()) { + html += "<ul>"; + + for (auto&& m : report.messages) { + log(m.type, m.text); + + html += "<li>"; + + switch (m.type) + { + case log::Error: + { + html += "<b>" + QObject::tr("Error") + "</b>: "; + break; + } + + case log::Warning: + { + html += "<b>" + QObject::tr("Warning") + "</b>: "; + break; + } + + default: + { + break; + } + } + + html += m.text + "</li>"; + } + + html + "</ul>"; + } else { + html += QObject::tr("No messages."); } + m_messages->setHtml(html); + for (auto&& p : report.plugins) { m_core.pluginList()->addLootReport(p.name, p); } @@ -299,7 +338,7 @@ Loot::~Loot() { m_thread->wait(); - if (!m_outPath.isEmpty()) { + if (!m_outPath.isEmpty() && QFile::exists(m_outPath)) { const auto r = shell::Delete(m_outPath); if (!r) { |
