Settings for syntax highlighting, showing whitespaces and loading last open file are now saved and restored across executions

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/3/head
Michele Calgaro 2 years ago
parent 191e11f6dc
commit b4d35ab97d
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -174,7 +174,7 @@
[fix] The editors column showing the line numbers did not adapt its width to the maximum line number. [fix] The editors column showing the line numbers did not adapt its width to the maximum line number.
2007-03-19 Version 0.5.1 Beta 2007-03-19 Version 0.5.1 Beta
[add] Supporting syntax highlightning for the programming language D. [add] Supporting syntax highlighting for the programming language D.
[change] The live typing and indenting feature was not adapted to QScintilla. Now works again (depending on the used indenter). [change] The live typing and indenting feature was not adapted to QScintilla. Now works again (depending on the used indenter).
[fix] Bug ID 1678783 : Files other encoded than ascii were not displayed correctly. Now allways displaying files using UTF-8 encoding. [fix] Bug ID 1678783 : Files other encoded than ascii were not displayed correctly. Now allways displaying files using UTF-8 encoding.
[fix] Bug ID 1678783 : The new syntax highlighter selection menu was not translated. [fix] Bug ID 1678783 : The new syntax highlighter selection menu was not translated.
@ -182,7 +182,7 @@
2007-03-14 Version 0.5.0 Beta 2007-03-14 Version 0.5.0 Beta
[add/change] Using QScintilla as editing component, which is by far more mighty than the before uses QTextEdit. Have a look inside the development area for details. [add/change] Using QScintilla as editing component, which is by far more mighty than the before uses QTextEdit. Have a look inside the development area for details.
[add] Because of QScintilla, added syntax highlightning for bash, batch, cpp, csharp, css, diff, html, idl, java, javascript, lua, makefile, perl, pov, ini, python, ruby, sql and tex. [add] Because of QScintilla, added syntax highlighting for bash, batch, cpp, csharp, css, diff, html, idl, java, javascript, lua, makefile, perl, pov, ini, python, ruby, sql and tex.
[add] Also added code folding for previously mentioned languages. [add] Also added code folding for previously mentioned languages.
[add] Added support for the indenter "phpCB" phpCodeBeatufier. (Thanks to Nelson Tai) The executable is not included in the UiGui release, because I am not sure about the license of phpCB right now. [add] Added support for the indenter "phpCB" phpCodeBeatufier. (Thanks to Nelson Tai) The executable is not included in the UiGui release, because I am not sure about the license of phpCB right now.
[add] The output of an indenter can now be read from stdout, by setting "stdout" for "outputFileParameter". [add] The output of an indenter can now be read from stdout, by setting "stdout" for "outputFileParameter".

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

