initial port for Cevo game in C++ (libs)

This commit is contained in:
Geoffray Levasseur committed 2026-10-22 17:20:45 +02:00
commit 8436242032
375 files changed
+46282

No files matched your search

+40
View File
@@ -0,0 +1,40 @@
#pragma once
#include <QRect>
#include <QString>
class QWidget;
namespace Cevo {
// Equivalent of PersistentForm.pas's TPersistentForm: window geometry
// persistence across sessions. Re-architected around Qt's native
// QWidget::save/restoreGeometry() + QSettings instead of the original's
// Windows-Registry-based TRect/WindowState bookkeeping - restoreGeometry()
// already clamps off-screen geometry to the current screen layout, which
// covers what CheckEntireVisible/CheckPartVisible did by hand. The
// original's recursive per-control persistence (TListView column widths,
// TPanel docked size) is NOT ported: LCL-specific widget introspection with
// no current consumer. Add a narrower, Qt-idiomatic equivalent (e.g.
// persisting a specific QTreeWidget's column widths) once a concrete form
// actually needs it.
class PersistentForm {
public:
// settingsGroup: QSettings group this form's state is stored under
// (e.g. "Forms/MainWindow") - assumes the application has already set
// QCoreApplication::setOrganizationName()/setApplicationName().
explicit PersistentForm(QString settingsGroup);
void load(QWidget *form, bool defaultMaximized = false, bool defaultFullScreen = false);
void save(QWidget *form) const;
bool isFullScreen() const { return m_fullScreen; }
void setFullScreen(QWidget *form, bool state);
private:
QString m_settingsGroup;
QRect m_restoredGeometry;
bool m_fullScreen = false;
};
} // namespace Cevo