Added sector view hex dump to Disk Explorer

This commit is contained in:
Mark Long 2016-10-28 01:38:45 -05:00
parent df201f95b1
commit 23acb3f54d
7 changed files with 45 additions and 21 deletions

View File

@ -68,10 +68,13 @@ void DiskExplorer::initUi()
m_cw = new CatalogWidget(widget);
m_demw = new DiskExplorerMapWidget(35,16,widget);
QFrame *frame = new QFrame(widget);
frame->setFrameStyle(QFrame::Raised);
frame->setStyleSheet("background-color: darkGray");
frame->setMinimumSize(200,200);
m_frame = new QFrame(widget);
m_frame->setFrameStyle(QFrame::Raised);
m_frame->setMinimumSize(200,200);
QGridLayout *frameLayout = new QGridLayout(this);
m_frame->setLayout(frameLayout);
m_hdv = new HexDumpViewer(this);
frameLayout->addWidget(m_hdv);
layout->setColumnStretch(0,4);
layout->setColumnStretch(1,1);
@ -80,13 +83,14 @@ void DiskExplorer::initUi()
layout->addWidget(m_cw,0,0,2,1);
layout->addWidget(m_demw,0,1,1,2);
layout->addWidget(m_demw->makeKeyWidget(),1,1);
layout->addWidget(frame,1,2);
layout->addWidget(m_frame,1,2);
connect(m_cw,SIGNAL(openWithDefaultViewer(DiskFile*,FileDescriptiveEntry)),
SLOT(handleDiskItemSelectedDefaultOpen(DiskFile*,FileDescriptiveEntry)));
connect(m_demw, SIGNAL(showSectorData(QByteArray,int,int,QVariant)),
SLOT(handleShowSectorData(QByteArray,int,int,QVariant)));
}
@ -96,6 +100,7 @@ void DiskExplorer::unloadDiskFile()
{
m_cw->unloadDisk(m_disk);
m_demw->unloadDisk();
m_hdv->setRawData(QByteArray(),0);
}
}
@ -121,6 +126,14 @@ void DiskExplorer::loadDiskFile(QString filename)
}
void DiskExplorer::handleShowSectorData(QByteArray data, int track, int sector, QVariant metadata)
{
Q_UNUSED(track)
Q_UNUSED(sector)
Q_UNUSED(metadata)
m_hdv->setRawData(data,0);
}
void DiskExplorer::showLoadDialog()
{
QSettings settings;

View File

@ -8,6 +8,7 @@
#include "diskfile.h"
#include "hrcgcontrolsinfo.h"
#include "hexconverter.h"
#include "hexdumpviewer.h"
#include <QFrame>
@ -31,6 +32,7 @@ public slots:
void showLoadDialog();
private slots:
void handleShowSectorData(QByteArray data, int track, int sector, QVariant metadata);
void handleDiskItemSelectedDefaultOpen(DiskFile *disk, FileDescriptiveEntry fde);
@ -40,12 +42,15 @@ protected:
private:
CatalogWidget *m_cw;
DiskExplorerMapWidget *m_demw;
QFrame *m_frame;
HexDumpViewer *m_hdv;
DiskFile *m_disk;
HRCGControlsInfo *m_hrcgDialog;
HexConverter *m_hexConverter;
QAction *m_action_Unload_Disk_Image;
};

View File

@ -63,26 +63,24 @@ DiskExplorerMapWidget::DiskExplorerMapWidget(int numtracks, int numsectors, QWid
void DiskExplorerMapWidget::handleButtonCheck(int track, int sector, bool checked)
{
DEButton *currbutton = buttonAt(track,sector);
if (m_currentChecked)
{
// Do anything needed to clean up after previous button click
// m_currentClicked->setHighlighted(false);
}
qDebug() << "Checked: " << checked << "t/s" << track << sector;
DEButton *currbutton = buttonAt(track,sector);
if (currbutton == m_currentChecked)
if (checked)
{
// currbutton->setHighlighted(false);
// Handle reclicking on the same button
Sector sec = m_disk->getSector(track,sector);
QByteArray data = sec.rawData();
emit showSectorData(data,track,sector,QVariant());
}
else{
emit showSectorData(QByteArray(),-1,-1,QVariant());
}
else
{
// currbutton->setHighlighted(true);
// Handle clicking on a new button;
}
m_currentChecked = currbutton;
}
@ -268,5 +266,7 @@ void DiskExplorerMapWidget::mapDiskToButtons()
}
}
}
m_bgroup->setExclusive(true);
}

View File

@ -117,7 +117,9 @@ public:
void unloadDisk();
void setAllButtonsEnabled(bool enabled);
signals:
void showSectorData(QByteArray data, int track, int sector, QVariant metadata);
public slots:
void handleButtonCheck(int track, int sector, bool checked);

View File

@ -43,8 +43,6 @@ void HexDumpViewer::toggleWordWrap(bool enabled)
void HexDumpViewer::showHexAndAsciiValues()
{
int offset = ui->textArea->verticalScrollBar()->value();
@ -130,7 +128,13 @@ void HexDumpViewer::setFile(GenericFile *file, quint16 offset)
m_data = file->data();
showHexAndAsciiValues();
}
void HexDumpViewer::setRawData(QByteArray data, quint16 offset)
{
m_offset = offset;
m_data = data;
showHexAndAsciiValues();
}
bool HexDumpViewer::optionsMenuItems(QMenu *menu)

View File

@ -23,7 +23,7 @@ public:
void setFile(GenericFile *file) { setFile(file,0); }
void setFile(GenericFile *file, quint16 offset);
void setRawData(QByteArray data, quint16 offset = 0);
virtual bool optionsMenuItems(QMenu *menu);
bool canPrint() const;

View File

@ -28,7 +28,7 @@
<property name="font">
<font>
<family>Courier 10 Pitch</family>
<pointsize>12</pointsize>
<pointsize>10</pointsize>
</font>
</property>
</widget>