mirror of
https://github.com/markdavidlong/AppleSAWS.git
synced 2026-03-10 23:25:02 +00:00
Modernized src/ui/viewers classes
This commit is contained in:
@@ -12,13 +12,19 @@ namespace Ui {
|
||||
class ApplesoftFileDetailViewer;
|
||||
}
|
||||
|
||||
class ApplesoftFileDetailViewer : public QWidget
|
||||
class ApplesoftFileDetailViewer final : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ApplesoftFileDetailViewer(ApplesoftFile *file, QWidget *parent = 0);
|
||||
~ApplesoftFileDetailViewer();
|
||||
explicit ApplesoftFileDetailViewer(ApplesoftFile *file, QWidget *parent = nullptr);
|
||||
~ApplesoftFileDetailViewer() override;
|
||||
|
||||
// Rule of Five - Qt QObject classes cannot be copied or moved
|
||||
ApplesoftFileDetailViewer(const ApplesoftFileDetailViewer&) = delete;
|
||||
ApplesoftFileDetailViewer& operator=(const ApplesoftFileDetailViewer&) = delete;
|
||||
ApplesoftFileDetailViewer(ApplesoftFileDetailViewer&&) = delete;
|
||||
ApplesoftFileDetailViewer& operator=(ApplesoftFileDetailViewer&&) = delete;
|
||||
|
||||
void setLineData(QList<ApplesoftLine> lineData);
|
||||
void foo() { qDebug() << "AFDV::foo!"; }
|
||||
@@ -27,15 +33,15 @@ public:
|
||||
bool load();
|
||||
|
||||
protected:
|
||||
QString shortenName(QString name);
|
||||
[[nodiscard]] QString shortenName(QString name);
|
||||
private:
|
||||
void process();
|
||||
void process();
|
||||
|
||||
std::unique_ptr<Ui::ApplesoftFileDetailViewer> ui;
|
||||
QList<ApplesoftLine> m_lines;
|
||||
|
||||
QMap<QString,QString> m_notes;
|
||||
|
||||
ApplesoftFile *m_file;
|
||||
ApplesoftFile *m_file{nullptr};
|
||||
};
|
||||
|
||||
|
||||
@@ -14,15 +14,10 @@ ApplesoftFileViewer::ApplesoftFileViewer(QWidget *parent) :
|
||||
ui(std::make_unique<Ui::ApplesoftFileViewer>())
|
||||
{
|
||||
ui->setupUi(this);
|
||||
m_afdv = Q_NULLPTR;
|
||||
|
||||
QFont textAreaFont("PR Number 3");
|
||||
// QFont textAreaFont("Print Char 21");
|
||||
// textAreaFont.setStyleHint(QFont::Monospace);
|
||||
textAreaFont.setPointSize(12);
|
||||
|
||||
// qDebug() << "************ " << textAreaFont;
|
||||
|
||||
QSettings settings;
|
||||
QString title = QString("Applesoft Viewer");
|
||||
m_title = title;
|
||||
@@ -31,29 +26,19 @@ ApplesoftFileViewer::ApplesoftFileViewer(QWidget *parent) :
|
||||
m_formatter = new ApplesoftFormatter(this);
|
||||
m_formatter->setFlags(ApplesoftFormatter::FormatOption::ShowCtrlChars);
|
||||
connect(ui->findButton, &QToolButton::clicked, this, &ApplesoftFileViewer::findText);
|
||||
m_isFirstFind = true;
|
||||
ui->textArea->setUndoRedoEnabled(false);
|
||||
ui->textArea->setUndoRedoEnabled(true);
|
||||
|
||||
m_showIntsAction = Q_NULLPTR;
|
||||
m_reindentCodeAction = Q_NULLPTR;
|
||||
m_blankAfterReturnsAction = Q_NULLPTR;
|
||||
m_syntaxHighlightingAction = Q_NULLPTR;
|
||||
m_showVarExplorerAction = Q_NULLPTR;
|
||||
m_wordWrapAction = Q_NULLPTR;
|
||||
m_showCtrlCharsAction = Q_NULLPTR;
|
||||
m_setFontAction = Q_NULLPTR;
|
||||
|
||||
toggleWordWrap(settings.value("ASViewer.WordWrap",true).toBool());
|
||||
|
||||
setIndentCode(settings.value("ASViewer.indentCode",false).toBool(), NoReformat);
|
||||
setIntsAsHex(settings.value("ASViewer.intsAsHex",false).toBool(), NoReformat);
|
||||
setBreakAfterReturn(settings.value("ASViewer.breakAfterReturn",false).toBool(), NoReformat);
|
||||
setSyntaxHighlighting(settings.value("ASViewer.syntaxHighlighting",true).toBool(), NoReformat);
|
||||
setShowCtrlChars(settings.value("ASViewer.showCtrlChars",true).toBool(), NoReformat);
|
||||
setIndentCode(settings.value("ASViewer.indentCode",false).toBool(), ReformatRule::NoReformat);
|
||||
setIntsAsHex(settings.value("ASViewer.intsAsHex",false).toBool(), ReformatRule::NoReformat);
|
||||
setBreakAfterReturn(settings.value("ASViewer.breakAfterReturn",false).toBool(), ReformatRule::NoReformat);
|
||||
setSyntaxHighlighting(settings.value("ASViewer.syntaxHighlighting",true).toBool(), ReformatRule::NoReformat);
|
||||
setShowCtrlChars(settings.value("ASViewer.showCtrlChars",true).toBool(), ReformatRule::NoReformat);
|
||||
|
||||
setTextFont(fontFromSettings("ASViewer.textFont", textAreaFont), NoReformat);
|
||||
setTextFont(textAreaFont, NoReformat);
|
||||
setTextFont(fontFromSettings("ASViewer.textFont", textAreaFont), ReformatRule::NoReformat);
|
||||
setTextFont(textAreaFont, ReformatRule::NoReformat);
|
||||
}
|
||||
|
||||
ApplesoftFileViewer::~ApplesoftFileViewer()
|
||||
@@ -73,7 +58,7 @@ bool ApplesoftFileViewer::makeMenuOptions(QMenu *menu)
|
||||
m_showIntsAction = new QAction("Show Ints as &Hex",this);
|
||||
m_showIntsAction->setCheckable(true);
|
||||
m_showIntsAction->setChecked(settings.value("ASViewer.intsAsHex",false).toBool());
|
||||
setIntsAsHex(settings.value("ASViewer.intsAsHex",false).toBool(),NoReformat);
|
||||
setIntsAsHex(settings.value("ASViewer.intsAsHex",false).toBool(),ReformatRule::NoReformat);
|
||||
|
||||
connect(m_showIntsAction, &QAction::toggled, ui->findText, &QLineEdit::clear);
|
||||
connect(m_showIntsAction, &QAction::toggled,
|
||||
@@ -87,7 +72,7 @@ bool ApplesoftFileViewer::makeMenuOptions(QMenu *menu)
|
||||
m_reindentCodeAction = new QAction("&Indent code",this);
|
||||
m_reindentCodeAction->setCheckable(true);
|
||||
m_reindentCodeAction->setChecked(settings.value("ASViewer.indentCode",false).toBool());
|
||||
setIndentCode(settings.value("ASViewer.indentCode",false).toBool(),NoReformat);
|
||||
setIndentCode(settings.value("ASViewer.indentCode",false).toBool(),ReformatRule::NoReformat);
|
||||
|
||||
connect(m_reindentCodeAction, &QAction::toggled, ui->findText, &QLineEdit::clear);
|
||||
connect(m_reindentCodeAction, &QAction::toggled,
|
||||
@@ -101,7 +86,7 @@ bool ApplesoftFileViewer::makeMenuOptions(QMenu *menu)
|
||||
m_blankAfterReturnsAction = new QAction("Blank &Line after RETURNs",this);
|
||||
m_blankAfterReturnsAction->setCheckable(true);
|
||||
m_blankAfterReturnsAction->setChecked(settings.value("ASViewer.breakAfterReturn",false).toBool());
|
||||
setIndentCode(settings.value("ASViewer.breakAfterReturn",false).toBool(),NoReformat);
|
||||
setIndentCode(settings.value("ASViewer.breakAfterReturn",false).toBool(),ReformatRule::NoReformat);
|
||||
|
||||
connect(m_blankAfterReturnsAction, &QAction::toggled, ui->findText, &QLineEdit::clear);
|
||||
connect(m_blankAfterReturnsAction, &QAction::toggled,
|
||||
@@ -114,7 +99,7 @@ bool ApplesoftFileViewer::makeMenuOptions(QMenu *menu)
|
||||
m_showCtrlCharsAction = new QAction("Show &Control Characters",this);
|
||||
m_showCtrlCharsAction->setCheckable(true);
|
||||
m_showCtrlCharsAction->setChecked(settings.value("ASViewer.showCtrlChars",false).toBool());
|
||||
setIndentCode(settings.value("ASViewer.showCtrlChars",false).toBool(),NoReformat);
|
||||
setIndentCode(settings.value("ASViewer.showCtrlChars",false).toBool(),ReformatRule::NoReformat);
|
||||
|
||||
connect(m_showCtrlCharsAction, &QAction::toggled, ui->findText, &QLineEdit::clear);
|
||||
connect(m_showCtrlCharsAction, &QAction::toggled,
|
||||
@@ -140,7 +125,7 @@ bool ApplesoftFileViewer::makeMenuOptions(QMenu *menu)
|
||||
m_syntaxHighlightingAction = new QAction("&Syntax Highlighting",this);
|
||||
m_syntaxHighlightingAction->setCheckable(true);
|
||||
m_syntaxHighlightingAction->setChecked(settings.value("ASViewer.syntaxHighlighting",false).toBool());
|
||||
setIndentCode(settings.value("ASViewer.syntaxHighlighting",false).toBool(),NoReformat);
|
||||
setIndentCode(settings.value("ASViewer.syntaxHighlighting",false).toBool(),ReformatRule::NoReformat);
|
||||
|
||||
connect(m_syntaxHighlightingAction, &QAction::toggled, ui->findText, &QLineEdit::clear);
|
||||
connect(m_syntaxHighlightingAction, &QAction::toggled,
|
||||
@@ -172,7 +157,7 @@ bool ApplesoftFileViewer::makeMenuOptions(QMenu *menu)
|
||||
this, "Set Font"
|
||||
/*, QFontDialog::MonospacedFonts| QFontDialog::DontUseNativeDialog */);
|
||||
if (ok) {
|
||||
setTextFont(font,ForceReformat);
|
||||
setTextFont(font,ReformatRule::ForceReformat);
|
||||
fontToSettings("ASViewer.textFont",font);
|
||||
}
|
||||
|
||||
@@ -215,7 +200,7 @@ void ApplesoftFileViewer::setIndentCode(bool enabled, ReformatRule reformat)
|
||||
}
|
||||
QSettings settings;
|
||||
settings.setValue("ASViewer.indentCode",enabled);
|
||||
if (reformat == ForceReformat)
|
||||
if (reformat == ReformatRule::ForceReformat)
|
||||
reformatText();
|
||||
}
|
||||
|
||||
@@ -231,7 +216,7 @@ void ApplesoftFileViewer::setBreakAfterReturn(bool enabled, ReformatRule reforma
|
||||
}
|
||||
QSettings settings;
|
||||
settings.setValue("ASViewer.breakAfterReturn",enabled);
|
||||
if (reformat == ForceReformat)
|
||||
if (reformat == ReformatRule::ForceReformat)
|
||||
reformatText();
|
||||
}
|
||||
|
||||
@@ -247,13 +232,13 @@ void ApplesoftFileViewer::setShowCtrlChars(bool enabled, ReformatRule reformat)
|
||||
}
|
||||
QSettings settings;
|
||||
settings.setValue("ASViewer.showCtrlChars",enabled);
|
||||
if (reformat == ForceReformat)
|
||||
if (reformat == ReformatRule::ForceReformat)
|
||||
reformatText();
|
||||
}
|
||||
|
||||
void ApplesoftFileViewer::setSyntaxHighlighting(bool enabled)
|
||||
{
|
||||
setSyntaxHighlighting(enabled, ForceReformat);
|
||||
setSyntaxHighlighting(enabled, ReformatRule::ForceReformat);
|
||||
}
|
||||
|
||||
void ApplesoftFileViewer::setSyntaxHighlighting(bool enabled, ReformatRule reformat)
|
||||
@@ -268,7 +253,7 @@ void ApplesoftFileViewer::setSyntaxHighlighting(bool enabled, ReformatRule refor
|
||||
}
|
||||
QSettings settings;
|
||||
settings.setValue("ASViewer.syntaxHighlighting",enabled);
|
||||
if (reformat == ForceReformat)
|
||||
if (reformat == ReformatRule::ForceReformat)
|
||||
reformatText();
|
||||
}
|
||||
|
||||
@@ -284,14 +269,14 @@ void ApplesoftFileViewer::setIntsAsHex(bool enabled, ReformatRule reformat)
|
||||
}
|
||||
QSettings settings;
|
||||
settings.setValue("ASViewer.intsAsHex",enabled);
|
||||
if (reformat == ForceReformat)
|
||||
if (reformat == ReformatRule::ForceReformat)
|
||||
reformatText();
|
||||
}
|
||||
|
||||
void ApplesoftFileViewer::setTextFont(const QFont &font, ReformatRule reformat)
|
||||
{
|
||||
ui->textArea->setFont(font);
|
||||
if (reformat == ForceReformat)
|
||||
if (reformat == ReformatRule::ForceReformat)
|
||||
{
|
||||
reformatText();
|
||||
}
|
||||
|
||||
@@ -14,25 +14,28 @@ namespace Ui {
|
||||
class ApplesoftFileViewer;
|
||||
}
|
||||
|
||||
class ApplesoftFileViewer : public FileViewerInterface
|
||||
class ApplesoftFileViewer final : public FileViewerInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum class ReformatRule : bool {
|
||||
ForceReformat = true,
|
||||
NoReformat = false
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
ForceReformat,
|
||||
NoReformat
|
||||
} ReformatRule;
|
||||
explicit ApplesoftFileViewer(QWidget *parent = nullptr);
|
||||
~ApplesoftFileViewer() override;
|
||||
|
||||
// Rule of Five - Qt QObject classes cannot be copied or moved
|
||||
ApplesoftFileViewer(const ApplesoftFileViewer&) = delete;
|
||||
ApplesoftFileViewer& operator=(const ApplesoftFileViewer&) = delete;
|
||||
ApplesoftFileViewer(ApplesoftFileViewer&&) = delete;
|
||||
ApplesoftFileViewer& operator=(ApplesoftFileViewer&&) = delete;
|
||||
|
||||
ApplesoftFileViewer(QWidget *parent = 0);
|
||||
~ApplesoftFileViewer();
|
||||
|
||||
virtual bool optionsMenuItems(QMenu *menu);
|
||||
|
||||
virtual bool canPrint() const;
|
||||
|
||||
bool canExport() const;
|
||||
[[nodiscard]] bool optionsMenuItems(QMenu *menu) override;
|
||||
[[nodiscard]] bool canPrint() const override;
|
||||
[[nodiscard]] bool canExport() const override;
|
||||
|
||||
public slots:
|
||||
void setFile(GenericFile *file);
|
||||
@@ -48,16 +51,16 @@ protected slots:
|
||||
void setSyntaxHighlighting(bool enabled);
|
||||
void setSyntaxHighlighting(bool enabled, ReformatRule reformat);
|
||||
|
||||
void setIndentCode(bool enabled) { setIndentCode(enabled, ForceReformat); }
|
||||
void setIndentCode(bool enabled) { setIndentCode(enabled, ReformatRule::ForceReformat); }
|
||||
void setIndentCode(bool enabled, ReformatRule reformat);
|
||||
|
||||
void setIntsAsHex(bool enabled) { setIntsAsHex(enabled, ForceReformat); }
|
||||
void setIntsAsHex(bool enabled) { setIntsAsHex(enabled, ReformatRule::ForceReformat); }
|
||||
void setIntsAsHex(bool enabled, ReformatRule reformat);
|
||||
|
||||
void setBreakAfterReturn(bool enabled) { setBreakAfterReturn(enabled,ForceReformat); }
|
||||
void setBreakAfterReturn(bool enabled) { setBreakAfterReturn(enabled, ReformatRule::ForceReformat); }
|
||||
void setBreakAfterReturn(bool enabled, ReformatRule reformat);
|
||||
|
||||
void setShowCtrlChars(bool enabled) { setShowCtrlChars(enabled,ForceReformat); }
|
||||
void setShowCtrlChars(bool enabled) { setShowCtrlChars(enabled, ReformatRule::ForceReformat); }
|
||||
void setShowCtrlChars(bool enabled, ReformatRule reformat);
|
||||
|
||||
void setTextFont(const QFont &font, ReformatRule reformat);
|
||||
@@ -65,20 +68,20 @@ protected slots:
|
||||
void reformatText();
|
||||
|
||||
private:
|
||||
bool makeMenuOptions(QMenu *menu);
|
||||
[[nodiscard]] bool makeMenuOptions(QMenu *menu);
|
||||
|
||||
ApplesoftFile *m_file;
|
||||
ApplesoftFormatter *m_formatter;
|
||||
bool m_isFirstFind;
|
||||
ApplesoftFile *m_file{nullptr};
|
||||
ApplesoftFormatter *m_formatter{nullptr};
|
||||
bool m_isFirstFind{true};
|
||||
std::unique_ptr<Ui::ApplesoftFileViewer> ui;
|
||||
ApplesoftFileDetailViewer *m_afdv;
|
||||
QAction *m_showIntsAction;
|
||||
QAction *m_reindentCodeAction;
|
||||
QAction *m_blankAfterReturnsAction;
|
||||
QAction *m_syntaxHighlightingAction;
|
||||
QAction *m_showVarExplorerAction;
|
||||
QAction *m_wordWrapAction;
|
||||
QAction *m_showCtrlCharsAction;
|
||||
QAction *m_setFontAction;
|
||||
ApplesoftFileDetailViewer *m_afdv{nullptr};
|
||||
QAction *m_showIntsAction{nullptr};
|
||||
QAction *m_reindentCodeAction{nullptr};
|
||||
QAction *m_blankAfterReturnsAction{nullptr};
|
||||
QAction *m_syntaxHighlightingAction{nullptr};
|
||||
QAction *m_showVarExplorerAction{nullptr};
|
||||
QAction *m_wordWrapAction{nullptr};
|
||||
QAction *m_showCtrlCharsAction{nullptr};
|
||||
QAction *m_setFontAction{nullptr};
|
||||
};
|
||||
|
||||
|
||||
@@ -8,17 +8,23 @@
|
||||
class BinaryFile;
|
||||
class CharacterWidget;
|
||||
|
||||
class CharSetViewer : public FileViewerInterface
|
||||
class CharSetViewer final : public FileViewerInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit CharSetViewer(QWidget *parent = 0);
|
||||
virtual ~CharSetViewer();
|
||||
explicit CharSetViewer(QWidget *parent = nullptr);
|
||||
~CharSetViewer() override;
|
||||
|
||||
// Rule of Five - Qt QObject classes cannot be copied or moved
|
||||
CharSetViewer(const CharSetViewer&) = delete;
|
||||
CharSetViewer& operator=(const CharSetViewer&) = delete;
|
||||
CharSetViewer(CharSetViewer&&) = delete;
|
||||
CharSetViewer& operator=(CharSetViewer&&) = delete;
|
||||
|
||||
void setFile(GenericFile *file);
|
||||
void setFile(GenericFile *file) override;
|
||||
void setFile(BinaryFile *file);
|
||||
|
||||
virtual bool optionsMenuItems(QMenu *menu);
|
||||
[[nodiscard]] bool optionsMenuItems(QMenu *menu) override;
|
||||
|
||||
public slots:
|
||||
void setFgColor(QColor color);
|
||||
@@ -33,22 +39,22 @@ public slots:
|
||||
signals:
|
||||
|
||||
protected:
|
||||
QList<CharacterWidget*> getChildren();
|
||||
[[nodiscard]] QList<CharacterWidget*> getChildren();
|
||||
|
||||
protected slots:
|
||||
void cleanupExplorer();
|
||||
|
||||
private:
|
||||
BinaryFile *m_file;
|
||||
BinaryFile *m_file{nullptr};
|
||||
|
||||
QByteArray m_data;
|
||||
|
||||
CharacterSet m_charset;
|
||||
|
||||
CharacterSetExplorer *m_cse;
|
||||
CharacterSetExplorer *m_cse{nullptr};
|
||||
|
||||
QAction *m_showGridAction;
|
||||
QAction *m_enableBitShiftAction;
|
||||
QAction *m_charSetEncoderAction;
|
||||
QAction *m_showGridAction{nullptr};
|
||||
QAction *m_enableBitShiftAction{nullptr};
|
||||
QAction *m_charSetEncoderAction{nullptr};
|
||||
};
|
||||
|
||||
|
||||
@@ -22,14 +22,6 @@ DisassemblerViewer::DisassemblerViewer(QWidget *parent) :
|
||||
QFont textAreaFont;
|
||||
textAreaFont.setStyleHint(QFont::Monospace);
|
||||
|
||||
|
||||
m_isRelo = false;
|
||||
m_dmd = Q_NULLPTR;
|
||||
m_wordWrapAction = Q_NULLPTR;
|
||||
m_showMetadataAction = Q_NULLPTR;
|
||||
m_setFontAction = Q_NULLPTR;
|
||||
|
||||
|
||||
QString title = QString("Disassembly Viewer");
|
||||
setWindowTitle(title);
|
||||
|
||||
|
||||
@@ -16,28 +16,32 @@ namespace Ui {
|
||||
class DisassemblerViewer;
|
||||
}
|
||||
|
||||
class DisassemblerViewer : public FileViewerInterface
|
||||
class DisassemblerViewer final : public FileViewerInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DisassemblerViewer(QWidget *parent = 0);
|
||||
~DisassemblerViewer();
|
||||
explicit DisassemblerViewer(QWidget *parent = nullptr);
|
||||
~DisassemblerViewer() override;
|
||||
|
||||
// Rule of Five - Qt QObject classes cannot be copied or moved
|
||||
DisassemblerViewer(const DisassemblerViewer&) = delete;
|
||||
DisassemblerViewer& operator=(const DisassemblerViewer&) = delete;
|
||||
DisassemblerViewer(DisassemblerViewer&&) = delete;
|
||||
DisassemblerViewer& operator=(DisassemblerViewer&&) = delete;
|
||||
|
||||
void setFile(BinaryFile *file);
|
||||
void setFile(RelocatableFile *file);
|
||||
void setData(QByteArray data);
|
||||
|
||||
QString getPotentialLabel(quint16 address);
|
||||
virtual bool optionsMenuItems(QMenu *);
|
||||
|
||||
bool canPrint() const;
|
||||
bool canExport() const;
|
||||
|
||||
QString makeDescriptorStringForVal(quint8 val);
|
||||
[[nodiscard]] QString getPotentialLabel(quint16 address);
|
||||
[[nodiscard]] bool optionsMenuItems(QMenu *) override;
|
||||
[[nodiscard]] bool canPrint() const override;
|
||||
[[nodiscard]] bool canExport() const override;
|
||||
[[nodiscard]] QString makeDescriptorStringForVal(quint8 val);
|
||||
|
||||
void disassemble(QList<quint16> entryPoints);
|
||||
QStringList getDisassemblyStrings();
|
||||
[[nodiscard]] QStringList getDisassemblyStrings();
|
||||
|
||||
public slots:
|
||||
void setFile(GenericFile *file);
|
||||
@@ -53,18 +57,18 @@ protected slots:
|
||||
private:
|
||||
std::unique_ptr<Ui::DisassemblerViewer> ui;
|
||||
|
||||
DisassemblerMetadataDialog *m_dmd;
|
||||
GenericFile *m_file;
|
||||
DisassemblerMetadataDialog *m_dmd{nullptr};
|
||||
GenericFile *m_file{nullptr};
|
||||
|
||||
QAction *m_wordWrapAction;
|
||||
QAction *m_showMetadataAction;
|
||||
QAction *m_setFontAction;
|
||||
QAction *m_wordWrapAction{nullptr};
|
||||
QAction *m_showMetadataAction{nullptr};
|
||||
QAction *m_setFontAction{nullptr};
|
||||
|
||||
BinaryFileMetadata *m_bfm;
|
||||
BinaryFileMetadata *m_bfm{nullptr};
|
||||
|
||||
AttributedMemory m_mem;
|
||||
|
||||
bool m_isRelo;
|
||||
bool m_isRelo{false};
|
||||
|
||||
QStringList m_disassemblyStrings;
|
||||
JumpLines m_jumpLines;
|
||||
|
||||
@@ -13,21 +13,26 @@ namespace Ui {
|
||||
class HexDumpViewer;
|
||||
}
|
||||
|
||||
class HexDumpViewer : public FileViewerInterface
|
||||
class HexDumpViewer final : public FileViewerInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit HexDumpViewer(QWidget *parent = 0, int defaultFontSize = -1);
|
||||
~HexDumpViewer();
|
||||
explicit HexDumpViewer(QWidget *parent = nullptr, int defaultFontSize = -1);
|
||||
~HexDumpViewer() override;
|
||||
|
||||
// Rule of Five - Qt QObject classes cannot be copied or moved
|
||||
HexDumpViewer(const HexDumpViewer&) = delete;
|
||||
HexDumpViewer& operator=(const HexDumpViewer&) = delete;
|
||||
HexDumpViewer(HexDumpViewer&&) = delete;
|
||||
HexDumpViewer& operator=(HexDumpViewer&&) = delete;
|
||||
|
||||
void setFile(GenericFile *file) { setFile(file,0); }
|
||||
void setFile(GenericFile *file) { setFile(file, 0); }
|
||||
void setFile(GenericFile *file, quint16 offset);
|
||||
void setRawData(QByteArray data, quint16 offset = 0);
|
||||
virtual bool optionsMenuItems(QMenu *menu);
|
||||
|
||||
bool canPrint() const;
|
||||
bool canExport() const;
|
||||
[[nodiscard]] bool optionsMenuItems(QMenu *menu) override;
|
||||
[[nodiscard]] bool canPrint() const override;
|
||||
[[nodiscard]] bool canExport() const override;
|
||||
|
||||
public slots:
|
||||
void showHexAndAsciiValues();
|
||||
@@ -40,15 +45,15 @@ protected:
|
||||
private:
|
||||
void setText(QString text);
|
||||
void setData(QByteArray data);
|
||||
QString valToAppleAscii(quint8 val);
|
||||
[[nodiscard]] QString valToAppleAscii(quint8 val);
|
||||
|
||||
QAction *m_setFontAction;
|
||||
QAction *m_setFontAction{nullptr};
|
||||
int m_defaultFontSize;
|
||||
std::unique_ptr<Ui::HexDumpViewer> ui;
|
||||
|
||||
quint16 m_offset;
|
||||
quint16 m_offset{0};
|
||||
QByteArray m_data;
|
||||
|
||||
GenericFile *m_file;
|
||||
GenericFile *m_file{nullptr};
|
||||
};
|
||||
|
||||
|
||||
@@ -15,29 +15,35 @@
|
||||
#include <QLabel>
|
||||
|
||||
|
||||
class HiresViewer : public FileViewerInterface
|
||||
class HiresViewer final : public FileViewerInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
explicit HiresViewer(QWidget *parent = 0);
|
||||
virtual bool optionsMenuItems(QMenu *);
|
||||
|
||||
bool canPrint() const;
|
||||
bool canExport() const;
|
||||
explicit HiresViewer(QWidget *parent = nullptr);
|
||||
~HiresViewer() override = default;
|
||||
|
||||
// Rule of Five - Qt QObject classes cannot be copied or moved
|
||||
HiresViewer(const HiresViewer&) = delete;
|
||||
HiresViewer& operator=(const HiresViewer&) = delete;
|
||||
HiresViewer(HiresViewer&&) = delete;
|
||||
HiresViewer& operator=(HiresViewer&&) = delete;
|
||||
|
||||
[[nodiscard]] bool optionsMenuItems(QMenu *) override;
|
||||
[[nodiscard]] bool canPrint() const override;
|
||||
[[nodiscard]] bool canExport() const override;
|
||||
|
||||
public slots:
|
||||
void setFile(GenericFile *file);
|
||||
void setFile(GenericFile *file) override;
|
||||
void setFile(BinaryFile *file);
|
||||
|
||||
void doPrint();
|
||||
void doExport();
|
||||
void doPrint() override;
|
||||
void doExport() override;
|
||||
|
||||
void handleNewOffset(quint16 offset);
|
||||
|
||||
private:
|
||||
HiresScreenWidget *hrsw;
|
||||
QLabel *m_offsetLabel;
|
||||
HiresScreenWidget *hrsw{nullptr};
|
||||
QLabel *m_offsetLabel{nullptr};
|
||||
|
||||
BinaryFile *m_file;
|
||||
BinaryFile *m_file{nullptr};
|
||||
};
|
||||
|
||||
@@ -8,18 +8,24 @@ namespace Ui {
|
||||
class IntBasicFileViewer;
|
||||
}
|
||||
|
||||
class IntBasicFileViewer : public FileViewerInterface
|
||||
class IntBasicFileViewer final : public FileViewerInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit IntBasicFileViewer(QWidget *parent = nullptr);
|
||||
~IntBasicFileViewer();
|
||||
~IntBasicFileViewer() override;
|
||||
|
||||
// Rule of Five - Qt QObject classes cannot be copied or moved
|
||||
IntBasicFileViewer(const IntBasicFileViewer&) = delete;
|
||||
IntBasicFileViewer& operator=(const IntBasicFileViewer&) = delete;
|
||||
IntBasicFileViewer(IntBasicFileViewer&&) = delete;
|
||||
IntBasicFileViewer& operator=(IntBasicFileViewer&&) = delete;
|
||||
|
||||
bool optionsMenuItems(QMenu * /*menu*/) { return false; }
|
||||
[[nodiscard]] bool optionsMenuItems(QMenu * /*menu*/) override { return false; }
|
||||
|
||||
public slots:
|
||||
void setFile(GenericFile *file);
|
||||
void setFile(GenericFile *file) override;
|
||||
|
||||
private:
|
||||
std::unique_ptr<Ui::IntBasicFileViewer> ui;
|
||||
|
||||
@@ -11,42 +11,48 @@ class BinaryFile;
|
||||
|
||||
/// A class for viewing maze files in "The Missing Ring" by DataMost.
|
||||
|
||||
class MazeViewer : public FileViewerInterface
|
||||
class MazeViewer final : public FileViewerInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
MazeViewer(QWidget *parent = 0);
|
||||
explicit MazeViewer(QWidget *parent = nullptr);
|
||||
~MazeViewer() override = default;
|
||||
|
||||
// Rule of Five - Qt QObject classes cannot be copied or moved
|
||||
MazeViewer(const MazeViewer&) = delete;
|
||||
MazeViewer& operator=(const MazeViewer&) = delete;
|
||||
MazeViewer(MazeViewer&&) = delete;
|
||||
MazeViewer& operator=(MazeViewer&&) = delete;
|
||||
|
||||
void drawMaze();
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
void paintEvent(QPaintEvent *event);
|
||||
|
||||
void setFile(GenericFile *file);
|
||||
void resizeEvent(QResizeEvent *event) override;
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
|
||||
void setFile(GenericFile *file) override;
|
||||
void setFile(BinaryFile *file);
|
||||
|
||||
virtual bool optionsMenuItems(QMenu *) { return false; }
|
||||
[[nodiscard]] bool optionsMenuItems(QMenu *) override { return false; }
|
||||
|
||||
private:
|
||||
QPixmap m_maze;
|
||||
BinaryFile *m_file;
|
||||
BinaryFile *m_file{nullptr};
|
||||
AttributedMemory mem;
|
||||
|
||||
bool cellHasWalls(int x, int y);
|
||||
bool cellHasNorthDoor(int x, int y);
|
||||
bool cellHasSouthDoor(int x, int y);
|
||||
bool cellHasEastDoor(int x, int y);
|
||||
bool cellHasWestDoor(int x, int y);
|
||||
[[nodiscard]] bool cellHasWalls(int x, int y);
|
||||
[[nodiscard]] bool cellHasNorthDoor(int x, int y);
|
||||
[[nodiscard]] bool cellHasSouthDoor(int x, int y);
|
||||
[[nodiscard]] bool cellHasEastDoor(int x, int y);
|
||||
[[nodiscard]] bool cellHasWestDoor(int x, int y);
|
||||
|
||||
bool cellHasSpecialNorth(int x, int y);
|
||||
bool cellHasSpecialSouth(int x, int y);
|
||||
bool cellHasSpecialEast(int x, int y);
|
||||
bool cellHasSpecialWest(int x, int y);
|
||||
[[nodiscard]] bool cellHasSpecialNorth(int x, int y);
|
||||
[[nodiscard]] bool cellHasSpecialSouth(int x, int y);
|
||||
[[nodiscard]] bool cellHasSpecialEast(int x, int y);
|
||||
[[nodiscard]] bool cellHasSpecialWest(int x, int y);
|
||||
|
||||
quint8 getCellDesc(int x, int y);
|
||||
quint8 getCellMonsters(int x, int y);
|
||||
quint8 getCellInventory(int x, int y);
|
||||
[[nodiscard]] quint8 getCellDesc(int x, int y);
|
||||
[[nodiscard]] quint8 getCellMonsters(int x, int y);
|
||||
[[nodiscard]] quint8 getCellInventory(int x, int y);
|
||||
|
||||
QString inventoryToString(quint8 inv);
|
||||
QString monsterToString(quint8 mc);
|
||||
[[nodiscard]] QString inventoryToString(quint8 inv);
|
||||
[[nodiscard]] QString monsterToString(quint8 mc);
|
||||
};
|
||||
|
||||
@@ -13,23 +13,28 @@ namespace Ui {
|
||||
class TextHexDumpViewer;
|
||||
}
|
||||
|
||||
class TextHexDumpViewer : public FileViewerInterface
|
||||
class TextHexDumpViewer final : public FileViewerInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit TextHexDumpViewer(QWidget *parent = 0);
|
||||
~TextHexDumpViewer();
|
||||
explicit TextHexDumpViewer(QWidget *parent = nullptr);
|
||||
~TextHexDumpViewer() override;
|
||||
|
||||
// Rule of Five - Qt QObject classes cannot be copied or moved
|
||||
TextHexDumpViewer(const TextHexDumpViewer&) = delete;
|
||||
TextHexDumpViewer& operator=(const TextHexDumpViewer&) = delete;
|
||||
TextHexDumpViewer(TextHexDumpViewer&&) = delete;
|
||||
TextHexDumpViewer& operator=(TextHexDumpViewer&&) = delete;
|
||||
|
||||
void setFile(GenericFile *file) { setFile(file,0); }
|
||||
void setFile(GenericFile *file) { setFile(file, 0); }
|
||||
void setFile(GenericFile *file, quint16 offset);
|
||||
void setData(QByteArray data);
|
||||
void setText(QString text);
|
||||
|
||||
virtual bool optionsMenuItems(QMenu *menu);
|
||||
|
||||
bool canPrint() const;
|
||||
bool canExport() const;
|
||||
[[nodiscard]] bool optionsMenuItems(QMenu *menu) override;
|
||||
[[nodiscard]] bool canPrint() const override;
|
||||
[[nodiscard]] bool canExport() const override;
|
||||
|
||||
public slots:
|
||||
void toggleWordWrap(bool enabled);
|
||||
@@ -37,13 +42,13 @@ public slots:
|
||||
void doExport();
|
||||
|
||||
protected:
|
||||
QString makeTextStr(QByteArray data);
|
||||
QString makeHexStr(QByteArray data);
|
||||
[[nodiscard]] QString makeTextStr(QByteArray data);
|
||||
[[nodiscard]] QString makeHexStr(QByteArray data);
|
||||
|
||||
private:
|
||||
std::unique_ptr<Ui::TextHexDumpViewer> ui;
|
||||
|
||||
quint16 m_offset;
|
||||
quint16 m_offset{0};
|
||||
|
||||
GenericFile *m_file;
|
||||
GenericFile *m_file{nullptr};
|
||||
};
|
||||
|
||||
@@ -13,13 +13,19 @@ namespace Ui {
|
||||
class ViewerBase;
|
||||
}
|
||||
|
||||
class ViewerBase : public QMainWindow
|
||||
class ViewerBase final : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ViewerBase(QWidget *parent = 0);
|
||||
~ViewerBase();
|
||||
explicit ViewerBase(QWidget *parent = nullptr);
|
||||
~ViewerBase() override;
|
||||
|
||||
// Rule of Five - Qt QObject classes cannot be copied or moved
|
||||
ViewerBase(const ViewerBase&) = delete;
|
||||
ViewerBase& operator=(const ViewerBase&) = delete;
|
||||
ViewerBase(ViewerBase&&) = delete;
|
||||
ViewerBase& operator=(ViewerBase&&) = delete;
|
||||
|
||||
void setFile(GenericFile *file);
|
||||
|
||||
@@ -30,17 +36,17 @@ public slots:
|
||||
void showViewer(int index);
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent *event);
|
||||
void closeEvent(QCloseEvent *event) override;
|
||||
void addViewer(QString descriptor, FileViewerInterface *viewer);
|
||||
|
||||
private:
|
||||
std::unique_ptr<Ui::ViewerBase> ui;
|
||||
QStackedWidget *m_stack;
|
||||
QToolBar *m_toolbar;
|
||||
QComboBox *m_viewercombo;
|
||||
QStackedWidget *m_stack{nullptr};
|
||||
QToolBar *m_toolbar{nullptr};
|
||||
QComboBox *m_viewercombo{nullptr};
|
||||
|
||||
QMap<QString,FileViewerInterface *> m_viewers;
|
||||
GenericFile *m_file;
|
||||
QMenu *m_optionMenu;
|
||||
GenericFile *m_file{nullptr};
|
||||
QMenu *m_optionMenu{nullptr};
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user