mirror of
https://github.com/markdavidlong/AppleSAWS.git
synced 2025-01-20 20:33:23 +00:00
Added word wrap to all text-based viewer widgets.
This commit is contained in:
parent
441dc4613e
commit
28f6f66234
@ -18,13 +18,13 @@ ApplesoftFileViewer::ApplesoftFileViewer(QWidget *parent) :
|
||||
setWindowTitle(title);
|
||||
|
||||
m_formatter = new ApplesoftFormatter(this);
|
||||
//m_formatter->setFlags(ApplesoftFormatter::PrettyFlags | ApplesoftFormatter::BreakAfterReturn);
|
||||
m_formatter->setFlags(ApplesoftFormatter::PrettyFlags);
|
||||
connect(ui->findButton,SIGNAL(clicked(bool)), SLOT(findText()));
|
||||
m_isFirstFind = true;
|
||||
ui->textArea->setUndoRedoEnabled(false);
|
||||
ui->textArea->setUndoRedoEnabled(true);
|
||||
ui->textArea->setWordWrapMode(QTextOption::NoWrap);
|
||||
|
||||
toggleWordWrap(settings.value("ASViewer.WordWrap",true).toBool());
|
||||
}
|
||||
|
||||
ApplesoftFileViewer::~ApplesoftFileViewer()
|
||||
|
@ -4,6 +4,9 @@
|
||||
#include "memory.h"
|
||||
#include "relocatablefile.h"
|
||||
|
||||
#include <QSettings>
|
||||
#include <QMenu>
|
||||
#include <QAction>
|
||||
#include <QDebug>
|
||||
|
||||
DisassemblerViewer::DisassemblerViewer(QWidget *parent) :
|
||||
@ -14,6 +17,9 @@ DisassemblerViewer::DisassemblerViewer(QWidget *parent) :
|
||||
|
||||
QString title = QString("Disassembly Viewer");
|
||||
setWindowTitle(title);
|
||||
|
||||
QSettings settings;
|
||||
toggleWordWrap(settings.value("DisassemblerViewer.WordWrap",true).toBool());
|
||||
}
|
||||
|
||||
DisassemblerViewer::~DisassemblerViewer()
|
||||
@ -33,6 +39,20 @@ void DisassemblerViewer::setFile(GenericFile *file)
|
||||
}
|
||||
}
|
||||
|
||||
void DisassemblerViewer::toggleWordWrap(bool enabled)
|
||||
{
|
||||
if (enabled)
|
||||
{
|
||||
ui->textArea->setWordWrapMode(QTextOption::WordWrap);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->textArea->setWordWrapMode(QTextOption::NoWrap);
|
||||
}
|
||||
QSettings settings;
|
||||
settings.setValue("DisassemblerViewer.WordWrap",enabled);
|
||||
}
|
||||
|
||||
void DisassemblerViewer::setFile(BinaryFile *file) {
|
||||
m_file = file;
|
||||
|
||||
@ -1391,6 +1411,19 @@ QString DisassemblerViewer::getPotentialLabel(quint16 address) {
|
||||
return retval;
|
||||
}
|
||||
|
||||
bool DisassemblerViewer::optionsMenuItems(QMenu *menu)
|
||||
{
|
||||
QSettings settings;
|
||||
|
||||
QAction *action = new QAction("&Word Wrap");
|
||||
action->setCheckable(true);
|
||||
action->setChecked(settings.value("DisassemblerViewer.WordWrap",true).toBool());
|
||||
connect(action, SIGNAL(toggled(bool)), SLOT(toggleWordWrap(bool)));
|
||||
menu->addAction(action);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void DisassemblerViewer::setData(QByteArray data)
|
||||
{
|
||||
ui->textArea->setText(data);
|
||||
|
@ -26,10 +26,11 @@ public:
|
||||
void setText(QString text);
|
||||
|
||||
QString getPotentialLabel(quint16 address);
|
||||
virtual bool optionsMenuItems(QMenu *) { return false; }
|
||||
virtual bool optionsMenuItems(QMenu *);
|
||||
|
||||
public slots:
|
||||
void setFile(GenericFile *file);
|
||||
void toggleWordWrap(bool enabled);
|
||||
|
||||
private:
|
||||
Ui::DisassemblerViewer *ui;
|
||||
|
@ -3,6 +3,9 @@
|
||||
|
||||
#include <QDebug>
|
||||
#include <QScrollBar>
|
||||
#include <QSettings>
|
||||
#include <QAction>
|
||||
#include <QMenu>
|
||||
|
||||
HexDumpViewer::HexDumpViewer(QWidget *parent) :
|
||||
FileViewerInterface(parent),
|
||||
@ -13,6 +16,9 @@ HexDumpViewer::HexDumpViewer(QWidget *parent) :
|
||||
|
||||
QString title = QString("Hex Viewer");
|
||||
setWindowTitle(title);
|
||||
|
||||
QSettings settings;
|
||||
toggleWordWrap(settings.value("HexViewer.WordWrap",true).toBool());
|
||||
}
|
||||
|
||||
HexDumpViewer::~HexDumpViewer()
|
||||
@ -20,6 +26,24 @@ HexDumpViewer::~HexDumpViewer()
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void HexDumpViewer::toggleWordWrap(bool enabled)
|
||||
{
|
||||
if (enabled)
|
||||
{
|
||||
ui->textArea->setWordWrapMode(QTextOption::WordWrap);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->textArea->setWordWrapMode(QTextOption::NoWrap);
|
||||
}
|
||||
QSettings settings;
|
||||
settings.setValue("HexViewer.WordWrap",enabled);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void HexDumpViewer::showHexAndAsciiValues()
|
||||
{
|
||||
int offset = ui->textArea->verticalScrollBar()->value();
|
||||
@ -107,6 +131,19 @@ void HexDumpViewer::setFile(GenericFile *file, quint16 offset)
|
||||
|
||||
}
|
||||
|
||||
bool HexDumpViewer::optionsMenuItems(QMenu *menu)
|
||||
{
|
||||
QSettings settings;
|
||||
|
||||
QAction *action = new QAction("&Word Wrap");
|
||||
action->setCheckable(true);
|
||||
action->setChecked(settings.value("HexViewer.WordWrap",true).toBool());
|
||||
connect(action, SIGNAL(toggled(bool)), SLOT(toggleWordWrap(bool)));
|
||||
menu->addAction(action);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void HexDumpViewer::setData(QByteArray data)
|
||||
{
|
||||
ui->textArea->setHtml(data);
|
||||
|
@ -24,10 +24,11 @@ public:
|
||||
void setFile(GenericFile *file) { setFile(file,0); }
|
||||
void setFile(GenericFile *file, quint16 offset);
|
||||
|
||||
virtual bool optionsMenuItems(QMenu *) { return false; }
|
||||
virtual bool optionsMenuItems(QMenu *menu);
|
||||
|
||||
public slots:
|
||||
void showHexAndAsciiValues();
|
||||
void toggleWordWrap(bool enabled);
|
||||
|
||||
private:
|
||||
void setText(QString text);
|
||||
|
@ -4,6 +4,9 @@
|
||||
|
||||
#include <QVector>
|
||||
#include <QByteArray>
|
||||
#include <QSettings>
|
||||
#include <QMenu>
|
||||
#include <QAction>
|
||||
|
||||
TextHexDumpViewer::TextHexDumpViewer(QWidget *parent) :
|
||||
FileViewerInterface(parent),
|
||||
@ -14,6 +17,9 @@ TextHexDumpViewer::TextHexDumpViewer(QWidget *parent) :
|
||||
|
||||
QString title = QString("Text/Hex File Viewer");
|
||||
setWindowTitle(title);
|
||||
|
||||
QSettings settings;
|
||||
toggleWordWrap(settings.value("TexHexViewer.WordWrap",true).toBool());
|
||||
}
|
||||
|
||||
TextHexDumpViewer::~TextHexDumpViewer()
|
||||
@ -21,6 +27,21 @@ TextHexDumpViewer::~TextHexDumpViewer()
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void TextHexDumpViewer::toggleWordWrap(bool enabled)
|
||||
{
|
||||
if (enabled)
|
||||
{
|
||||
ui->textArea->setWordWrapMode(QTextOption::WordWrap);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->textArea->setWordWrapMode(QTextOption::NoWrap);
|
||||
}
|
||||
QSettings settings;
|
||||
settings.setValue("TextHexViewer.WordWrap",enabled);
|
||||
}
|
||||
|
||||
|
||||
QString TextHexDumpViewer::makeHexStr(QByteArray data)
|
||||
{
|
||||
QString retval;
|
||||
@ -93,3 +114,16 @@ void TextHexDumpViewer::setText(QString text)
|
||||
{
|
||||
ui->textArea->setHtml(text);
|
||||
}
|
||||
|
||||
bool TextHexDumpViewer::optionsMenuItems(QMenu *menu)
|
||||
{
|
||||
QSettings settings;
|
||||
|
||||
QAction *action = new QAction("&Word Wrap");
|
||||
action->setCheckable(true);
|
||||
action->setChecked(settings.value("TexHexViewer.WordWrap",true).toBool());
|
||||
connect(action, SIGNAL(toggled(bool)), SLOT(toggleWordWrap(bool)));
|
||||
menu->addAction(action);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -26,8 +26,10 @@ public:
|
||||
void setData(QByteArray data);
|
||||
void setText(QString text);
|
||||
|
||||
virtual bool optionsMenuItems(QMenu *) { return false; }
|
||||
virtual bool optionsMenuItems(QMenu *menu);
|
||||
|
||||
public slots:
|
||||
void toggleWordWrap(bool enabled);
|
||||
protected:
|
||||
QString makeTextStr(QByteArray data);
|
||||
QString makeHexStr(QByteArray data);
|
||||
|
Loading…
x
Reference in New Issue
Block a user