diff options
| author | Chris Bessent <lost.dragonist@gmail.com> | 2020-01-06 05:17:01 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-01-06 05:17:01 -0700 |
| commit | dfa600996c49c1b23dca884c963dc917bd9cfc0a (patch) | |
| tree | c6def4277cc962822d0dcde71fa9148e050f693f /src/lootdialog.h | |
| parent | e69078e2399a88bda7bb9ffae7a3d57db9a4e9cf (diff) | |
| parent | d1a788dfad341b32235abc25c2ba1645f8be1ace (diff) | |
Merge pull request #954 from ModOrganizer2/Develop
Stage for release 2.2.2
Diffstat (limited to 'src/lootdialog.h')
| -rw-r--r-- | src/lootdialog.h | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/src/lootdialog.h b/src/lootdialog.h new file mode 100644 index 00000000..3cec15c6 --- /dev/null +++ b/src/lootdialog.h @@ -0,0 +1,79 @@ +#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 +{ + Q_OBJECT; +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 |
