Various Changes

This commit is contained in:
Mark Long 2017-06-29 00:21:45 -05:00
parent 30010dc1a4
commit 177ecdfea1
47 changed files with 6667 additions and 1142 deletions

View File

@ -2,6 +2,10 @@
QT += core gui printsupport QT += core gui printsupport
CONFIG += c++11 CONFIG += c++11
MOC_DIR = ./.build
UI_DIR = ./.build
OBJECTS_DIR = ./.build
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = AppleSAWS TARGET = AppleSAWS
@ -120,7 +124,8 @@ HEADERS += \
src/applesoftfile/ApplesoftRetokenizer.h \ src/applesoftfile/ApplesoftRetokenizer.h \
src/util/AppleColors.h \ src/util/AppleColors.h \
src/internals/JumpLineManager.h \ src/internals/JumpLineManager.h \
src/ui/widgets/FlowLineTextBrowser.h src/ui/widgets/FlowLineTextBrowser.h \
src/ui/widgets/asciiinfodialog.h
FORMS += \ FORMS += \
src/ui/catalogwidget.ui \ src/ui/catalogwidget.ui \
@ -134,4 +139,5 @@ FORMS += \
src/ui/viewers/viewerbase.ui \ src/ui/viewers/viewerbase.ui \
src/ui/widgets/CharacterSetExplorer.ui \ src/ui/widgets/CharacterSetExplorer.ui \
src/ui/widgets/DisassemblerMetadataDialog.ui \ src/ui/widgets/DisassemblerMetadataDialog.ui \
src/ui/widgets/LocationInfoDialog.ui src/ui/widgets/LocationInfoDialog.ui \
src/ui/widgets/asciiinfodialog.ui

View File

