mirror of
https://github.com/markdavidlong/AppleSAWS.git
synced 2025-02-06 08:29:54 +00:00
Added new viewer menu options.
This commit is contained in:
parent
243cb5a16b
commit
400db17b3c
@ -55,7 +55,6 @@ SOURCES += \
|
||||
src/ui/widgets/characterwidget.cpp \
|
||||
src/ui/viewers/applesoftfiledetailviewer.cpp \
|
||||
src/ui/widgets/hexconverter.cpp \
|
||||
src/ui/widgets/hrcgcontrolsinfo.cpp \
|
||||
src/ui/viewers/viewerbase.cpp \
|
||||
src/ui/viewers/fileviewerinterface.cpp
|
||||
|
||||
|
@ -34,9 +34,6 @@ ApplesoftFileViewer::~ApplesoftFileViewer()
|
||||
|
||||
bool ApplesoftFileViewer::makeMenuOptions(QMenu *menu)
|
||||
{
|
||||
qDebug() << "makeMenuOptions()";
|
||||
|
||||
|
||||
QSettings settings;
|
||||
|
||||
QAction *action = new QAction("Show &Ints as Hex",menu);
|
||||
@ -67,7 +64,6 @@ bool ApplesoftFileViewer::makeMenuOptions(QMenu *menu)
|
||||
|
||||
bool ApplesoftFileViewer::optionsMenuItems(QMenu *menu)
|
||||
{
|
||||
qDebug() << "AFV::optionMenuItems()";
|
||||
return makeMenuOptions(menu);
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
#include "charsetviewer.h"
|
||||
#include <QGridLayout>
|
||||
|
||||
#include <QSettings>
|
||||
#include <QAction>
|
||||
#include <QMenu>
|
||||
|
||||
CharSetViewer::CharSetViewer(QWidget *parent) : FileViewerInterface(parent)
|
||||
{
|
||||
@ -52,3 +54,84 @@ void CharSetViewer::setFile(BinaryFile *file)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool CharSetViewer::optionsMenuItems(QMenu *menu)
|
||||
{
|
||||
QSettings settings;
|
||||
|
||||
QAction *action = new QAction("Show &Grid",menu);
|
||||
action->setCheckable(true);
|
||||
action->setChecked(settings.value("CharSetViewer.ShowGrid",true).toBool());
|
||||
showGrid(settings.value("CharSetViewer.ShowGrid",true).toBool());
|
||||
connect(action, SIGNAL(toggled(bool)),SLOT(showGrid(bool)));
|
||||
menu->addAction(action);
|
||||
|
||||
action = new QAction("&Enable Bit Shift",menu);
|
||||
action->setCheckable(true);
|
||||
action->setChecked(settings.value("CharSetViewer.EnableBitShift",true).toBool());
|
||||
enableBitShift(settings.value("CharSetViewer.EnableBitShift",true).toBool());
|
||||
connect(action, SIGNAL(toggled(bool)),SLOT(enableBitShift(bool)));
|
||||
menu->addAction(action);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
QList<CharacterWidget *> CharSetViewer::getChildren()
|
||||
{
|
||||
QList<CharacterWidget*> retval;
|
||||
foreach (QObject *child, children())
|
||||
{
|
||||
if (dynamic_cast<CharacterWidget*>(child))
|
||||
{
|
||||
retval.append(dynamic_cast<CharacterWidget*>(child));
|
||||
}
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
void CharSetViewer::setFgColor(QColor color)
|
||||
{
|
||||
foreach (auto child, getChildren())
|
||||
{
|
||||
child->setFgColor(color);
|
||||
}
|
||||
}
|
||||
|
||||
void CharSetViewer::setBgColor(QColor color)
|
||||
{
|
||||
foreach (auto child, getChildren())
|
||||
{
|
||||
child->setBgColor(color);
|
||||
}
|
||||
}
|
||||
|
||||
void CharSetViewer::setGridColor(QColor color)
|
||||
{
|
||||
foreach (auto child, getChildren())
|
||||
{
|
||||
child->setGridColor(color);
|
||||
}
|
||||
}
|
||||
|
||||
void CharSetViewer::showGrid(bool show)
|
||||
{
|
||||
QSettings settings;
|
||||
settings.setValue("CharSetViewer.ShowGrid",show);
|
||||
|
||||
foreach (auto child, getChildren())
|
||||
{
|
||||
child->showGrid(show);
|
||||
}
|
||||
}
|
||||
|
||||
void CharSetViewer::enableBitShift(bool enable)
|
||||
{
|
||||
QSettings settings;
|
||||
settings.setValue("CharSetViewer.EnableBitShift",enable);
|
||||
|
||||
foreach (auto child, getChildren())
|
||||
{
|
||||
child->enableBitShift(enable);
|
||||
}
|
||||
}
|
||||
|
@ -16,10 +16,22 @@ public:
|
||||
void setFile(GenericFile *file);
|
||||
void setFile(BinaryFile *file);
|
||||
|
||||
virtual bool optionsMenuItems(QMenu *) { return false; }
|
||||
virtual bool optionsMenuItems(QMenu *menu);
|
||||
|
||||
public slots:
|
||||
void setFgColor(QColor color);
|
||||
void setBgColor(QColor color);
|
||||
void setGridColor(QColor color);
|
||||
|
||||
void showGrid(bool show);
|
||||
void enableBitShift(bool enable);
|
||||
|
||||
|
||||
signals:
|
||||
|
||||
protected:
|
||||
QList<CharacterWidget*> getChildren();
|
||||
|
||||
private:
|
||||
BinaryFile *m_file;
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include <QMap>
|
||||
#include <QDebug>
|
||||
#include <QResizeEvent>
|
||||
#include <QSettings>
|
||||
|
||||
#include <math.h>
|
||||
|
||||
@ -13,8 +14,9 @@ HiresViewWidget::HiresViewWidget(QWidget *parent) :
|
||||
FileViewerInterface(parent)
|
||||
{
|
||||
resize(561,384);
|
||||
m_viewMode = Color2;
|
||||
m_showScanLines = true;
|
||||
QSettings settings;
|
||||
m_viewMode = static_cast<ViewMode>(settings.value("HiresViewWidget.ViewMode",Color2).toInt());
|
||||
m_showScanLines = settings.value("HiresViewWidget.ShowScanLines",true).toBool();
|
||||
|
||||
if (m_rowTable == 0) { makeOffsetTable(); }
|
||||
|
||||
@ -42,7 +44,8 @@ HiresViewWidget::HiresViewWidget(QWidget *parent) :
|
||||
|
||||
showScanLinesAction = new QAction("Show Scan Lines",this);
|
||||
showScanLinesAction->setCheckable(true);
|
||||
showScanLinesAction->setChecked(true);
|
||||
showScanLinesAction->setChecked(m_showScanLines);
|
||||
|
||||
|
||||
connect(ntscAction, SIGNAL(toggled(bool)), this, SLOT(handleNtscAction(bool)));
|
||||
connect(monochromeAction, SIGNAL(toggled(bool)), this, SLOT(handleMonochromeAction(bool)));
|
||||
@ -57,6 +60,8 @@ void HiresViewWidget::handleNtscAction(bool toggled) {
|
||||
m_viewMode = Color2;
|
||||
update();
|
||||
}
|
||||
QSettings settings;
|
||||
settings.setValue("HiresViewWidget.ViewMode",m_viewMode);
|
||||
}
|
||||
|
||||
void HiresViewWidget::handleMonochromeAction(bool toggled) {
|
||||
@ -64,6 +69,8 @@ void HiresViewWidget::handleMonochromeAction(bool toggled) {
|
||||
m_viewMode = Monochrome;
|
||||
update();
|
||||
}
|
||||
QSettings settings;
|
||||
settings.setValue("HiresViewWidget.ViewMode",m_viewMode);
|
||||
}
|
||||
|
||||
void HiresViewWidget::handlePerPixelColorAction(bool toggled) {
|
||||
@ -71,11 +78,15 @@ void HiresViewWidget::handlePerPixelColorAction(bool toggled) {
|
||||
m_viewMode = Color1;
|
||||
update();
|
||||
}
|
||||
QSettings settings;
|
||||
settings.setValue("HiresViewWidget.ViewMode",m_viewMode);
|
||||
}
|
||||
|
||||
void HiresViewWidget::handleShowScanLinesAction(bool toggled) {
|
||||
m_showScanLines = toggled;
|
||||
update();
|
||||
QSettings settings;
|
||||
settings.setValue("HiresViewWidget.ShowScanLines",toggled);
|
||||
}
|
||||
|
||||
void HiresViewWidget::paintEvent(QPaintEvent *event)
|
||||
@ -511,6 +522,16 @@ void HiresViewWidget::contextMenuEvent(QContextMenuEvent *event) {
|
||||
menu.exec(event->globalPos());
|
||||
}
|
||||
|
||||
bool HiresViewWidget::optionsMenuItems(QMenu *menu)
|
||||
{
|
||||
menu->addAction(monochromeAction);
|
||||
menu->addAction(ntscAction);
|
||||
menu->addAction(perPixelColorAction);
|
||||
menu->addSeparator();
|
||||
menu->addAction(showScanLinesAction);
|
||||
return true;
|
||||
}
|
||||
|
||||
void HiresViewWidget::setFile(GenericFile *file)
|
||||
{
|
||||
BinaryFile *af = dynamic_cast<BinaryFile*>(file);
|
||||
|
@ -51,7 +51,7 @@ public:
|
||||
static QBitArray byteToBits(quint8 byte);
|
||||
void contextMenuEvent(QContextMenuEvent *);
|
||||
|
||||
virtual bool optionsMenuItems(QMenu *) { return false; }
|
||||
virtual bool optionsMenuItems(QMenu *);
|
||||
|
||||
signals:
|
||||
|
||||
@ -67,6 +67,7 @@ protected slots:
|
||||
void handleMonochromeAction(bool toggled);
|
||||
void handlePerPixelColorAction(bool toggled);
|
||||
void handleShowScanLinesAction(bool toggled);
|
||||
|
||||
private:
|
||||
QPixmap m_pixmap;
|
||||
QByteArray m_data;
|
||||
|
@ -20,7 +20,8 @@ ViewerBase::ViewerBase(QWidget *parent) :
|
||||
QMainWindow(parent),
|
||||
ui(new Ui::ViewerBase)
|
||||
{
|
||||
setMinimumWidth(1024);
|
||||
// setMinimumWidth(1024);
|
||||
|
||||
m_stack = new QStackedWidget(this);
|
||||
ui->setupUi(this);
|
||||
setCentralWidget(m_stack);
|
||||
@ -37,7 +38,6 @@ ViewerBase::ViewerBase(QWidget *parent) :
|
||||
m_optionMenu = new QMenu("&Viewer");
|
||||
menuBar()->addMenu(m_optionMenu);
|
||||
m_optionMenu->setEnabled(false);
|
||||
|
||||
}
|
||||
|
||||
ViewerBase::~ViewerBase()
|
||||
@ -135,7 +135,6 @@ void ViewerBase::addViewer(QString descriptor, FileViewerInterface *viewer)
|
||||
|
||||
void ViewerBase::showViewer(QString descriptor)
|
||||
{
|
||||
qDebug() << "showViewer";
|
||||
FileViewerInterface *fvi = m_viewers[descriptor];
|
||||
if (fvi)
|
||||
{
|
||||
|
@ -1,15 +0,0 @@
|
||||
#include "hrcgcontrolsinfo.h"
|
||||
#include "ui_hrcgcontrolsinfo.h"
|
||||
|
||||
HRCGControlsInfo::HRCGControlsInfo(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::HRCGControlsInfo)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->tableWidget->resizeColumnsToContents();
|
||||
}
|
||||
|
||||
HRCGControlsInfo::~HRCGControlsInfo()
|
||||
{
|
||||
delete ui;
|
||||
}
|
@ -2,6 +2,8 @@
|
||||
#define HRCGCONTROLSINFO_H
|
||||
|
||||
#include <QDialog>
|
||||
#include "ui_hrcgcontrolsinfo.h"
|
||||
|
||||
|
||||
namespace Ui {
|
||||
class HRCGControlsInfo;
|
||||
@ -12,8 +14,17 @@ class HRCGControlsInfo : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit HRCGControlsInfo(QWidget *parent = 0);
|
||||
~HRCGControlsInfo();
|
||||
explicit HRCGControlsInfo(QWidget *parent = 0) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::HRCGControlsInfo)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->tableWidget->resizeColumnsToContents();
|
||||
}
|
||||
~HRCGControlsInfo()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
private:
|
||||
Ui::HRCGControlsInfo *ui;
|
||||
|
Loading…
x
Reference in New Issue
Block a user