summaryrefslogtreecommitdiff
path: root/src/instancemanagerdialog.h
diff options
context:
space:
mode:
authorQudix <17361645+Qudix@users.noreply.github.com>2020-11-09 13:02:01 -0600
committerQudix <17361645+Qudix@users.noreply.github.com>2020-11-09 13:02:01 -0600
commit0a3bdad8afd18a21a3697804ae344abd09e3712e (patch)
tree0bf234b41dff43cdfe39afea48c7c1d8bdd995c2 /src/instancemanagerdialog.h
parentb7b843d42badab83b262260035658259f24e4f9a (diff)
parentfef8543a58b4226242ce26c4c8876abaa64394cb (diff)
Merge branch 'master' of https://github.com/ModOrganizer2/modorganizer into master
Diffstat (limited to 'src/instancemanagerdialog.h')
-rw-r--r--src/instancemanagerdialog.h93
1 files changed, 86 insertions, 7 deletions
diff --git a/src/instancemanagerdialog.h b/src/instancemanagerdialog.h
index 5b08ffc2..86fe0dac 100644
--- a/src/instancemanagerdialog.h
+++ b/src/instancemanagerdialog.h
@@ -6,9 +6,11 @@
namespace Ui { class InstanceManagerDialog; };
-class InstanceInfo;
+class Instance;
class PluginContainer;
+// a dialog to manage existing instances
+//
class InstanceManagerDialog : public QDialog
{
Q_OBJECT
@@ -19,49 +21,126 @@ public:
~InstanceManagerDialog();
+ // selects the instance having the given index in the list
+ //
void select(std::size_t i);
+
+ // selects the instance by name
+ //
void select(const QString& name);
+
+ // select the instance that is currently in use in MO
+ //
void selectActiveInstance();
+
+ // switches to the selected instance; restarts MO, unless
+ // was called setRestartOnSelect(false)
+ //
void openSelectedInstance();
+ // renames the currently selected instance
+ //
void rename();
+
+ // explores the directory of the selected instance
+ //
void exploreLocation();
+
+ // explores the base directory of the selected instance
+ //
void exploreBaseDirectory();
+
+ // explores the game directory of the selected instance
+ //
void exploreGame();
+
+ // converts the selected, portable instance to a global one; not implemented
+ //
void convertToGlobal();
+
+ // converts the selected, global instance to a portable one; not implemented
+ //
void convertToPortable();
+
+ // opens the ini of the selected instance in the shell
+ //
void openINI();
+
+ // deletes the selected instance
+ //
void deleteInstance();
+
+ // sets whether the dialog should restart MO when selecting an instance; this
+ // is false on startup when no instances exist
+ //
void setRestartOnSelect(bool b);
+
+ // saves geometry
+ //
+ void done(int r) override;
+
+protected:
+ // restores geometry
+ //
+ void showEvent(QShowEvent* e) override;
+
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;
+ std::vector<std::unique_ptr<Instance>> m_instances;
MOBase::FilterWidget m_filter;
QStandardItemModel* m_model;
bool m_restartOnSelect;
+ // refreshes the list instances from disk
+ //
void updateInstances();
+ // updates the ui for the selected instance
+ //
void onSelection();
+
+ // opens the create instance dialog
+ //
void createNew();
+ // shows a confirmation to the user before switching
+ //
+ bool confirmSwitch(const Instance& to);
+
+
+ // returns the index of selected instance, NoSelection if none
+ //
std::size_t singleSelectionIndex() const;
- InstanceInfo* singleSelection();
- const InstanceInfo* singleSelection() const;
+ // returns the InstanceInfo associated with the selected instance, null if
+ // none
+ //
+ const Instance* singleSelection() const;
+
+ // fills the instance list on the ui
+ //
void updateList();
- void fillData(const InstanceInfo& ii);
+
+ // fills the ui for the selected instance
+ //
+ void fillData(const Instance& ii);
+
+ // clears the ui when there's no selection
+ //
void clearData();
+
+ // enables/disables buttons like rename, explore...
+ //
void setButtonsEnabled(bool b);
- bool deletePortable(const InstanceInfo& ii);
- bool deleteGlobal(const InstanceInfo& ii);
+ // deletes the given files, returns false on error
+ //
bool doDelete(const QStringList& files, bool recycle);
};