summaryrefslogtreecommitdiff
path: root/src/modinfodialogtextfiles.h
diff options
context:
space:
mode:
authorJeremy Rimpo <jrim@rimpo.org>2019-07-03 10:24:14 -0500
committerGitHub <noreply@github.com>2019-07-03 10:24:14 -0500
commitefec72a85a351f53880bffdba2438f6802d4f9ab (patch)
tree94cf5dd724a16f29b458776ef5a83477ccfe2a52 /src/modinfodialogtextfiles.h
parent1822c1dc655e60c7693b528004ed715305df45f5 (diff)
parent7fe637ce4421e0c6d6ee6b103db5fcc4ef676c25 (diff)
Merge pull request #782 from isanae/modinfodialog-rework
Mod info dialog rework
Diffstat (limited to 'src/modinfodialogtextfiles.h')
-rw-r--r--src/modinfodialogtextfiles.h64
1 files changed, 64 insertions, 0 deletions
diff --git a/src/modinfodialogtextfiles.h b/src/modinfodialogtextfiles.h
new file mode 100644
index 00000000..725ac999
--- /dev/null
+++ b/src/modinfodialogtextfiles.h
@@ -0,0 +1,64 @@
+#ifndef MODINFODIALOGTEXTFILES_H
+#define MODINFODIALOGTEXTFILES_H
+
+#include "modinfodialogtab.h"
+#include "filterwidget.h"
+#include <QSplitter>
+#include <QListView>
+
+class FileListItem;
+class FileListModel;
+class TextEditor;
+
+class GenericFilesTab : public ModInfoDialogTab
+{
+ Q_OBJECT;
+
+public:
+ void clear() override;
+ bool canClose() override;
+ bool feedFile(const QString& rootPath, const QString& fullPath) override;
+ void update() override;
+ void saveState(Settings& s) override;
+ void restoreState(const Settings& s) override;
+
+protected:
+ QListView* m_list;
+ TextEditor* m_editor;
+ QSplitter* m_splitter;
+ FileListModel* m_model;
+ FilterWidget m_filter;
+
+ GenericFilesTab(
+ ModInfoDialogTabContext cx,
+ QListView* list, QSplitter* splitter,
+ TextEditor* editor, QLineEdit* filter);
+
+ virtual bool wantsFile(const QString& rootPath, const QString& fullPath) const = 0;
+
+private:
+ void onSelection(const QModelIndex& current, const QModelIndex& previous);
+ void select(const QModelIndex& index);
+};
+
+
+class TextFilesTab : public GenericFilesTab
+{
+public:
+ TextFilesTab(ModInfoDialogTabContext cx);
+
+protected:
+ bool wantsFile(const QString& rootPath, const QString& fullPath) const override;
+};
+
+
+class IniFilesTab : public GenericFilesTab
+{
+public:
+ IniFilesTab(ModInfoDialogTabContext cx);
+
+protected:
+ bool wantsFile(const QString& rootPath, const QString& fullPath) const override;
+};
+
+#endif // MODINFODIALOGTEXTFILES_H