Merge branch 'master' into qt6_cmake_joshua

This commit is contained in:
joshua
2026-07-31 21:15:21 +02:00
parent f16cf7dac8
commit e6d29cf345
297 changed files with 82691 additions and 27463 deletions
+36 -15
View File
@@ -28,13 +28,11 @@
#include "properties/xrefproperties.h"
#include "titleblock/templatescollection.h"
#include "titleblockproperties.h"
#ifdef BUILD_WITHOUT_KF5
#else
# include <KAutoSaveFile>
#endif
#include "diagram.h"
#include <KAutoSaveFile>
#include <QHash>
#include <QFuture>
class Diagram;
class ElementsLocation;
@@ -47,10 +45,23 @@ class XmlElementCollection;
class QTimer;
class TerminalStrip;
#ifdef BUILD_WITHOUT_KF5
#else
class KAutoSaveFile;
#endif
#include <QColor>
struct GuideProperties {
int orientation; // 0 = Horizontal, 1 = Vertical
qreal position;
QColor color;
bool operator==(const GuideProperties &other) const {
return orientation == other.orientation &&
position == other.position &&
color == other.color;
}
bool operator!=(const GuideProperties &other) const {
return !(*this == other);
}
};
/**
This class represents a QET project. Typically saved as a .qet file, it
@@ -78,10 +89,7 @@ class QETProject : public QObject
public:
QETProject (QObject *parent = nullptr);
QETProject (const QString &path, QObject * = nullptr);
#ifdef BUILD_WITHOUT_KF5
#else
QETProject (KAutoSaveFile *backup, QObject *parent=nullptr);
#endif
~QETProject() override;
private:
@@ -105,10 +113,19 @@ class QETProject : public QObject
QVersionNumber declaredQElectroTechVersion();
void setTitle(const QString &);
/// Enable/disable the asynchronous crash-recovery backup for all
/// projects. Disabled by the headless CLI: the backup write runs on a
/// background thread referencing the project, and a short-lived CLI
/// process can destroy the project before the write finishes (crash).
static void setBackupEnabled(bool enabled);
///DEFAULT PROPERTIES
BorderProperties defaultBorderProperties() const;
void setDefaultBorderProperties(const BorderProperties &);
QList<GuideProperties> defaultGuides() const;
void setDefaultGuides(const QList<GuideProperties> &guides);
TitleBlockProperties defaultTitleBlockProperties() const;
void setDefaultTitleBlockProperties(const TitleBlockProperties &);
@@ -230,9 +247,11 @@ class QETProject : public QObject
void readProjectPropertiesXml(QDomDocument &xml_project);
void readDefaultPropertiesXml(QDomDocument &xml_project);
void readTerminalStripXml(const QDomDocument &xml_project);
void readUsageXml(QDomDocument &xml_project);
void writeProjectPropertiesXml(QDomElement &);
void writeDefaultPropertiesXml(QDomElement &);
void writeUsageXml(QDomElement &);
void addDiagram(Diagram *diagram, int pos = -1);
void writeBackup();
void init();
@@ -241,6 +260,8 @@ class QETProject : public QObject
// attributes
private:
/// When false, writeBackup() is a no-op (set by the headless CLI)
static bool m_backup_enabled;
/// File path this project is saved to
QString m_file_path;
/// Current state of the project
@@ -259,6 +280,8 @@ class QETProject : public QObject
QString read_only_file_path_;
/// Default dimensions and properties for new diagrams created within the project
BorderProperties default_border_properties_ = BorderProperties::defaultProperties();
/// Default guides for new diagrams created within the project
QList<GuideProperties> m_default_guides;
/// Default conductor properties for new diagrams created within the project
ConductorProperties default_conductor_properties_ = ConductorProperties::defaultProperties();
/// Default title block properties for new diagrams created within the project
@@ -287,10 +310,8 @@ class QETProject : public QObject
bool m_freeze_new_conductors = false;
QTimer m_save_backup_timer,
m_autosave_timer;
#ifdef BUILD_WITHOUT_KF5
#else
QFuture<bool> m_backup_future;
KAutoSaveFile m_backup_file;
#endif
QUuid m_uuid = QUuid::createUuid();
projectDataBase m_data_base;
QVector<TerminalStrip *> m_terminal_strip_vector;