@ -15,9 +15,9 @@ void AssemblerSymbolModel::setAssemblerSymbolsData(AssemblerSymbols *symbols)
if (assemblerSymbols) if (assemblerSymbols)
{ {
connect(assemblerSymbols,SIGNAL(symbolAddedAt(int)),SLOT(handleSymbolAddition(int))); connect(assemblerSymbols, &AssemblerSymbols::symbolAddedAt, this, &AssemblerSymbolModel::handleSymbolAddition);
connect(assemblerSymbols,SIGNAL(symbolChangedAt(int)),SLOT(handleSymbolChange(int))); connect(assemblerSymbols, &AssemblerSymbols::symbolChangedAt, this, &AssemblerSymbolModel::handleSymbolChange);
connect(assemblerSymbols,SIGNAL(symbolRemovedAt(int)),SLOT(handleSymbolRemoval(int))); connect(assemblerSymbols, &AssemblerSymbols::symbolRemovedAt, this, &AssemblerSymbolModel::handleSymbolRemoval);
} }
} }
@ -57,7 +57,7 @@ int AssemblerSymbolModel::rowCount(const QModelIndex &parent) const
int AssemblerSymbolModel::columnCount(const QModelIndex &parent) const int AssemblerSymbolModel::columnCount(const QModelIndex &parent) const
{ {
Q_UNUSED(parent); Q_UNUSED(parent);
return 1; return 2;
} }
QVariant AssemblerSymbolModel::data(const QModelIndex &index, int role) const QVariant AssemblerSymbolModel::data(const QModelIndex &index, int role) const
@ -67,6 +67,19 @@ QVariant AssemblerSymbolModel::data(const QModelIndex &index, int role) const
if (role == Qt::DisplayRole) if (role == Qt::DisplayRole)
{ {
if (index.column() == 0) if (index.column() == 0)
{
QString val;
if (assemblerSymbols->at(index.row()).symbolsize == SizeWord)
{
val = "WORD";
}
else if (assemblerSymbols->at(index.row()).symbolsize == SizeByte)
{
val = "BYTE";
}
return val;
}
else if (index.column() == 1)
{ {
return assemblerSymbols->at(index.row()).name; return assemblerSymbols->at(index.row()).name;
} }
@ -79,9 +92,9 @@ bool AssemblerSymbolModel::setData(const QModelIndex &index, const QVariant &val
if (!assemblerSymbols) return false; if (!assemblerSymbols) return false;
if (data(index, role) != value) { if (data(index, role) != value) {
if (index.column() == 0) if (index.column() == 1)
{ {
assemblerSymbols->symbolRefAt(index.row()).name = value.toString(); assemblerSymbols->symbolRefAt(index.row()).name = value.toString();
} }
emit dataChanged(index, index, QVector<int>() << role); emit dataChanged(index, index, QVector<int>() << role);
return true; return true;
@ -92,7 +105,7 @@ bool AssemblerSymbolModel::setData(const QModelIndex &index, const QVariant &val
Qt::ItemFlags AssemblerSymbolModel::flags(const QModelIndex &index) const Qt::ItemFlags AssemblerSymbolModel::flags(const QModelIndex &index) const
{ {
Q_UNUSED(index); Q_UNUSED(index);
if (index.column() == 0) if (index.column() == 1)
return Qt::ItemIsEditable | QAbstractTableModel::flags(index); return Qt::ItemIsEditable | QAbstractTableModel::flags(index);
else else
return QAbstractTableModel::flags(index); return QAbstractTableModel::flags(index);
@ -108,14 +121,16 @@ bool AssemblerSymbolModel::insertRows(int row, int count, const QModelIndex &par
bool AssemblerSymbolModel::removeRows(int row, int count, const QModelIndex &parent) bool AssemblerSymbolModel::removeRows(int row, int count, const QModelIndex &parent)
{ {
if (!assemblerSymbols) return false; if (!assemblerSymbols) return false;
bool success = false;
beginRemoveRows(parent, row, row + count - 1); beginRemoveRows(parent, row, row + count - 1);
for (int idx = 0; idx < count; idx++) for (int idx = 0; idx < count; idx++)
{ {
assemblerSymbols->removeSymbolAt(row); assemblerSymbols->removeSymbolAt(row);
success = true;
} }
endRemoveRows(); endRemoveRows();
return false; return success;
} }

View File

@ -1,10 +1,26 @@
#include "AssemblerSymbols.h" #include "AssemblerSymbols.h"
AssemblerSymbols::AssemblerSymbols(QObject *parent) : QObject(parent) AssemblerSymbols::AssemblerSymbols(QObject *parent) : QObject(parent)
{ {
} }
int AssemblerSymbols::locationOfSymbolAtAddress(quint16 address)
{
// Assume list m_assemblerSymbols is sorted by address (it should be)
QListIterator<AssemblerSymbol> it(m_assemblerSymbols);
int idx = 0;
while (it.hasNext())
{
AssemblerSymbol ep = it.next();
if (ep.address == address) return idx;
if (ep.address > address) return -1;
idx++;
}
return -1;
}
bool AssemblerSymbols::hasAssemSymbolAtAddress(quint16 address) bool AssemblerSymbols::hasAssemSymbolAtAddress(quint16 address)
{ {
// Assume list m_assemblerSymbols is sorted by address (it should be) // Assume list m_assemblerSymbols is sorted by address (it should be)
@ -51,7 +67,6 @@ void AssemblerSymbols::addSymbol(AssemblerSymbol ep)
void AssemblerSymbols::removeSymbolAt(int location) void AssemblerSymbols::removeSymbolAt(int location)
{ {
m_assemblerSymbols.removeAt(location); m_assemblerSymbols.removeAt(location);
emit symbolRemovedAt(location);
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
@ -92,6 +107,7 @@ QDataStream &operator<<(QDataStream &out, const AssemblerSymbol &model)
{ {
out << model.address; out << model.address;
out << model.name; out << model.name;
out << (qint32) model.symbolsize;
return out; return out;
} }
@ -99,7 +115,9 @@ QDataStream &operator>>(QDataStream &in, AssemblerSymbol &model)
{ {
in >> model.address; in >> model.address;
in >> model.name; in >> model.name;
qint32 size;
in >> size;
model.symbolsize = (SymbolSize) size;
return in; return in;
} }

View File

@ -4,11 +4,19 @@
#include <QObject> #include <QObject>
#include <QDataStream> #include <QDataStream>
typedef enum {
SizeUnknown = 0,
SizeByte = 1,
SizeWord = 2
} SymbolSize;
struct AssemblerSymbol { struct AssemblerSymbol {
quint16 address; quint16 address;
QString name; QString name;
SymbolSize symbolsize;
}; };
class AssemblerSymbols : public QObject class AssemblerSymbols : public QObject
{ {
Q_OBJECT Q_OBJECT
@ -30,6 +38,7 @@ public:
void doTestData(); void doTestData();
int locationOfSymbolAtAddress(quint16 address);
signals: signals:
void symbolAdded(AssemblerSymbol &AssemblerSymbol, int location); void symbolAdded(AssemblerSymbol &AssemblerSymbol, int location);
void symbolAddedAt(int location); void symbolAddedAt(int location);

View File

@ -17,10 +17,9 @@ void EntryPointModel::setEntryPointsData(EntryPoints *points)
if (entryPoints) if (entryPoints)
{ {
connect(entryPoints,SIGNAL(pointAddedAt(int)),SLOT(handlePointAddition(int))); connect(entryPoints, &EntryPoints::pointAddedAt, this, &EntryPointModel::handlePointAddition);
connect(entryPoints,SIGNAL(pointChangedAt(int)),SLOT(handlePointChange(int))); connect(entryPoints, &EntryPoints::pointChangedAt, this, &EntryPointModel::handlePointChange);
connect(entryPoints,SIGNAL(pointRemovedAt(int)),SLOT(handlePointRemoval(int)));
// insertRows(0,entryPoints->numEntryPoints());
} }
} }
@ -110,15 +109,26 @@ bool EntryPointModel::insertRows(int row, int count, const QModelIndex &parent)
bool EntryPointModel::removeRows(int row, int count, const QModelIndex &parent) bool EntryPointModel::removeRows(int row, int count, const QModelIndex &parent)
{ {
qDebug() << __FILE__ << __LINE__;
if (!entryPoints) return false; if (!entryPoints) return false;
qDebug() << __FILE__ << __LINE__;
bool success = false;
qDebug() << __FILE__ << __LINE__;
beginRemoveRows(parent, row, row + count - 1); beginRemoveRows(parent, row, row + count - 1);
qDebug() << __FILE__ << __LINE__;
for (int idx = 0; idx < count; idx++) for (int idx = 0; idx < count; idx++)
{ {
qDebug() << __FILE__ << __LINE__;
entryPoints->removePointAt(row); entryPoints->removePointAt(row);
qDebug() << __FILE__ << __LINE__;
success = true;
} }
qDebug() << __FILE__ << __LINE__;
endRemoveRows(); endRemoveRows();
return false; qDebug() << __FILE__ << __LINE__;
return success;
} }

View File

@ -18,8 +18,7 @@ public:
void setEntryPointsData(EntryPoints *points); void setEntryPointsData(EntryPoints *points);
// Header: // Header:
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;//DONE QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
// Basic functionality: // Basic functionality:
int rowCount(const QModelIndex &parent = QModelIndex()) const override; int rowCount(const QModelIndex &parent = QModelIndex()) const override;
int columnCount(const QModelIndex &parent = QModelIndex()) const override; int columnCount(const QModelIndex &parent = QModelIndex()) const override;
@ -43,7 +42,7 @@ public:
protected slots: protected slots:
void handlePointAddition(int location) { insertRows(location,1); } void handlePointAddition(int location) { insertRows(location,1); }
void handlePointRemoval(int location) { removeRows(location, 1); } // void handlePointRemoval(int location) { removeRows(location, 1); }
void handlePointChange(int location) void handlePointChange(int location)
{ {
QModelIndex ind = createIndex(location,0); QModelIndex ind = createIndex(location,0);

View File

@ -1,4 +1,5 @@
#include "EntryPoints.h" #include "EntryPoints.h"
#include <QDebug>
EntryPoints::EntryPoints(QObject *parent) : QObject(parent) EntryPoints::EntryPoints(QObject *parent) : QObject(parent)
{ {
@ -51,7 +52,6 @@ void EntryPoints::addPoint(EntryPoint ep)
void EntryPoints::removePointAt(int location) void EntryPoints::removePointAt(int location)
{ {
m_entryPoints.removeAt(location); m_entryPoints.removeAt(location);
emit pointRemovedAt(location);
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------

View File

@ -1,8 +1,8 @@
#include "binaryfilemetadata.h" #include "binaryfilemetadata.h"
#include "genericfile.h"
#include <QFile> #include <QFile>
#include <QDataStream> #include <QDataStream>
#include <QDebug> #include <QDebug>
BinaryFileMetadata::BinaryFileMetadata(GenericFile *file, quint16 defaultAddress, QObject *parent) BinaryFileMetadata::BinaryFileMetadata(GenericFile *file, quint16 defaultAddress, QObject *parent)
: QObject(parent) : QObject(parent)
{ {
@ -17,31 +17,49 @@ BinaryFileMetadata::BinaryFileMetadata(GenericFile *file, quint16 defaultAddress
void BinaryFileMetadata::load() void BinaryFileMetadata::load()
{ {
QFile infile(QString("%1%2").arg(m_file->filename()).arg(".bfm")); QFile infile(QString("%1%2%3")
.arg(m_file->diskFile()->getMetaDataPath())
.arg(m_file->filename())
.arg(".bfm"));
if (infile.open(QIODevice::ReadOnly)) if (infile.open(QIODevice::ReadOnly))
{ {
qDebug() << "Loading binary file metadata from" << QString("%1%2").arg(m_file->filename()).arg(".bfm"); qDebug() << "Loading binary file metadata from" << QString("%1%2%3")
.arg(m_file->diskFile()->getMetaDataPath())
.arg(m_file->filename())
.arg(".bfm");
QDataStream ds(&infile); QDataStream ds(&infile);
ds >> *m_eps; ds >> *m_eps;
ds >> *m_as; ds >> *m_as;
infile.close(); infile.close();
} }
else qDebug() << "Cannot open " << QString("%1%2").arg(m_file->filename()).arg(".bfm") << "for reading"; else qDebug() << "Cannot open " << QString("%1%2%3")
.arg(m_file->diskFile()->getMetaDataPath())
.arg(m_file->filename())
.arg(".bfm") << "for reading";
} }
void BinaryFileMetadata::save() void BinaryFileMetadata::save()
{ {
QFile infile(QString("%1%2").arg(m_file->filename()).arg(".bfm")); QFile outfile(QString("%1%2%3")
if (infile.open(QIODevice::WriteOnly)) .arg(m_file->diskFile()->getMetaDataPath())
.arg(m_file->filename())
.arg(".bfm"));
if (outfile.open(QIODevice::WriteOnly))
{ {
qDebug() << "Saving binary file metadata to" << QString("%1%2").arg(m_file->filename()).arg(".bfm"); qDebug() << "Saving binary file metadata to" << QString("%1%2%3")
QDataStream ds(&infile); .arg(m_file->diskFile()->getMetaDataPath())
.arg(m_file->filename())
.arg(".bfm");
QDataStream ds(&outfile);
ds << *m_eps; ds << *m_eps;
ds << *m_as; ds << *m_as;
infile.close(); outfile.close();
} }
else qDebug() << "Cannot open " << QString("%1%2").arg(m_file->filename()).arg(".bfm") << "for writing"; else qDebug() << "Cannot open " << QString("%1%2%3")
.arg(m_file->diskFile()->getMetaDataPath())
.arg(m_file->filename())
.arg(".bfm") << "for writing";
} }

View File

@ -13,8 +13,6 @@ CatalogSector::CatalogSector(Sector *data)
FileDescriptiveEntry fde = makeFDE(idx*0x23+0x0B); FileDescriptiveEntry fde = makeFDE(idx*0x23+0x0B);
if (fde.firstTSListSector != TSPair(0,0)) { if (fde.firstTSListSector != TSPair(0,0)) {
m_fdes.append(fde); m_fdes.append(fde);
// qDebug() << "FDE #"<<idx;
// fde.dump();
} }
} }
} }

View File

@ -4,6 +4,7 @@
#include <QDataStream> #include <QDataStream>
#include <QFileInfo> #include <QFileInfo>
#include <QDebug> #include <QDebug>
#include <QDir>
#include "tracksectorlist.h" #include "tracksectorlist.h"
#include "applesoftfile.h" #include "applesoftfile.h"
@ -29,6 +30,7 @@ DiskFile::~DiskFile()
bool DiskFile::read(QString filename) bool DiskFile::read(QString filename)
{ {
m_fullImageName = filename;
m_imageName = QFileInfo(filename).fileName(); m_imageName = QFileInfo(filename).fileName();
if (m_imageName.toUpper().contains(".D13")) if (m_imageName.toUpper().contains(".D13"))
{ {
@ -132,6 +134,7 @@ GenericFile *DiskFile::getFile(FileDescriptiveEntry fde)
} }
m_files[fde] = retval; m_files[fde] = retval;
} }
if (retval) { retval->setDiskFile(this); }
return retval; return retval;
} }
@ -167,3 +170,12 @@ QList<FileDescriptiveEntry> DiskFile::getAllFDEs() {
return retval; return retval;
} }
QString DiskFile::getMetaDataPath() const {
QString path = QString("%1.metadata/").arg(getFullDiskImageName());
QDir dir(path);
dir.mkpath(".");
return path;
}

View File

@ -11,7 +11,7 @@
#include "sector.h" #include "sector.h"
#include "vtoc.h" #include "vtoc.h"
#include "genericfile.h" class GenericFile;
class DiskFile class DiskFile
{ {
@ -40,6 +40,9 @@ public:
QByteArray fileHash() const { return m_hash; } QByteArray fileHash() const { return m_hash; }
QString getDiskImageName() const { return m_imageName; } QString getDiskImageName() const { return m_imageName; }
QString getFullDiskImageName() const { return m_fullImageName; }
QString getMetaDataPath() const;
private: private:
QMap< int, QMap< int, Sector> > m_contents; QMap< int, QMap< int, Sector> > m_contents;
@ -47,6 +50,8 @@ private:
QByteArray m_hash; QByteArray m_hash;
QString m_imageName; QString m_imageName;
QString m_fullImageName;
quint8 m_sectors_per_track; quint8 m_sectors_per_track;
}; };

View File

@ -2,6 +2,7 @@
GenericFile::GenericFile(QByteArray data) GenericFile::GenericFile(QByteArray data)
{ {
m_diskfile = 0;
if (!data.isEmpty()) { if (!data.isEmpty()) {
setData(data); setData(data);
} }

View File

@ -1,9 +1,12 @@
#ifndef GENERICFILE_H #ifndef GENERICFILE_H
#define GENERICFILE_H #define GENERICFILE_H
#include "diskfile.h"
#include <QByteArray> #include <QByteArray>
#include <QString> #include <QString>
class GenericFile class GenericFile
{ {
public: public:
@ -21,12 +24,15 @@ public:
virtual void setLength(quint16 length) { m_length = length; } virtual void setLength(quint16 length) { m_length = length; }
virtual quint16 length() { return m_length; } virtual quint16 length() { return m_length; }
DiskFile *diskFile() const { return m_diskfile; }
void setDiskFile(DiskFile *diskfile) { m_diskfile = diskfile; }
protected: protected:
QByteArray m_data; QByteArray m_data;
QString m_filename; QString m_filename;
quint16 m_address; quint16 m_address;
qint16 m_length; qint16 m_length;
DiskFile * m_diskfile;
}; };

View File

@ -4,7 +4,7 @@ JumpLineManager::JumpLineManager(quint16 from, quint16 to)
: m_start(from), : m_start(from),
m_end(to) m_end(to)
{ {
qDebug() << "JumpLineManager(from:"<<uint16ToHex(m_start)<<", to:"<<uint16ToHex(m_end) << ")"; //qDebug() << "JumpLineManager(from:"<<uint16ToHex(m_start)<<", to:"<<uint16ToHex(m_end) << ")";
} }
@ -20,12 +20,12 @@ void JumpLineManager::addJump(quint16 src, quint16 dest, JumpType type, quint16
} }
else else
{ {
qDebug() << "JumpLineManager::addJump: Not adding duplicate jump:" << uint16ToHex(src) << "," << uint16ToHex(dest); //qDebug() << "JumpLineManager::addJump: Not adding duplicate jump:" << uint16ToHex(src) << "," << uint16ToHex(dest);
} }
} }
else else
{ {
qDebug() << "JumpLineManager::addJump: Address range is out of bounds"; // qDebug() << "JumpLineManager::addJump: Address range is out of bounds";
} }
} }
@ -36,7 +36,7 @@ void JumpLineManager::dumpJumps() const {
void JumpLineManager::dumpJumps(JumpMap map) const void JumpLineManager::dumpJumps(JumpMap map) const
{ {
qDebug() << "JumpLineManager::dumpJumps()\n JumpTable:"; //qDebug() << "JumpLineManager::dumpJumps()\n JumpTable:";
QMapIterator<TJump,JumpType> it(map); QMapIterator<TJump,JumpType> it(map);
while (it.hasNext()) while (it.hasNext())
{ {
@ -47,14 +47,14 @@ void JumpLineManager::dumpJumps(JumpMap map) const
if (it.value() == IsBranch) { jumptypelabel = "Branch"; } if (it.value() == IsBranch) { jumptypelabel = "Branch"; }
if (it.value() == IsJSR) { jumptypelabel = "JSR"; } if (it.value() == IsJSR) { jumptypelabel = "JSR"; }
if (it.value() == IsBRA) { jumptypelabel = "BRA"; } if (it.value() == IsBRA) { jumptypelabel = "BRA"; }
qDebug() << " Jump from" << uint16ToHex(it.key().first) << "to" //qDebug() << " Jump from" << uint16ToHex(it.key().first) << "to"
<< uint16ToHex(it.key().second) << jumptypelabel; // << uint16ToHex(it.key().second) << jumptypelabel;
} }
} }
JumpLines JumpLineManager::buildJumpLines() JumpLines JumpLineManager::buildJumpLines()
{ {
qDebug() << "A"; //qDebug() << "A";
m_channelsAtAddress.clear(); m_channelsAtAddress.clear();
m_jumplines.m_maxChannel = 0; m_jumplines.m_maxChannel = 0;
@ -74,7 +74,7 @@ qDebug() << "A";
m_jumplines.jumpLines.append(jl); m_jumplines.jumpLines.append(jl);
m_jumplines.m_maxChannel = qMax(m_jumplines.m_maxChannel, channel); m_jumplines.m_maxChannel = qMax(m_jumplines.m_maxChannel, channel);
} }
qDebug() << "A"; //qDebug() << "A";
return m_jumplines; return m_jumplines;
@ -85,7 +85,7 @@ qDebug() << "A";
int JumpLineManager::findBestChannel(JumpLine &jl) int JumpLineManager::findBestChannel(JumpLine &jl)
{ {
qDebug() << "findBestChannel()"; //qDebug() << "findBestChannel()";
if (m_jumplines.jumpLines.count() == 0) if (m_jumplines.jumpLines.count() == 0)
{ {
return 0; return 0;
@ -95,7 +95,7 @@ int JumpLineManager::findBestChannel(JumpLine &jl)
bool foundChannel = false; bool foundChannel = false;
while (!foundChannel) while (!foundChannel)
{ {
qDebug() << "Tryning potential channel" << potentialChannel; //qDebug() << "Tryning potential channel" << potentialChannel;
bool matched = false; bool matched = false;
for (quint16 addr = jl.min(); addr <= jl.max(); addr++) for (quint16 addr = jl.min(); addr <= jl.max(); addr++)
{ {
@ -129,12 +129,12 @@ void JumpLineManager::setChannelForJumpLine(int channel, JumpLine &jl)
void JumpLineManager::dumpJumpLines() const void JumpLineManager::dumpJumpLines() const
{ {
foreach (JumpLine jl, m_jumplines.jumpLines) //foreach (JumpLine jl, m_jumplines.jumpLines)
{ // {
qDebug() << " JumpLine from:" << uint16ToHex(jl.from) //qDebug() << " JumpLine from:" << uint16ToHex(jl.from)
<< " to:" << uint16ToHex(jl.to) // << " to:" << uint16ToHex(jl.to)
<< "channel: " << jl.channel << " type:" << jl.type; // << "channel: " << jl.channel << " type:" << jl.type;
} // }
} }
bool JumpLineManager::doJumpsIntersect(TJump &A, TJump &B) const bool JumpLineManager::doJumpsIntersect(TJump &A, TJump &B) const

View File

@ -8,6 +8,7 @@
#include <QDebug> #include <QDebug>
#include <QMenu> #include <QMenu>
#include <QAction> #include <QAction>
#include <QPalette>
CatalogWidget::CatalogWidget(QWidget *parent) : CatalogWidget::CatalogWidget(QWidget *parent) :
QWidget(parent), QWidget(parent),
@ -15,9 +16,11 @@ CatalogWidget::CatalogWidget(QWidget *parent) :
{ {
ui->setupUi(this); ui->setupUi(this);
ui->catalog_list->setFont(QFont("monospace")); ui->catalog_list->setFont(QFont("monospace"));
ui->noteButton->setText(QChar(0x270d));
ui->noteButton->setFont(QFont("sans",16,QFont::Bold));
connect(ui->catalog_list, SIGNAL(itemDoubleClicked(QListWidgetItem*)), connect(ui->catalog_list, &QListWidget::itemDoubleClicked,
SLOT(itemDoubleClicked(QListWidgetItem*))); this, &CatalogWidget::itemDoubleClicked);
} }
CatalogWidget::~CatalogWidget() CatalogWidget::~CatalogWidget()
@ -86,6 +89,17 @@ void CatalogWidget::processNewlyLoadedDisk(QString diskfilename, DiskFile *disk)
QString sizeStr = QString("%1").arg(size,5,10,QChar(' ')).toUpper(); QString sizeStr = QString("%1").arg(size,5,10,QChar(' ')).toUpper();
QString text = QString("%1 %2 %3 %4").arg(locked?"*":" ").arg(sizeStr).arg(filetype).arg(filename); QString text = QString("%1 %2 %3 %4").arg(locked?"*":" ").arg(sizeStr).arg(filetype).arg(filename);
QListWidgetItem *item = new QListWidgetItem(text); QListWidgetItem *item = new QListWidgetItem(text);
if (filetype == "A") { item->setForeground(Qt::blue); }
else if (filetype == "I") { item->setForeground(Qt::darkYellow); }
else if (filetype == "B") { item->setForeground(Qt::darkGreen); }
else if (filetype == "T") { item->setForeground(Qt::red); }
else if (filetype == "R") { item->setForeground(Qt::darkRed); }
else if (filetype == "S") { item->setForeground(Qt::magenta); }
else if (filetype == "a") { item->setForeground(Qt::darkBlue); }
else if (filetype == "b") { item->setForeground(Qt::darkMagenta); }
else { item->setForeground(Qt::black); }
item->setToolTip(createToolTip(fde)); item->setToolTip(createToolTip(fde));
item->setData(0x0100,idx); item->setData(0x0100,idx);
ui->catalog_list->addItem(item); ui->catalog_list->addItem(item);
@ -95,6 +109,20 @@ void CatalogWidget::processNewlyLoadedDisk(QString diskfilename, DiskFile *disk)
} }
idx++; idx++;
} }
// QFont italfont = ui->catalog_list->font();
// italfont.setItalic(true);
// QListWidgetItem *item = new QListWidgetItem("Boot Sector");
// item->setForeground(Qt::black);
// item->setFont(italfont);
// item->setData(0x0100,-1);
// ui->catalog_list->addItem(item);
// item = new QListWidgetItem("DOS Image");
// item->setForeground(Qt::black);
// item->setFont(italfont);
// item->setData(0x0100,-2);
// ui->catalog_list->addItem(item);
ui->catalog_list->resize(maxrect.width(),ui->catalog_list->size().height()); ui->catalog_list->resize(maxrect.width(),ui->catalog_list->size().height());
} }
} }
@ -111,9 +139,23 @@ void CatalogWidget::unloadDisk(DiskFile *disk)
void CatalogWidget::itemDoubleClicked(QListWidgetItem *item) void CatalogWidget::itemDoubleClicked(QListWidgetItem *item)
{ {
int idx = item->data(0x0100).toInt(); int idx = item->data(0x0100).toInt();
FileDescriptiveEntry fde = m_disk->getAllFDEs()[idx]; if (idx >= 0)
{
FileDescriptiveEntry fde = m_disk->getAllFDEs()[idx];
// qDebug() << "Default File " << AppleString(fde.filename).printable().trimmed(); // qDebug() << "Default File " << AppleString(fde.filename).printable().trimmed();
emit openWithDefaultViewer(m_disk,fde); emit openWithDefaultViewer(m_disk,fde);
}
else
{
if (idx == -1) // Boot Sector
{
}
else if (idx == -2) // DOS Image
{
}
}
} }
void CatalogWidget::itemClicked(QListWidgetItem *item) void CatalogWidget::itemClicked(QListWidgetItem *item)

View File

@ -32,22 +32,71 @@
<string>Form</string> <string>Form</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<property name="spacing">
<number>2</number>
</property>
<item row="0" column="0"> <item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>2</number>
</property>
<item> <item>
<widget class="QLabel" name="volume_label"> <layout class="QHBoxLayout" name="horizontalLayout">
<property name="text"> <property name="spacing">
<string/> <number>4</number>
</property> </property>
</widget> <item>
<widget class="QLabel" name="volume_label">
<property name="font">
<font>
<family>Sans Serif</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="noteButton">
<property name="font">
<font>
<family>Sans Serif</family>
</font>
</property>
<property name="toolTip">
<string>Notes for image.</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item> </item>
<item> <item>
<widget class="QListWidget" name="catalog_list"/> <widget class="QListWidget" name="catalog_list">
</item> <property name="autoFillBackground">
<item> <bool>false</bool>
<widget class="QLabel" name="file_label"> </property>
<property name="text"> <property name="alternatingRowColors">
<string/> <bool>true</bool>
</property>
<property name="selectionRectVisible">
<bool>false</bool>
</property> </property>
</widget> </widget>
</item> </item>

View File

@ -29,8 +29,6 @@ DiskExplorer::~DiskExplorer()
void DiskExplorer::initUi() void DiskExplorer::initUi()
{ {
QMenuBar *menuBar = new QMenuBar(this); QMenuBar *menuBar = new QMenuBar(this);
setMenuBar(menuBar); setMenuBar(menuBar);
QMenu *menu = new QMenu(tr("&File"),this); QMenu *menu = new QMenu(tr("&File"),this);
@ -38,18 +36,23 @@ void DiskExplorer::initUi()
QAction *action_Load_Disk_Image = new QAction(tr("&Load Disk Image..."),this); QAction *action_Load_Disk_Image = new QAction(tr("&Load Disk Image..."),this);
menu->addAction(action_Load_Disk_Image); menu->addAction(action_Load_Disk_Image);
connect(action_Load_Disk_Image, SIGNAL(triggered()), SLOT(showLoadDialog()));
connect(action_Load_Disk_Image, &QAction::triggered,
this, &DiskExplorer::showLoadDialog);
m_action_Unload_Disk_Image = new QAction(tr("&Unload Disk Image"),this); m_action_Unload_Disk_Image = new QAction(tr("&Unload Disk Image"),this);
m_action_Unload_Disk_Image->setEnabled(false); m_action_Unload_Disk_Image->setEnabled(false);
menu->addAction(m_action_Unload_Disk_Image); menu->addAction(m_action_Unload_Disk_Image);
connect(m_action_Unload_Disk_Image, SIGNAL(triggered()), SLOT(unloadDiskFile()));
connect(m_action_Unload_Disk_Image, &QAction::triggered,
this, &DiskExplorer::unloadDiskFile);
menu->addSeparator(); menu->addSeparator();
QAction *action_Quit = new QAction(tr("&Quit"),this); QAction *action_Quit = new QAction(tr("&Quit"),this);
menu->addAction(action_Quit); menu->addAction(action_Quit);
connect(action_Quit, SIGNAL(triggered()), qApp, SLOT(quit()));
connect(action_Quit, &QAction::triggered, qApp, &QApplication::quit);
menu = new QMenu(tr("&Util"),this); menu = new QMenu(tr("&Util"),this);
menuBar->addMenu(menu); menuBar->addMenu(menu);
@ -62,8 +65,9 @@ void DiskExplorer::initUi()
m_setDiskToolsVisibleAction = new QAction(tr("Show &Disk tools"),this); m_setDiskToolsVisibleAction = new QAction(tr("Show &Disk tools"),this);
m_setDiskToolsVisibleAction->setCheckable(true); m_setDiskToolsVisibleAction->setCheckable(true);
m_setDiskToolsVisibleAction->setChecked(false); m_setDiskToolsVisibleAction->setChecked(false);
connect(m_setDiskToolsVisibleAction, SIGNAL(toggled(bool)),
SLOT(setDiskToolsVisible(bool))); connect(m_setDiskToolsVisibleAction, &QAction::triggered, this, &DiskExplorer::setDiskToolsVisible);
menu->addAction(m_setDiskToolsVisibleAction); menu->addAction(m_setDiskToolsVisibleAction);
@ -72,13 +76,17 @@ void DiskExplorer::initUi()
QAction *action_HRCG_Commands = new QAction(tr("&HRCG Commands..."),this); QAction *action_HRCG_Commands = new QAction(tr("&HRCG Commands..."),this);
menu->addAction(action_HRCG_Commands); menu->addAction(action_HRCG_Commands);
m_hrcgDialog = new HRCGControlsInfo(this); m_hrcgDialog = new HRCGControlsInfo(this);
connect(action_HRCG_Commands, SIGNAL(triggered()), m_hrcgDialog, SLOT(show())); connect(action_HRCG_Commands, &QAction::triggered, m_hrcgDialog, &HRCGControlsInfo::show);
m_hexConverter = new HexConverter(this); m_hexConverter = new HexConverter(this);
connect(action_Hex_Converter, SIGNAL(triggered()), m_hexConverter, SLOT(show())); connect(action_Hex_Converter, &QAction::triggered, m_hexConverter, &HexConverter::show);
QAction *action_Ascii_Info = new QAction(tr("&ASCII Table..."),this);
menu->addAction(action_Ascii_Info);
m_AsciiInfoDialog = new AsciiInfoDialog(this);
connect(action_Ascii_Info, &QAction::triggered, m_AsciiInfoDialog, &AsciiInfoDialog::show);
QWidget *widget = new QWidget(0); QWidget *widget = new QWidget(0);
m_gridLayout = new QGridLayout(); m_gridLayout = new QGridLayout();
@ -106,12 +114,10 @@ void DiskExplorer::initUi()
m_gridLayout->addWidget(m_frame,1,2); m_gridLayout->addWidget(m_frame,1,2);
this->setCentralWidget(widget); this->setCentralWidget(widget);
connect(m_cw,SIGNAL(openWithDefaultViewer(DiskFile*,FileDescriptiveEntry)), connect(m_cw, &CatalogWidget::openWithDefaultViewer,
SLOT(handleDiskItemSelectedDefaultOpen(DiskFile*,FileDescriptiveEntry))); this, &DiskExplorer::handleDiskItemSelectedDefaultOpen);
connect(m_demw, &DiskExplorerMapWidget::showSectorData,
connect(m_demw, SIGNAL(showSectorData(QByteArray,int,int,QVariant)), this, &DiskExplorer::handleShowSectorData);
SLOT(handleShowSectorData(QByteArray,int,int,QVariant)));
QStatusBar *statusBar = new QStatusBar(this); QStatusBar *statusBar = new QStatusBar(this);
setStatusBar(statusBar); setStatusBar(statusBar);
@ -119,7 +125,6 @@ void DiskExplorer::initUi()
m_demwStatusWidget = m_demw->getStatusWidget(); m_demwStatusWidget = m_demw->getStatusWidget();
statusBar->addPermanentWidget(m_demwStatusWidget); statusBar->addPermanentWidget(m_demwStatusWidget);
setDiskToolsVisible(false); setDiskToolsVisible(false);
} }
@ -184,7 +189,9 @@ void DiskExplorer::handleDiskItemSelectedDefaultOpen(DiskFile *disk, FileDescrip
ViewerBase *vb = new ViewerBase(); ViewerBase *vb = new ViewerBase();
qDebug() << "Adding viewer" << vb; qDebug() << "Adding viewer" << vb;
m_viewerList.append(vb); m_viewerList.append(vb);
connect(vb,SIGNAL(viewerClosing(ViewerBase*)), SLOT(handleViewerClosing(ViewerBase*)));
connect(vb,&ViewerBase::viewerClosing,
this, &DiskExplorer::handleViewerClosing);
vb->setFile(file); vb->setFile(file);
vb->show(); vb->show();
} }

View File

@ -10,6 +10,7 @@
#include "hexconverter.h" #include "hexconverter.h"
#include "hexdumpviewer.h" #include "hexdumpviewer.h"
#include "viewerbase.h" #include "viewerbase.h"
#include "asciiinfodialog.h"
#include <QFrame> #include <QFrame>
#include <QTimer> #include <QTimer>
@ -66,6 +67,7 @@ private:
HRCGControlsInfo *m_hrcgDialog; HRCGControlsInfo *m_hrcgDialog;
HexConverter *m_hexConverter; HexConverter *m_hexConverter;
AsciiInfoDialog *m_AsciiInfoDialog;
QAction *m_action_Unload_Disk_Image; QAction *m_action_Unload_Disk_Image;

View File

@ -56,7 +56,7 @@ DiskExplorerMapWidget::DiskExplorerMapWidget(int numtracks, int numsectors, QWid
tb->setBgColor(m_defaultColor); tb->setBgColor(m_defaultColor);
tb->setCheckable(true); tb->setCheckable(true);
m_bgroup->addButton(tb,(track * numsectors) + sec); m_bgroup->addButton(tb,(track * numsectors) + sec);
connect(tb,SIGNAL(checked(int,int,bool)),SLOT(handleButtonCheck(int,int,bool))); connect(tb, &DEButton::checked, this, &DiskExplorerMapWidget::handleButtonCheck);
m_buttons[track][sec] = tb; m_buttons[track][sec] = tb;
tb->setAutoFillBackground(true); tb->setAutoFillBackground(true);
@ -315,7 +315,7 @@ void DiskExplorerMapWidget::mapDiskToButtons()
tslcount++; tslcount++;
buttonAt(tsltr,tslse)->setBgColor(m_tsListColor); buttonAt(tsltr,tslse)->setBgColor(m_tsListColor);
buttonAt(tsltr,tslse)->setText(QString("%1").arg(idx)); buttonAt(tsltr,tslse)->setText(QString("%1").arg(idx));
qDebug() << "Button" << idx << "=" << tsltr << "," << tslse << " " << fde.filename.printable() << "TSL"; //qDebug() << "Button" << idx << "=" << tsltr << "," << tslse << " " << fde.filename.printable() << "TSL";
QString description = QString("T/S List #%1 for %2").arg(tslcount).arg(fde.filename.printable()); QString description = QString("T/S List #%1 for %2").arg(tslcount).arg(fde.filename.printable());
m_sectorDescriptions.insert(DETSPair(tsltr,tslse),description); m_sectorDescriptions.insert(DETSPair(tsltr,tslse),description);
@ -346,7 +346,7 @@ void DiskExplorerMapWidget::mapDiskToButtons()
else qDebug() << "Unknown file type: " << fde.fileType(); else qDebug() << "Unknown file type: " << fde.fileType();
buttonAt(tr,se)->setBgColor(color); buttonAt(tr,se)->setBgColor(color);
setButtonText(tr,se,QString("%1").arg(idx)); setButtonText(tr,se,QString("%1").arg(idx));
qDebug() << "Button" << idx << "=" << tr << "," << se << " " << fde.filename.printable(); //qDebug() << "Button" << idx << "=" << tr << "," << se << " " << fde.filename.printable();
// fde.dump(); // fde.dump();
idx++; idx++;
} }

View File

@ -21,7 +21,7 @@ public:
{ {
setTrack(track); setTrack(track);
setSector(sec); setSector(sec);
connect(this,SIGNAL(clicked(bool)),SLOT(handleClick(bool))); connect(this, &DEButton::clicked, this, &DEButton::handleClick);
m_isHighlighted = false; m_isHighlighted = false;
} }
void setTrack(int track) { m_track = track; } void setTrack(int track) { m_track = track; }

View File

@ -7,16 +7,20 @@
#include <QTableWidgetItem> #include <QTableWidgetItem>
ApplesoftFileDetailViewer::ApplesoftFileDetailViewer(QWidget *parent) : ApplesoftFileDetailViewer::ApplesoftFileDetailViewer(ApplesoftFile *file, QWidget *parent) :
QWidget(parent), QWidget(parent),
ui(new Ui::ApplesoftFileDetailViewer) ui(new Ui::ApplesoftFileDetailViewer)
{ {
ui->setupUi(this); ui->setupUi(this);
ui->m_varView->setSortingEnabled(true); ui->m_varView->setSortingEnabled(true);
m_file = file;
load();
setLineData(m_file->getLines());
} }
ApplesoftFileDetailViewer::~ApplesoftFileDetailViewer() ApplesoftFileDetailViewer::~ApplesoftFileDetailViewer()
{ {
save();
delete ui; delete ui;
} }
@ -26,10 +30,64 @@ void ApplesoftFileDetailViewer::setLineData(QVector<ApplesoftLine> lineData)
process(); process();
} }
bool ApplesoftFileDetailViewer::save()
{
if (ui->gridLayout->rowCount() == 0) { return false; }
QMap <QString,QString> map;
for (int idx = 0; idx < ui->m_varView->rowCount(); idx++)
{
QString var = ui->m_varView->item(idx,1)->text();
if (var.contains(","))
{
var.truncate(var.indexOf(","));
}
var = var.trimmed();
QString note = ui->m_varView->item(idx,2)->text().trimmed();
if (note.length())
{
map.insert(var,note);
}
}
QFile outfile(QString("%1%2%3")
.arg(m_file->diskFile()->getMetaDataPath())
.arg(m_file->filename())
.arg(".asvar"));
if (outfile.open(QIODevice::WriteOnly))
{
QDataStream ds(&outfile);
ds << map;
outfile.close();
return true;
}
return false;
}
bool ApplesoftFileDetailViewer::load()
{
QFile infile(QString("%1%2%3")
.arg(m_file->diskFile()->getMetaDataPath())
.arg(m_file->filename())
.arg(".asvar"));
if (infile.open(QIODevice::ReadOnly))
{
QDataStream ds(&infile);
ds >> m_notes;
infile.close();
return true;
}
return false;
}
void ApplesoftFileDetailViewer::process() void ApplesoftFileDetailViewer::process()
{ {
QMap<QString,QStringList> vardata; QMap<QString,QStringList> vardata;
QMap<QString,quint16> vartypes; QMap<QString,quint16> vartypes;
QMap<QString,QStringList> varalias;
foreach (ApplesoftLine line, m_lines) foreach (ApplesoftLine line, m_lines)
{ {
@ -45,9 +103,16 @@ void ApplesoftFileDetailViewer::process()
tid == ApplesoftToken::StringAryVarTokenVal) tid == ApplesoftToken::StringAryVarTokenVal)
{ {
QString varname = token.getStringValue(); QString varname = token.getStringValue();
QString fullname = varname;
varname = shortenName(varname);
if (varname.contains("(")) { varname.append(")"); } if (varname.contains("(")) { varname.append(")"); }
if (fullname.contains("(")) { fullname.append(")"); }
vardata[varname].append(QString("%1").arg(linenum)); vardata[varname].append(QString("%1").arg(linenum));
vartypes[varname] = tid; vartypes[varname] = tid;
if (fullname != varname)
{
varalias[varname].append(fullname);
}
} }
} }
} }
@ -78,11 +143,23 @@ void ApplesoftFileDetailViewer::process()
twi->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); twi->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
ui->m_varView->setItem(idx,0,twi); ui->m_varView->setItem(idx,0,twi);
twi = new QTableWidgetItem(key); QString keywithalias = key;
if (varalias.contains(key))
{
varalias[key].removeDuplicates();
QString aliases = varalias[key].join(", ");
keywithalias.append(", ");
keywithalias.append(aliases);
}
twi = new QTableWidgetItem(keywithalias);
twi->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); twi->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
ui->m_varView->setItem(idx,1,twi); ui->m_varView->setItem(idx,1,twi);
twi = new QTableWidgetItem(" "); twi = new QTableWidgetItem(" ");
if (m_notes.contains(key))
{
twi->setText(m_notes[key]);
}
twi->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable); twi->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable);
ui->m_varView->setItem(idx,2,twi); ui->m_varView->setItem(idx,2,twi);
@ -98,3 +175,22 @@ void ApplesoftFileDetailViewer::process()
ui->m_varView->resizeColumnToContents(2); ui->m_varView->resizeColumnToContents(2);
} }
QString ApplesoftFileDetailViewer::shortenName(QString name)
{
bool hasParen = name.contains('(');
if (hasParen) { name.remove(name.indexOf('('),1); }
bool hasDollar = name.contains('$');
if (hasDollar) { name.remove(name.indexOf('$'),1); }
bool hasPercent = name.contains('%');
if (hasPercent) { name.remove(name.indexOf('%'),1); }
name = name.left(2);
if (hasDollar) { name.append("$"); }
if (hasPercent) { name.append("%"); }
if (hasParen) { name.append("("); }
return name;
}

View File

@ -4,6 +4,7 @@
#include <QWidget> #include <QWidget>
#include "applesoftline.h" #include "applesoftline.h"
#include "applesofttoken.h" #include "applesofttoken.h"
#include "applesoftfile.h"
#include <QDebug> #include <QDebug>
namespace Ui { namespace Ui {
@ -15,16 +16,26 @@ class ApplesoftFileDetailViewer : public QWidget
Q_OBJECT Q_OBJECT
public: public:
explicit ApplesoftFileDetailViewer(QWidget *parent = 0); explicit ApplesoftFileDetailViewer(ApplesoftFile *file, QWidget *parent = 0);
~ApplesoftFileDetailViewer(); ~ApplesoftFileDetailViewer();
void setLineData(QVector<ApplesoftLine> lineData); void setLineData(QVector<ApplesoftLine> lineData);
void foo() { qDebug() << "AFDV::foo!"; } void foo() { qDebug() << "AFDV::foo!"; }
bool save();
bool load();
protected:
QString shortenName(QString name);
private: private:
void process(); void process();
Ui::ApplesoftFileDetailViewer *ui; Ui::ApplesoftFileDetailViewer *ui;
QVector<ApplesoftLine> m_lines; QVector<ApplesoftLine> m_lines;
QMap<QString,QString> m_notes;
ApplesoftFile *m_file;
}; };
#endif // APPLESOFTFILEDETAILVIEWER_H #endif // APPLESOFTFILEDETAILVIEWER_H

View File

@ -22,7 +22,7 @@ ApplesoftFileViewer::ApplesoftFileViewer(QWidget *parent) :
m_formatter = new ApplesoftFormatter(this); m_formatter = new ApplesoftFormatter(this);
m_formatter->setFlags(ApplesoftFormatter::ShowCtrlChars); m_formatter->setFlags(ApplesoftFormatter::ShowCtrlChars);
connect(ui->findButton,SIGNAL(clicked(bool)), SLOT(findText())); connect(ui->findButton, &QToolButton::clicked, this, &ApplesoftFileViewer::findText);
m_isFirstFind = true; m_isFirstFind = true;
ui->textArea->setUndoRedoEnabled(false); ui->textArea->setUndoRedoEnabled(false);
ui->textArea->setUndoRedoEnabled(true); ui->textArea->setUndoRedoEnabled(true);
@ -46,11 +46,11 @@ ApplesoftFileViewer::ApplesoftFileViewer(QWidget *parent) :
ApplesoftFileViewer::~ApplesoftFileViewer() ApplesoftFileViewer::~ApplesoftFileViewer()
{ {
delete ui;
if (m_afdv) if (m_afdv)
{ m_afdv->foo(); {
delete m_afdv; m_afdv->deleteLater();
} }
delete ui;
} }
bool ApplesoftFileViewer::makeMenuOptions(QMenu *menu) bool ApplesoftFileViewer::makeMenuOptions(QMenu *menu)
@ -63,8 +63,11 @@ bool ApplesoftFileViewer::makeMenuOptions(QMenu *menu)
m_showIntsAction->setCheckable(true); m_showIntsAction->setCheckable(true);
m_showIntsAction->setChecked(settings.value("ASViewer.intsAsHex",false).toBool()); m_showIntsAction->setChecked(settings.value("ASViewer.intsAsHex",false).toBool());
setIntsAsHex(settings.value("ASViewer.intsAsHex",false).toBool(),NoReformat); setIntsAsHex(settings.value("ASViewer.intsAsHex",false).toBool(),NoReformat);
connect(m_showIntsAction, SIGNAL(toggled(bool)), ui->findText,SLOT(clear()));
connect(m_showIntsAction, SIGNAL(toggled(bool)),SLOT(setIntsAsHex(bool))); connect(m_showIntsAction, &QAction::toggled, ui->findText, &QLineEdit::clear);
connect(m_showIntsAction, &QAction::toggled,
this, static_cast< void (ApplesoftFileViewer::*)(bool)>(&ApplesoftFileViewer::setIntsAsHex));
} }
menu->addAction(m_showIntsAction); menu->addAction(m_showIntsAction);
@ -74,8 +77,11 @@ bool ApplesoftFileViewer::makeMenuOptions(QMenu *menu)
m_reindentCodeAction->setCheckable(true); m_reindentCodeAction->setCheckable(true);
m_reindentCodeAction->setChecked(settings.value("ASViewer.indentCode",false).toBool()); m_reindentCodeAction->setChecked(settings.value("ASViewer.indentCode",false).toBool());
setIndentCode(settings.value("ASViewer.indentCode",false).toBool(),NoReformat); setIndentCode(settings.value("ASViewer.indentCode",false).toBool(),NoReformat);
connect(m_reindentCodeAction, SIGNAL(toggled(bool)), ui->findText,SLOT(clear()));
connect(m_reindentCodeAction, SIGNAL(toggled(bool)),SLOT(setIndentCode(bool))); connect(m_reindentCodeAction, &QAction::toggled, ui->findText, &QLineEdit::clear);
connect(m_reindentCodeAction, &QAction::toggled,
this, static_cast< void (ApplesoftFileViewer::*)(bool)>(&ApplesoftFileViewer::setIndentCode));
} }
menu->addAction(m_reindentCodeAction); menu->addAction(m_reindentCodeAction);
@ -85,8 +91,10 @@ bool ApplesoftFileViewer::makeMenuOptions(QMenu *menu)
m_blankAfterReturnsAction->setCheckable(true); m_blankAfterReturnsAction->setCheckable(true);
m_blankAfterReturnsAction->setChecked(settings.value("ASViewer.breakAfterReturn",false).toBool()); m_blankAfterReturnsAction->setChecked(settings.value("ASViewer.breakAfterReturn",false).toBool());
setIndentCode(settings.value("ASViewer.breakAfterReturn",false).toBool(),NoReformat); setIndentCode(settings.value("ASViewer.breakAfterReturn",false).toBool(),NoReformat);
connect(m_blankAfterReturnsAction, SIGNAL(toggled(bool)), ui->findText,SLOT(clear()));
connect(m_blankAfterReturnsAction, SIGNAL(toggled(bool)),SLOT(setBreakAfterReturn(bool))); connect(m_blankAfterReturnsAction, &QAction::toggled, ui->findText, &QLineEdit::clear);
connect(m_blankAfterReturnsAction, &QAction::toggled,
this, static_cast< void (ApplesoftFileViewer::*)(bool)>(&ApplesoftFileViewer::setBreakAfterReturn));
} }
menu->addAction(m_blankAfterReturnsAction); menu->addAction(m_blankAfterReturnsAction);
@ -96,8 +104,10 @@ bool ApplesoftFileViewer::makeMenuOptions(QMenu *menu)
m_showCtrlCharsAction->setCheckable(true); m_showCtrlCharsAction->setCheckable(true);
m_showCtrlCharsAction->setChecked(settings.value("ASViewer.showCtrlChars",false).toBool()); m_showCtrlCharsAction->setChecked(settings.value("ASViewer.showCtrlChars",false).toBool());
setIndentCode(settings.value("ASViewer.showCtrlChars",false).toBool(),NoReformat); setIndentCode(settings.value("ASViewer.showCtrlChars",false).toBool(),NoReformat);
connect(m_showCtrlCharsAction, SIGNAL(toggled(bool)), ui->findText,SLOT(clear()));
connect(m_showCtrlCharsAction, SIGNAL(toggled(bool)),SLOT(setShowCtrlChars(bool))); connect(m_showCtrlCharsAction, &QAction::toggled, ui->findText, &QLineEdit::clear);
connect(m_showCtrlCharsAction, &QAction::toggled,
this, static_cast<void (ApplesoftFileViewer::*)(bool)>(&ApplesoftFileViewer::setShowCtrlChars));
} }
menu->addAction(m_showCtrlCharsAction); menu->addAction(m_showCtrlCharsAction);
@ -110,7 +120,7 @@ bool ApplesoftFileViewer::makeMenuOptions(QMenu *menu)
m_wordWrapAction->setCheckable(true); m_wordWrapAction->setCheckable(true);
m_wordWrapAction->setChecked(settings.value("ASViewer.WordWrap",true).toBool()); m_wordWrapAction->setChecked(settings.value("ASViewer.WordWrap",true).toBool());
toggleWordWrap(settings.value("ASViewer.WordWrap",true).toBool()); toggleWordWrap(settings.value("ASViewer.WordWrap",true).toBool());
connect(m_wordWrapAction, SIGNAL(toggled(bool)), SLOT(toggleWordWrap(bool))); connect(m_wordWrapAction, &QAction::triggered, this, &ApplesoftFileViewer::toggleWordWrap);
} }
menu->addAction(m_wordWrapAction); menu->addAction(m_wordWrapAction);
@ -120,8 +130,10 @@ bool ApplesoftFileViewer::makeMenuOptions(QMenu *menu)
m_syntaxHighlightingAction->setCheckable(true); m_syntaxHighlightingAction->setCheckable(true);
m_syntaxHighlightingAction->setChecked(settings.value("ASViewer.syntaxHighlighting",false).toBool()); m_syntaxHighlightingAction->setChecked(settings.value("ASViewer.syntaxHighlighting",false).toBool());
setIndentCode(settings.value("ASViewer.syntaxHighlighting",false).toBool(),NoReformat); setIndentCode(settings.value("ASViewer.syntaxHighlighting",false).toBool(),NoReformat);
connect(m_syntaxHighlightingAction, SIGNAL(toggled(bool)), ui->findText,SLOT(clear()));
connect(m_syntaxHighlightingAction, SIGNAL(toggled(bool)),SLOT(setSyntaxHighlighting(bool))); connect(m_syntaxHighlightingAction, &QAction::toggled, ui->findText, &QLineEdit::clear);
connect(m_syntaxHighlightingAction, &QAction::toggled,
this, static_cast<void (ApplesoftFileViewer::*)(bool)>(&ApplesoftFileViewer::setSyntaxHighlighting));
} }
menu->addAction(m_syntaxHighlightingAction); menu->addAction(m_syntaxHighlightingAction);
@ -133,7 +145,7 @@ bool ApplesoftFileViewer::makeMenuOptions(QMenu *menu)
{ {
m_showVarExplorerAction = new QAction("Show &Variable Explorer...",this); m_showVarExplorerAction = new QAction("Show &Variable Explorer...",this);
m_showVarExplorerAction->setCheckable(false); m_showVarExplorerAction->setCheckable(false);
connect(m_showVarExplorerAction, SIGNAL(triggered(bool)), SLOT(launchVarBrowser())); connect(m_showVarExplorerAction, &QAction::triggered, this, &ApplesoftFileViewer::launchVarBrowser);
} }
menu->addAction(m_showVarExplorerAction); menu->addAction(m_showVarExplorerAction);
@ -208,6 +220,11 @@ void ApplesoftFileViewer::setShowCtrlChars(bool enabled, ReformatRule reformat)
reformatText(); reformatText();
} }
void ApplesoftFileViewer::setSyntaxHighlighting(bool enabled)
{
setSyntaxHighlighting(enabled, ForceReformat);
}
void ApplesoftFileViewer::setSyntaxHighlighting(bool enabled, ReformatRule reformat) void ApplesoftFileViewer::setSyntaxHighlighting(bool enabled, ReformatRule reformat)
{ {
if (enabled) if (enabled)
@ -290,9 +307,8 @@ void ApplesoftFileViewer::launchVarBrowser()
{ {
if (!m_afdv) if (!m_afdv)
{ {
m_afdv = new ApplesoftFileDetailViewer(); m_afdv = new ApplesoftFileDetailViewer(m_file);
qDebug() << "m_afdv = " << m_afdv; qDebug() << "m_afdv = " << m_afdv;
m_afdv->setLineData(m_file->getLines());
m_afdv->setWindowTitle(QString("Variables - %1").arg(m_file->filename())); m_afdv->setWindowTitle(QString("Variables - %1").arg(m_file->filename()));
} }
m_afdv->show(); m_afdv->show();

View File

@ -46,11 +46,20 @@ public slots:
protected slots: protected slots:
void toggleWordWrap(bool enabled); void toggleWordWrap(bool enabled);
void setSyntaxHighlighting(bool enabled, ReformatRule reformat = ForceReformat); void setSyntaxHighlighting(bool enabled);
void setIndentCode(bool enabled, ReformatRule reformat = ForceReformat); void setSyntaxHighlighting(bool enabled, ReformatRule reformat);
void setIntsAsHex(bool enabled, ReformatRule reformat = ForceReformat);
void setBreakAfterReturn(bool enabled, ReformatRule reformat = ForceReformat); void setIndentCode(bool enabled) { setIndentCode(enabled, ForceReformat); }
void setShowCtrlChars(bool enabled, ReformatRule reformat = ForceReformat); void setIndentCode(bool enabled, ReformatRule reformat);
void setIntsAsHex(bool enabled) { setIntsAsHex(enabled, ForceReformat); }
void setIntsAsHex(bool enabled, ReformatRule reformat);
void setBreakAfterReturn(bool enabled) { setBreakAfterReturn(enabled,ForceReformat); }
void setBreakAfterReturn(bool enabled, ReformatRule reformat);
void setShowCtrlChars(bool enabled) { setShowCtrlChars(enabled,ForceReformat); }
void setShowCtrlChars(bool enabled, ReformatRule reformat);
void launchVarBrowser(); void launchVarBrowser();
void reformatText(); void reformatText();

View File

@ -68,20 +68,20 @@ bool CharSetViewer::optionsMenuItems(QMenu *menu)
action->setCheckable(true); action->setCheckable(true);
action->setChecked(settings.value("CharSetViewer.ShowGrid",true).toBool()); action->setChecked(settings.value("CharSetViewer.ShowGrid",true).toBool());
showGrid(settings.value("CharSetViewer.ShowGrid",true).toBool()); showGrid(settings.value("CharSetViewer.ShowGrid",true).toBool());
connect(action, SIGNAL(toggled(bool)),SLOT(showGrid(bool))); connect(action, &QAction::toggled, this, &CharSetViewer::showGrid);
menu->addAction(action); menu->addAction(action);
action = new QAction("&Enable Bit Shift",menu); action = new QAction("&Enable Bit Shift",menu);
action->setCheckable(true); action->setCheckable(true);
action->setChecked(settings.value("CharSetViewer.EnableBitShift",true).toBool()); action->setChecked(settings.value("CharSetViewer.EnableBitShift",true).toBool());
enableBitShift(settings.value("CharSetViewer.EnableBitShift",true).toBool()); enableBitShift(settings.value("CharSetViewer.EnableBitShift",true).toBool());
connect(action, SIGNAL(toggled(bool)),SLOT(enableBitShift(bool))); connect(action, &QAction::toggled, this, &CharSetViewer::enableBitShift);
menu->addAction(action); menu->addAction(action);
menu->addSeparator(); menu->addSeparator();
action = new QAction("&Character Set Explorer..."); action = new QAction("&Character Set Explorer...");
connect(action, SIGNAL(triggered(bool)), SLOT(showExplorer())); connect(action, &QAction::triggered, this, &CharSetViewer::showExplorer);
menu->addAction(action); menu->addAction(action);
return true; return true;
@ -91,7 +91,7 @@ void CharSetViewer::showExplorer()
{ {
if (!m_cse) { if (!m_cse) {
m_cse = new CharacterSetExplorer(this); m_cse = new CharacterSetExplorer(this);
connect(m_cse, SIGNAL(destroyed(QObject*)), SLOT(cleanupExplorer())); connect(m_cse, &CharacterSetExplorer::destroyed, this, &CharSetViewer::cleanupExplorer);
m_cse->setCharSet(m_charset); m_cse->setCharSet(m_charset);
} }
m_cse->show(); m_cse->show();

File diff suppressed because it is too large Load Diff

View File

@ -144,7 +144,8 @@ bool HexDumpViewer::optionsMenuItems(QMenu *menu)
QAction *action = new QAction("&Word Wrap"); QAction *action = new QAction("&Word Wrap");
action->setCheckable(true); action->setCheckable(true);
action->setChecked(settings.value("HexViewer.WordWrap",true).toBool()); action->setChecked(settings.value("HexViewer.WordWrap",true).toBool());
connect(action, SIGNAL(toggled(bool)), SLOT(toggleWordWrap(bool))); connect(action, &QAction::toggled,
this, &HexDumpViewer::toggleWordWrap);
menu->addAction(action); menu->addAction(action);
return true; return true;

View File

@ -1,5 +1,6 @@
#include "hiresviewwidget.h" #include "hiresviewwidget.h"
#include "binaryfile.h" #include "binaryfile.h"
#include "util.h"
#include <QPainter> #include <QPainter>
#include <QMap> #include <QMap>
@ -7,6 +8,7 @@
#include <QResizeEvent> #include <QResizeEvent>
#include <QSettings> #include <QSettings>
#include <QGridLayout> #include <QGridLayout>
#include <QLabel>
#include <math.h> #include <math.h>
@ -18,6 +20,15 @@ HiresViewWidget::HiresViewWidget(QWidget *parent) :
setLayout(gv); setLayout(gv);
hrsw = new HiresScreenWidget(this); hrsw = new HiresScreenWidget(this);
gv->addWidget(hrsw); gv->addWidget(hrsw);
m_offsetLabel = new QLabel(this);
m_offsetLabel->setText("");
gv->addWidget(m_offsetLabel,1,0);
gv->setRowStretch(0,10000);
gv->setRowStretch(1,1);
connect(hrsw, &HiresScreenWidget::newOffset,
this, &HiresViewWidget::handleNewOffset);
handleNewOffset(0);
resize(561,384); resize(561,384);
} }
@ -38,6 +49,10 @@ bool HiresViewWidget::optionsMenuItems(QMenu *menu)
menu->addAction(hrsw->perPixelColorAction()); menu->addAction(hrsw->perPixelColorAction());
menu->addSeparator(); menu->addSeparator();
menu->addAction(hrsw->showScanLinesAction()); menu->addAction(hrsw->showScanLinesAction());
menu->addSeparator();
menu->addAction(hrsw->prevPageAction());
menu->addAction(hrsw->nextPageAction());
return true; return true;
} }
@ -99,3 +114,9 @@ void HiresViewWidget::doExport()
pm.save(savename.path()); pm.save(savename.path());
} }
void HiresViewWidget::handleNewOffset(quint16 offset)
{
QString text = QString("Offset: %1 (0x%2)").arg(offset).arg(uint16ToHex(offset));
m_offsetLabel->setText(text);
}

