aboutsummaryrefslogtreecommitdiff
path: root/libs/installer_bsplugins/src/BSPluginInfo/PluginRecordView.h
blob: 880cc1a13d82a87ba3c48b0685050bdcd3c48c09 (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
#ifndef BSPLUGININFO_PLUGINRECORDVIEW_H
#define BSPLUGININFO_PLUGINRECORDVIEW_H

#include "PluginRecordModel.h"
#include "RecordFilterProxyModel.h"
#include "RecordStructureModel.h"

#include <QWidget>

class QSplitter;
class QTreeView;
namespace Ui
{
class PluginRecordView;
}

namespace BSPluginInfo
{

class PluginRecordView final : public QWidget
{
  Q_OBJECT

public:
  enum ConflictFilter
  {
    Filter_AllConflicts,
    Filter_WinningConflicts,
    Filter_LosingConflicts,
  };

  explicit PluginRecordView(QWidget* parent = nullptr);

  PluginRecordView(const PluginRecordView&) = delete;
  PluginRecordView(PluginRecordView&&)      = delete;

  ~PluginRecordView() noexcept;

  PluginRecordView& operator=(const PluginRecordView&) = delete;
  PluginRecordView& operator=(PluginRecordView&&)      = delete;

  void setup(MOBase::IOrganizer* organizer, TESData::PluginList* pluginList,
             const QString& pluginName);

  [[nodiscard]] bool hasData() const;

  [[nodiscard]] QSplitter* splitter() const;
  [[nodiscard]] QTreeView* pickRecordView() const;
  [[nodiscard]] QTreeView* recordStructureView() const;

  void setFile(const QString& pluginName);

private slots:
  void onRecordPicked(const QModelIndex& current);
  void onFileHeaderMoved(int logicalIndex, int oldVisualIndex, int newVisualIndex);

  void on_pickRecordView_expanded(const QModelIndex& index);
  void on_pickRecordView_customContextMenuRequested(const QPoint& pos);
  void on_recordStructureView_expanded(const QModelIndex& index);
  void on_filterCombo_currentIndexChanged(int index);
  void on_ignoreMasterConflicts_stateChanged(int state);

private:
  void expandStructureConflicts(const QModelIndex& parent = QModelIndex());

  Ui::PluginRecordView* ui;
  MOBase::IOrganizer* m_Organizer           = nullptr;
  const TESData::FileEntry* m_ConflictEntry = nullptr;
  TESData::PluginList* m_PluginList         = nullptr;
  PluginRecordModel* m_RecordModel          = nullptr;
  RecordFilterProxyModel* m_FilterProxy     = nullptr;
  RecordStructureModel* m_StructureModel    = nullptr;
  bool m_MovingSection                      = false;
};

}  // namespace BSPluginInfo

#endif  // BSPLUGININFO_PLUGINRECORDVIEW_H