diff options
| author | isanae <14251494+isanae@users.noreply.github.com> | 2019-11-25 04:01:32 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-11-25 04:01:32 -0500 |
| commit | 765c9667de25547929f8ff58e3eab7bd3aeb3cbf (patch) | |
| tree | b8dc9f70a3a812fa3eb59461ab3bd65916b4b6b8 /src/lootdialog.h | |
| parent | 5f165b80e8035bafa15fe5a534726733836a3dd7 (diff) | |
| parent | f1b621d0babd33537cde97fc9d53e0dfa0ad5ea5 (diff) | |
Merge pull request #901 from isanae/loot-rework
Loot rework
Diffstat (limited to 'src/lootdialog.h')
| -rw-r--r-- | src/lootdialog.h | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/src/lootdialog.h b/src/lootdialog.h new file mode 100644 index 00000000..bc8c01fb --- /dev/null +++ b/src/lootdialog.h @@ -0,0 +1,78 @@ +#ifndef MODORGANIZER_LOOTDIALOG_H +#define MODORGANIZER_LOOTDIALOG_H + +#include <lootcli/lootcli.h> +#include <log.h> +#include <expanderwidget.h> + +namespace Ui { class LootDialog; } + +class OrganizerCore; +class Loot; + + +class MarkdownDocument : public QObject +{ + Q_OBJECT; + Q_PROPERTY(QString text MEMBER m_text NOTIFY textChanged FINAL); + +public: + explicit MarkdownDocument(QObject* parent=nullptr); + void setText(const QString& text); + +signals: + void textChanged(const QString &text); + +private: + QString m_text; +}; + + +class MarkdownPage : public QWebEnginePage +{ + Q_OBJECT; + +public: + explicit MarkdownPage(QObject* parent=nullptr); + +protected: + bool acceptNavigationRequest(const QUrl &url, NavigationType, bool) override; +}; + + +class LootDialog : public QDialog +{ +public: + LootDialog(QWidget* parent, OrganizerCore& core, Loot& loot); + ~LootDialog(); + + void setText(const QString& s); + void setProgress(lootcli::Progress p); + + void addOutput(const QString& s); + bool result() const; + void cancel(); + void openReport(); + + int exec() override; + void accept() override; + void reject() override; + +private: + std::unique_ptr<Ui::LootDialog> ui; + MOBase::ExpanderWidget m_expander; + OrganizerCore& m_core; + Loot& m_loot; + bool m_finished; + bool m_cancelling; + MarkdownDocument m_report; + + void createUI(); + void closeEvent(QCloseEvent* e) override; + void addLineOutput(const QString& line); + void onFinished(); + void log(MOBase::log::Levels lv, const QString& s); + void showReport(); +}; + +#endif // MODORGANIZER_LOOTDIALOG_H |