@ -37,7 +37,7 @@ class ToolBarWidget;
/// class TQActionGroup; /// class TQActionGroup;
/// class TQTranslator; /// class TQTranslator;
/// ///
/// class QsciScintilla; class TQextScintilla;
class MainWindow : public MainWindowBase class MainWindow : public MainWindowBase
@ -60,8 +60,8 @@ class MainWindow : public MainWindowBase
///-- void saveAsOtherEncoding(TQAction *chosenEncodingAction); ///-- void saveAsOtherEncoding(TQAction *chosenEncodingAction);
///-- void callIndenter(); ///-- void callIndenter();
///-- void updateSourceView(); ///-- void updateSourceView();
///-- void turnHighlightOnOff(bool turnOn); void turnHighlightOnOff(bool turnOn);
///-- void setWhiteSpaceVisibility(bool visible); void setWhiteSpaceVisibility(bool visible);
///-- void sourceCodeChangedHelperSlot(); ///-- void sourceCodeChangedHelperSlot();
///-- void sourceCodeChangedSlot(); ///-- void sourceCodeChangedSlot();
///-- void indentSettingsChangedSlot(); ///-- void indentSettingsChangedSlot();
@ -96,10 +96,10 @@ class MainWindow : public MainWindowBase
///-- void dragEnterEvent(TQDragEnterEvent *event); ///-- void dragEnterEvent(TQDragEnterEvent *event);
///-- void dropEvent(TQDropEvent *event); ///-- void dropEvent(TQDropEvent *event);
///-- ///--
///-- QsciScintilla *_qSciSourceCodeEditor; TQextScintilla *m_qSciSourceCodeEditor;
UiGuiSettings *m_settings; UiGuiSettings *m_settings;
///-- ///--
///-- TQString _currentEncoding; TQString m_currentEncoding;
///-- TQString _sourceFileContent; ///-- TQString _sourceFileContent;
///-- TQString _sourceFormattedContent; ///-- TQString _sourceFormattedContent;
///-- TQString _sourceViewContent; ///-- TQString _sourceViewContent;
@ -121,8 +121,7 @@ class MainWindow : public MainWindowBase
///-- TQTranslator *_uiGuiTranslator; ///-- TQTranslator *_uiGuiTranslator;
///-- TQTranslator *_qTTranslator; ///-- TQTranslator *_qTTranslator;
///-- ///--
///-- bool _sourceCodeChanged; bool m_sourceCodeChanged;
///-- bool _scrollPositionChanged;
///-- bool _indentSettingsChanged; ///-- bool _indentSettingsChanged;
///-- bool _previewToggled; ///-- bool _previewToggled;
///-- TQStringList _encodingsList; ///-- TQStringList _encodingsList;

@ -289,7 +289,7 @@
<string>Enables or disables diplaying of white space characters in the editor.</string> <string>Enables or disables diplaying of white space characters in the editor.</string>
</property> </property>
<property name="visible"> <property name="visible">
<bool>false</bool> <bool>true</bool>
</property> </property>
</action> </action>
<action> <action>
@ -340,7 +340,7 @@
<string>If selected opens last source code file on startup.</string> <string>If selected opens last source code file on startup.</string>
</property> </property>
<property name="visible"> <property name="visible">
<bool>false</bool> <bool>true</bool>
</property> </property>
</action> </action>
<action> <action>

@ -58,7 +58,7 @@
<string>Syntax Highlight</string> <string>Syntax Highlight</string>
</property> </property>
<property name="whatsThis" stdset="0"> <property name="whatsThis" stdset="0">
<string>Enables and disables the highlightning of the source</string> <string>Enables and disables the highlighting of the source</string>
</property> </property>
<property name="accel"> <property name="accel">
<string>Ctrl+H</string> <string>Ctrl+H</string>