View File

@ -13,7 +13,7 @@
#include <QBitArray> #include <QBitArray>
#include <QAction> #include <QAction>
#include <QMenu> #include <QMenu>
#include <QLabel>
class HiresViewWidget : public FileViewerInterface class HiresViewWidget : public FileViewerInterface
@ -26,14 +26,19 @@ public:
bool canPrint() const; bool canPrint() const;
bool canExport() const; bool canExport() const;
public slots: public slots:
void setFile(GenericFile *file); void setFile(GenericFile *file);
void setFile(BinaryFile *file); void setFile(BinaryFile *file);
void doPrint(); void doPrint();
void doExport(); void doExport();
void handleNewOffset(quint16 offset);
private: private:
HiresScreenWidget *hrsw; HiresScreenWidget *hrsw;
QLabel *m_offsetLabel;
BinaryFile *m_file; BinaryFile *m_file;
}; };

View File

@ -203,7 +203,7 @@ void MazeViewer::drawMaze()
} }
painter.setPen(Qt::black); painter.setPen(Qt::black);
quint8 cv = getCellDesc(idx,jdx); //quint8 cv = getCellDesc(idx,jdx);
quint8 tr = getCellInventory(idx,jdx); quint8 tr = getCellInventory(idx,jdx);
QString trs = inventoryToString(tr); QString trs = inventoryToString(tr);
quint8 mo = getCellMonsters(idx,jdx); quint8 mo = getCellMonsters(idx,jdx);

