diff options
Diffstat (limited to 'src/MainWindow.cpp')
-rwxr-xr-x | src/MainWindow.cpp | 384 |
1 files changed, 192 insertions, 192 deletions
diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 3c12f81..9c17954 100755 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -33,25 +33,25 @@ #include "IndentHandler.h" #include "UpdateCheckDialog.h" -#include <tqwidget.h> -#include <tqlabel.h> -#include <tqstring.h> -#include <tqscrollbar.h> +#include <tntqwidget.h> +#include <tntqlabel.h> +#include <tntqstring.h> +#include <tntqscrollbar.h> #include <tqtextcursor.h> -#include <tqfiledialog.h> -#include <tqtextstream.h> +#include <tntqfiledialog.h> +#include <tntqtextstream.h> #include <tqtextdocument.h> -#include <tqprinter.h> -#include <tqprintdialog.h> +#include <tntqprinter.h> +#include <tntqprintdialog.h> #include <tqcloseevent.h> #include <tqhelpevent.h> -#include <tqtooltip.h> -#include <tqtranslator.h> -#include <tqlocale.h> -#include <tqtextcodec.h> +#include <tntqtooltip.h> +#include <tntqtranslator.h> +#include <tntqlocale.h> +#include <tntqtextcodec.h> #include <tqdate.h> -#include <tqurl.h> -#include <tqmessagebox.h> +#include <tntqurl.h> +#include <tntqmessagebox.h> #include <tqtdebug.h> #include <Qsci/qsciscintilla.h> @@ -74,7 +74,7 @@ using namespace tschweitzer; /*! \brief Constructs the main window. */ -MainWindow::MainWindow(QString file2OpenOnStart, QWidget *parent) : QMainWindow(parent) +MainWindow::MainWindow(TQString file2OpenOnStart, TQWidget *parent) : TQMainWindow(parent) , _mainWindowForm(NULL) , _qSciSourceCodeEditor(NULL) , _settings(NULL) @@ -109,7 +109,7 @@ MainWindow::MainWindow(QString file2OpenOnStart, QWidget *parent) : QMainWindow( // Create toolbar and insert it into the main window. initToolBar(); - // Create the text edit component using the QScintilla widget. + // Create the text edit component using the TQScintilla widget. initTextEditor(); // Create and init the syntax highlighter. @@ -124,7 +124,7 @@ MainWindow::MainWindow(QString file2OpenOnStart, QWidget *parent) : QMainWindow( // Generate about dialog box - _aboutDialog = new AboutDialog(this, Qt::SplashScreen); + _aboutDialog = new AboutDialog(this, TQt::SplashScreen); _aboutDialogGraphicsView = new AboutDialogGraphicsView(_aboutDialog, this); connect( _toolBarWidget->pbAbout, SIGNAL(clicked()), this, SLOT(showAboutDialog()) ); connect( _mainWindowForm->actionAbout_UniversalIndentGUI, SIGNAL(triggered()), this, SLOT(showAboutDialog()) ); @@ -134,7 +134,7 @@ MainWindow::MainWindow(QString file2OpenOnStart, QWidget *parent) : QMainWindow( connect( _mainWindowForm->actionShowSettings, SIGNAL(triggered()), _settingsDialog, SLOT(showDialog()) ); // If a file that should be opened on start has been handed over to the constructor exists, load it - if ( QFile::exists(file2OpenOnStart) ) { + if ( TQFile::exists(file2OpenOnStart) ) { openSourceFileDialog(file2OpenOnStart); } // Otherwise load the last opened file, if this is enabled in the settings. @@ -145,7 +145,7 @@ MainWindow::MainWindow(QString file2OpenOnStart, QWidget *parent) : QMainWindow( updateSourceView(); // Check if a newer version is available but only if the setting for that is enabled and today not already a check has been done. - if ( _settings->getValueByName("CheckForUpdate").toBool() && QDate::currentDate() != _settings->getValueByName("LastUpdateCheck").toDate() ) { + if ( _settings->getValueByName("CheckForUpdate").toBool() && TQDate::currentDate() != _settings->getValueByName("LastUpdateCheck").toDate() ) { _updateCheckDialog->checkForUpdate(); } @@ -165,8 +165,8 @@ void MainWindow::initMainWindow() { // Handle last opened window size // ------------------------------ bool maximized = _settings->getValueByName("maximized").toBool(); - QPoint pos = _settings->getValueByName("position").toPoint(); - QSize size = _settings->getValueByName("size").toSize(); + TQPoint pos = _settings->getValueByName("position").toPoint(); + TQSize size = _settings->getValueByName("size").toSize(); resize(size); move(pos); if ( maximized ) { @@ -178,7 +178,7 @@ void MainWindow::initMainWindow() { // Handle if first run of this version // ----------------------------------- - QString readVersion = _settings->getValueByName("version").toString(); + TQString readVersion = _settings->getValueByName("version").toString(); // If version strings are not equal set first run true. if ( readVersion != PROGRAM_VERSION_STRING ) { _isFirstRunOfThisVersion = true; @@ -196,7 +196,7 @@ void MainWindow::initMainWindow() { // Register the load last file setting in the menu to the _settings object. _settings->registerObjectProperty(_mainWindowForm->loadLastOpenedFileOnStartupAction, "checked", "loadLastSourceCodeFileOnStartup"); - // Tell the QScintilla editor if it has to show white space. + // Tell the TQScintilla editor if it has to show white space. connect( _mainWindowForm->whiteSpaceIsVisibleAction, SIGNAL(toggled(bool)), this, SLOT(setWhiteSpaceVisibility(bool)) ); // Register the white space setting in the menu to the _settings object. _settings->registerObjectProperty(_mainWindowForm->whiteSpaceIsVisibleAction, "checked", "whiteSpaceIsVisible"); @@ -212,7 +212,7 @@ void MainWindow::initMainWindow() { // Init the menu for selecting one of the recently opened files. updateRecentlyOpenedList(); - connect( _mainWindowForm->menuRecently_Opened_Files, SIGNAL(triggered(QAction*)), this, SLOT(openFileFromRecentlyOpenedList(QAction*)) ); + connect( _mainWindowForm->menuRecently_Opened_Files, SIGNAL(triggered(TQAction*)), this, SLOT(openFileFromRecentlyOpenedList(TQAction*)) ); //connect( _settings, SIGNAL(recentlyOpenedListSize(int)), this, SLOT(updateRecentlyOpenedList()) ); _settings->registerObjectSlot(this, "updateRecentlyOpenedList()", "recentlyOpenedListSize"); } @@ -224,10 +224,10 @@ void MainWindow::initMainWindow() { void MainWindow::initToolBar() { // Create the tool bar and add it to the main window. _toolBarWidget = new Ui::ToolBarWidget(); - QWidget* helpWidget = new QWidget(); + TQWidget* helpWidget = new TQWidget(); _toolBarWidget->setupUi(helpWidget); _mainWindowForm->toolBar->addWidget(helpWidget); - _mainWindowForm->toolBar->setAllowedAreas( Qt::TopToolBarArea | Qt::BottomToolBarArea ); + _mainWindowForm->toolBar->setAllowedAreas( TQt::TopToolBarArea | TQt::BottomToolBarArea ); // Connect the tool bar widgets to their functions. _settings->registerObjectProperty(_toolBarWidget->enableSyntaxHighlightningCheckBox, "checked", "SyntaxHighlightingEnabled"); @@ -241,29 +241,29 @@ void MainWindow::initToolBar() { /*! - \brief Create and initialize the text editor component. It uses the QScintilla widget. + \brief Create and initialize the text editor component. It uses the TQScintilla widget. */ void MainWindow::initTextEditor() { - // Create the QScintilla widget and add it to the layout. - qDebug() << "Trying to load QScintilla library. If anything fails during loading, it might be possible that" - << " the debug and release version of QScintilla are mixed or the library cannot be found at all."; - // Try and catch doesn't seem to catch the runtime error when starting UiGUI release with QScintilla debug lib and the other way around. + // Create the TQScintilla widget and add it to the layout. + tqDebug() << "Trying to load TQScintilla library. If anything fails during loading, it might be possible that" + << " the debug and release version of TQScintilla are mixed or the library cannot be found at all."; + // Try and catch doesn't seem to catch the runtime error when starting UiGUI release with TQScintilla debug lib and the other way around. try { _qSciSourceCodeEditor = new QsciScintilla(this); } catch (...) { - QMessageBox::critical(this, "Error creating QScintilla text editor component!", - "During trying to create the text editor component, that is based on QScintilla, an error occurred. Please make sure that you have installed QScintilla and not mixed release and debug versions." ); + TQMessageBox::critical(this, "Error creating TQScintilla text editor component!", + "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); - // Make some _settings for the QScintilla widget. + // Make some _settings for the TQScintilla widget. _qSciSourceCodeEditor->setUtf8(true); _qSciSourceCodeEditor->setMarginLineNumbers(1, true); - _qSciSourceCodeEditor->setMarginWidth(1, QString("10000") ); + _qSciSourceCodeEditor->setMarginWidth(1, TQString("10000") ); _qSciSourceCodeEditor->setBraceMatching(_qSciSourceCodeEditor->SloppyBraceMatch); - _qSciSourceCodeEditor->setMatchedBraceForegroundColor( QColor("red") ); + _qSciSourceCodeEditor->setMatchedBraceForegroundColor( TQColor("red") ); _qSciSourceCodeEditor->setFolding(QsciScintilla::BoxedTreeFoldStyle); _qSciSourceCodeEditor->setAutoCompletionSource(QsciScintilla::AcsAll); _qSciSourceCodeEditor->setAutoCompletionThreshold(3); @@ -276,12 +276,12 @@ void MainWindow::initTextEditor() { int tabWidth = _settings->getValueByName("tabWidth").toInt(); _qSciSourceCodeEditor->setTabWidth(tabWidth); - // Remember a pointer to the scrollbar of the QScintilla 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. _textEditVScrollBar = _qSciSourceCodeEditor->verticalScrollBar(); // Add a column row indicator to the status bar. - _textEditLineColumnInfoLabel = new QLabel( 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); connect( _qSciSourceCodeEditor, SIGNAL(cursorPositionChanged(int, int)), this, SLOT(setStatusBarCursorPosInfo(int, int)) ); @@ -295,7 +295,7 @@ void MainWindow::initTextEditor() { /*! - \brief Create and init the syntax _highlighter and set it to use the QScintilla edit component. + \brief Create and init the syntax _highlighter and set it to use the TQScintilla edit component. */ void MainWindow::initSyntaxHighlighter() { // Create the _highlighter. @@ -319,14 +319,14 @@ void MainWindow::initSyntaxHighlighter() { false and uses the default language, which is English. */ bool MainWindow::initApplicationLanguage() { - QString languageShort; + TQString languageShort; // Get the language _settings from the _settings object. int languageIndex = _settings->getValueByName("language").toInt(); // If no language was set, indicated by a negative index, use the system language. if ( languageIndex < 0 ) { - languageShort = QLocale::system().name(); + languageShort = TQLocale::system().name(); // Chinese and Japanese language consist of country and language code. // For all others the language code will be cut off. @@ -347,19 +347,19 @@ bool MainWindow::initApplicationLanguage() { languageShort = _settings->getAvailableTranslations().at(languageIndex); } - // Load the Qt own translation file and set it for the application. - _qTTranslator = new QTranslator(); + // Load the TQt own translation file and set it for the application. + _qTTranslator = new TQTranslator(); bool translationFileLoaded; translationFileLoaded = _qTTranslator->load( SettingsPaths::getGlobalFilesPath() + "/translations/qt_" + languageShort ); if ( translationFileLoaded ) { - qApp->installTranslator(_qTTranslator); + tqApp->installTranslator(_qTTranslator); } // Load the uigui translation file and set it for the application. - _uiGuiTranslator = new QTranslator(); + _uiGuiTranslator = new TQTranslator(); translationFileLoaded = _uiGuiTranslator->load( SettingsPaths::getGlobalFilesPath() + "/translations/universalindent_" + languageShort ); if ( translationFileLoaded ) { - qApp->installTranslator(_uiGuiTranslator); + tqApp->installTranslator(_uiGuiTranslator); } //connect( _settings, SIGNAL(language(int)), this, SLOT(languageChanged(int)) ); @@ -396,26 +396,26 @@ void MainWindow::initIndenter() { /*! - \brief Tries to load the by \a filePath defined file and returns its content as QString. + \brief Tries to load the by \a filePath defined file and returns its content as TQString. If the file could not be loaded a error dialog will be shown. */ -QString MainWindow::loadFile(QString filePath) { - QFile inSrcFile(filePath); - QString fileContent = ""; +TQString MainWindow::loadFile(TQString filePath) { + TQFile inSrcFile(filePath); + TQString fileContent = ""; - if ( !inSrcFile.open(QFile::ReadOnly | QFile::Text) ) { - QMessageBox::warning(NULL, tr("Error opening file"), tr("Cannot read the file ")+"\""+filePath+"\"." ); + if ( !inSrcFile.open(TQFile::ReadOnly | TQFile::Text) ) { + TQMessageBox::warning(NULL, tr("Error opening file"), tr("Cannot read the file ")+"\""+filePath+"\"." ); } else { - QTextStream inSrcStrm(&inSrcFile); - QApplication::setOverrideCursor(Qt::WaitCursor); - inSrcStrm.setCodec( QTextCodec::codecForName(_currentEncoding.toAscii()) ); + TQTextStream inSrcStrm(&inSrcFile); + TQApplication::setOverrideCursor(TQt::WaitCursor); + inSrcStrm.setCodec( TQTextCodec::codecForName(_currentEncoding.toAscii()) ); fileContent = inSrcStrm.readAll(); - QApplication::restoreOverrideCursor(); + TQApplication::restoreOverrideCursor(); inSrcFile.close(); - QFileInfo fileInfo(filePath); + TQFileInfo fileInfo(filePath); _currentSourceFileExtension = fileInfo.suffix(); int indexOfHighlighter = _highlighter->setLexerForExtension( _currentSourceFileExtension ); _highlighterActionGroup->actions().at(indexOfHighlighter)->setChecked(true); @@ -429,24 +429,24 @@ QString MainWindow::loadFile(QString filePath) { If the file was successfully loaded the indenter will be called to generate the formatted source code. */ -void MainWindow::openSourceFileDialog(QString fileName) { +void MainWindow::openSourceFileDialog(TQString fileName) { // If the source code file is changed and the shown dialog for saving the file // is canceled, also stop opening another source file. if ( !maybeSave() ) { return; } - QString openedSourceFileContent = ""; - QString fileExtensions = tr("Supported by indenter")+" ("+_indentHandler->getPossibleIndenterFileExtensions()+ + TQString openedSourceFileContent = ""; + TQString fileExtensions = tr("Supported by indenter")+" ("+_indentHandler->getPossibleIndenterFileExtensions()+ ");;"+tr("All files")+" (*.*)"; - //QString openedSourceFileContent = openFileDialog( tr("Choose source code file"), "./", fileExtensions ); + //TQString openedSourceFileContent = openFileDialog( tr("Choose source code file"), "./", fileExtensions ); if ( fileName.isEmpty() ) { - fileName = QFileDialog::getOpenFileName( this, tr("Choose source code file"), _currentSourceFile, fileExtensions); + fileName = TQFileDialog::getOpenFileName( this, tr("Choose source code file"), _currentSourceFile, fileExtensions); } if (fileName != "") { _currentSourceFile = fileName; - QFileInfo fileInfo(fileName); + TQFileInfo fileInfo(fileName); _currentSourceFileExtension = fileInfo.suffix(); openedSourceFileContent = loadFile(fileName); @@ -474,13 +474,13 @@ void MainWindow::openSourceFileDialog(QString fileName) { If the file already exists and it should be overwritten, a warning is shown before. */ -bool MainWindow::saveasSourceFileDialog(QAction *chosenEncodingAction) { - QString encoding; - QString fileExtensions = tr("Supported by indenter")+" ("+_indentHandler->getPossibleIndenterFileExtensions()+ +bool MainWindow::saveasSourceFileDialog(TQAction *chosenEncodingAction) { + TQString encoding; + TQString fileExtensions = tr("Supported by indenter")+" ("+_indentHandler->getPossibleIndenterFileExtensions()+ ");;"+tr("All files")+" (*.*)"; - //QString openedSourceFileContent = openFileDialog( tr("Choose source code file"), "./", fileExtensions ); - QString fileName = QFileDialog::getSaveFileName( this, tr("Save source code file"), _currentSourceFile, fileExtensions); + //TQString openedSourceFileContent = openFileDialog( tr("Choose source code file"), "./", fileExtensions ); + TQString fileName = TQFileDialog::getSaveFileName( this, tr("Save source code file"), _currentSourceFile, fileExtensions); // Saving has been canceled if the filename is empty if ( fileName.isEmpty() ) { @@ -490,9 +490,9 @@ bool MainWindow::saveasSourceFileDialog(QAction *chosenEncodingAction) { _savedSourceContent = _qSciSourceCodeEditor->text(); _currentSourceFile = fileName; - QFile::remove(fileName); - QFile outSrcFile(fileName); - outSrcFile.open( QFile::ReadWrite | QFile::Text ); + TQFile::remove(fileName); + TQFile outSrcFile(fileName); + outSrcFile.open( TQFile::ReadWrite | TQFile::Text ); // Get current encoding. if ( chosenEncodingAction != NULL ) { @@ -501,12 +501,12 @@ bool MainWindow::saveasSourceFileDialog(QAction *chosenEncodingAction) { else { encoding = _encodingActionGroup->checkedAction()->text(); } - QTextStream outSrcStrm(&outSrcFile); - outSrcStrm.setCodec( QTextCodec::codecForName(encoding.toAscii()) ); + TQTextStream outSrcStrm(&outSrcFile); + outSrcStrm.setCodec( TQTextCodec::codecForName(encoding.toAscii()) ); outSrcStrm << _savedSourceContent; outSrcFile.close(); - QFileInfo fileInfo(fileName); + TQFileInfo fileInfo(fileName); _currentSourceFileExtension = fileInfo.suffix(); _qSciSourceCodeEditor->setModified( false ); @@ -528,15 +528,15 @@ bool MainWindow::saveSourceFile() { return saveasSourceFileDialog(); } else { - QFile::remove(_currentSourceFile); - QFile outSrcFile(_currentSourceFile); + TQFile::remove(_currentSourceFile); + TQFile outSrcFile(_currentSourceFile); _savedSourceContent = _qSciSourceCodeEditor->text(); - outSrcFile.open( QFile::ReadWrite | QFile::Text ); + outSrcFile.open( TQFile::ReadWrite | TQFile::Text ); // Get current encoding. - QString _currentEncoding = _encodingActionGroup->checkedAction()->text(); - QTextStream outSrcStrm(&outSrcFile); - outSrcStrm.setCodec( QTextCodec::codecForName(_currentEncoding.toAscii()) ); + TQString _currentEncoding = _encodingActionGroup->checkedAction()->text(); + TQTextStream outSrcStrm(&outSrcFile); + outSrcStrm.setCodec( TQTextCodec::codecForName(_currentEncoding.toAscii()) ); outSrcStrm << _savedSourceContent; outSrcFile.close(); @@ -551,12 +551,12 @@ bool MainWindow::saveSourceFile() { \brief Shows a file open dialog. Shows a file open dialog with the title \a dialogHeaderStr starting in the directory \a startPath - and with a file mask defined by \a fileMaskStr. Returns the contents of the file as QString. + and with a file mask defined by \a fileMaskStr. Returns the contents of the file as TQString. */ -QString MainWindow::openFileDialog(QString dialogHeaderStr, QString startPath, QString fileMaskStr) { - QString fileContent = ""; +TQString MainWindow::openFileDialog(TQString dialogHeaderStr, TQString startPath, TQString fileMaskStr) { + TQString fileContent = ""; - QString fileName = QFileDialog::getOpenFileName( NULL, dialogHeaderStr, startPath, fileMaskStr); + TQString fileName = TQFileDialog::getOpenFileName( NULL, dialogHeaderStr, startPath, fileMaskStr); if (fileName != "") { fileContent = loadFile(fileName); @@ -602,10 +602,10 @@ void MainWindow::updateSourceView() { The original loaded source code file will not be changed. */ void MainWindow::callIndenter() { - QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); + TQApplication::setOverrideCursor(TQCursor(TQt::WaitCursor)); _sourceFormattedContent = _indentHandler->callIndenter(_sourceFileContent, _currentSourceFileExtension); //updateSourceView(); - QApplication::restoreOverrideCursor(); + TQApplication::restoreOverrideCursor(); } @@ -628,7 +628,7 @@ void MainWindow::turnHighlightOnOff(bool turnOn) { \brief Added this slot to avoid multiple calls because of changed text. */ void MainWindow::sourceCodeChangedHelperSlot() { - QTimer::singleShot(0, this, SLOT(sourceCodeChangedSlot())); + TQTimer::singleShot(0, this, SLOT(sourceCodeChangedSlot())); } @@ -637,9 +637,9 @@ void MainWindow::sourceCodeChangedHelperSlot() { to format the changed source code. */ void MainWindow::sourceCodeChangedSlot() { - QChar enteredCharacter; + TQChar enteredCharacter; int cursorPos, cursorPosAbsolut, cursorLine; - QString text; + TQString text; _sourceCodeChanged = true; if ( _scrollPositionChanged ) { @@ -750,7 +750,7 @@ void MainWindow::sourceCodeChangedSlot() { setWindowModified( false ); } else { - _qSciSourceCodeEditor->setModified( true ); // Has no effect according to QScintilla docs. + _qSciSourceCodeEditor->setModified( true ); // Has no effect according to TQScintilla docs. setWindowModified( true ); } @@ -798,7 +798,7 @@ void MainWindow::indentSettingsChangedSlot() { setWindowModified( false ); } else { - _qSciSourceCodeEditor->setModified( true ); // Has no effect according to QScintilla docs. + _qSciSourceCodeEditor->setModified( true ); // Has no effect according to TQScintilla docs. setWindowModified( true ); } } @@ -848,7 +848,7 @@ void MainWindow::previewTurnedOnOff(bool turnOn) { source code filename. */ void MainWindow::updateWindowTitle() { - this->setWindowTitle( "UniversalIndentGUI " + QString(PROGRAM_VERSION_STRING) + " [*]" + _currentSourceFile ); + this->setWindowTitle( "UniversalIndentGUI " + TQString(PROGRAM_VERSION_STRING) + " [*]" + _currentSourceFile ); } @@ -856,18 +856,18 @@ void MainWindow::updateWindowTitle() { \brief Opens a dialog to save the current source code as a PDF document. */ void MainWindow::exportToPDF() { - QString fileExtensions = tr("PDF Document")+" (*.pdf)"; + TQString fileExtensions = tr("PDF Document")+" (*.pdf)"; - QString fileName = _currentSourceFile; - QFileInfo fileInfo(fileName); - QString fileExtension = fileInfo.suffix(); + TQString fileName = _currentSourceFile; + TQFileInfo fileInfo(fileName); + TQString fileExtension = fileInfo.suffix(); fileName.replace( fileName.length()-fileExtension.length(), fileExtension.length(), "pdf" ); - fileName = QFileDialog::getSaveFileName( this, tr("Export source code file"), fileName, fileExtensions); + fileName = TQFileDialog::getSaveFileName( this, tr("Export source code file"), fileName, fileExtensions); if ( !fileName.isEmpty() ) { - QsciPrinter printer(QPrinter::HighResolution); - printer.setOutputFormat(QPrinter::PdfFormat); + QsciPrinter printer(TQPrinter::HighResolution); + printer.setOutputFormat(TQPrinter::PdfFormat); printer.setOutputFileName(fileName); printer.printRange(_qSciSourceCodeEditor); } @@ -878,27 +878,27 @@ void MainWindow::exportToPDF() { \brief Opens a dialog to save the current source code as a HTML document. */ void MainWindow::exportToHTML() { - QString fileExtensions = tr("HTML Document")+" (*.html)"; + TQString fileExtensions = tr("HTML Document")+" (*.html)"; - QString fileName = _currentSourceFile; - QFileInfo fileInfo(fileName); - QString fileExtension = fileInfo.suffix(); + TQString fileName = _currentSourceFile; + TQFileInfo fileInfo(fileName); + TQString fileExtension = fileInfo.suffix(); fileName.replace( fileName.length()-fileExtension.length(), fileExtension.length(), "html" ); - fileName = QFileDialog::getSaveFileName( this, tr("Export source code file"), fileName, fileExtensions); + fileName = TQFileDialog::getSaveFileName( this, tr("Export source code file"), fileName, fileExtensions); if ( !fileName.isEmpty() ) { // Create a document from which HTML code can be generated. - QTextDocument sourceCodeDocument( _qSciSourceCodeEditor->text() ); - sourceCodeDocument.setDefaultFont( QFont("Courier", 12, QFont::Normal) ); - QString sourceCodeAsHTML = sourceCodeDocument.toHtml(); + TQTextDocument sourceCodeDocument( _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. sourceCodeAsHTML.replace("\"></p>", "\"><br /></p>"); // Write the HTML file. - QFile::remove(fileName); - QFile outSrcFile(fileName); - outSrcFile.open( QFile::ReadWrite | QFile::Text ); + TQFile::remove(fileName); + TQFile outSrcFile(fileName); + outSrcFile.open( TQFile::ReadWrite | TQFile::Text ); outSrcFile.write( sourceCodeAsHTML.toAscii() ); outSrcFile.close(); } @@ -922,14 +922,14 @@ void MainWindow::loadLastOpenedFile() { _currentSourceFile = _settings->getValueByName("lastSourceCodeFile").toString().split("|").first(); // If source file exist load it. - if ( QFile::exists(_currentSourceFile) ) { - QFileInfo fileInfo(_currentSourceFile); + if ( TQFile::exists(_currentSourceFile) ) { + TQFileInfo fileInfo(_currentSourceFile); _currentSourceFile = fileInfo.absoluteFilePath(); _sourceFileContent = loadFile(_currentSourceFile); } // If the last opened source code file does not exist, try to load the default example.cpp file. - else if ( QFile::exists( SettingsPaths::getIndenterPath() + "/example.cpp" ) ) { - QFileInfo fileInfo( SettingsPaths::getIndenterPath() + "/example.cpp" ); + else if ( TQFile::exists( SettingsPaths::getIndenterPath() + "/example.cpp" ) ) { + TQFileInfo fileInfo( SettingsPaths::getIndenterPath() + "/example.cpp" ); _currentSourceFile = fileInfo.absoluteFilePath(); _sourceFileContent = loadFile(_currentSourceFile); } @@ -976,7 +976,7 @@ void MainWindow::saveSettings() { /*! \brief Is always called when the program is quit. Calls the saveSettings function before really quits. */ -void MainWindow::closeEvent( QCloseEvent *event ) { +void MainWindow::closeEvent( TQCloseEvent *event ) { if ( maybeSave() ) { saveSettings(); event->accept(); @@ -994,19 +994,19 @@ void MainWindow::closeEvent( QCloseEvent *event ) { for indenter parameters are connected with this event filter. So depending on the _settings the tooltips can be enabled and disabled for these widgets. */ -bool MainWindow::eventFilter(QObject *obj, QEvent *event) { - if ( event->type() == QEvent::ToolTip) { +bool MainWindow::eventFilter(TQObject *obj, TQEvent *event) { + if ( event->type() == TQEvent::ToolTip) { if ( _mainWindowForm->indenterParameterTooltipsEnabledAction->isChecked() ) { - return QMainWindow::eventFilter(obj, event); + return TQMainWindow::eventFilter(obj, event); } else { - //QToolTip::showText( QPoint(100,100) , "Test1"); + //TQToolTip::showText( TQPoint(100,100) , "Test1"); return true; } } else { // pass the event on to the parent class - return QMainWindow::eventFilter(obj, event); + return TQMainWindow::eventFilter(obj, event); } } @@ -1016,15 +1016,15 @@ bool MainWindow::eventFilter(QObject *obj, QEvent *event) { */ bool MainWindow::maybeSave() { if ( isWindowModified() ) { - int ret = QMessageBox::warning(this, tr("Modified code"), + int ret = TQMessageBox::warning(this, tr("Modified code"), tr("The source code has been modified.\nDo you want to save your changes?"), - QMessageBox::Yes | QMessageBox::Default, - QMessageBox::No, - QMessageBox::Cancel | QMessageBox::Escape); - if (ret == QMessageBox::Yes) { + TQMessageBox::Yes | TQMessageBox::Default, + TQMessageBox::No, + TQMessageBox::Cancel | TQMessageBox::Escape); + if (ret == TQMessageBox::Yes) { return saveSourceFile(); } - else if (ret == QMessageBox::Cancel) { + else if (ret == TQMessageBox::Cancel) { return false; } } @@ -1039,25 +1039,25 @@ bool MainWindow::maybeSave() { void MainWindow::languageChanged(int languageIndex) { if ( languageIndex < _settings->getAvailableTranslations().size() ) { // Get the mnemonic of the new selected language. - QString languageShort = _settings->getAvailableTranslations().at(languageIndex); + TQString languageShort = _settings->getAvailableTranslations().at(languageIndex); // Remove the old qt translation. - qApp->removeTranslator( _qTTranslator ); + tqApp->removeTranslator( _qTTranslator ); // Remove the old uigui translation. - qApp->removeTranslator( _uiGuiTranslator ); + tqApp->removeTranslator( _uiGuiTranslator ); - // Load the Qt own translation file and set it for the application. + // Load the TQt own translation file and set it for the application. bool translationFileLoaded; translationFileLoaded = _qTTranslator->load( SettingsPaths::getGlobalFilesPath() + "/translations/qt_" + languageShort ); if ( translationFileLoaded ) { - qApp->installTranslator(_qTTranslator); + tqApp->installTranslator(_qTTranslator); } // Load the uigui translation file and set it for the application. translationFileLoaded = _uiGuiTranslator->load( SettingsPaths::getGlobalFilesPath() + "/translations/universalindent_" + languageShort ); if ( translationFileLoaded ) { - qApp->installTranslator(_uiGuiTranslator); + tqApp->installTranslator(_uiGuiTranslator); } } } @@ -1067,22 +1067,22 @@ void MainWindow::languageChanged(int languageIndex) { \brief Creates a menu entries in the file menu for opening and saving a file with different encodings. */ void MainWindow::createEncodingMenu() { - QAction *encodingAction; - QString encodingName; + TQAction *encodingAction; + TQString encodingName; - _encodingsList = QStringList() << "UTF-8" << "UTF-16" << "UTF-16BE" << "UTF-16LE" + _encodingsList = TQStringList() << "UTF-8" << "UTF-16" << "UTF-16BE" << "UTF-16LE" << "Apple Roman" << "Big5" << "Big5-HKSCS" << "EUC-JP" << "EUC-KR" << "GB18030-0" << "IBM 850" << "IBM 866" << "IBM 874" << "ISO 2022-JP" << "ISO 8859-1" << "ISO 8859-13" << "Iscii-Bng" << "JIS X 0201" << "JIS X 0208" << "KOI8-R" << "KOI8-U" << "MuleLao-1" << "ROMAN8" << "Shift-JIS" << "TIS-620" << "TSCII" << "Windows-1250" << "WINSAMI2"; - _encodingActionGroup = new QActionGroup(this); - _saveEncodedActionGroup = new QActionGroup(this); + _encodingActionGroup = new TQActionGroup(this); + _saveEncodedActionGroup = new TQActionGroup(this); // Loop for each available encoding foreach ( encodingName, _encodingsList ) { // Create actions for the "reopen" menu - encodingAction = new QAction(encodingName, _encodingActionGroup); + encodingAction = new TQAction(encodingName, _encodingActionGroup); encodingAction->setStatusTip( tr("Reopen the currently opened source code file by using the text encoding scheme ") + encodingName ); encodingAction->setCheckable(true); if ( encodingName == _currentEncoding ) { @@ -1090,15 +1090,15 @@ void MainWindow::createEncodingMenu() { } // Create actions for the "save as encoded" menu - encodingAction = new QAction(encodingName, _saveEncodedActionGroup); + encodingAction = new TQAction(encodingName, _saveEncodedActionGroup); encodingAction->setStatusTip( tr("Save the currently opened source code file by using the text encoding scheme ") + encodingName ); } _mainWindowForm->encodingMenu->addActions( _encodingActionGroup->actions() ); - connect( _encodingActionGroup, SIGNAL(triggered(QAction*)), this, SLOT(encodingChanged(QAction*)) ); + connect( _encodingActionGroup, SIGNAL(triggered(TQAction*)), this, SLOT(encodingChanged(TQAction*)) ); _mainWindowForm->saveEncodedMenu->addActions( _saveEncodedActionGroup->actions() ); - connect( _saveEncodedActionGroup, SIGNAL(triggered(QAction*)), this, SLOT(saveAsOtherEncoding(QAction*)) ); + connect( _saveEncodedActionGroup, SIGNAL(triggered(TQAction*)), this, SLOT(saveAsOtherEncoding(TQAction*)) ); } @@ -1108,12 +1108,12 @@ void MainWindow::createEncodingMenu() { If the saving is successful and not aborted, the currently used encoding, visible in the "reopen" menu, is also changed to the new encoding. */ -void MainWindow::saveAsOtherEncoding(QAction *chosenEncodingAction) { +void MainWindow::saveAsOtherEncoding(TQAction *chosenEncodingAction) { bool fileWasSaved = saveasSourceFileDialog(chosenEncodingAction); // If the file was save with another encoding, change the selected encoding in the reopen menu. if ( fileWasSaved ) { - foreach ( QAction *action, _encodingActionGroup->actions() ) { + foreach ( TQAction *action, _encodingActionGroup->actions() ) { if ( action->text() == chosenEncodingAction->text() ) { action->setChecked(true); return; @@ -1126,22 +1126,22 @@ void MainWindow::saveAsOtherEncoding(QAction *chosenEncodingAction) { /*! \brief This slot is called whenever an encoding is selected in the settings menu. */ -void MainWindow::encodingChanged(QAction* encodingAction) { +void MainWindow::encodingChanged(TQAction* encodingAction) { if ( maybeSave() ) { - QFile inSrcFile(_currentSourceFile); - QString fileContent = ""; + TQFile inSrcFile(_currentSourceFile); + TQString fileContent = ""; - if ( !inSrcFile.open(QFile::ReadOnly | QFile::Text) ) { - QMessageBox::warning(NULL, tr("Error opening file"), tr("Cannot read the file ")+"\""+_currentSourceFile+"\"." ); + if ( !inSrcFile.open(TQFile::ReadOnly | TQFile::Text) ) { + TQMessageBox::warning(NULL, tr("Error opening file"), tr("Cannot read the file ")+"\""+_currentSourceFile+"\"." ); } else { - QTextStream inSrcStrm(&inSrcFile); - QApplication::setOverrideCursor(Qt::WaitCursor); - QString encodingName = encodingAction->text(); + TQTextStream inSrcStrm(&inSrcFile); + TQApplication::setOverrideCursor(TQt::WaitCursor); + TQString encodingName = encodingAction->text(); _currentEncoding = encodingName; - inSrcStrm.setCodec( QTextCodec::codecForName(encodingName.toAscii()) ); + inSrcStrm.setCodec( TQTextCodec::codecForName(encodingName.toAscii()) ); fileContent = inSrcStrm.readAll(); - QApplication::restoreOverrideCursor(); + TQApplication::restoreOverrideCursor(); inSrcFile.close(); _qSciSourceCodeEditor->setText( fileContent ); _qSciSourceCodeEditor->setModified(false); @@ -1154,21 +1154,21 @@ void MainWindow::encodingChanged(QAction* encodingAction) { \brief Creates a menu entry under the settings menu for all available text encodings. */ void MainWindow::createHighlighterMenu() { - QAction *highlighterAction; - QString highlighterName; + TQAction *highlighterAction; + TQString highlighterName; - _highlighterActionGroup = new QActionGroup(this); + _highlighterActionGroup = new TQActionGroup(this); // Loop for each known highlighter foreach ( highlighterName, _highlighter->getAvailableHighlighters() ) { - highlighterAction = new QAction(highlighterName, _highlighterActionGroup); + highlighterAction = new TQAction(highlighterName, _highlighterActionGroup); highlighterAction->setStatusTip( tr("Set the syntax highlightning to ") + highlighterName ); highlighterAction->setCheckable(true); } _mainWindowForm->highlighterMenu->addActions( _highlighterActionGroup->actions() ); _mainWindowForm->menuSettings->insertMenu(_mainWindowForm->indenterParameterTooltipsEnabledAction, _mainWindowForm->highlighterMenu ); - connect( _highlighterActionGroup, SIGNAL(triggered(QAction*)), _highlighter, SLOT(setHighlighterByAction(QAction*)) ); + connect( _highlighterActionGroup, SIGNAL(triggered(TQAction*)), _highlighter, SLOT(setHighlighterByAction(TQAction*)) ); } @@ -1191,7 +1191,7 @@ void MainWindow::setWhiteSpaceVisibility(bool visible) { and adapts the margin for the displayed line numbers. */ void MainWindow::numberOfLinesChanged() { - QString lineNumbers; + TQString lineNumbers; lineNumbers.setNum( _qSciSourceCodeEditor->lines()*10 ); _qSciSourceCodeEditor->setMarginWidth(1, lineNumbers); } @@ -1200,11 +1200,11 @@ void MainWindow::numberOfLinesChanged() { /*! \brief Catches language change events and retranslates all needed widgets. */ -void MainWindow::changeEvent(QEvent *event) { +void MainWindow::changeEvent(TQEvent *event) { int i = 0; - if (event->type() == QEvent::LanguageChange) { - QString languageName; + if (event->type() == TQEvent::LanguageChange) { + TQString languageName; // Translate the main window. _mainWindowForm->retranslateUi(this); @@ -1217,7 +1217,7 @@ void MainWindow::changeEvent(QEvent *event) { _indentHandler->retranslateUi(); // Translate the load encoding menu. - QList<QAction *> encodingActionList = _encodingActionGroup->actions(); + TQList<TQAction *> encodingActionList = _encodingActionGroup->actions(); for ( i = 0; i < encodingActionList.size(); i++ ) { encodingActionList.at(i)->setStatusTip( tr("Reopen the currently opened source code file by using the text encoding scheme ") + _encodingsList.at(i) ); } @@ -1229,10 +1229,10 @@ void MainWindow::changeEvent(QEvent *event) { } // Translate the _highlighter menu. - QList<QAction *> actionList = _mainWindowForm->highlighterMenu->actions(); + TQList<TQAction *> actionList = _mainWindowForm->highlighterMenu->actions(); i = 0; - foreach ( QString highlighterName, _highlighter->getAvailableHighlighters() ) { - QAction *highlighterAction = actionList.at(i); + foreach ( TQString highlighterName, _highlighter->getAvailableHighlighters() ) { + TQAction *highlighterAction = actionList.at(i); highlighterAction->setStatusTip( tr("Set the syntax highlightning to ") + highlighterName ); i++; } @@ -1243,7 +1243,7 @@ void MainWindow::changeEvent(QEvent *event) { setStatusBarCursorPosInfo( line, column ); } else { - QWidget::changeEvent(event); + TQWidget::changeEvent(event); } } @@ -1258,10 +1258,10 @@ void MainWindow::changeEvent(QEvent *event) { the recently opened menu will be updated too. */ void MainWindow::updateRecentlyOpenedList() { - QString fileName; - QString filePath; - QStringList recentlyOpenedList = _settings->getValueByName("lastSourceCodeFile").toString().split("|"); - QList<QAction*> recentlyOpenedActionList = _mainWindowForm->menuRecently_Opened_Files->actions(); + TQString fileName; + TQString filePath; + TQStringList recentlyOpenedList = _settings->getValueByName("lastSourceCodeFile").toString().split("|"); + TQList<TQAction*> recentlyOpenedActionList = _mainWindowForm->menuRecently_Opened_Files->actions(); // Check if the currently open file is in the list of recently opened. int indexOfCurrentFile = recentlyOpenedList.indexOf( _currentSourceFile ); @@ -1274,7 +1274,7 @@ void MainWindow::updateRecentlyOpenedList() { // Put the current file at the first position if it not already is and is not empty. else if ( indexOfCurrentFile == -1 && !_currentSourceFile.isEmpty() ) { recentlyOpenedList.insert(0, _currentSourceFile); - QAction *recentlyOpenedAction = new QAction(QFileInfo(_currentSourceFile).fileName(), _mainWindowForm->menuRecently_Opened_Files); + TQAction *recentlyOpenedAction = new TQAction(TQFileInfo(_currentSourceFile).fileName(), _mainWindowForm->menuRecently_Opened_Files); recentlyOpenedAction->setStatusTip(_currentSourceFile); recentlyOpenedActionList.insert(0, recentlyOpenedAction ); } @@ -1286,20 +1286,20 @@ void MainWindow::updateRecentlyOpenedList() { // loop only as long as maximum allowed list entries are set. for ( int i = 0; i < recentlyOpenedList.size() && i < recentlyOpenedListMaxSize; ) { filePath = recentlyOpenedList.at(i); - QFileInfo fileInfo(filePath); + TQFileInfo fileInfo(filePath); // If the file does no longer exist, remove it from the list. if ( !fileInfo.exists() ) { recentlyOpenedList.takeAt(i); if ( i < recentlyOpenedActionList.size()-2 ) { - QAction* action = recentlyOpenedActionList.takeAt(i); + TQAction* action = recentlyOpenedActionList.takeAt(i); delete action; } } // else if its not already in the menu, add it to the menu. else { if ( i >= recentlyOpenedActionList.size()-2 ) { - QAction *recentlyOpenedAction = new QAction(fileInfo.fileName(), _mainWindowForm->menuRecently_Opened_Files); + TQAction *recentlyOpenedAction = new TQAction(fileInfo.fileName(), _mainWindowForm->menuRecently_Opened_Files); recentlyOpenedAction->setStatusTip(filePath); recentlyOpenedActionList.insert( recentlyOpenedActionList.size()-2, recentlyOpenedAction ); } @@ -1310,7 +1310,7 @@ void MainWindow::updateRecentlyOpenedList() { // Trim the list to its in the _settings allowed maximum size. while ( recentlyOpenedList.size() > recentlyOpenedListMaxSize ) { recentlyOpenedList.takeLast(); - QAction* action = recentlyOpenedActionList.takeAt( recentlyOpenedActionList.size()-3 ); + TQAction* action = recentlyOpenedActionList.takeAt( recentlyOpenedActionList.size()-3 ); delete action; } @@ -1335,12 +1335,12 @@ void MainWindow::updateRecentlyOpenedList() { \brief This slot empties the list of recently opened files. */ void MainWindow::clearRecentlyOpenedList() { - QStringList recentlyOpenedList = _settings->getValueByName("lastSourceCodeFile").toString().split("|"); - QList<QAction*> recentlyOpenedActionList = _mainWindowForm->menuRecently_Opened_Files->actions(); + TQStringList recentlyOpenedList = _settings->getValueByName("lastSourceCodeFile").toString().split("|"); + TQList<TQAction*> recentlyOpenedActionList = _mainWindowForm->menuRecently_Opened_Files->actions(); while ( recentlyOpenedList.size() > 0 ) { recentlyOpenedList.takeLast(); - QAction* action = recentlyOpenedActionList.takeAt( recentlyOpenedActionList.size()-3 ); + TQAction* action = recentlyOpenedActionList.takeAt( recentlyOpenedActionList.size()-3 ); delete action; } @@ -1356,7 +1356,7 @@ void MainWindow::clearRecentlyOpenedList() { \brief This slot is called if an entry from the list of recently opened files is being selected. */ -void MainWindow::openFileFromRecentlyOpenedList(QAction* recentlyOpenedAction) { +void MainWindow::openFileFromRecentlyOpenedList(TQAction* recentlyOpenedAction) { // If the selected action from the recently opened list menu is the clear action // call the slot to clear the list and then leave. if ( recentlyOpenedAction == _mainWindowForm->actionClear_Recently_Opened_List ) { @@ -1364,11 +1364,11 @@ void MainWindow::openFileFromRecentlyOpenedList(QAction* recentlyOpenedAction) { return; } - QString fileName = recentlyOpenedAction->text(); + TQString fileName = recentlyOpenedAction->text(); int indexOfSelectedFile = _mainWindowForm->menuRecently_Opened_Files->actions().indexOf( recentlyOpenedAction ); - QStringList recentlyOpenedList = _settings->getValueByName("lastSourceCodeFile").toString().split("|"); - QString filePath = recentlyOpenedList.at(indexOfSelectedFile); - QFileInfo fileInfo(filePath); + TQStringList recentlyOpenedList = _settings->getValueByName("lastSourceCodeFile").toString().split("|"); + TQString filePath = recentlyOpenedList.at(indexOfSelectedFile); + TQFileInfo fileInfo(filePath); // If the file exists, open it. if ( fileInfo.exists() ) { @@ -1376,12 +1376,12 @@ void MainWindow::openFileFromRecentlyOpenedList(QAction* recentlyOpenedAction) { } // If it does not exist, show a warning message and update the list of recently opened files. else { - QMessageBox::warning(NULL, tr("File no longer exists"), tr("The file %1 in the list of recently opened files does no longer exist.") ); + TQMessageBox::warning(NULL, tr("File no longer exists"), tr("The file %1 in the list of recently opened files does no longer exist.") ); // The function updateRecentlyOpenedList() has to be called via a singleShot so it is executed after this // function (openFileFromRecentlyOpenedList) has already been left. This has to be done because - // a Qt3Support function tries to emit a signal based on the existing actions and deleting + // a TQt3Support function tries to emit a signal based on the existing actions and deleting // any of these actions in updateRecentlyOpenedList() causes an error. - QTimer::singleShot(0, this, SLOT(updateRecentlyOpenedList()) ); + TQTimer::singleShot(0, this, SLOT(updateRecentlyOpenedList()) ); } } @@ -1389,7 +1389,7 @@ void MainWindow::openFileFromRecentlyOpenedList(QAction* recentlyOpenedAction) { /*! \brief If the dragged in object contains urls/paths to a file, accept the drag. */ -void MainWindow::dragEnterEvent(QDragEnterEvent *event) { +void MainWindow::dragEnterEvent(TQDragEnterEvent *event) { if ( event->mimeData()->hasUrls() ) { event->acceptProposedAction(); } @@ -1399,9 +1399,9 @@ void MainWindow::dragEnterEvent(QDragEnterEvent *event) { /*! \brief If the dropped in object contains urls/paths to a file, open that file. */ -void MainWindow::dropEvent(QDropEvent *event) { +void MainWindow::dropEvent(TQDropEvent *event) { if ( event->mimeData()->hasUrls() ) { - QString filePathName = event->mimeData()->urls().first().toLocalFile(); + TQString filePathName = event->mimeData()->urls().first().toLocalFile(); openSourceFileDialog(filePathName); } @@ -1413,8 +1413,8 @@ void MainWindow::dropEvent(QDropEvent *event) { \brief If the dropped in object contains urls/paths to a file, open that file. */ void MainWindow::showAboutDialog() { - //QPixmap originalPixmap = QPixmap::grabWindow(QApplication::desktop()->screen()->winId()); - //qDebug("in main pixmap width %d, numScreens = %d", originalPixmap.size().width(), QApplication::desktop()->availableGeometry().width()); + //TQPixmap originalPixmap = TQPixmap::grabWindow(TQApplication::desktop()->screen()->winId()); + //tqDebug("in main pixmap width %d, numScreens = %d", originalPixmap.size().width(), TQApplication::desktop()->availableGeometry().width()); //_aboutDialogGraphicsView->setScreenshotPixmap( originalPixmap ); _aboutDialogGraphicsView->show(); } |