Tome
A generic data editor for games supporting arbitrary input and output formats.
mainwindow.h
1 #ifndef MAINWINDOW_H
2 #define MAINWINDOW_H
3 
4 #include <QCloseEvent>
5 #include <QMainWindow>
6 #include <QProgressDialog>
7 #include <QSharedPointer>
8 #include <QTableWidget>
9 
10 #include "../Features/Search/Model/searchresultlist.h"
11 #include "../Features/Tasks/Model/messagelist.h"
12 
13 class ComponentsWindow;
15 class FieldValueWindow;
16 class AboutWindow;
17 class NewProjectWindow;
18 class RecordWindow;
19 class CustomTypesWindow;
21 class FindRecordWindow;
23 class UserSettingsWindow;
24 
25 namespace Ui {
26  class MainWindow;
27 }
28 
29 namespace Tome
30 {
31  class Controller;
32  class ErrorListDockWidget;
33  class OutputDockWidget;
34  class Project;
35  class RecordFieldsTableWidget;
36  class RecordTreeWidget;
37  class RecordTreeWidgetItem;
38  class SearchResultsDockWidget;
39 }
40 
44 class MainWindow : public QMainWindow
45 {
46  Q_OBJECT
47 
48  public:
54  explicit MainWindow(Tome::Controller* controller, QWidget *parent = 0);
55  ~MainWindow();
56 
57  protected:
62  void closeEvent(QCloseEvent* event);
63 
64  private slots:
65  void on_actionExit_triggered();
66 
67  void on_actionProject_Overview_triggered();
68 
69  void on_actionField_Definions_triggered();
70  void on_actionManage_Components_triggered();
71  void on_actionManage_Custom_Types_triggered();
72 
73  void on_actionNew_Project_triggered();
74  void on_actionOpen_Project_triggered();
75  void on_actionSave_Project_triggered();
76  void on_actionReload_Project_triggered();
77 
78  void on_actionNew_Record_triggered();
79  void on_actionAdd_Child_triggered();
80  void on_actionEdit_Record_triggered();
81  void on_actionDuplicate_Record_triggered();
82  void on_actionRevert_Record_triggered();
83  void on_actionRemove_Record_triggered();
84 
85  void on_actionFindRecord_triggered();
86  void on_actionFind_Usages_triggered();
87 
88  void on_actionRun_Integrity_Checks_triggered();
89 
90  void on_actionUser_Settings_triggered();
91 
92  void on_actionAbout_triggered();
93  void on_actionManual_triggered();
94  void on_actionReport_a_Bug_triggered();
95  void on_actionReleases_triggered();
96  void on_actionRoadmap_triggered();
97 
98  void on_actionOutput_triggered();
99  void on_actionError_List_triggered();
100  void on_actionNavigate_Backward_triggered();
101  void on_actionNavigate_Forward_triggered();
102 
103  void exportRecords(QAction* exportAction);
104  void importRecords(QAction* importAction);
105  void onExportTemplatesChanged();
106  void onFieldChanged(const QString fieldId);
107  void onImportError(const QString& error);
108  void onImportFinished();
109  void onImportStarted();
110  void onImportTemplatesChanged();
111  void onFileLinkActivated(const QString& filePath);
112  void onProgressChanged(const QString title, const QString text, const int currentValue, const int maximumValue);
113  void onProjectChanged(QSharedPointer<Tome::Project> project);
114  void onRecordAdded(const QVariant& recordId, const QString& recordDisplayName, const QVariant& parentId);
115  void onRecordFieldsChanged(const QVariant& recordId);
116  void onRecordRemoved(const QVariant& recordId);
117  void onRecordReparented(const QVariant& recordId, const QVariant& oldParentId, const QVariant& newParentId);
118  void onRecordSetsChanged();
119  void onRecordUpdated(const QVariant& oldId,
120  const QString& oldDisplayName,
121  const QString& oldEditorIconFieldId,
122  const QVariant& newId,
123  const QString& newDisplayName,
124  const QString& newEditorIconFieldId);
125  void onRecordLinkActivated(const QString& recordId);
126  void onUndoStackChanged(bool clean);
127  void openRecentProject(QAction* recentProjectAction);
128  void revertFieldValue();
129  void searchResultChanged(const QString& title, const Tome::SearchResultList results);
130  void tableWidgetDoubleClicked(const QModelIndex &index);
131  void treeWidgetDoubleClicked(const QModelIndex &index);
132  void treeWidgetRecordReparented(const QVariant& recordId, const QVariant& newParentId);
133  void treeWidgetSelectionChanged(const QItemSelection& selected, const QItemSelection& deselected);
134 
135  private:
136  Ui::MainWindow *ui;
137 
138  Tome::RecordTreeWidget* recordTreeWidget;
139  Tome::RecordFieldsTableWidget* recordFieldTableWidget;
140  Tome::ErrorListDockWidget* errorListDockWidget;
141  Tome::OutputDockWidget* outputDockWidget;
142  Tome::SearchResultsDockWidget* searchResultsDockWidget;
143 
144  Tome::Controller* controller;
145 
146  AboutWindow *aboutWindow;
147  ComponentsWindow* componentsWindow;
148  CustomTypesWindow* customTypesWindow;
149  FieldDefinitionsWindow* fieldDefinitionsWindow;
150  FieldValueWindow* fieldValueWindow;
151  NewProjectWindow *newProjectWindow;
152  RecordWindow* recordWindow;
153  DuplicateRecordWindow* duplicateRecordWindow;
154  FindRecordWindow* findRecordWindow;
155  ProjectOverviewWindow* projectOverviewWindow;
156  UserSettingsWindow* userSettingsWindow;
157 
158  QProgressDialog* progressDialog;
159 
160  QList<QDockWidget*> dockWidgets;
161 
162  Tome::MessageList messages;
163 
164  bool refreshRecordTreeAfterReparent;
165 
166  QString getReadOnlyMessage(const QVariant& recordId);
167  void openProject(QString path);
168  void refreshErrorList();
169  void refreshExportMenu();
170  void refreshImportMenu();
171  void refreshRecordTree();
172  void refreshRecordTable();
173  void showReadOnlyMessage(const QVariant& recordId);
174  void showWindow(QWidget* widget);
175  void updateMenus();
176  void updateRecentProjects();
177  void updateWindowTitle();
178 };
179 
180 #endif // MAINWINDOW_H
Definition: commandlineoptions.h:6
Allows editing the values of all fields of a record.
Definition: recordfieldstablewidget.h:18
Shows the results of a search operation.
Definition: searchresultsdockwidget.h:15
Definition: mainwindow.h:25
Window for adding and removing components.
Definition: componentswindow.h:24
Window for editing user-specific application settings.
Definition: usersettingswindow.h:18
Shows the record of hierarchy and allows selecting one or more records.
Definition: recordtreewidget.h:23
Window for editing the value of a record field.
Definition: fieldvaluewindow.h:25
Window for creating a new Tome project.
Definition: newprojectwindow.h:16
Window for adding and removing field definitions.
Definition: fielddefinitionswindow.h:31
Window for showing copyright and license information about Tome.
Definition: aboutwindow.h:13
Window for adding a new record or editing an existing one.
Definition: recordwindow.h:20
Window for adding and removing custom types.
Definition: customtypeswindow.h:29
Window for adding files to or removing files from the project.
Definition: projectoverviewwindow.h:26
Main controller of Tome. Sets up and owns all other controllers and views.
Definition: controller.h:29
Shows messages, warnings and errors generated by automated tasks.
Definition: errorlistdockwidget.h:17
Window for finding specific records.
Definition: findrecordwindow.h:13
Window for duplicating an existing record, including all of its field values.
Definition: duplicaterecordwindow.h:15
Main view of Tome. Sets up and owns all other views.
Definition: mainwindow.h:44
Dock widget for showing Qt messages (e.g. qInfo or qCritical).
Definition: outputdockwidget.h:13