Added startup dialog widget.

This commit is contained in:
mlong 2021-01-30 14:02:10 -06:00
parent 25992b86ff
commit d8cf9111c6
8 changed files with 267 additions and 34 deletions

View File

@ -39,6 +39,7 @@ SOURCES += \
src/diskfiles/dos33/tracksectorlist.cxx \ src/diskfiles/dos33/tracksectorlist.cxx \
src/diskfiles/dos33/filedescriptiveentry.cxx \ src/diskfiles/dos33/filedescriptiveentry.cxx \
src/diskfiles/dos33/genericfile.cxx \ src/diskfiles/dos33/genericfile.cxx \
src/ui/startupdialog.cpp \
src/ui/viewers/intbasicfileviewer.cxx \ src/ui/viewers/intbasicfileviewer.cxx \
src/ui/widgets/notesdialog.cpp \ src/ui/widgets/notesdialog.cpp \
src/util/applestring.cxx \ src/util/applestring.cxx \
@ -88,6 +89,7 @@ HEADERS += \
src/diskfiles/dos33/filedescriptiveentry.h \ src/diskfiles/dos33/filedescriptiveentry.h \
src/diskfiles/dos33/genericfile.h \ src/diskfiles/dos33/genericfile.h \
src/intbasic/IntBasicFile.h \ src/intbasic/IntBasicFile.h \
src/ui/startupdialog.h \
src/ui/viewers/intbasicfileviewer.h \ src/ui/viewers/intbasicfileviewer.h \
src/ui/widgets/notesdialog.h \ src/ui/widgets/notesdialog.h \
src/util/util.h \ src/util/util.h \
@ -136,6 +138,7 @@ HEADERS += \
FORMS += \ FORMS += \
src/ui/catalogwidget.ui \ src/ui/catalogwidget.ui \
src/ui/startupdialog.ui \
src/ui/viewers/applesoftfileviewer.ui \ src/ui/viewers/applesoftfileviewer.ui \
src/ui/viewers/disassemblerviewer.ui \ src/ui/viewers/disassemblerviewer.ui \
src/ui/viewers/hexdumpviewer.ui \ src/ui/viewers/hexdumpviewer.ui \

View File

@ -9,7 +9,8 @@
#include "diskfile.h" #include "diskfile.h"
#include "catalogsector.h" #include "catalogsector.h"
#include "applesoftfile.h" #include "applesoftfile.h"
#include "DiskExplorer.h" //#include "DiskExplorer.h"
#include "startupdialog.h"
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
@ -21,18 +22,12 @@ int main(int argc, char** argv)
qDebug("Adding fonts"); qDebug("Adding fonts");
auto x = QFontDatabase::addApplicationFont(":/fonts/A2_40Col.ttf"); auto x = QFontDatabase::addApplicationFont(":/fonts/A2_40Col.ttf");
auto y = QFontDatabase::addApplicationFont(":/fonts/A2_80Col.ttf"); auto y = QFontDatabase::addApplicationFont(":/fonts/A2_80Col.ttf");
qDebug("40Col: %d 80Col: %d",x,y);
qDebug() << "40: " << QFontDatabase::applicationFontFamilies(0); // qDebug("40Col: %d 80Col: %d",x,y);
qDebug() << "80: " << QFontDatabase::applicationFontFamilies(1); // qDebug() << "40: " << QFontDatabase::applicationFontFamilies(0);
// qDebug() << "80: " << QFontDatabase::applicationFontFamilies(1);
DiskExplorer w; StartupDialog w;
QSettings settings;
QString lastOpened = settings.value("lastOpened").toString();
if (!lastOpened.isEmpty())
{
w.loadDiskFile(lastOpened);
}
w.show(); w.show();
return a.exec(); return a.exec();

View File

@ -5,7 +5,7 @@ https://github.com/markdavidlong/AppleSAWS
### Welcome ### Welcome
This is a toolkit for exploring DOS 3.3 disk contents. I started this because This is a toolkit for exploring DOS 3.3 disk images and their contents. I started this because
I had become interested in a game that I used to play a long time ago and I I had become interested in a game that I used to play a long time ago and I
wanted to dig deeper into the internals of how it worked. Since it was a nice wanted to dig deeper into the internals of how it worked. Since it was a nice
combination of a series of Applesoft and Binary files, I decided that a tool combination of a series of Applesoft and Binary files, I decided that a tool

View File

