summaryrefslogtreecommitdiff
path: root/src/modlistviewactions.h
blob: 10aa6c39c5920f2f15c6c5c82133d73b8023987f (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
88
89
90
91
92
#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 OrganizerCore;

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,
    MainWindow* mainWindow,
    ModListView* view);

  // install the mod from the given archive
  //
  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 -1
  //
  void createEmptyMod(int modIndex) const;
  void createSeparator(int modIndex) const;

  // check all mods for update
  //
  void checkModsForUpdates() 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;

  // open the Windows explorer for the specified mods
  //
  void openExplorer(const QModelIndexList& 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;

private:

  void moveOverwriteContentsTo(const QString& absolutePath) const;

private:

  OrganizerCore& m_core;
  FilterList& m_filters;
  CategoryFactory& m_categories;
  MainWindow* m_main;
  ModListView* m_view;
};

#endif