View File

@ -124,7 +124,8 @@ bool TextHexDumpViewer::optionsMenuItems(QMenu *menu)
QAction *action = new QAction("&Word Wrap"); QAction *action = new QAction("&Word Wrap");
action->setCheckable(true); action->setCheckable(true);
action->setChecked(settings.value("TexHexViewer.WordWrap",true).toBool()); action->setChecked(settings.value("TexHexViewer.WordWrap",true).toBool());
connect(action, SIGNAL(toggled(bool)), SLOT(toggleWordWrap(bool))); connect(action, &QAction::toggled,
this, &TextHexDumpViewer::toggleWordWrap);
menu->addAction(action); menu->addAction(action);
return true; return true;

View File

@ -59,7 +59,7 @@ void ViewerBase::setFile(GenericFile *file)
if (dynamic_cast<ApplesoftFile*>(file)) if (dynamic_cast<ApplesoftFile*>(file))
hdv->setFile(file,0x801); //TODO: Double check this offset. hdv->setFile(file,0x801); //TODO: Double check this offset.
else else
hdv->setFile(file); hdv->setFile(file,m_file->address());
descriptor = ("Hex Dump Viewer"); descriptor = ("Hex Dump Viewer");
addViewer(descriptor,hdv); addViewer(descriptor,hdv);
defaultViewerDescriptor = descriptor; defaultViewerDescriptor = descriptor;
@ -132,7 +132,8 @@ void ViewerBase::setFile(GenericFile *file)
defaultViewerDescriptor = descriptor; defaultViewerDescriptor = descriptor;
} }
connect(m_viewercombo, SIGNAL(currentIndexChanged(QString)), SLOT(showViewer(QString))); connect(m_viewercombo, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
this, &ViewerBase::showViewer);
showViewer(defaultViewerDescriptor); showViewer(defaultViewerDescriptor);
} }
@ -151,18 +152,20 @@ void ViewerBase::addViewer(QString descriptor, FileViewerInterface *viewer)
} }
} }
void ViewerBase::showViewer(QString descriptor) void ViewerBase::showViewer(const QString& descriptor)
{ {
FileViewerInterface *fvi = m_viewers[descriptor]; FileViewerInterface *fvi = m_viewers[descriptor];
if (fvi) if (fvi)
{ {
ui->actionExport->disconnect(SIGNAL(triggered(bool))); ui->actionExport->disconnect(SIGNAL(triggered(bool)));
ui->actionExport->setEnabled(fvi->canExport()); ui->actionExport->setEnabled(fvi->canExport());
connect(ui->actionExport, SIGNAL(triggered(bool)), fvi, SLOT(doExport())); connect(ui->actionExport, &QAction::triggered,
fvi, &FileViewerInterface::doExport);
ui->action_Print->disconnect(SIGNAL(triggered(bool))); ui->action_Print->disconnect(SIGNAL(triggered(bool)));
ui->action_Print->setEnabled(fvi->canPrint()); ui->action_Print->setEnabled(fvi->canPrint());
connect(ui->action_Print, SIGNAL(triggered(bool)), fvi, SLOT(doPrint())); connect(ui->action_Print, &QAction::triggered,
fvi, &FileViewerInterface::doPrint);
m_optionMenu->clear(); m_optionMenu->clear();
m_viewercombo->setCurrentText(descriptor); m_viewercombo->setCurrentText(descriptor);

View File

@ -27,7 +27,7 @@ signals:
void viewerClosing(ViewerBase *me); void viewerClosing(ViewerBase *me);
public slots: public slots:
void showViewer(QString descriptor); void showViewer(const QString &descriptor);
protected: protected:
void closeEvent(QCloseEvent *event); void closeEvent(QCloseEvent *event);

View File

@ -7,8 +7,11 @@ CharacterSetExplorer::CharacterSetExplorer(QWidget *parent) :
{ {
m_unpackedScreen.fill(0,8192); m_unpackedScreen.fill(0,8192);
ui->setupUi(this); ui->setupUi(this);
connect(ui->insertChar, SIGNAL(clicked(bool)), SLOT(handleInsertCharButton()));
connect(ui->inputText, SIGNAL(textChanged(QString)), SLOT(handleTextChanged(QString))); connect(ui->insertChar, &QPushButton::clicked,
this, &CharacterSetExplorer::handleInsertCharButton);
connect(ui->inputText, &QLineEdit::textChanged,
this, &CharacterSetExplorer::handleTextChanged);
} }
void CharacterSetExplorer::setCharSet(CharacterSet &charset) void CharacterSetExplorer::setCharSet(CharacterSet &charset)

View File

@ -9,7 +9,9 @@ DisassemblerMetadataDialog::DisassemblerMetadataDialog(BinaryFileMetadata *bfm,
ui(new Ui::DisassemblerMetadataDialog) ui(new Ui::DisassemblerMetadataDialog)
{ {
ui->setupUi(this); ui->setupUi(this);
setRelocatable(false); ui->entryTable->verticalHeader()->show();
ui->removeEntryPointButton->setEnabled(false);
ui->removeSymbolButton->setEnabled(false);
m_bfm = bfm; m_bfm = bfm;
@ -19,17 +21,29 @@ DisassemblerMetadataDialog::DisassemblerMetadataDialog(BinaryFileMetadata *bfm,
ui->entryTable->setModel(m_epmodel); ui->entryTable->setModel(m_epmodel);
ui->symbolTable->setModel(m_asmodel); ui->symbolTable->setModel(m_asmodel);
connect(ui->cancelButton, SIGNAL(clicked(bool)), SLOT(handleCancelButton())); connect(ui->exitButton, &QPushButton::clicked,
connect(ui->exitButton,SIGNAL(clicked(bool)), SLOT(handleExitButton())); this, &DisassemblerMetadataDialog::handleExitButton);
connect(ui->processButton, SIGNAL(clicked(bool)), SLOT(handleProcessButton())); connect(ui->processButton, &QPushButton::clicked,
this, &DisassemblerMetadataDialog::handleProcessButton);
connect(ui->addEntryPointButton, SIGNAL(clicked(bool)), SLOT(handleAddEntryPointButton())); connect(ui->addEntryPointButton, &QToolButton::clicked,
connect(ui->addSymbolButton, SIGNAL(clicked(bool)), SLOT(handleAddSymbolButton())); this, &DisassemblerMetadataDialog::handleAddEntryPointButton);
connect(ui->addSymbolButton, &QToolButton::clicked,
this, &DisassemblerMetadataDialog::handleAddSymbolButton);
connect(ui->removeEntryPointButton, &QToolButton::clicked,
this, &DisassemblerMetadataDialog::handleRemoveEntryPointButton);
connect(ui->removeSymbolButton, &QToolButton::clicked,
this, &DisassemblerMetadataDialog::handleRemoveSymbolButton);
connect(ui->entryTable->selectionModel(), &QItemSelectionModel::selectionChanged,
this, &DisassemblerMetadataDialog::handleEntryPointSelectionChanged);
connect(ui->symbolTable->selectionModel(), &QItemSelectionModel::selectionChanged,
this, &DisassemblerMetadataDialog::handleSymbolSelectionChanged);
} }
DisassemblerMetadataDialog::~DisassemblerMetadataDialog() DisassemblerMetadataDialog::~DisassemblerMetadataDialog()
{ {
delete m_bfm;
delete ui; delete ui;
} }
@ -39,19 +53,9 @@ void DisassemblerMetadataDialog::showEvent(QShowEvent *)
ui->symbolTable->resizeRowsToContents(); ui->symbolTable->resizeRowsToContents();
} }
void DisassemblerMetadataDialog::setRelocatable(bool relocatable)
{
ui->reloAddrLabel->setVisible(relocatable);
ui->reloAddrText->setVisible(relocatable);
}
void DisassemblerMetadataDialog::handleCancelButton()
{
this->close();
}
void DisassemblerMetadataDialog::handleExitButton() void DisassemblerMetadataDialog::handleExitButton()
{ {
m_bfm->requestDisassembly();
m_bfm->save(); m_bfm->save();
this->close(); this->close();
} }
@ -72,12 +76,20 @@ void DisassemblerMetadataDialog::handleAddEntryPointButton()
ep.note = lid.getInfo(); ep.note = lid.getInfo();
m_bfm->entryPoints()->addPoint(ep); m_bfm->entryPoints()->addPoint(ep);
ui->entryTable->resizeRowsToContents(); ui->entryTable->resizeRowsToContents();
ui->entryTable->resizeRowsToContents();
} }
} }
void DisassemblerMetadataDialog::handleRemoveEntryPointButton() void DisassemblerMetadataDialog::handleRemoveEntryPointButton()
{ {
QModelIndexList selection = ui->entryTable->selectionModel()->selectedRows(0);
qDebug() << "Removing" << selection.count() << "row(s)";
if (selection.count())
{
// qDebug() << "Removing row" << selection[0].row();
m_epmodel->removeRows(selection[0].row(),1);
// qDebug() << "Removed row" << selection[0].row();
}
} }
void DisassemblerMetadataDialog::handleAddSymbolButton() void DisassemblerMetadataDialog::handleAddSymbolButton()
@ -85,11 +97,20 @@ void DisassemblerMetadataDialog::handleAddSymbolButton()
LocationInfoDialog lid(this); LocationInfoDialog lid(this);
lid.setInfoLabelString("Symbol Name"); lid.setInfoLabelString("Symbol Name");
lid.setWindowTitle("Add Symbol"); lid.setWindowTitle("Add Symbol");
lid.showSizeWidgets(true);
if (lid.exec() == Accepted) if (lid.exec() == Accepted)
{ {
AssemblerSymbol as; AssemblerSymbol as;
as.address = lid.getAddress(); as.address = lid.getAddress();
as.name = lid.getInfo(); as.name = lid.getInfo();
if (lid.getSymbolSize() == 0) // Byte
{
as.symbolsize = SizeByte;
}
else
{
as.symbolsize = SizeWord;
}
m_bfm->assemblerSymbols()->addSymbol(as); m_bfm->assemblerSymbols()->addSymbol(as);
ui->symbolTable->resizeRowsToContents(); ui->symbolTable->resizeRowsToContents();
} }
@ -97,5 +118,26 @@ void DisassemblerMetadataDialog::handleAddSymbolButton()
void DisassemblerMetadataDialog::handleRemoveSymbolButton() void DisassemblerMetadataDialog::handleRemoveSymbolButton()
{ {
QModelIndexList selection = ui->symbolTable->selectionModel()->selectedRows(0);
qDebug() << "Removing" << selection.count() << "row(s)";
if (selection.count())
{
m_asmodel->removeRows(selection[0].row(),1);
}
}
void DisassemblerMetadataDialog::handleEntryPointSelectionChanged(QItemSelection selected, QItemSelection deselected)
{
Q_UNUSED(selected);
Q_UNUSED(deselected);
int selectedcount = ui->entryTable->selectionModel()->selectedRows().count();
ui->removeEntryPointButton->setEnabled(selectedcount);
}
void DisassemblerMetadataDialog::handleSymbolSelectionChanged(QItemSelection selected, QItemSelection deselected)
{
Q_UNUSED(selected);
Q_UNUSED(deselected);
int selectedcount = ui->symbolTable->selectionModel()->selectedRows().count();
ui->removeSymbolButton->setEnabled(selectedcount);
} }