@ -15,13 +15,16 @@
DiskExplorer::DiskExplorer(QWidget *parent) : QMainWindow(parent) DiskExplorer::DiskExplorer(QWidget *parent) : QMainWindow(parent)
{ {
m_action_Unload_Disk_Image = nullptr; m_action_Unload_Disk_Image = nullptr;
m_hexConverter = nullptr;
m_disk = nullptr; m_disk = nullptr;
m_horizSizePref = -1; m_horizSizePref = -1;
m_toolsHidden = true; m_toolsHidden = true;
m_notesDialog = nullptr; // m_notesDialog = nullptr;
m_AsciiInfoDialog = nullptr; m_AsciiInfoDialog = nullptr;
m_hrcgDialog = nullptr; m_hrcgDialog = nullptr;
m_action_Unload_Disk_Image = nullptr;
resize(300,800); resize(300,800);
initUi(); initUi();
} }
@ -37,20 +40,20 @@ void DiskExplorer::initUi()
QMenu *menu = new QMenu(tr("&File"),this); QMenu *menu = new QMenu(tr("&File"),this);
menuBar->addMenu(menu); menuBar->addMenu(menu);
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, &QAction::triggered, // connect(action_Load_Disk_Image, &QAction::triggered,
this, &DiskExplorer::showLoadDialog); // 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, &QAction::triggered, // connect(m_action_Unload_Disk_Image, &QAction::triggered,
this, &DiskExplorer::unloadDiskFile); // 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);
@ -90,12 +93,12 @@ void DiskExplorer::initUi()
m_AsciiInfoDialog = new AsciiInfoDialog(this); m_AsciiInfoDialog = new AsciiInfoDialog(this);
connect(action_Ascii_Info, &QAction::triggered, m_AsciiInfoDialog, &AsciiInfoDialog::show); connect(action_Ascii_Info, &QAction::triggered, m_AsciiInfoDialog, &AsciiInfoDialog::show);
menu->addSeparator(); // menu->addSeparator();
QAction *action_Notes = new QAction(tr("&Notes..."), this); // QAction *action_Notes = new QAction(tr("&Notes..."), this);
menu->addAction(action_Notes); // menu->addAction(action_Notes);
if (!m_notesDialog) m_notesDialog = new NotesDialog(this); // if (!m_notesDialog) m_notesDialog = new NotesDialog(this);
connect(action_Notes, &QAction::triggered, m_notesDialog, &NotesDialog::show); // connect(action_Notes, &QAction::triggered, m_notesDialog, &NotesDialog::show);
QWidget *widget = new QWidget(0); QWidget *widget = new QWidget(0);
m_gridLayout = new QGridLayout(); m_gridLayout = new QGridLayout();
@ -157,7 +160,7 @@ void DiskExplorer::loadDiskFile(QString filename)
m_disk = new DiskFile(); m_disk = new DiskFile();
m_cw->prepForNewDisk(filename,m_disk); m_cw->prepForNewDisk(filename,m_disk);
if (m_disk->read(filename)) { if (m_disk->read(filename)) {
m_action_Unload_Disk_Image->setEnabled(true); if (m_action_Unload_Disk_Image) { m_action_Unload_Disk_Image->setEnabled(true); }
QSettings settings; QSettings settings;
settings.setValue("lastOpened",filename); settings.setValue("lastOpened",filename);
m_cw->processNewlyLoadedDisk(filename,m_disk); m_cw->processNewlyLoadedDisk(filename,m_disk);
@ -177,15 +180,16 @@ void DiskExplorer::handleShowSectorData(QByteArray data, int track, int sector,
m_hdv->setRawData(data,0); m_hdv->setRawData(data,0);
} }
void DiskExplorer::showLoadDialog() void DiskExplorer::showLoadDialog(bool parentToThis)
{ {
QSettings settings; QSettings settings;
QString last = settings.value("lastOpened",".").toString(); QString last = settings.value("lastOpened",".").toString();
QString filename = QFileDialog::getOpenFileName(this, QString filename = QFileDialog::getOpenFileName(parentToThis?this:nullptr,
tr("Open Disk Image"), tr("Open Disk Image"),
last, last,
"Disk Images (*.do *.dsk)"); "Disk Images (*.do *.dsk)");
if (!filename.isEmpty()) { if (!filename.isEmpty()) {
if (!parentToThis) { this->show(); }
loadDiskFile(filename); loadDiskFile(filename);
} }
} }

View File

@ -11,7 +11,7 @@
#include "hexdumpviewer.h" #include "hexdumpviewer.h"
#include "viewerbase.h" #include "viewerbase.h"
#include "asciiinfodialog.h" #include "asciiinfodialog.h"
#include "notesdialog.h" //#include "notesdialog.h"
#include <QFrame> #include <QFrame>
#include <QTimer> #include <QTimer>
@ -34,7 +34,7 @@ signals:
public slots: public slots:
void unloadDiskFile(); void unloadDiskFile();
void loadDiskFile(QString filename); void loadDiskFile(QString filename);
void showLoadDialog(); void showLoadDialog(bool parentToThis = true);
private slots: private slots:
void handleShowSectorData(QByteArray data, int track, int sector, QVariant metadata); void handleShowSectorData(QByteArray data, int track, int sector, QVariant metadata);
@ -69,7 +69,7 @@ private:
HRCGControlsInfo *m_hrcgDialog; HRCGControlsInfo *m_hrcgDialog;
HexConverter *m_hexConverter; HexConverter *m_hexConverter;
AsciiInfoDialog *m_AsciiInfoDialog; AsciiInfoDialog *m_AsciiInfoDialog;
NotesDialog *m_notesDialog; // NotesDialog *m_notesDialog;
QAction *m_action_Unload_Disk_Image; QAction *m_action_Unload_Disk_Image;

43
src/ui/startupdialog.cpp Normal file
View File

@ -0,0 +1,43 @@
#include "startupdialog.h"
#include "ui_startupdialog.h"
#include "diskexplorer/DiskExplorer.h"
#include <QFileDialog>
StartupDialog::StartupDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::StartupDialog)
{
m_notes = new NotesDialog(this);
ui->setupUi(this);
}
StartupDialog::~StartupDialog()
{
delete ui;
}
void StartupDialog::on_exploreContentsBtn_clicked()
{
DiskExplorer *w = new DiskExplorer(this);
w->showLoadDialog(false);
}
void StartupDialog::on_exploreDiskImageBtn_clicked()
{
}
void StartupDialog::on_bootSectorCompareBtn_clicked()
{
}
void StartupDialog::on_infoBtn_clicked()
{
m_notes->show();
}

