Added word wrap to Applesoft Viewer

This commit is contained in:
Mark Long 2016-10-15 16:01:26 -05:00
parent 823ae4dd57
commit 441dc4613e
2 changed files with 24 additions and 2 deletions

View File

@ -24,7 +24,7 @@ ApplesoftFileViewer::ApplesoftFileViewer(QWidget *parent) :
m_isFirstFind = true; m_isFirstFind = true;
ui->textArea->setUndoRedoEnabled(false); ui->textArea->setUndoRedoEnabled(false);
ui->textArea->setUndoRedoEnabled(true); ui->textArea->setUndoRedoEnabled(true);
ui->textArea->setWordWrapMode(QTextOption::NoWrap);
} }
ApplesoftFileViewer::~ApplesoftFileViewer() ApplesoftFileViewer::~ApplesoftFileViewer()
@ -59,6 +59,14 @@ bool ApplesoftFileViewer::makeMenuOptions(QMenu *menu)
connect(action, SIGNAL(triggered(bool)), SLOT(launchVarBrowser())); connect(action, SIGNAL(triggered(bool)), SLOT(launchVarBrowser()));
menu->addAction(action); menu->addAction(action);
menu->addSeparator();
action = new QAction("&Word Wrap");
action->setCheckable(true);
action->setChecked(settings.value("ASViewer.WordWrap",true).toBool());
connect(action, SIGNAL(toggled(bool)), SLOT(toggleWordWrap(bool)));
menu->addAction(action);
return true; return true;
} }
@ -67,6 +75,20 @@ bool ApplesoftFileViewer::optionsMenuItems(QMenu *menu)
return makeMenuOptions(menu); return makeMenuOptions(menu);
} }
void ApplesoftFileViewer::toggleWordWrap(bool enabled)
{
if (enabled)
{
ui->textArea->setWordWrapMode(QTextOption::WordWrap);
}
else
{
ui->textArea->setWordWrapMode(QTextOption::NoWrap);
}
QSettings settings;
settings.setValue("ASViewer.WordWrap",enabled);
}
void ApplesoftFileViewer::setIndentCode(bool enabled) void ApplesoftFileViewer::setIndentCode(bool enabled)
{ {
if (enabled) if (enabled)

View File

@ -33,8 +33,8 @@ public slots:
void findText(); void findText();
protected:
protected slots: protected slots:
void toggleWordWrap(bool enabled);
void setIndentCode(bool enabled); void setIndentCode(bool enabled);
void setIntsAsHex(bool enabled); void setIntsAsHex(bool enabled);
void launchVarBrowser(); void launchVarBrowser();