View File

@ -9,6 +9,7 @@
#include "LocationInfoDialog.h" #include "LocationInfoDialog.h"
#include <QDialog> #include <QDialog>
#include <QItemSelection>
namespace Ui { namespace Ui {
class DisassemblerMetadataDialog; class DisassemblerMetadataDialog;
@ -22,13 +23,10 @@ public:
explicit DisassemblerMetadataDialog(BinaryFileMetadata *bfm, QWidget *parent = 0); explicit DisassemblerMetadataDialog(BinaryFileMetadata *bfm, QWidget *parent = 0);
~DisassemblerMetadataDialog(); ~DisassemblerMetadataDialog();
void setRelocatable(bool relocatable);
protected: protected:
void showEvent(QShowEvent *); void showEvent(QShowEvent *);
protected slots: protected slots:
void handleCancelButton();
void handleExitButton(); void handleExitButton();
void handleProcessButton(); void handleProcessButton();
@ -38,6 +36,9 @@ protected slots:
void handleAddSymbolButton(); void handleAddSymbolButton();
void handleRemoveSymbolButton(); void handleRemoveSymbolButton();
void handleEntryPointSelectionChanged(QItemSelection selected, QItemSelection deselected);
void handleSymbolSelectionChanged(QItemSelection selected, QItemSelection deselected);
private: private:
Ui::DisassemblerMetadataDialog *ui; Ui::DisassemblerMetadataDialog *ui;

View File

@ -6,205 +6,15 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>796</width> <width>634</width>
<height>593</height> <height>429</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Dialog</string> <string>Metadata</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout_4" rowstretch="2,3,0"> <layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout" stretch="1,1">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Entry Points</string>
</property>
<property name="flat">
<bool>false</bool>
</property>
<property name="checkable">
<bool>false</bool>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>312</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1">
<widget class="QToolButton" name="addEntryPointButton">
<property name="text">
<string>+</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QToolButton" name="removeEntryPointButton">
<property name="text">
<string>-</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="3">
<widget class="QTableView" name="entryTable">
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::NoSelection</enum>
</property>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
</property>
<attribute name="horizontalHeaderVisible">
<bool>false</bool>
</attribute>
<attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool>
</attribute>
<attribute name="verticalHeaderVisible">
<bool>true</bool>
</attribute>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Symbols</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>311</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1">
<widget class="QToolButton" name="addSymbolButton">
<property name="text">
<string>+</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QToolButton" name="removeSymbolButton">
<property name="text">
<string>-</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="3">
<widget class="QTableView" name="symbolTable">
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::NoSelection</enum>
</property>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
</property>
<attribute name="horizontalHeaderVisible">
<bool>false</bool>
</attribute>
<attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool>
</attribute>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>Usage</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_5" stretch="10,1">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QPushButton" name="processButton">
<property name="text">
<string>&amp;Process</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="outputLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>xxxxx</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="reloAddrLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Reloc. Addr</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="reloAddrText">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QTableView" name="metadataTable"/>
</item>
</layout>
</widget>
</item>
<item row="2" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_3" stretch="0,0,0"> <layout class="QHBoxLayout" name="horizontalLayout_3" stretch="0,0,0">
<item> <item>
<spacer name="hs2"> <spacer name="hs2">
@ -220,9 +30,9 @@
</spacer> </spacer>
</item> </item>
<item> <item>
<widget class="QPushButton" name="cancelButton"> <widget class="QPushButton" name="processButton">
<property name="text"> <property name="text">
<string>&amp;Cancel</string> <string>Apply</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -238,6 +48,146 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="0" column="0">
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="entryPointTab">
<attribute name="title">
<string>Entry Points</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_7">
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Entry Points</string>
</property>
<property name="flat">
<bool>false</bool>
</property>
<property name="checkable">
<bool>false</bool>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="1" column="0" colspan="3">
<widget class="QTableView" name="entryTable">
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::SingleSelection</enum>
</property>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
</property>
<attribute name="horizontalHeaderVisible">
<bool>false</bool>
</attribute>
<attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool>
</attribute>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
</widget>
</item>
<item row="0" column="2">
<widget class="QToolButton" name="removeEntryPointButton">
<property name="text">
<string>Remove</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QToolButton" name="addEntryPointButton">
<property name="text">
<string>Add</string>
</property>
</widget>
</item>
<item row="0" column="0">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>312</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="symbolsTab">
<attribute name="title">
<string>Symbols</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_6">
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Symbols</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>311</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1">
<widget class="QToolButton" name="addSymbolButton">
<property name="text">
<string>Add</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QToolButton" name="removeSymbolButton">
<property name="text">
<string>Remove</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="3">
<widget class="QTableView" name="symbolTable">
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::SingleSelection</enum>
</property>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
</property>
<attribute name="horizontalHeaderVisible">
<bool>false</bool>
</attribute>
<attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool>
</attribute>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout> </layout>
</widget> </widget>
<resources/> <resources/>

View File

@ -13,10 +13,6 @@ FlowLineTextBrowser::FlowLineTextBrowser(QWidget *parent) : QTextBrowser(parent)
m_lineArea = new LineArea(this); m_lineArea = new LineArea(this);
m_jl = Q_NULLPTR; m_jl = Q_NULLPTR;
//this->verticalScrollBar()->setSliderPosition(this->verticalScrollBar()->sliderPosition());
// connect(this->document(), SIGNAL(blockCountChanged(int)), SLOT(updateLineAreaWidth(int)));
connect(this, SIGNAL(updateRequest(QRect,int)), SLOT(updateLineArea(QRect,int)));
updateLineAreaWidth(); updateLineAreaWidth();
} }
@ -37,7 +33,7 @@ int FlowLineTextBrowser::getFirstVisibleBlock(QTextBlock *firstBlock) const
if (r1.contains(r2, true) || r1.intersects(r2)) if (r1.contains(r2, true) || r1.intersects(r2))
{ {
qDebug() << r2; // qDebug() << r2;
if (firstBlock) if (firstBlock)
*firstBlock = block; *firstBlock = block;
return i; return i;
@ -69,7 +65,7 @@ void FlowLineTextBrowser::lineAreaPaintEvent(QPaintEvent *event)
QTextBlock block; QTextBlock block;
getFirstVisibleBlock(&block); getFirstVisibleBlock(&block);
qDebug() << block.text(); // qDebug() << block.text();
bool foundFirst = false; bool foundFirst = false;
quint16 linenum; quint16 linenum;
@ -116,6 +112,23 @@ void FlowLineTextBrowser::lineAreaPaintEvent(QPaintEvent *event)
foreach (JumpLine jl, jllist) foreach (JumpLine jl, jllist)
{ {
if (jl.type == IsBranch || jl.type == IsBRA)
{
painter.setPen(Qt::yellow);
painter.setBrush(Qt::yellow);
}
else if (jl.type == IsJMP)
{
painter.setPen(Qt::white);
painter.setBrush(Qt::white);
}
else
{
painter.setPen(Qt::red);
painter.setBrush(Qt::red);
}
int offset = getChannelOffset(jl.channel); int offset = getChannelOffset(jl.channel);
if (!inBlankLine) if (!inBlankLine)
{ {
@ -297,3 +310,5 @@ void FlowLineTextBrowser::updateLineArea(const QRect &rect, int dy)
if (rect.contains(viewport()->rect())) if (rect.contains(viewport()->rect()))
updateLineAreaWidth(); updateLineAreaWidth();
} }
void FlowLineTextBrowser::setLineAreaVisible(bool visible) { m_lineArea->setVisible(visible); }

View File

@ -39,6 +39,9 @@ private slots:
void updateLineAreaWidth(); void updateLineAreaWidth();
void updateLineArea(const QRect &, int); void updateLineArea(const QRect &, int);
public slots:
void setLineAreaVisible(bool visible);
private: private:
LineArea *m_lineArea; LineArea *m_lineArea;

View File

@ -53,13 +53,29 @@ HiresScreenWidget::HiresScreenWidget(QWidget *parent) :
m_showScanLinesAction->setCheckable(true); m_showScanLinesAction->setCheckable(true);
m_showScanLinesAction->setChecked(m_showScanLines); m_showScanLinesAction->setChecked(m_showScanLines);
m_prevPageAction = new QAction("Previous Data Page");
m_prevPageAction->setEnabled(false);
m_prevPageAction->setShortcut(QKeySequence(Qt::Key_Left | Qt::CTRL));
connect(m_ntscAction, SIGNAL(toggled(bool)), this, SLOT(handleNtscAction(bool))); m_nextPageAction = new QAction("Next Data Page");
connect(m_monochromeAction, SIGNAL(toggled(bool)), this, SLOT(handleMonochromeAction(bool))); m_nextPageAction->setEnabled(false);
connect(m_perPixelColorAction, SIGNAL(toggled(bool)), this, SLOT(handlePerPixelColorAction(bool))); m_nextPageAction->setShortcut(QKeySequence(Qt::Key_Right | Qt::CTRL));
connect(m_showScanLinesAction, SIGNAL(toggled(bool)), this, SLOT(handleShowScanLinesAction(bool))); connect(m_ntscAction, &QAction::toggled, this, &HiresScreenWidget::handleNtscAction);
connect(m_monochromeAction, &QAction::toggled, this, &HiresScreenWidget::handleMonochromeAction);
connect(m_perPixelColorAction, &QAction::toggled, this, &HiresScreenWidget::handlePerPixelColorAction);
connect(m_showScanLinesAction, &QAction::toggled,
this, &HiresScreenWidget::handleShowScanLinesAction);
connect(m_prevPageAction, &QAction::triggered,
this, &HiresScreenWidget::handlePrevPageAction);
connect(m_nextPageAction, &QAction::triggered,
this, &HiresScreenWidget::handleNextPageAction);
m_offset = 0;
} }
void HiresScreenWidget::handleNtscAction(bool toggled) { void HiresScreenWidget::handleNtscAction(bool toggled) {
@ -124,6 +140,8 @@ void HiresScreenWidget::drawPixmap()
{ {
QPainter pmpainter(&m_pixmap); QPainter pmpainter(&m_pixmap);
QByteArray workingdata = m_data.mid(m_offset);
pmpainter.setBrush(Qt::black); pmpainter.setBrush(Qt::black);
pmpainter.setPen(Qt::black); pmpainter.setPen(Qt::black);
pmpainter.drawRect(0,0,m_pixmap.width(),m_pixmap.height()); pmpainter.drawRect(0,0,m_pixmap.width(),m_pixmap.height());
@ -136,7 +154,7 @@ void HiresScreenWidget::drawPixmap()
quint8 chunkCount = 0; quint8 chunkCount = 0;
int idx = 0; int idx = 0;
while (idx < qMin(m_data.size(),8192)) { while (idx < qMin(workingdata.size(),8192)) {
ColRow cr = getColRowFromAppleAddress(idx); ColRow cr = getColRowFromAppleAddress(idx);
int yoff = cr.row(); int yoff = cr.row();
@ -148,7 +166,7 @@ void HiresScreenWidget::drawPixmap()
for (int jdx = 0; jdx < 40; jdx++) for (int jdx = 0; jdx < 40; jdx++)
{ {
quint8 byte = m_data[idx++]; quint8 byte = workingdata[idx++];
QBitArray dataBits = byteToBits(byte); QBitArray dataBits = byteToBits(byte);
bool highBit = dataBits.at(0); bool highBit = dataBits.at(0);
@ -195,10 +213,10 @@ void HiresScreenWidget::drawPixmap()
pmpainter.setPen(Qt::white); pmpainter.setPen(Qt::white);
pmpainter.setBrush(Qt::white); pmpainter.setBrush(Qt::white);
for (int idx = 0; idx < qMin(m_data.size(),8192) ; idx++) { for (int idx = 0; idx < qMin(workingdata.size(),8192) ; idx++) {
ColRow cr = getColRowFromAppleAddress(idx); ColRow cr = getColRowFromAppleAddress(idx);
quint8 byte = m_data[idx]; quint8 byte = workingdata[idx];
bool highBit = byte & 0x80; bool highBit = byte & 0x80;
@ -269,6 +287,42 @@ void HiresScreenWidget::setUnpackedData(QByteArray unpackedData)
setData(packedData); setData(packedData);
} }
void HiresScreenWidget::setOffset(quint16 offset)
{
m_offset = offset;
emit newOffset(m_offset);
update();
}
quint16 HiresScreenWidget::offset() const { return m_offset; }
void HiresScreenWidget::handlePrevPageAction(bool)
{
if (m_offset >= 8192)
{
setOffset(m_offset - 8192);
m_nextPageAction->setEnabled(true);
}
if (m_offset == 0) { m_prevPageAction->setEnabled(false); }
}
void HiresScreenWidget::handleNextPageAction(bool)
{
if (m_offset+8192 <= m_data.size())
{
setOffset(m_offset+8192);
m_prevPageAction->setEnabled(true);
}
if (m_offset+8192 > m_data.size())
{
m_nextPageAction->setEnabled(false);
}
}
QByteArray HiresScreenWidget::packData(QByteArray unpackedData) QByteArray HiresScreenWidget::packData(QByteArray unpackedData)
{ {
QByteArray packedData; QByteArray packedData;
@ -309,6 +363,20 @@ int HiresScreenWidget::getLineAddressOffset(int line)
void HiresScreenWidget::setData(QByteArray data) { void HiresScreenWidget::setData(QByteArray data) {
m_data = data; m_data = data;
if (data.size() > 8192)
{
m_nextPageAction->setEnabled(true);
m_prevPageAction->setEnabled(false);
m_offset = 0;
}
else
{
m_nextPageAction->setEnabled(false);
m_prevPageAction->setEnabled(false);
m_offset = 0;
}
repaint(); repaint();
} }
@ -477,6 +545,9 @@ void HiresScreenWidget::contextMenuEvent(QContextMenuEvent *event) {
menu.addAction(m_perPixelColorAction); menu.addAction(m_perPixelColorAction);
menu.addSeparator(); menu.addSeparator();
menu.addAction(m_showScanLinesAction); menu.addAction(m_showScanLinesAction);
menu.addSeparator();
menu.addAction(prevPageAction());
menu.addAction(nextPageAction());
menu.exec(event->globalPos()); menu.exec(event->globalPos());
} }

View File

@ -83,19 +83,23 @@ public:
QAction *ntscAction() { return m_ntscAction; } QAction *ntscAction() { return m_ntscAction; }
QAction *perPixelColorAction() { return m_perPixelColorAction; } QAction *perPixelColorAction() { return m_perPixelColorAction; }
QAction *showScanLinesAction() { return m_showScanLinesAction; } QAction *showScanLinesAction() { return m_showScanLinesAction; }
QAction *prevPageAction() { return m_prevPageAction; }
QAction *nextPageAction() { return m_nextPageAction; }
ColRow getColRowFromAppleAddress(quint16 address); ColRow getColRowFromAppleAddress(quint16 address);
ColRow getColRowFromRawAddress(quint16 address); ColRow getColRowFromRawAddress(quint16 address);
QPixmap getPixmap() const { return m_pixmap; } QPixmap getPixmap() const { return m_pixmap; }
quint16 offset() const;
signals: signals:
void newOffset(quint16 offset);
public slots: public slots:
void setData(QByteArray data); void setData(QByteArray data);
void setMode(ViewMode); void setMode(ViewMode);
void setUnpackedData(QByteArray unpackedData); void setUnpackedData(QByteArray unpackedData);
void setOffset(quint16 offset);
protected: protected:
int getLineAddressOffset(int line); int getLineAddressOffset(int line);
QByteArray packData(QByteArray unpackedData); QByteArray packData(QByteArray unpackedData);
@ -106,6 +110,9 @@ protected slots:
void handlePerPixelColorAction(bool toggled); void handlePerPixelColorAction(bool toggled);
void handleShowScanLinesAction(bool toggled); void handleShowScanLinesAction(bool toggled);
void handlePrevPageAction(bool);
void handleNextPageAction(bool);
private: private:
void makeAddressTables(); void makeAddressTables();
QColor getColorFromBits(QBitArray bits, quint8 phase); QColor getColorFromBits(QBitArray bits, quint8 phase);
@ -124,12 +131,16 @@ private:
QAction *m_ntscAction; QAction *m_ntscAction;
QAction *m_perPixelColorAction; QAction *m_perPixelColorAction;
QAction *m_showScanLinesAction; QAction *m_showScanLinesAction;
QAction *m_prevPageAction;
QAction *m_nextPageAction;
QActionGroup *formatGroup; QActionGroup *formatGroup;
bool m_showScanLines; bool m_showScanLines;
static QVector<ColRow> m_rawAddressToColRowList; static QVector<ColRow> m_rawAddressToColRowList;
static QVector<ColRow> m_appleAddressToColRowList; static QVector<ColRow> m_appleAddressToColRowList;
quint16 m_offset;
}; };
#endif // HIRESSCREENWIDGET_H #endif // HIRESSCREENWIDGET_H

View File

@ -6,6 +6,7 @@ LocationInfoDialog::LocationInfoDialog(QWidget *parent) :
ui(new Ui::LocationInfoDialog) ui(new Ui::LocationInfoDialog)
{ {
ui->setupUi(this); ui->setupUi(this);
showSizeWidgets(false);
} }
LocationInfoDialog::~LocationInfoDialog() LocationInfoDialog::~LocationInfoDialog()
@ -27,3 +28,14 @@ QString LocationInfoDialog::getInfo()
{ {
return ui->infoEdit->text(); return ui->infoEdit->text();
} }
int LocationInfoDialog::getSymbolSize()
{
return ui->sizeCombo->currentIndex();
}
void LocationInfoDialog::showSizeWidgets(bool show)
{
ui->sizeCombo->setHidden(!show);
ui->sizeLabel->setHidden(!show);
}

View File

@ -19,6 +19,9 @@ public:
void setInfoLabelString(QString label); void setInfoLabelString(QString label);
quint16 getAddress(); quint16 getAddress();
QString getInfo(); QString getInfo();
int getSymbolSize();
void showSizeWidgets(bool show);
protected: protected:

View File

@ -7,11 +7,11 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>284</width> <width>284</width>
<height>99</height> <height>162</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Dialog</string> <string>Address Metadata Info</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="0" column="0"> <item row="0" column="0">
@ -33,7 +33,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="2" column="0">
<widget class="QLabel" name="infoLabel"> <widget class="QLabel" name="infoLabel">
<property name="text"> <property name="text">
<string>Note</string> <string>Note</string>
@ -43,9 +43,30 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item row="2" column="1">
<widget class="QLineEdit" name="infoEdit"/> <widget class="QLineEdit" name="infoEdit"/>
</item> </item>
<item row="1" column="0">
<widget class="QLabel" name="sizeLabel">
<property name="text">
<string>Size</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="sizeCombo">
<item>
<property name="text">
<string>Byte</string>
</property>
</item>
<item>
<property name="text">
<string>Word</string>
</property>
</item>
</widget>
</item>
</layout> </layout>
</item> </item>
<item row="1" column="0"> <item row="1" column="0">

View File

@ -0,0 +1,62 @@
#ifndef ASCIIINFODIALOG_H
#define ASCIIINFODIALOG_H
#include <QDialog>
#include "asciiinfodialog.h"
#include "ui_asciiinfodialog.h"
namespace Ui {
class AsciiInfoDialog;
}
class AsciiInfoDialog : public QDialog
{
Q_OBJECT
public:
explicit AsciiInfoDialog(QWidget *parent = 0) :
QDialog(parent),
ui(new Ui::AsciiInfoDialog)
{
ui->setupUi(this);
QFont font = ui->tableWidget->itemAt(0,0)->font();
font.setBold(true);
for (int idx = 0; idx < ui->tableWidget->rowCount(); idx++)
{
// ui->tableWidget->item(idx,5 )->setFont(font);
// ui->tableWidget->item(idx,6 )->setFont(font);
// ui->tableWidget->item(idx,7 )->setFont(font);
// ui->tableWidget->item(idx,8 )->setFont(font);
// ui->tableWidget->item(idx,9 )->setFont(font);
}
for (int idx = 0; idx < ui->tableWidget->rowCount(); idx++)
{
for (int jdx = 0; jdx < ui->tableWidget->columnCount(); jdx++)
{
ui->tableWidget->item(idx,jdx )->setTextAlignment(Qt::AlignVCenter|Qt::AlignHCenter);
if (jdx < 5 || jdx > 9)
{
ui->tableWidget->item(idx,jdx )->setBackgroundColor(QColor(235,235,235));
}
}
}
ui->tableWidget->resizeColumnsToContents();
ui->tableWidget->resizeRowsToContents();
ui->tableWidget->verticalHeader()->setVisible(false);
ui->tableWidget->repaint();
}
~AsciiInfoDialog()
{
delete ui;
}
private:
Ui::AsciiInfoDialog *ui;
};
#endif // ASCIIINFODIALOG_H

File diff suppressed because it is too large Load Diff

View File

@ -13,11 +13,11 @@ HexConverter::HexConverter(QWidget *parent) :
ui->uint16LineEdit->setValidator(new QIntValidator(0,65535,this)); ui->uint16LineEdit->setValidator(new QIntValidator(0,65535,this));
ui->int16LineEdit->setValidator(new QIntValidator(-32768,32767,this)); ui->int16LineEdit->setValidator(new QIntValidator(-32768,32767,this));
connect(ui->hexLineEdit, SIGNAL(textEdited(QString)), SLOT(calcFromNewHex(QString))); connect(ui->hexLineEdit, &QLineEdit::textEdited, this, &HexConverter::calcFromNewHex);
connect(ui->uint8LineEdit, SIGNAL(textEdited(QString)), SLOT(calcFromNewUint8(QString))); connect(ui->uint8LineEdit, &QLineEdit::textEdited, this, &HexConverter::calcFromNewUint8);
connect(ui->int8LineEdit, SIGNAL(textEdited(QString)), SLOT(calcFromNewInt8(QString))); connect(ui->int8LineEdit, &QLineEdit::textEdited, this, &HexConverter::calcFromNewInt8);
connect(ui->uint16LineEdit, SIGNAL(textEdited(QString)), SLOT(calcFromNewUint16(QString))); connect(ui->uint16LineEdit, &QLineEdit::textEdited, this, &HexConverter::calcFromNewUint16);
connect(ui->int16LineEdit, SIGNAL(textEdited(QString)), SLOT(calcFromNewInt16(QString))); connect(ui->int16LineEdit, &QLineEdit::textEdited, this, &HexConverter::calcFromNewInt16);
} }
HexConverter::~HexConverter() HexConverter::~HexConverter()