summaryrefslogtreecommitdiff
path: root/src/modlistviewactions.h
diff options
context:
space:
mode:
authorMikaƫl Capelle <capelle.mikael@gmail.com>2021-01-18 21:17:46 +0100
committerGitHub <noreply@github.com>2021-01-18 21:17:46 +0100
commit0a683c0a5adda925e7dce5c9e0df5222b5ce3462 (patch)
treefdf38d77f9ab5615161141d9df314551f696870e /src/modlistviewactions.h
parent1f9a1da7f450937810a7ac8ee317cd28bdac0bdd (diff)
parent3c0201a79909a878e6ae572b28bc7fc9588ff1c2 (diff)
Merge pull request #1372 from Holt59/install-mod-at
Modify 'Install mod... ' in context menu to install above current mod.
Diffstat (limited to 'src/modlistviewactions.h')
-rw-r--r--src/modlistviewactions.h22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/modlistviewactions.h b/src/modlistviewactions.h
index 1914a8aa..8de9ad38 100644
--- a/src/modlistviewactions.h
+++ b/src/modlistviewactions.h
@@ -31,13 +31,20 @@ public:
PluginListView* pluginView,
QObject* nxmReceiver);
- // install the mod from the given archive
+ // install mod, create an empty mod or a separator with at priority based on the
+ // index and the current sorting of the view
+ // - if the list is not sorted by priority or the index is invalid, use the
+ // highest priority
+ // - otherwise
+ // - create separators above the given index (the priority is not the
+ // same depending on the current sorting)
+ // - create/install mods above or below other mods depending on the sort order, or
+ // at the end of the separator if index corresponds to the separator
//
- void installMod(const QString& archivePath = "") const;
-
- // create an empty mod/a separator before the given mod or at
- // the end of the list if the index is invalid
+ // if the archivePath is empty for installMod, ask the user for the archive
+ // to install
//
+ void installMod(const QString& archivePath = "", const QModelIndex& index = QModelIndex()) const;
void createEmptyMod(const QModelIndex& index = QModelIndex()) const;
void createSeparator(const QModelIndex& index = QModelIndex()) const;
@@ -133,6 +140,11 @@ signals:
private:
+ // find the priority where to install or create a mod for the
+ // given index (e.g. above, below, inside separator or at the end)
+ //
+ int findInstallPriority(const QModelIndex& current) const;
+
// move the contents of the overwrite to the given path
//
void moveOverwriteContentsTo(const QString& absolutePath) const;