diff options
Diffstat (limited to 'src/MainWindow.cpp')
-rw-r--r-- | src/MainWindow.cpp | 54 |
1 files changed, 30 insertions, 24 deletions
diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 33ec315..36700d4 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -25,6 +25,7 @@ #include "stdlib.h" #include "AboutDialog.h" +#include "IndentHandler.h" #include "SettingsPaths.h" #include "UiGuiSettings.h" #include "UiGuiVersion.h" @@ -32,7 +33,6 @@ ///-- #include "AboutDialogGraphicsView.h" ///-- #include "UiGuiSettingsDialog.h" ///-- #include "UiGuiHighlighter.h" -///-- #include "IndentHandler.h" #include <tqaction.h> #include <tqapplication.h> @@ -47,10 +47,11 @@ #include <tqpixmap.h> #include <tqpopupmenu.h> #include <tqpushbutton.h> +#include <tqsplitter.h> #include <tqstatusbar.h> #include <tqtextcodec.h> #include <tqtranslator.h> -///-- #include <tqwidget.h> +#include <tqwidget.h> ///-- #include <tqstring.h> ///-- #include <tqscrollbar.h> ///-- #include <tqtextcursor.h> @@ -91,10 +92,11 @@ MainWindow::MainWindow(TQString file2OpenOnStart, TQWidget *parent) : m_qTranslator(nullptr), m_uiGuiTranslator(nullptr), m_textEditLineColumnInfoLabel(nullptr), m_oldLinesNumber(0), m_openEncodingActions(), m_saveEncodingActions(), m_encodingActionGroup(nullptr), m_saveEncodedActionGroup(nullptr), - m_highlighterActionGroup(nullptr), m_documentModified(false), m_previewToggled(true) + m_highlighterActionGroup(nullptr), m_documentModified(false), m_previewToggled(true), + m_indentHandler(nullptr), m_centralSplitter(nullptr) ///- _mainWindowForm(nullptr), _settings(nullptr) ///- m_highlighter(nullptr), _aboutDialogGraphicsView(nullptr), _settingsDialog(nullptr) -///- m_textEditVScrollBar(nullptr), _toolBarWidget(nullptr), _indentHandler(nullptr) +///- m_textEditVScrollBar(nullptr), _toolBarWidget(nullptr) { // Init of some variables. m_sourceCodeChanged = false; @@ -181,6 +183,11 @@ void MainWindow::initMainWindow() actionExportPDF->setIconSet(TQPixmap(ICONS_PATH + "exportpdf.png")); actionExportHTML->setIconSet(TQPixmap(ICONS_PATH + "exporthtml.png")); actionExit->setIconSet(TQPixmap(ICONS_PATH + "system-log-out.png")); + // - Indenter menu + actionLoadIndenterConfigFile->setIconSet(TQPixmap(ICONS_PATH + "load_indent_cfg.png")); + actionSaveIndenterConfigFile->setIconSet(TQPixmap(ICONS_PATH + "save_indent_cfg.png")); + actionCreateShellScript->setIconSet(TQPixmap(ICONS_PATH + "shell.png")); + actionResetIndenterParameters->setIconSet(TQPixmap(ICONS_PATH + "view-refresh.png")); // - Setting menu actionLiveIndentPreview->setIconSet(TQPixmap(ICONS_PATH + "live-preview.png")); actionEnableSyntaxHighlighting->setIconSet(TQPixmap(ICONS_PATH + "syntax-highlight.png")); @@ -193,6 +200,11 @@ void MainWindow::initMainWindow() m_actionClearRecentlyOpenedListId = popupMenuRecentlyOpenedFiles->idAt( popupMenuRecentlyOpenedFiles->count() - 1); + // Central splitter + m_centralSplitter = new TQSplitter(this); + m_centralSplitter->setChildrenCollapsible(true); + setCentralWidget(m_centralSplitter); + // Handle last opened window size // ------------------------------ bool maximized = m_settings->getValueByName("WindowIsMaximized").toBool(); @@ -242,6 +254,7 @@ void MainWindow::initMainWindow() connect(actionSaveSourceFileAs, SIGNAL(activated()), this, SLOT(saveasSourceFileDialog())); connect(actionExportPDF, SIGNAL(activated()), this, SLOT(exportToPDF())); connect(actionExportHTML, SIGNAL(activated()), this, SLOT(exportToHTML())); + ///-- connect(actionShowLog, SIGNAL(activated()), ///-- debugging::TSLogger::getInstance(), SLOT(show())); @@ -301,7 +314,7 @@ void MainWindow::initTextEditor() // Create the TQScintilla widget and add it to the layout. try { - m_qSciSourceCodeEditor = new TQextScintilla(this); + m_qSciSourceCodeEditor = new TQextScintilla(m_centralSplitter); } catch (...) { @@ -311,7 +324,6 @@ void MainWindow::initTextEditor() "versions are not mixed."); exit(1); } - setCentralWidget(m_qSciSourceCodeEditor); // Make some _settings for the TQScintilla widget. m_qSciSourceCodeEditor->setUtf8(true); @@ -445,15 +457,15 @@ bool MainWindow::initApplicationLanguage() */ void MainWindow::initIndenter() { -///-- // Get Id of last selected indenter. -///-- _currentIndenterID = _settings->getValueByName("selectedIndenter").toInt(); -///-- -///-- // Create the indenter widget with the ID and add it to the layout. -///-- _indentHandler = new IndentHandler(_currentIndenterID, this, _mainWindowForm->centralwidget); -///-- _mainWindowForm->vboxLayout->addWidget(_indentHandler); -///-- + // Get Id of last selected indenter. + m_currentIndenterID = m_settings->getValueByName("SelectedIndenter").toInt(); + + // Create the indenter widget with the ID and add it to the layout. + m_indentHandler = new IndentHandler(m_currentIndenterID, this, m_centralSplitter); + m_centralSplitter->moveToFirst(m_indentHandler); + ///-- // If _settings for the indenter have changed, let the main window know aboud it. -///-- connect(_indentHandler, SIGNAL(indenterSettingsChanged()), this, +///-- connect(m_indentHandler, SIGNAL(indenterSettingsChanged()), this, ///-- SLOT(indentSettingsChangedSlot())); ///-- ///-- // Set this true, so the indenter is called at first program start @@ -463,9 +475,6 @@ void MainWindow::initIndenter() ///-- // Handle if indenter parameter tool tips are enabled ///-- _settings->registerObjectProperty(actionIndenterParameterTooltipsEnabled, ///-- "checked", "indenterParameterTooltipsEnabled"); -///-- -///-- // Add the indenters context menu to the mainwindows menu. -///-- _mainWindowForm->menuIndenter->addActions(_indentHandler->getIndenterMenuActions()); } /* @@ -515,7 +524,7 @@ void MainWindow::openSourceFileDialog(const TQString &fileName) TQString openedSourceFileContent = ""; TQString fileExtensions = "*.h *.c *.cpp *.*"; // Remove this line when the indenter is available ///-- TQString fileExtensions = tr("Supported by indenter") + " (" + -///-- _indentHandler->getPossibleIndenterFileExtensions() + ");;" + tr("All files") + " (*.*)"; +///-- m_indentHandler->getPossibleIndenterFileExtensions() + ");;" + tr("All files") + " (*.*)"; TQString fileToOpen = fileName; if (fileToOpen.isEmpty()) @@ -558,7 +567,7 @@ bool MainWindow::saveasSourceFileDialog(TQAction *chosenEncodingAction) { TQString fileExtensions = "*.h *.c *.cpp *.*"; // Remove this line when the indenter is available //--- TQString fileExtensions = tr("Supported by indenter") + " (" + -//--- _indentHandler->getPossibleIndenterFileExtensions() + ");;" + tr("All files") + " (*.*)"; +//--- m_indentHandler->getPossibleIndenterFileExtensions() + ");;" + tr("All files") + " (*.*)"; TQString fileName = TQFileDialog::getSaveFileName(m_currentSourceFile, fileExtensions, this, nullptr, tr("Save source code file")); @@ -674,7 +683,7 @@ void MainWindow::updateSourceView() void MainWindow::callIndenter() { TQApplication::setOverrideCursor(TQCursor(TQt::WaitCursor)); -///-- m_sourceFormattedContent = _indentHandler->callIndenter(m_sourceFileContent, +///-- m_sourceFormattedContent = m_indentHandler->callIndenter(m_sourceFileContent, ///-- m_currentSourceFileExtension); updateSourceView(); TQApplication::restoreOverrideCursor(); @@ -1112,7 +1121,7 @@ void MainWindow::closeEvent(TQCloseEvent *event) ///-- /* ///-- \brief This function is setup to capture tooltip events. ///-- -///-- All widgets that are created by the _indentHandler object and are responsible +///-- All widgets that are created by the m_indentHandler object and are responsible ///-- for indenter parameters are connected with this event filter. ///-- So depending on the _settings the tooltips can be enabled and disabled for these widgets. ///-- */ @@ -1377,9 +1386,6 @@ void MainWindow::numberOfLinesChanged() ///-- // Translate the toolbar. ///-- _toolBarWidget->retranslateUi(_mainWindowForm->toolBar); ///-- -///-- // Translate the indent handler widget. -///-- _indentHandler->retranslateUi(); -///-- ///-- // Translate the load encoding menu. ///-- TQList<TQAction*> encodingActionList = m_encodingActionGroup->actions(); ///-- for (i = 0; i < encodingActionList.size(); i++) |