41
src/ui/startupdialog.h Normal file
View File

@ -0,0 +1,41 @@
#ifndef STARTUPDIALOG_H
#define STARTUPDIALOG_H
#include "notesdialog.h"
#include "hrcgcontrolsinfo.h"
#include "hexconverter.h"
#include "hexdumpviewer.h"
#include <QDialog>
#include "asciiinfodialog.h"
namespace Ui {
class StartupDialog;
}
class StartupDialog : public QDialog
{
Q_OBJECT
public:
explicit StartupDialog(QWidget *parent = nullptr);
~StartupDialog();
private slots:
void on_exploreContentsBtn_clicked();
void on_exploreDiskImageBtn_clicked();
void on_bootSectorCompareBtn_clicked();
void on_infoBtn_clicked();
private:
Ui::StartupDialog *ui;
NotesDialog *m_notes;
HRCGControlsInfo *m_hrcgDialog;
HexConverter *m_hexConverter;
AsciiInfoDialog *m_AsciiInfoDialog;
};
#endif // STARTUPDIALOG_H

147
src/ui/startupdialog.ui Normal file
View File

@ -0,0 +1,147 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>StartupDialog</class>
<widget class="QDialog" name="StartupDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>312</width>
<height>197</height>
</rect>
</property>
<property name="windowTitle">
<string>AppleSAWS</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="3" column="1">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>122</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="0">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QPushButton" name="exploreContentsBtn">
<property name="text">
<string>Explore Disk Image Contents ...</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="exploreDiskImageBtn">
<property name="text">
<string>Explore Disk Image File ...</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="bootSectorCompareBtn">
<property name="text">
<string>Boot Sector Comparison ...</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="4" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>18</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>20</number>
</property>
<item>
<widget class="QLabel" name="titleLabel">
<property name="font">
<font>
<family>Arial</family>
<pointsize>18</pointsize>
<weight>75</weight>
<italic>true</italic>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>AppleSAWS</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="versionLabel">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text">
<string>V. 0.0.3pr</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>13</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="infoBtn">
<property name="text">
<string>?</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0" colspan="2">
<widget class="QLabel" name="copyrightLabel">
<property name="text">
<string>(C) 2015-2021 Mark D. Long</string>
</property>
</widget>
</item>
<item row="2" column="0">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>