mirror of
https://github.com/markdavidlong/AppleSAWS.git
synced 2026-04-19 14:16:45 +00:00
Updated diskexplorer files and some other various cleanup
This commit is contained in:
@@ -106,6 +106,7 @@ set(SOURCES
|
||||
src/binaryfile/AssemblerSymbolModel.cxx
|
||||
src/ui/diskexplorer/DiskExplorer.cxx
|
||||
src/ui/diskexplorer/DiskExplorerMapWidget.cxx
|
||||
src/ui/diskexplorer/DEButton.cxx
|
||||
src/applesoftfile/ApplesoftRetokenizer.cxx
|
||||
src/binaryfile/JumpLine.cxx
|
||||
src/binaryfile/JumpLines.cxx
|
||||
@@ -172,6 +173,8 @@ set(HEADERS
|
||||
src/binaryfile/MemoryUsageMap.h
|
||||
src/ui/diskexplorer/DiskExplorer.h
|
||||
src/ui/diskexplorer/DiskExplorerMapWidget.h
|
||||
src/ui/diskexplorer/DEButton.h
|
||||
src/ui/diskexplorer/DiskExplorerTypes.h
|
||||
src/applesoftfile/ApplesoftRetokenizer.h
|
||||
src/util/AppleColors.h
|
||||
src/binaryfile/JumpLine.h
|
||||
|
||||
@@ -18,6 +18,5 @@ void TextFile::dump() const
|
||||
{
|
||||
qDebug() << "Text File:" << filename();
|
||||
qDebug() << " Size:" << m_data.size() << "bytes";
|
||||
qDebug() << " Lines:" << asLines().size();
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
#include "DEButton.h"
|
||||
|
||||
// Implementation is header-only due to simple nature of the class
|
||||
// All methods are inline for performance
|
||||
@@ -0,0 +1,86 @@
|
||||
#pragma once
|
||||
|
||||
#include <QPushButton>
|
||||
#include <QColor>
|
||||
#include <QString>
|
||||
#include <QSize>
|
||||
|
||||
class DEButton final : public QPushButton
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DEButton(QWidget* parent, int track = -1, int sec = -1)
|
||||
: QPushButton(parent), m_track(track), m_sector(sec)
|
||||
{
|
||||
connect(this, &DEButton::clicked, this, &DEButton::handleClick);
|
||||
}
|
||||
|
||||
void setTrack(int track) noexcept { m_track = track; }
|
||||
void setSector(int sector) noexcept { m_sector = sector; }
|
||||
|
||||
[[nodiscard]] constexpr int track() const noexcept { return m_track; }
|
||||
[[nodiscard]] constexpr int sector() const noexcept { return m_sector; }
|
||||
|
||||
void clearBgColor() {
|
||||
m_backgroundColor.clear();
|
||||
setText(QString{});
|
||||
setStyleSheet(makeStyleSheet());
|
||||
}
|
||||
|
||||
void setBgColor(const QColor& color) {
|
||||
m_fgColor = determineFgColor(color).name();
|
||||
m_backgroundColor = color.name();
|
||||
m_hlColor = color.lighter(155).name();
|
||||
setStyleSheet(makeStyleSheet());
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr bool highlighted() const noexcept { return m_isHighlighted; }
|
||||
void setHighlighted(bool highlighted) {
|
||||
m_isHighlighted = highlighted;
|
||||
setStyleSheet(makeStyleSheet());
|
||||
}
|
||||
|
||||
void reset() {
|
||||
setHighlighted(false);
|
||||
setChecked(false);
|
||||
setStyleSheet(makeStyleSheet());
|
||||
}
|
||||
|
||||
void resetToDefault() {
|
||||
clearBgColor();
|
||||
reset();
|
||||
}
|
||||
|
||||
[[nodiscard]] static QColor determineFgColor(const QColor& bgColor) noexcept
|
||||
{
|
||||
return (qGray(bgColor.rgb()) > 128) ? QColor(Qt::black) : QColor(Qt::white);
|
||||
}
|
||||
|
||||
signals:
|
||||
void checked(int track, int sec, bool isChecked);
|
||||
|
||||
private slots:
|
||||
void handleClick(bool isChecked) { emit checked(m_track, m_sector, isChecked); }
|
||||
|
||||
protected:
|
||||
[[nodiscard]] QSize minimumSizeHint() const noexcept override { return QSize(24, 24); }
|
||||
[[nodiscard]] QSize sizeHint() const noexcept override { return QSize(24, 24); }
|
||||
[[nodiscard]] bool hasHeightForWidth() const noexcept override { return true; }
|
||||
[[nodiscard]] int heightForWidth(int width) const noexcept override { return width; }
|
||||
|
||||
private:
|
||||
[[nodiscard]] QString makeStyleSheet() const {
|
||||
return QStringLiteral(" QPushButton { font: 10px; border-width: 1px; color: %1; background-color: %2} "
|
||||
" QPushButton:checked { font: bold italic 11px; } ")
|
||||
.arg(m_fgColor, m_backgroundColor);
|
||||
}
|
||||
|
||||
int m_track{-1};
|
||||
int m_sector{-1};
|
||||
bool m_isHighlighted{false};
|
||||
|
||||
QString m_fgColor;
|
||||
QString m_backgroundColor;
|
||||
QString m_hlColor;
|
||||
};
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "DiskExplorerMapWidget.h"
|
||||
#include "DEButton.h"
|
||||
|
||||
#include "Util.h"
|
||||
|
||||
|
||||
@@ -1,101 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
#include "DiskFile.h"
|
||||
#include "DEButton.h"
|
||||
#include "DiskExplorerTypes.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <QPair>
|
||||
#include <QMap>
|
||||
#include <QPushButton>
|
||||
#include <QColor>
|
||||
#include <QGroupBox>
|
||||
#include <QLabel>
|
||||
|
||||
using namespace DiskExplorerTypes;
|
||||
|
||||
class DEButton final : public QPushButton
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DEButton(QWidget* parent, int track = -1, int sec = -1)
|
||||
: QPushButton(parent), m_track(track), m_sector(sec)
|
||||
{
|
||||
connect(this, &DEButton::clicked, this, &DEButton::handleClick);
|
||||
}
|
||||
void setTrack(int track) noexcept { m_track = track; }
|
||||
void setSector(int sector) noexcept { m_sector = sector; }
|
||||
|
||||
[[nodiscard]] constexpr int track() const noexcept { return m_track; }
|
||||
[[nodiscard]] constexpr int sector() const noexcept { return m_sector; }
|
||||
|
||||
void clearBgColor() {
|
||||
m_backgroundColor.clear();
|
||||
setText(QString{});
|
||||
setStyleSheet(makeStyleSheet());
|
||||
}
|
||||
|
||||
void setBgColor(const QColor& color) {
|
||||
m_fgColor = determineFgColor(color).name();
|
||||
m_backgroundColor = color.name();
|
||||
m_hlColor = color.lighter(155).name();
|
||||
setStyleSheet(makeStyleSheet());
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr bool highlighted() const noexcept { return m_isHighlighted; }
|
||||
void setHighlighted(bool highlighted) {
|
||||
m_isHighlighted = highlighted;
|
||||
setStyleSheet(makeStyleSheet());
|
||||
}
|
||||
|
||||
void reset() {
|
||||
setHighlighted(false);
|
||||
setChecked(false);
|
||||
setStyleSheet(makeStyleSheet());
|
||||
}
|
||||
|
||||
void resetToDefault() {
|
||||
clearBgColor();
|
||||
reset();
|
||||
}
|
||||
|
||||
QColor determineFgColor(QColor bgColor)
|
||||
{
|
||||
if (qGray(bgColor.rgb()) > 128)
|
||||
{
|
||||
return QColor(Qt::black);
|
||||
}
|
||||
return Qt::white;
|
||||
}
|
||||
|
||||
signals:
|
||||
void checked(int track, int sec,bool );
|
||||
|
||||
private slots:
|
||||
void handleClick(bool isChecked) { emit checked(m_track, m_sector, isChecked); }
|
||||
|
||||
[[nodiscard]] QSize minimumSizeHint() const noexcept override { return QSize(24, 24); }
|
||||
[[nodiscard]] QSize sizeHint() const noexcept override { return QSize(24, 24); }
|
||||
[[nodiscard]] bool hasHeightForWidth() const noexcept override { return true; }
|
||||
[[nodiscard]] int heightForWidth(int width) const noexcept override { return width; }
|
||||
|
||||
private:
|
||||
[[nodiscard]] QString makeStyleSheet() const {
|
||||
return QStringLiteral(" QPushButton { font: 10px; border-width: 1px; color: %1; background-color: %2} "
|
||||
" QPushButton:checked { font: bold italic 11px; } ")
|
||||
.arg(m_fgColor, m_backgroundColor);
|
||||
}
|
||||
|
||||
int m_track{-1};
|
||||
int m_sector{-1};
|
||||
bool m_isHighlighted{false};
|
||||
|
||||
QString m_fgColor;
|
||||
QString m_backgroundColor;
|
||||
QString m_hlColor;
|
||||
};
|
||||
|
||||
|
||||
|
||||
using DETSPair = QPair<int, int>;
|
||||
|
||||
class DiskExplorerMapWidget final : public QWidget
|
||||
{
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include <QPair>
|
||||
|
||||
namespace DiskExplorerTypes {
|
||||
|
||||
// Type aliases for disk explorer functionality
|
||||
using DETSPair = QPair<int, int>;
|
||||
|
||||
} // namespace DiskExplorerTypes
|
||||
@@ -114,7 +114,6 @@ void DisassemblerViewer::setFile(RelocatableFile *file) {
|
||||
|
||||
quint16 address = file->address(); // Handle offset for relocatable metadata
|
||||
m_mem.addFile(file->data(), address);
|
||||
qDebug("Added %d bytes at $%s", file->data().length(), uint16ToHex(address).toStdString().c_str());
|
||||
|
||||
QList<quint16> addresses = m_bfm->entryPoints().getEntryPointAddresses();
|
||||
if (!addresses.count()) { addresses.append(address); }
|
||||
|
||||
Reference in New Issue
Block a user