@ -53,6 +53,11 @@ UiGuiSettings::UiGuiSettings() : TQObject()
m_qsettings->beginGroup("universalindentgui/UniversalIndentGUI"); m_qsettings->beginGroup("universalindentgui/UniversalIndentGUI");
m_indenterDirectoryStr = SettingsPaths::getGlobalFilesPath() + "/indenters"; m_indenterDirectoryStr = SettingsPaths::getGlobalFilesPath() + "/indenters";
m_actionSettings["actionEnableSyntaxHighlighting"] = "SyntaxHighlightingEnabled";
m_actionSettings["actionLoadLastOpenedFileOnStartup"] = "LoadLastOpenedFileOnStartup";
m_actionSettings["actionWhiteSpaceIsVisible"] = "WhiteSpaceIsVisible";
readAvailableTranslations(); readAvailableTranslations();
loadSettings(); loadSettings();
} }
@ -229,8 +234,8 @@ void UiGuiSettings::loadSettings()
m_settings["SelectedIndenter"] = selectedIndenter; m_settings["SelectedIndenter"] = selectedIndenter;
// Read if syntax highlighting is enabled. // Read if syntax highlighting is enabled.
m_settings["SyntaxHighlightningEnabled"] = m_qsettings->readBoolEntry( m_settings["SyntaxHighlightingEnabled"] = m_qsettings->readBoolEntry(
"SyntaxHighlightningEnabled", true); "SyntaxHighlightingEnabled", true);
// Read if white space characters should be displayed. // Read if white space characters should be displayed.
m_settings["WhiteSpaceIsVisible"] = m_qsettings->readBoolEntry("whiteSpaceIsVisible", false); m_settings["WhiteSpaceIsVisible"] = m_qsettings->readBoolEntry("whiteSpaceIsVisible", false);
@ -297,8 +302,8 @@ void UiGuiSettings::saveSettings()
m_qsettings->writeEntry("selectedIndenter", m_settings["SelectedIndenter"].toInt()); m_qsettings->writeEntry("selectedIndenter", m_settings["SelectedIndenter"].toInt());
// Write if syntax highlighting is enabled. // Write if syntax highlighting is enabled.
m_qsettings->writeEntry("SyntaxHighlightningEnabled", m_qsettings->writeEntry("SyntaxHighlightingEnabled",
m_settings["SyntaxHighlightningEnabled"].toBool()); m_settings["SyntaxHighlightingEnabled"].toBool());
// Write if white space characters should be displayed. // Write if white space characters should be displayed.
m_qsettings->writeEntry("whiteSpaceIsVisible", m_settings["WhiteSpaceIsVisible"].toBool()); m_qsettings->writeEntry("whiteSpaceIsVisible", m_settings["WhiteSpaceIsVisible"].toBool());
@ -318,8 +323,44 @@ void UiGuiSettings::saveSettings()
//m_qsettings->writeEntry("MainWindowState", m_settings["MainWindowState"].toByteArray()); //m_qsettings->writeEntry("MainWindowState", m_settings["MainWindowState"].toByteArray());
} }
/*
\brief Extern widgets can connect to this slot to change settings.
According to the objects property "connectedSettingName" the corresponding
setting is known and set.
*/
void UiGuiSettings::handleValueChangeFromExtern(bool value)
{
if (sender())
{
// Get the corresponding setting name from the sender objects property
TQString senderName = TQString(sender()->name());
if (m_actionSettings.contains(senderName))
{
TQString settingName = m_actionSettings[senderName];
// Set the value of the setting to the objects value.
setValueByName(settingName, value);
tqWarning("MIKE set="+settingName);
}
}
}
void UiGuiSettings::emitSignalForSetting(TQString settingName) void UiGuiSettings::emitSignalForSetting(TQString settingName)
{ {
// Emit the signal for the changed value.
if (settingName == "LoadLastOpenedFileOnStartup")
{
emit loadLastOpenedFileOnStartup(m_settings[settingName].toBool());
}
else if (settingName == "SyntaxHighlightingEnabled")
{
emit syntaxHighlightingEnabled(m_settings[settingName].toBool());
}
else if (settingName == "WhiteSpaceIsVisible")
{
emit whiteSpaceIsVisible(m_settings[settingName].toBool());
}
} }
/* /*

@ -74,7 +74,7 @@ class UiGuiSettings : public TQObject
// [--] private slots: // [--] private slots:
// [--] void handleObjectPropertyChange(); // [--] void handleObjectPropertyChange();
// [++] void handleValueChangeFromExtern(int value); // [++] void handleValueChangeFromExtern(int value);
// [++] void handleValueChangeFromExtern(bool value); void handleValueChangeFromExtern(bool value);
// [++] void handleValueChangeFromExtern(TQDate value); // [++] void handleValueChangeFromExtern(TQDate value);
// [++] void handleValueChangeFromExtern(TQByteArray value); // [++] void handleValueChangeFromExtern(TQByteArray value);
@ -87,11 +87,11 @@ class UiGuiSettings : public TQObject
// [++] void windowSize(TQSize value); // [++] void windowSize(TQSize value);
// [++] void fileEncoding(TQString value); // [++] void fileEncoding(TQString value);
// [++] void recentlyOpenedListSize(int value); // [++] void recentlyOpenedListSize(int value);
// [++] void loadLastOpenedFileOnStartup(bool value); void loadLastOpenedFileOnStartup(bool value);
// [++] void lastOpenedFiles(TQString value); // [++] void lastOpenedFiles(TQString value);
// [++] void selectedIndenter(int value); // [++] void selectedIndenter(int value);
// [++] void syntaxHighlightningEnabled(bool value); void syntaxHighlightingEnabled(bool value);
// [++] void whiteSpaceIsVisible(bool value); void whiteSpaceIsVisible(bool value);
// [++] void indenterParameterTooltipsEnabled(bool value); // [++] void indenterParameterTooltipsEnabled(bool value);
// [++] void tabWidth(int value); // [++] void tabWidth(int value);
// [++] void language(int value); // [++] void language(int value);
@ -111,6 +111,9 @@ class UiGuiSettings : public TQObject
// This map holds all possible settings defined by their name as TQString. // This map holds all possible settings defined by their name as TQString.
TQMap<TQString, TQVariant> m_settings; TQMap<TQString, TQVariant> m_settings;
// This map holds the relationship between action widgets and settings entries
TQMap<TQString, TQString> m_actionSettings;
// The path where the indenters are located // The path where the indenters are located
TQString m_indenterDirectoryStr; TQString m_indenterDirectoryStr;
}; };

@ -95,7 +95,7 @@ UiGuiHighlighter::UiGuiHighlighter(QsciScintilla *parent) :
SettingsPaths::getSettingsPath() + "/UiGuiSyntaxHighlightConfig.ini", TQSettings::IniFormat, SettingsPaths::getSettingsPath() + "/UiGuiSyntaxHighlightConfig.ini", TQSettings::IniFormat,
this); this);
_highlightningIsOn = true; _highlightingIsOn = true;
_mapHighlighternameToExtension["Bash"] = TQStringList() << "sh"; _mapHighlighternameToExtension["Bash"] = TQStringList() << "sh";
_mapHighlighternameToExtension["Batch"] = TQStringList() << "bat"; _mapHighlighternameToExtension["Batch"] = TQStringList() << "bat";
@ -187,7 +187,7 @@ void UiGuiHighlighter::setHighlighterByAction(TQAction *highlighterAction)
*/ */
void UiGuiHighlighter::turnHighlightOn() void UiGuiHighlighter::turnHighlightOn()
{ {
_highlightningIsOn = true; _highlightingIsOn = true;
_qsciEditorParent->setLexer(_lexer); _qsciEditorParent->setLexer(_lexer);
readCurrentSettings(""); readCurrentSettings("");
} }
@ -197,7 +197,7 @@ void UiGuiHighlighter::turnHighlightOn()
*/ */
void UiGuiHighlighter::turnHighlightOff() void UiGuiHighlighter::turnHighlightOff()
{ {
_highlightningIsOn = false; _highlightingIsOn = false;
_qsciEditorParent->setLexer(); _qsciEditorParent->setLexer();
_qsciEditorParent->setFont(TQFont("Monospace", 10, TQFont::Normal)); _qsciEditorParent->setFont(TQFont("Monospace", 10, TQFont::Normal));
_qsciEditorParent->setMarginsFont(TQFont("Monospace", 10, TQFont::Normal)); _qsciEditorParent->setMarginsFont(TQFont("Monospace", 10, TQFont::Normal));
@ -583,7 +583,7 @@ int UiGuiHighlighter::setLexerForExtension(TQString extension)
} }
// Set the _lexer for the TQScintilla widget. // Set the _lexer for the TQScintilla widget.
if (_highlightningIsOn) if (_highlightingIsOn)
{ {
_qsciEditorParent->setLexer(_lexer); _qsciEditorParent->setLexer(_lexer);
} }

@ -63,7 +63,7 @@ class UiGuiHighlighter : public TQObject
void setHighlighterByAction(TQAction *highlighterAction); void setHighlighterByAction(TQAction *highlighterAction);
private: private:
bool _highlightningIsOn; bool _highlightingIsOn;
QsciScintilla *_qsciEditorParent; QsciScintilla *_qsciEditorParent;
TQMap<int, TQFont> _fontForStyles; TQMap<int, TQFont> _fontForStyles;
TQMap<int, TQColor> _colorForStyles; TQMap<int, TQColor> _colorForStyles;

Loading…
Cancel
Save