diff options
| author | isanae <14251494+isanae@users.noreply.github.com> | 2020-11-06 10:51:03 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-11-06 10:51:03 -0500 |
| commit | b909677c3fc6a7b7a1993d341a2bd420715e292a (patch) | |
| tree | 8a883011d5e207c31edf9b94ee67bff1827c2ddf /src/instancemanagerdialog.h | |
| parent | a63a27840bfa7b08f295bfe682ebc33d70a613b9 (diff) | |
| parent | ad8e9d99b30578676c15d10a74f010439e132406 (diff) | |
Merge pull request #1280 from isanae/command-line
Command line and instance dialogs
Diffstat (limited to 'src/instancemanagerdialog.h')
| -rw-r--r-- | src/instancemanagerdialog.h | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/src/instancemanagerdialog.h b/src/instancemanagerdialog.h new file mode 100644 index 00000000..5b08ffc2 --- /dev/null +++ b/src/instancemanagerdialog.h @@ -0,0 +1,68 @@ +#ifndef MODORGANIZER_INSTANCEMANAGERDIALOG_INCLUDED +#define MODORGANIZER_INSTANCEMANAGERDIALOG_INCLUDED + +#include <filterwidget.h> +#include <QDialog> + +namespace Ui { class InstanceManagerDialog; }; + +class InstanceInfo; +class PluginContainer; + +class InstanceManagerDialog : public QDialog +{ + Q_OBJECT + +public: + explicit InstanceManagerDialog( + const PluginContainer& pc, QWidget *parent = nullptr); + + ~InstanceManagerDialog(); + + void select(std::size_t i); + void select(const QString& name); + void selectActiveInstance(); + void openSelectedInstance(); + + void rename(); + void exploreLocation(); + void exploreBaseDirectory(); + void exploreGame(); + + void convertToGlobal(); + void convertToPortable(); + void openINI(); + void deleteInstance(); + + void setRestartOnSelect(bool b); + +private: + static const std::size_t NoSelection = -1; + + std::unique_ptr<Ui::InstanceManagerDialog> ui; + const PluginContainer& m_pc; + std::vector<std::unique_ptr<InstanceInfo>> m_instances; + MOBase::FilterWidget m_filter; + QStandardItemModel* m_model; + bool m_restartOnSelect; + + void updateInstances(); + + void onSelection(); + void createNew(); + + std::size_t singleSelectionIndex() const; + InstanceInfo* singleSelection(); + const InstanceInfo* singleSelection() const; + + void updateList(); + void fillData(const InstanceInfo& ii); + void clearData(); + void setButtonsEnabled(bool b); + + bool deletePortable(const InstanceInfo& ii); + bool deleteGlobal(const InstanceInfo& ii); + bool doDelete(const QStringList& files, bool recycle); +}; + +#endif // MODORGANIZER_INSTANCEMANAGERDIALOG_INCLUDED |
