aboutsummaryrefslogtreecommitdiff
path: root/libs/installer_fomod_csharp/src/installer_fomod_postdialog.h
blob: 9804610d28f30f73b79d57e706635d4146388061 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#ifndef INSTALLER_FOMOD_POSTDIALOG_H
#define INSTALLER_FOMOD_POSTDIALOG_H

#include "ui_installer_fomod_csharp_postdialog.h"

#include <QTextEdit>

#include "psettings.h"

/**
 * @brief Dialog for the installation of a simple archive
 * a simple archive is one that doesn't require any manual changes to work correctly
 **/
class InstallerFomodPostDialog : public QDialog
{
  Q_OBJECT

public:
  enum class Result
  {
    APPLY,
    DISCARD,
    MOVE,
  };

  /**
   * @brief constructor
   *
   * @param preset suggested name for the mod
   * @param parent parent widget
   **/
  explicit InstallerFomodPostDialog(QWidget* parent = 0)
      : QDialog(parent), ui(new Ui::FomodCSharpPostDialog)
  {
    ui->setupUi(this);
    setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint));
  }

  ~InstallerFomodPostDialog() {}

  /**
   * @return the result of this dialog if the user did not cancel.
   */
  Result result() const { return m_Result; }

  /**
   *
   */
  void setIniSettings(std::map<QString, PSettings> const& settings)
  {
    for (auto p : settings) {
      QTextEdit* widget = new QTextEdit(this);
      widget->append(p.second.toString());
      widget->setReadOnly(true);
      ui->tabWidget->addTab(widget, p.first);
    }
  }

private slots:

  void on_discardBtn_clicked()
  {
    m_Result = Result::DISCARD;
    this->accept();
  }

  void on_applyBtn_clicked()
  {
    m_Result = Result::APPLY;
    this->accept();
  }

  void on_moveBtn_clicked()
  {
    m_Result = Result::MOVE;
    this->accept();
  }

  void on_cancelBtn_clicked() { this->reject(); }

private:
  std::unique_ptr<Ui::FomodCSharpPostDialog> ui;

  Result m_Result{Result::APPLY};
};

#endif