summaryrefslogtreecommitdiff
path: root/src/modinfodialogtextfiles.h
blob: 0dc5ec899d7d4a44efe7bbfe42b61704414d5510 (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
#ifndef MODINFODIALOGTEXTFILES_H
#define MODINFODIALOGTEXTFILES_H

#include "modinfodialogtab.h"
#include <QSplitter>
#include <QListWidget>

class FileListItem;
class TextEditor;

class GenericFilesTab : public ModInfoDialogTab
{
  Q_OBJECT;

public:
  void clear() override;
  bool canClose() override;
  bool feedFile(const QString& rootPath, const QString& fullPath) override;

protected:
  QListWidget* m_list;
  TextEditor* m_editor;

  GenericFilesTab(
    OrganizerCore& oc, PluginContainer& plugin,
    QWidget* parent, Ui::ModInfoDialog* ui,
    QListWidget* list, QSplitter* splitter, TextEditor* editor);

  virtual bool wantsFile(const QString& rootPath, const QString& fullPath) const = 0;

private:
  void onSelection(QListWidgetItem* current, QListWidgetItem* previous);
  void select(FileListItem* item);
};


class TextFilesTab : public GenericFilesTab
{
public:
  TextFilesTab(
    OrganizerCore& oc, PluginContainer& plugin,
    QWidget* parent, Ui::ModInfoDialog* ui);

protected:
  bool wantsFile(const QString& rootPath, const QString& fullPath) const override;
};


class IniFilesTab : public GenericFilesTab
{
public:
  IniFilesTab(
    OrganizerCore& oc, PluginContainer& plugin,
    QWidget* parent, Ui::ModInfoDialog* ui);

protected:
  bool wantsFile(const QString& rootPath, const QString& fullPath) const override;
};

#endif // MODINFODIALOGTEXTFILES_H