Refactor loading and saving code

The saving code has been refactored into one class per format with common
methods for each part of the saving process. This should make it easier to
add further formats, and inheriting a format class can allow implementing a
different format that is largely based on an existing format.

The loading code is also in one class per format but is largely the same as
what it was before.

Both classes have the ability to warn the user if any issues or errors are
or will be encountered when loading or saving.

TTI files are now written with CR/LF line endings on all platforms as a
result of using binary file writing for all formats, previously Linux builds
would save TTI files with just LF line endings. TTI files are still loaded
with readLine() and trimmed() which can cope with either type of line ending.

Experimental support for loading and exporting EP1 and HMS SD-Teletext htt
formats has been added. The htt format inherits from the t42 format as the
format appears to be largely the same except for the bits being reversed
within each byte and the clock run-in and framing code added before each
packet.
This commit is contained in:
Gavin MacGregor
2025-03-02 21:56:11 +00:00
parent 42176f2fc0
commit c9b797cff4
9 changed files with 1678 additions and 879 deletions

View File

@@ -30,11 +30,13 @@
#include <QSlider>
#include <QToolButton>
#include "loadformats.h"
#include "mainwidget.h"
#include "pagecomposelinksdockwidget.h"
#include "pageenhancementsdockwidget.h"
#include "pageoptionsdockwidget.h"
#include "palettedockwidget.h"
#include "saveformats.h"
#include "x26dockwidget.h"
class QAction;
@@ -61,7 +63,7 @@ private slots:
bool saveAs();
void reload();
void exportAuto();
void exportT42(bool fromAuto);
void exportFile(bool fromAuto);
void exportZXNet();
void exportEditTF();
void exportImage();
@@ -138,6 +140,9 @@ private:
QString m_curFile, m_exportAutoFileName, m_exportImageFileName;
bool m_isUntitled;
LoadFormats m_loadFormats;
SaveFormats m_saveFormats;
};
#endif