summaryrefslogtreecommitdiffstats
path: root/src/MainWindow.cpp
diff options
context:
space:
mode:
authorMichele Calgaro <[email protected]>2023-04-08 14:41:17 +0900
committerMichele Calgaro <[email protected]>2023-04-08 14:41:17 +0900
commitb4d35ab97d008c3b24a109640d90dba73215631b (patch)
tree78ef92df7a05944abbbc564df9d2789e42d1220a /src/MainWindow.cpp
parent191e11f6dc9f8ac42f39a8866a8f4dfb4f75433c (diff)
downloaduniversal-indent-gui-tqt-b4d35ab97d008c3b24a109640d90dba73215631b.tar.gz
universal-indent-gui-tqt-b4d35ab97d008c3b24a109640d90dba73215631b.zip
Settings for syntax highlighting, showing whitespaces and loading last open file are now saved and restored across executions
Signed-off-by: Michele Calgaro <[email protected]>
Diffstat (limited to 'src/MainWindow.cpp')
-rw-r--r--src/MainWindow.cpp286
1 files changed, 149 insertions, 137 deletions
diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp
index 38e893b..496636d 100644
--- a/src/MainWindow.cpp
+++ b/src/MainWindow.cpp
@@ -58,7 +58,7 @@
///-- #include <tqmessagebox.h>
///-- #include <tqtdebug.h>
///--
-///-- #include <Qsci/qsciscintilla.h>
+#include <tqextscintilla.h>
///-- #include <Qsci/qsciprinter.h>
///--
///-- using namespace tschweitzer;
@@ -79,16 +79,15 @@
\brief Constructs the main window.
*/
MainWindow::MainWindow(TQString file2OpenOnStart, TQWidget *parent) :
- MainWindowBase(parent), m_aboutDialog(NULL)
-///- _mainWindowForm(NULL), _qSciSourceCodeEditor(NULL), _settings(NULL),
+ MainWindowBase(parent), m_aboutDialog(NULL), m_qSciSourceCodeEditor(NULL)
+///- _mainWindowForm(NULL), _settings(NULL),
///- _highlighter(NULL), _textEditVScrollBar(NULL), _aboutDialogGraphicsView(
///- NULL), _settingsDialog(NULL), _encodingActionGroup(NULL), _saveEncodedActionGroup(NULL),
///- _highlighterActionGroup(NULL), _uiGuiTranslator(NULL), _qTTranslator(NULL), _toolBarWidget(
///- NULL), _indentHandler(NULL), _textEditLineColumnInfoLabel(NULL)
{
-///-- // Init of some variables.
-///-- _sourceCodeChanged = false;
-///-- _scrollPositionChanged = false;
+ // Init of some variables.
+ m_sourceCodeChanged = false;
// Create the _settings object, which loads all UiGui settings from a file.
m_settings = UiGuiSettings::getInstance();
@@ -197,22 +196,39 @@ void MainWindow::initMainWindow()
showMaximized();
}
-///-- // Get last selected file encoding
-///-- // -------------------------------
-///-- _currentEncoding = _settings->getValueByName("encoding").toString();
-///--
-///-- // Register the load last file setting in the menu to the _settings object.
-///-- _settings->registerObjectProperty(actionLoadLastOpenedFileOnStartup, "checked",
-///-- "loadLastSourceCodeFileOnStartup");
-///--
-///-- // Tell the TQScintilla editor if it has to show white space.
-///-- connect(_mainWindowForm->actionWhiteSpaceIsVisible, SIGNAL(acivated(bool)), this,
-///-- SLOT(setWhiteSpaceVisibility(bool)));
-///-- // Register the white space setting in the menu to the _settings object.
-///-- _settings->registerObjectProperty(actionWhiteSpaceIsVisible, "checked",
-///-- "whiteSpaceIsVisible");
-///--
-///-- // Connect the remaining menu items.
+ // Get last selected file encoding
+ // -------------------------------
+ m_currentEncoding = m_settings->getValueByName("FileEncoding").toString();
+
+ // Register the syntax highlighting setting in the menu to the settings object.
+ connect(actionEnableSyntaxHighlighting, SIGNAL(toggled(bool)),
+ m_settings, SLOT(handleValueChangeFromExtern(bool)));
+ connect(m_settings, SIGNAL(syntaxHighlightingEnabled(bool)),
+ actionEnableSyntaxHighlighting, SLOT(setOn(bool)));
+ actionEnableSyntaxHighlighting->setOn(
+ m_settings->getValueByName("SyntaxHighlightingEnabled").toBool());
+ // Tell the highlighter if it has to be enabled or disabled.
+ connect(m_settings, SIGNAL(syntaxHighlightingEnabled(bool)), this, SLOT(turnHighlightOnOff(bool)));
+
+ // Register the load last file setting in the menu to the settings object
+ connect(actionLoadLastOpenedFileOnStartup, SIGNAL(toggled(bool)),
+ m_settings, SLOT(handleValueChangeFromExtern(bool)));
+ connect(m_settings, SIGNAL(loadLastOpenedFileOnStartup(bool)),
+ actionLoadLastOpenedFileOnStartup, SLOT(setOn(bool)));
+ actionLoadLastOpenedFileOnStartup->setOn(
+ m_settings->getValueByName("LoadLastOpenedFileOnStartup").toBool());
+
+ // Register the white space setting in the menu to the settings object.
+ connect(actionWhiteSpaceIsVisible, SIGNAL(toggled(bool)),
+ m_settings, SLOT(handleValueChangeFromExtern(bool)));
+ connect(m_settings, SIGNAL(whiteSpaceIsVisible(bool)),
+ actionWhiteSpaceIsVisible, SLOT(setOn(bool)));
+ actionWhiteSpaceIsVisible->setOn(m_settings->getValueByName("WhiteSpaceIsVisible").toBool());
+
+ // Tell the TQScintilla editor if it has to show white space.
+ connect(m_settings, SIGNAL(whiteSpaceIsVisible(bool)), this, SLOT(setWhiteSpaceVisibility(bool)));
+
+ // Connect the remaining menu items.
connect(actionOpenSourceFile, SIGNAL(activated()), this, SLOT(openSourceFileDialog()));
connect(actionSaveSourceFile, SIGNAL(activated()), this, SLOT(saveSourceFile()));
connect(actionSaveSourceFileAs, SIGNAL(activated()), this, SLOT(saveasSourceFileDialog()));
@@ -278,7 +294,7 @@ void MainWindow::initToolBar()
///-- // TQScintilla debug lib and the other way around.
///-- try
///-- {
-///-- _qSciSourceCodeEditor = new QsciScintilla(this);
+///-- m_qSciSourceCodeEditor = new QsciScintilla(this);
///-- }
///-- catch (...)
///-- {
@@ -286,17 +302,17 @@ void MainWindow::initToolBar()
///-- "During trying to create the text editor component, that is based on TQScintilla, an error occurred. Please make sure that you have installed TQScintilla and not mixed release and debug versions.");
///-- exit(1);
///-- }
-///-- _mainWindowForm->hboxLayout1->addWidget(_qSciSourceCodeEditor);
+///-- _mainWindowForm->hboxLayout1->addWidget(m_qSciSourceCodeEditor);
///--
///-- // Make some _settings for the TQScintilla widget.
-///-- _qSciSourceCodeEditor->setUtf8(true);
-///-- _qSciSourceCodeEditor->setMarginLineNumbers(1, true);
-///-- _qSciSourceCodeEditor->setMarginWidth(1, TQString("10000"));
-///-- _qSciSourceCodeEditor->setBraceMatching(_qSciSourceCodeEditor->SloppyBraceMatch);
-///-- _qSciSourceCodeEditor->setMatchedBraceForegroundColor(TQColor("red"));
-///-- _qSciSourceCodeEditor->setFolding(QsciScintilla::BoxedTreeFoldStyle);
-///-- _qSciSourceCodeEditor->setAutoCompletionSource(QsciScintilla::AcsAll);
-///-- _qSciSourceCodeEditor->setAutoCompletionThreshold(3);
+///-- m_qSciSourceCodeEditor->setUtf8(true);
+///-- m_qSciSourceCodeEditor->setMarginLineNumbers(1, true);
+///-- m_qSciSourceCodeEditor->setMarginWidth(1, TQString("10000"));
+///-- m_qSciSourceCodeEditor->setBraceMatching(m_qSciSourceCodeEditor->SloppyBraceMatch);
+///-- m_qSciSourceCodeEditor->setMatchedBraceForegroundColor(TQColor("red"));
+///-- m_qSciSourceCodeEditor->setFolding(QsciScintilla::BoxedTreeFoldStyle);
+///-- m_qSciSourceCodeEditor->setAutoCompletionSource(QsciScintilla::AcsAll);
+///-- m_qSciSourceCodeEditor->setAutoCompletionThreshold(3);
///--
///-- // Handle if white space is set to be visible
///-- bool whiteSpaceIsVisible = _settings->getValueByName("whiteSpaceIsVisible").toBool();
@@ -304,24 +320,24 @@ void MainWindow::initToolBar()
///--
///-- // Handle the width of tabs in spaces
///-- int tabWidth = _settings->getValueByName("tabWidth").toInt();
-///-- _qSciSourceCodeEditor->setTabWidth(tabWidth);
+///-- m_qSciSourceCodeEditor->setTabWidth(tabWidth);
///--
///-- // Remember a pointer to the scrollbar of the TQScintilla widget used to keep
///-- // on the same line as before when turning preview on/off.
-///-- _textEditVScrollBar = _qSciSourceCodeEditor->verticalScrollBar();
+///-- _textEditVScrollBar = m_qSciSourceCodeEditor->verticalScrollBar();
///--
///-- // Add a column row indicator to the status bar.
///-- _textEditLineColumnInfoLabel = new TQLabel(tr("Line %1, Column %2").arg(1).arg(1));
///-- _mainWindowForm->statusbar->addPermanentWidget(_textEditLineColumnInfoLabel);
-///-- connect(_qSciSourceCodeEditor, SIGNAL(cursorPositionChanged(int,int)), this,
+///-- connect(m_qSciSourceCodeEditor, SIGNAL(cursorPositionChanged(int,int)), this,
///-- SLOT(setStatusBarCursorPosInfo(int, int)));
///--
///-- // Connect the text editor to dependent functions.
-///-- connect(_qSciSourceCodeEditor, SIGNAL(textChanged()), this, SLOT(sourceCodeChangedHelperSlot()));
-///-- connect(_qSciSourceCodeEditor, SIGNAL(linesChanged()), this, SLOT(numberOfLinesChanged()));
-///-- //connect( _settings, SIGNAL(tabWidth(int)), _qSciSourceCodeEditor, SLOT(setTabWidth(int)) );
-///-- _settings->registerObjectSlot(_qSciSourceCodeEditor, "setTabWidth(int)", "tabWidth");
-///-- _qSciSourceCodeEditor->setTabWidth(_settings->getValueByName("tabWidth").toInt());
+///-- connect(m_qSciSourceCodeEditor, SIGNAL(textChanged()), this, SLOT(sourceCodeChangedHelperSlot()));
+///-- connect(m_qSciSourceCodeEditor, SIGNAL(linesChanged()), this, SLOT(numberOfLinesChanged()));
+///-- //connect( _settings, SIGNAL(tabWidth(int)), m_qSciSourceCodeEditor, SLOT(setTabWidth(int)) );
+///-- _settings->registerObjectSlot(m_qSciSourceCodeEditor, "setTabWidth(int)", "tabWidth");
+///-- m_qSciSourceCodeEditor->setTabWidth(_settings->getValueByName("tabWidth").toInt());
///-- }
///--
///-- /*
@@ -330,7 +346,7 @@ void MainWindow::initToolBar()
///-- void MainWindow::initSyntaxHighlighter()
///-- {
///-- // Create the _highlighter.
-///-- _highlighter = new UiGuiHighlighter(_qSciSourceCodeEditor);
+///-- _highlighter = new UiGuiHighlighter(m_qSciSourceCodeEditor);
///--
///-- // Connect the syntax highlighting setting in the menu to the turnHighlightOnOff function.
///-- connect(actionEnableSyntaxHighlighting, SIGNAL(activated(bool)), this,
@@ -457,7 +473,7 @@ void MainWindow::initToolBar()
///-- {
///-- TQTextStream inSrcStrm(&inSrcFile);
///-- TQApplication::setOverrideCursor(TQt::WaitCursor);
-///-- inSrcStrm.setCodec(TQTextCodec::codecForName(_currentEncoding.toAscii()));
+///-- inSrcStrm.setCodec(TQTextCodec::codecForName(m_currentEncoding.toAscii()));
///-- fileContent = inSrcStrm.readAll();
///-- TQApplication::restoreOverrideCursor();
///-- inSrcFile.close();
@@ -506,7 +522,7 @@ void MainWindow::openSourceFileDialog(TQString fileName)
///-- {
///-- callIndenter();
///-- }
-///-- _sourceCodeChanged = true;
+///-- m_sourceCodeChanged = true;
///-- _previewToggled = true;
///-- updateSourceView();
///-- updateWindowTitle();
@@ -515,7 +531,7 @@ void MainWindow::openSourceFileDialog(TQString fileName)
///-- _textEditVScrollBar->setValue(_textEditLastScrollPos);
///--
///-- _savedSourceContent = openedSourceFileContent;
-///-- _qSciSourceCodeEditor->setModified(false);
+///-- m_qSciSourceCodeEditor->setModified(false);
///-- setWindowModified(false);
///-- }
}
@@ -541,7 +557,7 @@ bool MainWindow::saveasSourceFileDialog(TQAction *chosenEncodingAction)
///-- return false;
///-- }
///--
-///-- _savedSourceContent = _qSciSourceCodeEditor->text();
+///-- _savedSourceContent = m_qSciSourceCodeEditor->text();
///--
///-- _currentSourceFile = fileName;
///-- TQFile::remove(fileName);
@@ -565,7 +581,7 @@ bool MainWindow::saveasSourceFileDialog(TQAction *chosenEncodingAction)
///-- TQFileInfo fileInfo(fileName);
///-- _currentSourceFileExtension = fileInfo.suffix();
///--
-///-- _qSciSourceCodeEditor->setModified(false);
+///-- m_qSciSourceCodeEditor->setModified(false);
///-- setWindowModified(false);
///--
///-- updateWindowTitle();
@@ -587,17 +603,17 @@ bool MainWindow::saveSourceFile()
///-- {
///-- TQFile::remove(_currentSourceFile);
///-- TQFile outSrcFile(_currentSourceFile);
-///-- _savedSourceContent = _qSciSourceCodeEditor->text();
+///-- _savedSourceContent = m_qSciSourceCodeEditor->text();
///-- outSrcFile.open(TQFile::ReadWrite | TQFile::Text);
///--
///-- // Get current encoding.
-///-- TQString _currentEncoding = _encodingActionGroup->checkedAction()->text();
+///-- TQString m_currentEncoding = _encodingActionGroup->checkedAction()->text();
///-- TQTextStream outSrcStrm(&outSrcFile);
-///-- outSrcStrm.setCodec(TQTextCodec::codecForName(_currentEncoding.toAscii()));
+///-- outSrcStrm.setCodec(TQTextCodec::codecForName(m_currentEncoding.toAscii()));
///-- outSrcStrm << _savedSourceContent;
///-- outSrcFile.close();
///--
-///-- _qSciSourceCodeEditor->setModified(false);
+///-- m_qSciSourceCodeEditor->setModified(false);
///-- setWindowModified(false);
///-- }
return true;
@@ -646,13 +662,13 @@ bool MainWindow::saveSourceFile()
///--
///-- if (_previewToggled)
///-- {
-///-- disconnect(_qSciSourceCodeEditor, SIGNAL(textChanged()), this,
+///-- disconnect(m_qSciSourceCodeEditor, SIGNAL(textChanged()), this,
///-- SLOT(sourceCodeChangedHelperSlot()));
///-- bool textIsModified = isWindowModified();
-///-- _qSciSourceCodeEditor->setText(_sourceViewContent);
+///-- m_qSciSourceCodeEditor->setText(_sourceViewContent);
///-- setWindowModified(textIsModified);
///-- _previewToggled = false;
-///-- connect(_qSciSourceCodeEditor, SIGNAL(textChanged()), this,
+///-- connect(m_qSciSourceCodeEditor, SIGNAL(textChanged()), this,
///-- SLOT(sourceCodeChangedHelperSlot()));
///-- }
///--
@@ -672,12 +688,12 @@ bool MainWindow::saveSourceFile()
///-- //updateSourceView();
///-- TQApplication::restoreOverrideCursor();
///-- }
-///--
-///-- /*
-///-- \brief Switches the syntax highlighting corresponding to the value \a turnOn either on or off.
-///-- */
-///-- void MainWindow::turnHighlightOnOff(bool turnOn)
-///-- {
+
+/*
+ \brief Switches the syntax highlighting corresponding to the value \a turnOn either on or off.
+ */
+void MainWindow::turnHighlightOnOff(bool turnOn)
+{
///-- if (turnOn)
///-- {
///-- _highlighter->turnHighlightOn();
@@ -688,8 +704,8 @@ bool MainWindow::saveSourceFile()
///-- }
///-- _previewToggled = true;
///-- updateSourceView();
-///-- }
-///--
+}
+
///-- /*
///-- \brief Added this slot to avoid multiple calls because of changed text.
///-- */
@@ -708,14 +724,10 @@ bool MainWindow::saveSourceFile()
///-- int cursorPos, cursorPosAbsolut, cursorLine;
///-- TQString text;
///--
-///-- _sourceCodeChanged = true;
-///-- if (_scrollPositionChanged)
-///-- {
-///-- _scrollPositionChanged = false;
-///-- }
+///-- m_sourceCodeChanged = true;
///--
///-- // Get the content text of the text editor.
-///-- _sourceFileContent = _qSciSourceCodeEditor->text();
+///-- _sourceFileContent = m_qSciSourceCodeEditor->text();
///--
///-- // Get the position of the cursor in the unindented text.
///-- if (_sourceFileContent.isEmpty())
@@ -729,9 +741,9 @@ bool MainWindow::saveSourceFile()
///-- }
///-- else
///-- {
-///-- _qSciSourceCodeEditor->getCursorPosition(&cursorLine, &cursorPos);
-///-- cursorPosAbsolut = _qSciSourceCodeEditor->SendScintilla(QsciScintillaBase::SCI_GETCURRENTPOS);
-///-- text = _qSciSourceCodeEditor->text(cursorLine);
+///-- m_qSciSourceCodeEditor->getCursorPosition(&cursorLine, &cursorPos);
+///-- cursorPosAbsolut = m_qSciSourceCodeEditor->SendScintilla(QsciScintillaBase::SCI_GETCURRENTPOS);
+///-- text = m_qSciSourceCodeEditor->text(cursorLine);
///-- if (cursorPosAbsolut > 0)
///-- {
///-- cursorPosAbsolut--;
@@ -765,10 +777,10 @@ bool MainWindow::saveSourceFile()
///--
///-- // Search forward
///-- for (cursorLine = saveCursorLine;
-///-- cursorLine - saveCursorLine < 6 && cursorLine < _qSciSourceCodeEditor->lines();
+///-- cursorLine - saveCursorLine < 6 && cursorLine < m_qSciSourceCodeEditor->lines();
///-- cursorLine++)
///-- {
-///-- text = _qSciSourceCodeEditor->text(cursorLine);
+///-- text = m_qSciSourceCodeEditor->text(cursorLine);
///-- while (cursorPos < text.count() && enteredCharacter != text.at(cursorPos))
///-- {
///-- cursorPos++;
@@ -787,7 +799,7 @@ bool MainWindow::saveSourceFile()
///-- // If foward search did not find the character, search backward
///-- if (!charFound)
///-- {
-///-- text = _qSciSourceCodeEditor->text(saveCursorLine);
+///-- text = m_qSciSourceCodeEditor->text(saveCursorLine);
///-- cursorPos = saveCursorPos;
///-- if (cursorPos >= text.count())
///-- {
@@ -797,14 +809,14 @@ bool MainWindow::saveSourceFile()
///-- for (cursorLine = saveCursorLine; saveCursorLine - cursorLine < 6 && cursorLine >= 0;
///-- cursorLine--)
///-- {
-///-- text = _qSciSourceCodeEditor->text(cursorLine);
+///-- text = m_qSciSourceCodeEditor->text(cursorLine);
///-- while (cursorPos >= 0 && enteredCharacter != text.at(cursorPos))
///-- {
///-- cursorPos--;
///-- }
///-- if (cursorPos < 0)
///-- {
-///-- cursorPos = _qSciSourceCodeEditor->lineLength(cursorLine - 1) - 1;
+///-- cursorPos = m_qSciSourceCodeEditor->lineLength(cursorLine - 1) - 1;
///-- }
///-- else
///-- {
@@ -817,39 +829,39 @@ bool MainWindow::saveSourceFile()
///-- // If the character was found set its new cursor position...
///-- if (charFound)
///-- {
-///-- _qSciSourceCodeEditor->setCursorPosition(cursorLine, cursorPos + 1);
+///-- m_qSciSourceCodeEditor->setCursorPosition(cursorLine, cursorPos + 1);
///-- }
///-- // ...if it was not found, set the previous cursor position.
///-- else
///-- {
-///-- _qSciSourceCodeEditor->setCursorPosition(saveCursorLine, saveCursorPos + 1);
+///-- m_qSciSourceCodeEditor->setCursorPosition(saveCursorLine, saveCursorPos + 1);
///-- }
///-- }
///-- // set the previous cursor position.
///-- else if (enteredCharacter == 10)
///-- {
-///-- _qSciSourceCodeEditor->setCursorPosition(cursorLine, cursorPos);
+///-- m_qSciSourceCodeEditor->setCursorPosition(cursorLine, cursorPos);
///-- }
///--
///-- if (m_toolBarWidget->cbLivePreview->isChecked())
///-- {
-///-- _sourceCodeChanged = false;
+///-- m_sourceCodeChanged = false;
///-- }
///--
-///-- if (_savedSourceContent == _qSciSourceCodeEditor->text())
+///-- if (_savedSourceContent == m_qSciSourceCodeEditor->text())
///-- {
-///-- _qSciSourceCodeEditor->setModified(false);
+///-- m_qSciSourceCodeEditor->setModified(false);
///-- setWindowModified(false);
///-- }
///-- else
///-- {
-///-- _qSciSourceCodeEditor->setModified(true); // Has no effect according to TQScintilla docs.
+///-- m_qSciSourceCodeEditor->setModified(true); // Has no effect according to TQScintilla docs.
///-- setWindowModified(true);
///-- }
///--
///-- // Could set cursor this way and use normal linear search in text instead of columns and rows.
-///-- //_qSciSourceCodeEditor->SendScintilla(QsciScintillaBase::SCI_SETCURRENTPOS, 50);
-///-- //_qSciSourceCodeEditor->SendScintilla(QsciScintillaBase::SCI_SETANCHOR, 50);
+///-- //m_qSciSourceCodeEditor->SendScintilla(QsciScintillaBase::SCI_SETCURRENTPOS, 50);
+///-- //m_qSciSourceCodeEditor->SendScintilla(QsciScintillaBase::SCI_SETANCHOR, 50);
///-- }
///--
///-- /*
@@ -863,7 +875,7 @@ bool MainWindow::saveSourceFile()
///-- _indentSettingsChanged = true;
///--
///-- int cursorLine, cursorPos;
-///-- _qSciSourceCodeEditor->getCursorPosition(&cursorLine, &cursorPos);
+///-- m_qSciSourceCodeEditor->getCursorPosition(&cursorLine, &cursorPos);
///--
///-- if (m_toolBarWidget->cbLivePreview->isChecked())
///-- {
@@ -871,16 +883,16 @@ bool MainWindow::saveSourceFile()
///-- _previewToggled = true;
///--
///-- updateSourceView();
-///-- if (_sourceCodeChanged)
+///-- if (m_sourceCodeChanged)
///-- {
-///-- /* savedCursor = _qSciSourceCodeEditor->textCursor();
-///-- if ( cursorPos >= _qSciSourceCodeEditor->text().count() ) {
-///-- cursorPos = _qSciSourceCodeEditor->text().count() - 1;
+///-- /* savedCursor = m_qSciSourceCodeEditor->textCursor();
+///-- if ( cursorPos >= m_qSciSourceCodeEditor->text().count() ) {
+///-- cursorPos = m_qSciSourceCodeEditor->text().count() - 1;
///-- }
///-- savedCursor.setPosition( cursorPos );
-///-- _qSciSourceCodeEditor->setTextCursor( savedCursor );
+///-- m_qSciSourceCodeEditor->setTextCursor( savedCursor );
///-- */
-///-- _sourceCodeChanged = false;
+///-- m_sourceCodeChanged = false;
///-- }
///-- _indentSettingsChanged = false;
///-- }
@@ -889,14 +901,14 @@ bool MainWindow::saveSourceFile()
///-- updateSourceView();
///-- }
///--
-///-- if (_savedSourceContent == _qSciSourceCodeEditor->text())
+///-- if (_savedSourceContent == m_qSciSourceCodeEditor->text())
///-- {
-///-- _qSciSourceCodeEditor->setModified(false);
+///-- m_qSciSourceCodeEditor->setModified(false);
///-- setWindowModified(false);
///-- }
///-- else
///-- {
-///-- _qSciSourceCodeEditor->setModified(true); // Has no effect according to TQScintilla docs.
+///-- m_qSciSourceCodeEditor->setModified(true); // Has no effect according to TQScintilla docs.
///-- setWindowModified(true);
///-- }
///-- }
@@ -912,34 +924,34 @@ void MainWindow::previewTurnedOnOff(bool turnOn)
///-- _previewToggled = true;
///--
///-- int cursorLine, cursorPos;
-///-- _qSciSourceCodeEditor->getCursorPosition(&cursorLine, &cursorPos);
+///-- m_qSciSourceCodeEditor->getCursorPosition(&cursorLine, &cursorPos);
///--
-///-- if (turnOn && (_indentSettingsChanged || _sourceCodeChanged))
+///-- if (turnOn && (_indentSettingsChanged || m_sourceCodeChanged))
///-- {
///-- callIndenter();
///-- }
///-- updateSourceView();
-///-- if (_sourceCodeChanged)
+///-- if (m_sourceCodeChanged)
///-- {
-///-- /* savedCursor = _qSciSourceCodeEditor->textCursor();
-///-- if ( cursorPos >= _qSciSourceCodeEditor->text().count() ) {
-///-- cursorPos = _qSciSourceCodeEditor->text().count() - 1;
+///-- /* savedCursor = m_qSciSourceCodeEditor->textCursor();
+///-- if ( cursorPos >= m_qSciSourceCodeEditor->text().count() ) {
+///-- cursorPos = m_qSciSourceCodeEditor->text().count() - 1;
///-- }
///-- savedCursor.setPosition( cursorPos );
-///-- _qSciSourceCodeEditor->setTextCursor( savedCursor );
+///-- m_qSciSourceCodeEditor->setTextCursor( savedCursor );
///-- */
-///-- _sourceCodeChanged = false;
+///-- m_sourceCodeChanged = false;
///-- }
///-- _indentSettingsChanged = false;
///--
-///-- if (_savedSourceContent == _qSciSourceCodeEditor->text())
+///-- if (_savedSourceContent == m_qSciSourceCodeEditor->text())
///-- {
-///-- _qSciSourceCodeEditor->setModified(false);
+///-- m_qSciSourceCodeEditor->setModified(false);
///-- setWindowModified(false);
///-- }
///-- else
///-- {
-///-- _qSciSourceCodeEditor->setModified(true);
+///-- m_qSciSourceCodeEditor->setModified(true);
///-- setWindowModified(true);
///-- }
///-- }
@@ -974,7 +986,7 @@ void MainWindow::exportToPDF()
///-- QsciPrinter printer(TQPrinter::HighResolution);
///-- printer.setOutputFormat(TQPrinter::PdfFormat);
///-- printer.setOutputFileName(fileName);
-///-- printer.printRange(_qSciSourceCodeEditor);
+///-- printer.printRange(m_qSciSourceCodeEditor);
///-- }
}
@@ -996,7 +1008,7 @@ void MainWindow::exportToHTML()
///-- if (!fileName.isEmpty())
///-- {
///-- // Create a document from which HTML code can be generated.
-///-- TQTextDocument sourceCodeDocument(_qSciSourceCodeEditor->text());
+///-- TQTextDocument sourceCodeDocument(m_qSciSourceCodeEditor->text());
///-- sourceCodeDocument.setDefaultFont(TQFont("Courier", 12, TQFont::Normal));
///-- TQString sourceCodeAsHTML = sourceCodeDocument.toHtml();
///-- // To ensure that empty lines are kept in the HTML code make this replacement.
@@ -1073,14 +1085,14 @@ void MainWindow::exportToHTML()
*/
void MainWindow::saveSettings()
{
-///-- m_settings->setValueByName("encoding", _currentEncoding);
-///-- m_settings->setValueByName("version", PROGRAM_VERSION_STRING);
+ m_settings->setValueByName("VersionInSettingsFile", PROGRAM_VERSION_STRING);
m_settings->setValueByName("WindowIsMaximized", isMaximized());
if (!isMaximized())
{
m_settings->setValueByName("WindowPosition", pos());
m_settings->setValueByName("WindowSize", size());
}
+ m_settings->setValueByName("FileEncoding", m_currentEncoding);
///-- m_settings->setValueByName("MainWindowState", saveState());
///--
///-- // Also save the syntax highlight style for all lexers.
@@ -1216,7 +1228,7 @@ bool MainWindow::maybeSave()
///-- "Reopen the currently opened source code file by using the text encoding scheme ") +
///-- encodingName);
///-- encodingAction->setCheckable(true);
-///-- if (encodingName == _currentEncoding)
+///-- if (encodingName == m_currentEncoding)
///-- {
///-- encodingAction->setChecked(true);
///-- }
@@ -1281,13 +1293,13 @@ bool MainWindow::maybeSave()
///-- TQTextStream inSrcStrm(&inSrcFile);
///-- TQApplication::setOverrideCursor(TQt::WaitCursor);
///-- TQString encodingName = encodingAction->text();
-///-- _currentEncoding = encodingName;
+///-- m_currentEncoding = encodingName;
///-- inSrcStrm.setCodec(TQTextCodec::codecForName(encodingName.toAscii()));
///-- fileContent = inSrcStrm.readAll();
///-- TQApplication::restoreOverrideCursor();
///-- inSrcFile.close();
-///-- _qSciSourceCodeEditor->setText(fileContent);
-///-- _qSciSourceCodeEditor->setModified(false);
+///-- m_qSciSourceCodeEditor->setText(fileContent);
+///-- m_qSciSourceCodeEditor->setModified(false);
///-- }
///-- }
///-- }
@@ -1306,7 +1318,7 @@ bool MainWindow::maybeSave()
///-- foreach(highlighterName, _highlighter->getAvailableHighlighters())
///-- {
///-- highlighterAction = new TQAction(highlighterName, _highlighterActionGroup);
-///-- highlighterAction->setStatusTip(tr("Set the syntax highlightning to ") + highlighterName);
+///-- highlighterAction->setStatusTip(tr("Set the syntax highlighting to ") + highlighterName);
///-- highlighterAction->setCheckable(true);
///-- }
///-- _mainWindowForm->popupMenuHighlighter->addActions(_highlighterActionGroup->actions());
@@ -1316,25 +1328,25 @@ bool MainWindow::maybeSave()
///-- connect(_highlighterActionGroup, SIGNAL(triggered(TQAction*)), _highlighter,
///-- SLOT(setHighlighterByAction(TQAction*)));
///-- }
-///--
-///-- /*
-///-- \brief Is called whenever the white space visibility is being changed in the menu.
-///-- */
-///-- void MainWindow::setWhiteSpaceVisibility(bool visible)
-///-- {
-///-- if (_qSciSourceCodeEditor != NULL)
-///-- {
-///-- if (visible)
-///-- {
-///-- _qSciSourceCodeEditor->setWhitespaceVisibility(QsciScintilla::WsVisible);
-///-- }
-///-- else
-///-- {
-///-- _qSciSourceCodeEditor->setWhitespaceVisibility(QsciScintilla::WsInvisible);
-///-- }
-///-- }
-///-- }
-///--
+
+/*
+ \brief Is called whenever the white space visibility is being changed in the menu.
+ */
+void MainWindow::setWhiteSpaceVisibility(bool visible)
+{
+ if (m_qSciSourceCodeEditor)
+ {
+ if (visible)
+ {
+ m_qSciSourceCodeEditor->setWhitespaceVisibility(TQextScintilla::WsVisible);
+ }
+ else
+ {
+ m_qSciSourceCodeEditor->setWhitespaceVisibility(TQextScintilla::WsInvisible);
+ }
+ }
+}
+
///-- /*
///-- \brief This slot is called whenever the number of lines in the editor changes
///-- and adapts the margin for the displayed line numbers.
@@ -1342,8 +1354,8 @@ bool MainWindow::maybeSave()
///-- void MainWindow::numberOfLinesChanged()
///-- {
///-- TQString lineNumbers;
-///-- lineNumbers.setNum(_qSciSourceCodeEditor->lines() * 10);
-///-- _qSciSourceCodeEditor->setMarginWidth(1, lineNumbers);
+///-- lineNumbers.setNum(m_qSciSourceCodeEditor->lines() * 10);
+///-- m_qSciSourceCodeEditor->setMarginWidth(1, lineNumbers);
///-- }
///--
///-- /*
@@ -1391,13 +1403,13 @@ bool MainWindow::maybeSave()
///-- foreach(TQString highlighterName, _highlighter->getAvailableHighlighters())
///-- {
///-- TQAction *highlighterAction = actionList.at(i);
-///-- highlighterAction->setStatusTip(tr("Set the syntax highlightning to ") + highlighterName);
+///-- highlighterAction->setStatusTip(tr("Set the syntax highlighting to ") + highlighterName);
///-- i++;
///-- }
///--
///-- // Translate the line and column indicators in the statusbar.
///-- int line, column;
-///-- _qSciSourceCodeEditor->getCursorPosition(&line, &column);
+///-- m_qSciSourceCodeEditor->getCursorPosition(&line, &column);
///-- setStatusBarCursorPosInfo(line, column);
///-- }
///-- else