Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
Toggle main menu visibility
Loading...
Searching...
No Matches
mainwindow.h
Go to the documentation of this file.
1
/*
2
* Copyright 2020 Twilight
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*/
16
#pragma once
17
#include <QString>
18
#include <QHash>
19
#include <QShortcut>
20
#include <QSettings>
21
#include <QQmlEngine>
22
23
#include "ui_mainwindow.h"
24
25
// The Q_PROPERTY(FileManagement* file) below makes MOC require the COMPLETE type
26
// (not a forward decl), and FileManagement is traversed in QML via brg.file so it
27
// must NOT be Q_DECLARE_OPAQUE_POINTER'd. This was previously satisfied only as a
28
// side effect of the single-target unity MOC; now that the app logic is a library
29
// (appcore), include it explicitly. See notes/reference/qt6-patterns.md.
30
#include <
pse-savefile/filemanagement.h
>
31
32
class
RecentFilesModel
;
33
class
QAbstractItemModel;
34
class
Bridge
;
35
50
class
MainWindow
:
public
QMainWindow
51
{
52
Q_OBJECT
53
54
Q_PROPERTY(
FileManagement
*
file
MEMBER
file
NOTIFY
fileChanged
)
55
56
public
:
57
MainWindow
(QWidget* parent =
nullptr
);
58
virtual
~MainWindow
();
59
60
static
MainWindow
*
getInstance
();
61
static
Bridge
*
bridge
;
62
static
QQmlEngine*
engine
;
63
64
FileManagement
*
file
=
nullptr
;
65
66
// MAX_RECENT_FILES
67
QShortcut*
recentFileShortcuts
[5];
68
QHash<QString, QShortcut*>
otherShortcuts
;
69
70
signals:
71
void
fileChanged
();
72
73
private
slots:
74
void
reUpdateRecentFiles(QList<QString> files);
75
void
onRecentFileClick();
76
void
onPathChanged(QString path);
77
78
private
:
79
Ui::MainWindow ui;
80
QSettings settings;
81
void
closeEvent(QCloseEvent* event);
82
83
void
saveState();
84
void
loadState();
85
86
void
setupShortcuts();
87
void
setupProviders();
88
void
injectIntoQML();
89
void
ssConnect();
90
91
static
MainWindow
* instance;
92
};
Bridge
The single QML<->C++ doorway – everything the UI touches hangs off here.
Definition
bridge.h:71
FileManagement
Owns the on-disk side of a save: the current path, the recent-files list, and the live SaveFile.
Definition
filemanagement.h:46
MainWindow::engine
static QQmlEngine * engine
The QML engine behind the hosted QQuickWidget.
Definition
mainwindow.h:62
MainWindow::recentFileShortcuts
QShortcut * recentFileShortcuts[5]
Ctrl+1..5 open-recent shortcuts.
Definition
mainwindow.h:67
MainWindow::otherShortcuts
QHash< QString, QShortcut * > otherShortcuts
Other global keyboard shortcuts by name.
Definition
mainwindow.h:68
MainWindow::file
FileManagement * file
Definition
mainwindow.h:64
MainWindow::MainWindow
MainWindow(QWidget *parent=nullptr)
< The live save controller.
Definition
mainwindow.cpp:52
MainWindow::fileChanged
protected::void fileChanged()
The live save was replaced.
MainWindow::getInstance
static MainWindow * getInstance()
The single MainWindow instance.
Definition
mainwindow.cpp:125
MainWindow::~MainWindow
virtual ~MainWindow()
Definition
mainwindow.cpp:110
MainWindow::bridge
static Bridge * bridge
The brg aggregate (created here, injected into QML).
Definition
mainwindow.h:61
RecentFilesModel
Recent-files list model for the start screen.
Definition
recentfilesmodel.h:30
filemanagement.h
projects
app
ui
window
mainwindow.h
Generated by
1.17.0