Skip to content
Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
Loading...
Searching...
No Matches
MainWindow Class Reference

The top-level window – a QMainWindow hosting the QML UI in a QQuickWidget. More...

#include <mainwindow.h>

Inheritance diagram for MainWindow:
Collaboration diagram for MainWindow:

Public Member Functions

 MainWindow (QWidget *parent=nullptr)
 < The live save controller.
virtual ~MainWindow ()
bool saveShot (const QString &path)
 DEBUG: render the live QML view to an image file (focus/occlusion-independent).
bool debugOpenPartyDetails (int index)
 DEBUG: open the details editor for party mon index (drives the QML AppWindow.debugOpenPartyDetails).
QObject * qmlRootObject ()
 DEBUG: the root QML object of the hosted view (for the debug control server's object lookups).
void reloadQml ()
 DEBUG (–hot): clear the QML cache and reload the view from the source files on disk (live QML refresh).
protected::void fileChanged ()
 The live save was replaced.

Static Public Member Functions

static MainWindowgetInstance ()
 The single MainWindow instance.

Public Attributes

FileManagementfile = nullptr
QShortcut * recentFileShortcuts [5]
 Ctrl+1..5 open-recent shortcuts.
QHash< QString, QShortcut * > otherShortcuts
 Other global keyboard shortcuts by name.

Static Public Attributes

static Bridgebridge = nullptr
 The brg aggregate (created here, injected into QML).
static QQmlEngine * engine = nullptr
 The QML engine behind the hosted QQuickWidget.

Detailed Description

The top-level window – a QMainWindow hosting the QML UI in a QQuickWidget.

Created last in the boot sequence (createApp()), it is where C++ meets QML at runtime: it constructs the bridge, registers the image providers, and injects brg into the QML engine (injectIntoQML()). It also owns the live file (FileManagement), wires global keyboard otherShortcuts and the recent-file shortcuts, and persists window state across runs.

Note
This is the one C++ class living under app/ui (with the QML) rather than app/src; it's included in the docs via a dedicated Doxyfile INPUT entry.
See also
Bridge (the brg aggregate it creates), the boot sequence in the system map.

Definition at line 51 of file mainwindow.h.

Constructor & Destructor Documentation

◆ MainWindow()

MainWindow::MainWindow ( QWidget * parent = nullptr)

< The live save controller.

Definition at line 87 of file mainwindow.cpp.

References file.

Referenced by fileChanged(), and getInstance().

◆ ~MainWindow()

MainWindow::~MainWindow ( )
virtual

Definition at line 152 of file mainwindow.cpp.

References file, MAX_RECENT_FILES, otherShortcuts, and recentFileShortcuts.

Member Function Documentation

◆ debugOpenPartyDetails()

bool MainWindow::debugOpenPartyDetails ( int index)

DEBUG: open the details editor for party mon index (drives the QML AppWindow.debugOpenPartyDetails).

Backs –screen pokemonDetails.

Returns
false if the item/mon can't be resolved.

Definition at line 184 of file mainwindow.cpp.

Referenced by reloadQml().

◆ fileChanged()

protected::void MainWindow::fileChanged ( )

The live save was replaced.

References MainWindow().

◆ getInstance()

MainWindow * MainWindow::getInstance ( )
static

The single MainWindow instance.

Definition at line 167 of file mainwindow.cpp.

References MainWindow().

◆ qmlRootObject()

QObject * MainWindow::qmlRootObject ( )

DEBUG: the root QML object of the hosted view (for the debug control server's object lookups).

Returns
null before QML is loaded.

Definition at line 199 of file mainwindow.cpp.

◆ reloadQml()

void MainWindow::reloadQml ( )

DEBUG (–hot): clear the QML cache and reload the view from the source files on disk (live QML refresh).

C++ state (the Bridge/save) survives; QML re-instantiates. Restores the screen you were on afterwards (full-tree reload otherwise dumps you at Home + the New File modal) – see the implementation for why partial reload is deliberately not attempted.

Definition at line 236 of file mainwindow.cpp.

References bridge, Router::changeScreen(), Router::closeScreen(), debugOpenPartyDetails(), engine, Bridge::router, Router::screens, and Router::stack.

◆ saveShot()

bool MainWindow::saveShot ( const QString & path)

DEBUG: render the live QML view to an image file (focus/occlusion-independent).

Backs the –shot debug launch flag.

Returns
false on failure.

Definition at line 176 of file mainwindow.cpp.

Member Data Documentation

◆ bridge

Bridge * MainWindow::bridge = nullptr
static

The brg aggregate (created here, injected into QML).

Definition at line 62 of file mainwindow.h.

Referenced by reloadQml().

◆ engine

QQmlEngine * MainWindow::engine = nullptr
static

The QML engine behind the hosted QQuickWidget.

Definition at line 63 of file mainwindow.h.

Referenced by reloadQml().

◆ file

FileManagement* MainWindow::file = nullptr
See also
file property.

Definition at line 85 of file mainwindow.h.

Referenced by MainWindow(), and ~MainWindow().

◆ otherShortcuts

QHash<QString, QShortcut*> MainWindow::otherShortcuts

Other global keyboard shortcuts by name.

Definition at line 89 of file mainwindow.h.

Referenced by ~MainWindow().

◆ recentFileShortcuts

QShortcut* MainWindow::recentFileShortcuts[5]

Ctrl+1..5 open-recent shortcuts.

Definition at line 88 of file mainwindow.h.

Referenced by ~MainWindow().


The documentation for this class was generated from the following files: