Added notes dialog on disk explorer, bundled Apple Fonts, and added legalese, as needed.

This commit is contained in:
mlong 2021-01-24 16:07:30 -06:00
parent 9f41eae9a6
commit c2af23df22
18 changed files with 315 additions and 24 deletions

View File

@ -40,6 +40,7 @@ SOURCES += \
src/diskfiles/dos33/filedescriptiveentry.cxx \
src/diskfiles/dos33/genericfile.cxx \
src/ui/viewers/intbasicfileviewer.cxx \
src/ui/widgets/notesdialog.cpp \
src/util/applestring.cxx \
src/applesoftfile/applesoftfile.cxx \
src/applesoftfile/applesofttoken.cxx \
@ -88,6 +89,7 @@ HEADERS += \
src/diskfiles/dos33/genericfile.h \
src/intbasic/IntBasicFile.h \
src/ui/viewers/intbasicfileviewer.h \
src/ui/widgets/notesdialog.h \
src/util/util.h \
src/util/applestring.h \
src/applesoftfile/applesoftfile.h \
@ -146,4 +148,8 @@ FORMS += \
src/ui/widgets/CharacterSetExplorer.ui \
src/ui/widgets/DisassemblerMetadataDialog.ui \
src/ui/widgets/LocationInfoDialog.ui \
src/ui/widgets/asciiinfodialog.ui
src/ui/widgets/asciiinfodialog.ui \
src/ui/widgets/notesdialog.ui
RESOURCES += \
src/resource/resources.qrc

View File

@ -148,7 +148,7 @@ QByteArray IntBasicFile::dumpBufferAsIntBasicFile(QByteArray origdata)
}
data.removeFirst();
int alen = get16(data[0],data[1]);
// int alen = get16(data[0],data[1]);
int position = 2;

View File

@ -1,6 +1,8 @@
#include <QApplication>
#include <QSettings>
#include <QString>
#include <QFontDatabase>
#include <QDebug>
#include "binaryfile.h"
#include "genericfile.h"
@ -15,6 +17,15 @@ int main(int argc, char** argv)
QCoreApplication::setOrganizationName("LydianScaleSoftware");
QCoreApplication::setOrganizationDomain("lydianscale.com");
QCoreApplication::setApplicationName("AppleSAWS");
qDebug("Adding fonts");
auto x = QFontDatabase::addApplicationFont(":/fonts/A2_40Col.ttf");
auto y = QFontDatabase::addApplicationFont(":/fonts/A2_80Col.ttf");
qDebug("40Col: %d 80Col: %d",x,y);
qDebug() << "40: " << QFontDatabase::applicationFontFamilies(0);
qDebug() << "80: " << QFontDatabase::applicationFontFamilies(1);
DiskExplorer w;
QSettings settings;
QString lastOpened = settings.value("lastOpened").toString();

View File

@ -0,0 +1,20 @@
KREATIVE SOFTWARE RELAY FONTS FREE USE LICENSE
version 1.2f
Permission is hereby granted, free of charge, to any person or entity (the "User") obtaining a copy of the included font files (the "Software") produced by Kreative Software, to utilize, display, embed, or redistribute the Software, subject to the following conditions:
1. The User may not sell copies of the Software for a fee.
1a. The User may give away copies of the Software free of charge provided this license and any documentation is included verbatim and credit is given to Kreative Korporation or Kreative Software.
2. The User may not modify, reverse-engineer, or create any derivative works of the Software.
3. Any Software carrying the following font names or variations thereof is not covered by this license and may not be used under the terms of this license: Jewel Hill, Miss Diode n Friends, This is Beckie's font!
3a. Any Software carrying a font name ending with the string "Pro CE" is not covered by this license and may not be used under the terms of this license.
4. This license becomes null and void if any of the above conditions are not met.
5. Kreative Software reserves the right to change this license at any time without notice.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE SOFTWARE OR FROM OTHER DEALINGS IN THE SOFTWARE.

BIN
src/resource/PRNumber3.ttf Normal file

Binary file not shown.

Binary file not shown.

64
src/resource/notes.txt Normal file
View File

@ -0,0 +1,64 @@
# AppleSAWS
## Apple Software Analysis WorkShop v.0.0.3pr
https://github.com/markdavidlong/AppleSAWS
### Welcome
This is a toolkit for exploring DOS 3.3 disk contents. I started this because
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
combination of a series of Applesoft and Binary files, I decided that a tool
to help explore those types of things would be handy. Of course, I've ended
up spending far more time writing the tool than I have actually exploring the
game, but nonetheless, it's been a fun ongoing project.
***
### Legal Stuff:
I am grateful to be able to include a couple of wonderful Apple II inspired fonts
from KreativeKorp, **Print Char 21** and **PR Number 3** available from
https://www.kreativekorp.com/software/fonts/apple2.shtml
Accordingly, here is their license:
```
KREATIVE SOFTWARE RELAY FONTS FREE USE LICENSE
version 1.2f
Permission is hereby granted, free of charge, to any person or entity (the "User") obtaining a copy of the included font files (the "Software") produced by Kreative Software, to utilize, display, embed, or redistribute the Software, subject to the following conditions:
1. The User may not sell copies of the Software for a fee.
1a. The User may give away copies of the Software free of charge provided this license and any documentation is included verbatim and credit is given to Kreative Korporation or Kreative Software.
2. The User may not modify, reverse-engineer, or create any derivative works of the Software.
3. Any Software carrying the following font names or variations thereof is not covered by this license and may not be used under the terms of this license: Jewel Hill, Miss Diode n Friends, This is Beckie's font!
3a. Any Software carrying a font name ending with the string "Pro CE" is not covered by this license and may not be used under the terms of this license.
4. This license becomes null and void if any of the above conditions are not met.
5. Kreative Software reserves the right to change this license at any time without notice.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE SOFTWARE OR FROM OTHER DEALINGS IN THE SOFTWARE.
```
***
And, of course, this program is released under the MIT License:
```
The MIT License (MIT)
Copyright (c) 2015-2021 Mark D. Long
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
```

View File

@ -0,0 +1,10 @@
<RCC>
<qresource prefix="/fonts">
<file>FreeLicense.txt</file>
<file alias="A2_40Col.ttf">PrintChar21.ttf</file>
<file alias="A2_80Col.ttf">PRNumber3.ttf</file>
</qresource>
<qresource prefix="/notes">
<file>notes.txt</file>
</qresource>
</RCC>

View File

@ -14,10 +14,13 @@
DiskExplorer::DiskExplorer(QWidget *parent) : QMainWindow(parent)
{
m_action_Unload_Disk_Image = 0;
m_disk = 0;
m_action_Unload_Disk_Image = nullptr;
m_disk = nullptr;
m_horizSizePref = -1;
m_toolsHidden = true;
m_notesDialog = nullptr;
m_AsciiInfoDialog = nullptr;
m_hrcgDialog = nullptr;
resize(300,800);
initUi();
@ -76,10 +79,10 @@ void DiskExplorer::initUi()
QAction *action_HRCG_Commands = new QAction(tr("&HRCG Commands..."),this);
menu->addAction(action_HRCG_Commands);
m_hrcgDialog = new HRCGControlsInfo(this);
if (!m_hrcgDialog) m_hrcgDialog = new HRCGControlsInfo(this);
connect(action_HRCG_Commands, &QAction::triggered, m_hrcgDialog, &HRCGControlsInfo::show);
m_hexConverter = new HexConverter(this);
if (!m_hexConverter) m_hexConverter = new HexConverter(this);
connect(action_Hex_Converter, &QAction::triggered, m_hexConverter, &HexConverter::show);
QAction *action_Ascii_Info = new QAction(tr("&ASCII Table..."),this);
@ -87,6 +90,12 @@ void DiskExplorer::initUi()
m_AsciiInfoDialog = new AsciiInfoDialog(this);
connect(action_Ascii_Info, &QAction::triggered, m_AsciiInfoDialog, &AsciiInfoDialog::show);
menu->addSeparator();
QAction *action_Notes = new QAction(tr("&Notes..."), this);
menu->addAction(action_Notes);
if (!m_notesDialog) m_notesDialog = new NotesDialog(this);
connect(action_Notes, &QAction::triggered, m_notesDialog, &NotesDialog::show);
QWidget *widget = new QWidget(0);
m_gridLayout = new QGridLayout();

View File

@ -11,6 +11,7 @@
#include "hexdumpviewer.h"
#include "viewerbase.h"
#include "asciiinfodialog.h"
#include "notesdialog.h"
#include <QFrame>
#include <QTimer>
@ -68,7 +69,7 @@ private:
HRCGControlsInfo *m_hrcgDialog;
HexConverter *m_hexConverter;
AsciiInfoDialog *m_AsciiInfoDialog;
NotesDialog *m_notesDialog;
QAction *m_action_Unload_Disk_Image;

View File

@ -18,10 +18,13 @@ ApplesoftFileViewer::ApplesoftFileViewer(QWidget *parent) :
m_afdv = Q_NULLPTR;
QFont textAreaFont;
textAreaFont.setStyleHint(QFont::Monospace);
// QFont textAreaFont("PR Number 3");
QFont textAreaFont("Print Char 21");
// textAreaFont.setStyleHint(QFont::Monospace);
textAreaFont.setPointSize(12);
qDebug() << "************ " << textAreaFont;
QSettings settings;
QString title = QString("Applesoft Viewer");
m_title = title;
@ -51,7 +54,8 @@ ApplesoftFileViewer::ApplesoftFileViewer(QWidget *parent) :
setSyntaxHighlighting(settings.value("ASViewer.syntaxHighlighting",true).toBool(), NoReformat);
setShowCtrlChars(settings.value("ASViewer.showCtrlChars",true).toBool(), NoReformat);
setTextFont(fontFromSettings("ASViewer.textFont", textAreaFont), NoReformat);
// setTextFont(fontFromSettings("ASViewer.textFont", textAreaFont), NoReformat);
setTextFont(textAreaFont, NoReformat);
}
ApplesoftFileViewer::~ApplesoftFileViewer()
@ -168,8 +172,8 @@ bool ApplesoftFileViewer::makeMenuOptions(QMenu *menu)
bool ok;
QFont font = QFontDialog::getFont(&ok,
ui->textArea->font(),
this, "Set Font",
QFontDialog::MonospacedFonts);
this, "Set Font"
/*, QFontDialog::MonospacedFonts| QFontDialog::DontUseNativeDialog */);
if (ok) {
setTextFont(font,ForceReformat);
fontToSettings("ASViewer.textFont",font);

View File

@ -16,7 +16,7 @@ public:
explicit IntBasicFileViewer(QWidget *parent = nullptr);
~IntBasicFileViewer();
bool optionsMenuItems(QMenu *menu) { return false; }
bool optionsMenuItems(QMenu * /*menu*/) { return false; }
public slots:
void setFile(GenericFile *file);

View File

@ -223,11 +223,11 @@ void MazeViewer::drawMaze()
quint8 roomPlayerIsIn = mem.at(0x8008 + (32*rdx));
if (roomPlayerIsIn == currentRoom) {
if (rdx == 0) { pl += QString("\u2460"); }
if (rdx == 1) { pl += QString("\u2461"); }
if (rdx == 2) { pl += QString("\u2462"); }
if (rdx == 3) { pl += QString("\u2463"); }
if (rdx == 4) { pl += QString("\u2464"); }
if (rdx == 0) { pl += QString(u8"\u2460"); }
if (rdx == 1) { pl += QString(u8"\u2461"); }
if (rdx == 2) { pl += QString(u8"\u2462"); }
if (rdx == 3) { pl += QString(u8"\u2463"); }
if (rdx == 4) { pl += QString(u8"\u2464"); }
}
}

View File

@ -267,6 +267,7 @@ int FlowLineTextBrowser::getChannelOffset(int channel)
return width - (channel * 9)- 10;
}
int FlowLineTextBrowser::lineAreaWidth()
{
if (!m_jl) return 10;

View File

@ -12,11 +12,12 @@
#include <QSize>
#include <QWidget>
#include <QScrollEvent>
#include <QToolTip>
class LineArea;
class FlowLineTextBrowser : public QTextBrowser
{
class LineArea;
public:
FlowLineTextBrowser(QWidget *parent = Q_NULLPTR);
@ -37,8 +38,6 @@ protected:
bool isBlockVisible(QTextBlock block) const;
void showEvent(QShowEvent *) Q_DECL_OVERRIDE;
// void wheelEvent(QWheelEvent *ev) Q_DECL_OVERRIDE { if (ev) { ev->ignore(); } }
private slots:
void updateLineAreaWidth();
void updateLineArea(const QRect &, int);
@ -47,16 +46,17 @@ public slots:
void setLineAreaVisible(bool visible);
private:
LineArea *m_lineArea;
FlowLineTextBrowser::LineArea *m_lineArea;
JumpLines *m_jl;
};
class LineArea : public QWidget
{
public:
LineArea(FlowLineTextBrowser *browser) : QWidget(browser)
{
setMouseTracking(true);
m_browser = browser;
}
@ -74,11 +74,41 @@ protected:
void wheelEvent(QWheelEvent *ev) Q_DECL_OVERRIDE { m_browser->proxyWheelEvent(ev); }
bool event(QEvent *event) Q_DECL_OVERRIDE
{
if (event->type() == QEvent::ToolTip) {
QHelpEvent *helpEvent = static_cast<QHelpEvent *>(event);
int index = getChannelForXPos(helpEvent->pos().x());
if (index != -1) {
QToolTip::showText(helpEvent->globalPos(), QString("Channel %1").arg(index));
} else {
QToolTip::hideText();
event->ignore();
}
return true;
}
return QWidget::event(event);
}
int getChannelForXPos(int xpos)
{
for (int idx = 0; idx < m_browser->m_jl->m_maxChannel; idx++)
{
int channeloffset = m_browser->getChannelOffset(idx);
if (abs(channeloffset - xpos) < 4)
{
return idx;
}
}
return -1;
}
private:
FlowLineTextBrowser *m_browser;
JumpLines *m_jl;
};
};
#endif // FLOWLINETEXTBROWSER_H

View File

@ -0,0 +1,27 @@
#include "notesdialog.h"
#include "ui_notesdialog.h"
#include <QFile>
NotesDialog::NotesDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::NotesDialog)
{
ui->setupUi(this);
QByteArray text;
QFile notes(":/notes/notes.txt");
if (notes.open(QIODevice::ReadOnly | QIODevice::Text))
{
text = notes.readAll();
notes.close();
}
else
{
text = "No notes available right now! Maybe next version!";
}
ui->notesArea->setMarkdown(text);
}
NotesDialog::~NotesDialog()
{
delete ui;
}

View File

@ -0,0 +1,22 @@
#ifndef NOTESDIALOG_H
#define NOTESDIALOG_H
#include <QDialog>
namespace Ui {
class NotesDialog;
}
class NotesDialog : public QDialog
{
Q_OBJECT
public:
explicit NotesDialog(QWidget *parent = nullptr);
~NotesDialog();
private:
Ui::NotesDialog *ui;
};
#endif // NOTESDIALOG_H

View File

@ -0,0 +1,86 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>NotesDialog</class>
<widget class="QDialog" name="NotesDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>479</width>
<height>409</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>Application Notes</string>
</property>
</widget>
</item>
<item>
<widget class="QTextBrowser" name="notesArea">
<property name="openExternalLinks">
<bool>true</bool>
</property>
<property name="openLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Close</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>NotesDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>NotesDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>