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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
|
#ifndef MODLISTVIEWACTIONS_H
#define MODLISTVIEWACTIONS_H
#include <QObject>
#include <QString>
#include "modinfo.h"
#include "modinfodialogfwd.h"
class CategoryFactory;
class FilterList;
class MainWindow;
class ModListView;
class PluginListView;
class OrganizerCore;
class DownloadManager;
class ModListViewActions : public QObject
{
Q_OBJECT
public:
// currently passing the main window itself because a lots of stuff needs it but
// it would be nice to avoid passing it at some point
//
ModListViewActions(OrganizerCore& core, FilterList& filters,
CategoryFactory& categoryFactory, ModListView* view,
PluginListView* pluginView, QObject* nxmReceiver);
// 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
//
// 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;
// enable/disable all non-filtered mods
//
void setAllMatchingModsEnabled(bool enabled) const;
// check all mods for update
//
void checkModsForUpdates() const;
void checkModsForUpdates(const QModelIndexList& indices) const;
// auto-assign categories based on nexus ID
//
void assignCategories() const;
// start the "Export Mod List" dialog
//
void exportModListCSV() const;
// display mod information
//
void displayModInformation(const QString& modName,
ModInfoTabIDs tabID = ModInfoTabIDs::None) const;
void displayModInformation(unsigned int index,
ModInfoTabIDs tab = ModInfoTabIDs::None) const;
void displayModInformation(ModInfo::Ptr modInfo, unsigned int modIndex,
ModInfoTabIDs tabID = ModInfoTabIDs::None) const;
// move mods to top/bottom, start the "Send to priority" and "Send to separator"
// dialog
//
void sendModsToTop(const QModelIndexList& index) const;
void sendModsToBottom(const QModelIndexList& index) const;
void sendModsToPriority(const QModelIndexList& index) const;
void sendModsToSeparator(const QModelIndexList& index) const;
void sendModsToFirstConflict(const QModelIndexList& index) const;
void sendModsToLastConflict(const QModelIndexList& index) const;
// actions for most regular mods
//
void renameMod(const QModelIndex& index) const;
void removeMods(const QModelIndexList& indices) const;
void ignoreMissingData(const QModelIndexList& indices) const;
void setIgnoreUpdate(const QModelIndexList& indices, bool ignore) const;
void changeVersioningScheme(const QModelIndex& indices) const;
void markConverted(const QModelIndexList& indices) const;
void visitOnNexus(const QModelIndexList& indices) const;
void visitWebPage(const QModelIndexList& indices) const;
void visitNexusOrWebPage(const QModelIndexList& indices) const;
void visitUploaderProfile(const QModelIndexList& indices) const;
void reinstallMod(const QModelIndex& index) const;
void createBackup(const QModelIndex& index) const;
void restoreHiddenFiles(const QModelIndexList& indices) const;
void setTracked(const QModelIndexList& indices, bool tracked) const;
void setEndorsed(const QModelIndexList& indices, bool endorsed) const;
void willNotEndorsed(const QModelIndexList& indices) const;
void remapCategory(const QModelIndexList& indices) const;
// set/reset color of the given selection, using the given reference index (index
// at which the context menu was shown)
//
void setColor(const QModelIndexList& indices, const QModelIndex& refIndex) const;
void resetColor(const QModelIndexList& indices) const;
// set the category of the mods in the given list, using the given index as reference
// - the categories are set as-is on the refernce mod
// - for the other mods, the category is only set if the current state of the category
// on the reference is different
//
void setCategories(const QModelIndexList& selected, const QModelIndex& ref,
const std::vector<std::pair<int, bool>>& categories) const;
// set the primary category of the mods in the given list, adding the appropriate
// category to the mods unless force is false, in which case the primary category
// is set only on mods that have this category
//
void setPrimaryCategory(const QModelIndexList& selected, int category,
bool force = true);
// open the Windows explorer for the specified mods
//
void openExplorer(const QModelIndexList& index) const;
// backup-specific actions
//
void restoreBackup(const QModelIndex& index) const;
// overwrite-specific actions
//
void createModFromOverwrite() const;
void moveOverwriteContentToExistingMod() const;
void clearOverwrite() const;
signals:
// emitted when the overwrite mod has been clear
//
void overwriteCleared() const;
// emitted when the origin of a file is modified
//
void originModified(int originId) const;
// emitted when the mod info dialog has been shown and closed
//
void modInfoDisplayed() const;
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;
// set the category of the given mod based on the given array
//
void setCategories(ModInfo::Ptr mod,
const std::vector<std::pair<int, bool>>& categories) const;
// set the category of the given mod if the category from the reference mod does not
// match the one in the array of categories
//
void setCategoriesIf(ModInfo::Ptr mod, ModInfo::Ptr ref,
const std::vector<std::pair<int, bool>>& categories) const;
// check the given mods from update, the map should map game names to nexus ID
//
void checkModsForUpdates(std::multimap<QString, int> const& IDs) const;
// ask the user for confirmation for opening many links at once.
// returns true if the user confirmed, false otherwise.
//
bool askOpenLinksConfirmation(std::size_t numberOfLinks,
const QString& nameOfLinks) const;
private:
OrganizerCore& m_core;
FilterList& m_filters;
CategoryFactory& m_categories;
ModListView* m_view;
PluginListView* m_pluginView;
QObject* m_receiver;
QWidget* m_parent;
};
#endif
|