diff options
| author | isanae <14251494+isanae@users.noreply.github.com> | 2019-11-16 20:47:30 -0500 |
|---|---|---|
| committer | isanae <14251494+isanae@users.noreply.github.com> | 2019-11-16 20:47:30 -0500 |
| commit | 9688f37bbe54568aba09e2dd755e0ea35eef2bb1 (patch) | |
| tree | 0fc3e8546619d6b76b2c6ca52c0d8ac72e811468 | |
| parent | 272cb514839ebe931d735677026ee55d08bd949b (diff) | |
added loot output
| -rw-r--r-- | src/loot.cpp | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/src/loot.cpp b/src/loot.cpp index c0051e61..a9e716ae 100644 --- a/src/loot.cpp +++ b/src/loot.cpp @@ -26,6 +26,19 @@ public: m_progress->setMaximum(0); } + void addOutput(const QString& s) + { + const auto lines = s.split(QRegExp("[\\r\\n]"), QString::SkipEmptyParts); + + for (auto&& line : lines) { + if (line.isEmpty()) { + continue; + } + + addLineOutput(line); + } + } + bool cancelled() const { return m_cancelled; @@ -35,6 +48,8 @@ private: QLabel* m_label; QProgressBar* m_progress; QDialogButtonBox* m_buttons; + QPlainTextEdit* m_output; + QString m_lastLine; bool m_cancelled; void createUI() @@ -52,7 +67,8 @@ private: m_progress = new QProgressBar; ly->addWidget(m_progress); - ly->addStretch(1); + m_output = new QPlainTextEdit; + ly->addWidget(m_output); m_buttons = new QDialogButtonBox(QDialogButtonBox::Cancel); connect(m_buttons, &QDialogButtonBox::clicked, [&](auto* b){ onButton(b); }); @@ -70,6 +86,16 @@ private: m_cancelled = true; } } + + void addLineOutput(const QString& line) + { + if (line == m_lastLine) { + return; + } + + m_output->appendPlainText(line); + m_lastLine = line; + } }; @@ -117,6 +143,8 @@ void processLOOTOut( OrganizerCore& core, const std::string &lootOut, std::string &errorMessages, LootDialog& dialog) { + dialog.addOutput(QString::fromStdString(lootOut)); + std::vector<std::string> lines; boost::split(lines, lootOut, boost::is_any_of("\r\n")); |
