diff options
author | Michele Calgaro <[email protected]> | 2023-03-05 20:45:24 +0900 |
---|---|---|
committer | Michele Calgaro <[email protected]> | 2023-03-05 20:45:24 +0900 |
commit | d879569fce39cb38991384a1851eeb42eca6e16f (patch) | |
tree | 3036f0292c863573f680bbb15088ae1aa8b15533 /src/MainWindow.cpp | |
parent | 4e57686976724d784d154620b3e81a9d459f601b (diff) | |
download | universal-indent-gui-tqt-d879569fce39cb38991384a1851eeb42eca6e16f.tar.gz universal-indent-gui-tqt-d879569fce39cb38991384a1851eeb42eca6e16f.zip |
Added SettingsPaths code.
Signed-off-by: Michele Calgaro <[email protected]>
Diffstat (limited to 'src/MainWindow.cpp')
-rw-r--r-- | src/MainWindow.cpp | 91 |
1 files changed, 44 insertions, 47 deletions
diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 2d4c242..72e28a1 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -63,9 +63,9 @@ ///-- ///-- using namespace tschweitzer; -//! \defgroup grp_MainWindow All concerning main window functionality. +// \defgroup grp_MainWindow All concerning main window functionality. -/*! +/* \class MainWindow \ingroup grp_MainWindow \brief Is the main window of UniversalIndentGUI @@ -75,7 +75,7 @@ and user actions are being controlled. Is responsible for file open dialogs and indenter selection. */ -/*! +/* \brief Constructs the main window. */ MainWindow::MainWindow(TQString file2OpenOnStart, TQWidget *parent) : @@ -151,7 +151,7 @@ MainWindow::~MainWindow() ///-- _settings.clear(); } -///-- /*! +///-- /* ///-- \brief Initializes the main window by creating the main gui and make some _settings. ///-- */ void MainWindow::initMainWindow() @@ -196,9 +196,6 @@ void MainWindow::initMainWindow() ///-- { ///-- showMaximized(); ///-- } -///-- #ifndef Q_OS_MAC // On Mac restoring the window state causes the screenshot no longer to work. -///-- restoreState(_settings->getValueByName("MainWindowState").toByteArray()); -///-- #endif ///-- ///-- // Handle if first run of this version ///-- // ----------------------------------- @@ -246,7 +243,7 @@ void MainWindow::initMainWindow() ///-- _settings->registerObjectSlot(this, "updateRecentlyOpenedList()", "recentlyOpenedListSize"); } -/*! +/* \brief Creates and inits the tool bar. It is added to the main window. */ void MainWindow::initToolBar() @@ -280,7 +277,7 @@ void MainWindow::initToolBar() ///-- bool)), m_toolBarWidget->cbLivePreview, SLOT(setChecked(bool))); } -///-- /*! +///-- /* ///-- \brief Create and initialize the text editor component. It uses the TQScintilla widget. ///-- */ ///-- void MainWindow::initTextEditor() @@ -340,7 +337,7 @@ void MainWindow::initToolBar() ///-- _qSciSourceCodeEditor->setTabWidth(_settings->getValueByName("tabWidth").toInt()); ///-- } ///-- -///-- /*! +///-- /* ///-- \brief Create and init the syntax _highlighter and set it to use the TQScintilla edit component. ///-- */ ///-- void MainWindow::initSyntaxHighlighter() @@ -357,7 +354,7 @@ void MainWindow::initToolBar() ///-- "SyntaxHighlightingEnabled"); ///-- } ///-- -///-- /*! +///-- /* ///-- \brief Initializes the language of UniversalIndentGUI. ///-- ///-- If the program language is defined in the _settings, the corresponding language @@ -426,7 +423,7 @@ void MainWindow::initToolBar() ///-- return translationFileLoaded; ///-- } ///-- -///-- /*! +///-- /* ///-- \brief Creates and initializes the indenter. ///-- */ ///-- void MainWindow::initIndenter() @@ -454,7 +451,7 @@ void MainWindow::initToolBar() ///-- _mainWindowForm->menuIndenter->addActions(_indentHandler->getIndenterMenuActions()); ///-- } ///-- -///-- /*! +///-- /* ///-- \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. @@ -486,7 +483,7 @@ void MainWindow::initToolBar() ///-- return fileContent; ///-- } -/*! +/* \brief Calls the source file open dialog to load a source file for the formatting preview. If the file was successfully loaded the indenter will be called to generate the formatted source code. */ @@ -536,7 +533,7 @@ void MainWindow::openSourceFileDialog(TQString fileName) ///-- } } -/*! +/* \brief Calls the source file save as dialog to save a source file under a chosen name. If the file already exists and it should be overwritten, a warning is shown before. */ @@ -588,7 +585,7 @@ bool MainWindow::saveasSourceFileDialog(TQAction *chosenEncodingAction) return true; } -/*! +/* \brief Saves the currently shown source code to the last save or opened source file. If no source file has been opened, because only the static example has been loaded, the save as file dialog will be shown. @@ -619,7 +616,7 @@ bool MainWindow::saveSourceFile() return true; } -///-- /*! +///-- /* ///-- \brief Shows a file open dialog. ///-- ///-- Shows a file open dialog with the title \a dialogHeaderStr starting in the directory \a startPath @@ -640,7 +637,7 @@ bool MainWindow::saveSourceFile() ///-- return fileContent; ///-- } ///-- -///-- /*! +///-- /* ///-- \brief Updates the displaying of the source code. ///-- ///-- Updates the text edit field, which is showing the loaded, and if preview is enabled formatted, source code. @@ -675,7 +672,7 @@ bool MainWindow::saveSourceFile() ///-- _textEditVScrollBar->setValue(_textEditLastScrollPos); ///-- } ///-- -///-- /*! +///-- /* ///-- \brief Calls the selected indenter with the currently loaded source code to retrieve the formatted source code. ///-- ///-- The original loaded source code file will not be changed. @@ -689,7 +686,7 @@ bool MainWindow::saveSourceFile() ///-- TQApplication::restoreOverrideCursor(); ///-- } ///-- -///-- /*! +///-- /* ///-- \brief Switches the syntax highlighting corresponding to the value \a turnOn either on or off. ///-- */ ///-- void MainWindow::turnHighlightOnOff(bool turnOn) @@ -706,7 +703,7 @@ bool MainWindow::saveSourceFile() ///-- updateSourceView(); ///-- } ///-- -///-- /*! +///-- /* ///-- \brief Added this slot to avoid multiple calls because of changed text. ///-- */ ///-- void MainWindow::sourceCodeChangedHelperSlot() @@ -714,7 +711,7 @@ bool MainWindow::saveSourceFile() ///-- TQTimer::singleShot(0, this, SLOT(sourceCodeChangedSlot())); ///-- } ///-- -///-- /*! +///-- /* ///-- \brief Is emitted whenever the text inside the source view window changes. Calls the indenter ///-- to format the changed source code. ///-- */ @@ -868,7 +865,7 @@ bool MainWindow::saveSourceFile() ///-- //_qSciSourceCodeEditor->SendScintilla(QsciScintillaBase::SCI_SETANCHOR, 50); ///-- } ///-- -///-- /*! +///-- /* ///-- \brief This slot is called whenever one of the indenter _settings are changed. ///-- ///-- It calls the selected indenter if the preview is turned on. If preview @@ -917,7 +914,7 @@ bool MainWindow::saveSourceFile() ///-- } ///-- } -/*! +/* \brief This slot is called whenever the preview button is turned on or off. It calls the selected indenter to format the current source code if @@ -960,7 +957,7 @@ void MainWindow::previewTurnedOnOff(bool turnOn) ///-- } ///-- } ///-- -///-- /*! +///-- /* ///-- \brief This slot updates the main window title to show the currently opened ///-- source code filename. ///-- */ @@ -970,7 +967,7 @@ void MainWindow::previewTurnedOnOff(bool turnOn) ///-- PROGRAM_VERSION_STRING) + " [*]" + _currentSourceFile); } -/*! +/* \brief Opens a dialog to save the current source code as a PDF document. */ void MainWindow::exportToPDF() @@ -994,7 +991,7 @@ void MainWindow::exportToPDF() ///-- } } -/*! +/* \brief Opens a dialog to save the current source code as a HTML document. */ void MainWindow::exportToHTML() @@ -1027,7 +1024,7 @@ void MainWindow::exportToHTML() ///-- } } -///-- /*! +///-- /* ///-- \brief Loads the last opened file if this option is enabled in the _settings. ///-- ///-- If the file does not exist, the default example file is tried to be loaded. If even that @@ -1082,7 +1079,7 @@ void MainWindow::exportToHTML() ///-- updateWindowTitle(); ///-- } ///-- -///-- /*! +///-- /* ///-- \brief Saves the _settings for the main application to the file "UniversalIndentGUI.ini". ///-- ///-- Settings are for example last selected indenter, last loaded config file and so on. @@ -1103,7 +1100,7 @@ void MainWindow::exportToHTML() ///-- _highlighter->writeCurrentSettings(""); ///-- } ///-- -///-- /*! +///-- /* ///-- \brief Is always called when the program is quit. Calls the saveSettings function before really quits. ///-- */ ///-- void MainWindow::closeEvent(TQCloseEvent *event) @@ -1119,7 +1116,7 @@ void MainWindow::exportToHTML() ///-- } ///-- } ///-- -///-- /*! +///-- /* ///-- \brief This function is setup to capture tooltip events. ///-- ///-- All widgets that are created by the _indentHandler object and are responsible @@ -1147,7 +1144,7 @@ void MainWindow::exportToHTML() ///-- } ///-- } ///-- -///-- /*! +///-- /* ///-- \brief Is called at application exit and asks whether to save the source code file, if it has been changed. ///-- */ ///-- bool MainWindow::maybeSave() @@ -1169,7 +1166,7 @@ void MainWindow::exportToHTML() ///-- return true; ///-- } ///-- -///-- /*! +///-- /* ///-- \brief This slot is called whenever a language is selected in the menu. It tries to find the ///-- corresponding action in the languageInfoList and sets the language. ///-- */ @@ -1205,7 +1202,7 @@ void MainWindow::exportToHTML() ///-- } ///-- } ///-- -///-- /*! +///-- /* ///-- \brief Creates a menu entries in the file menu for opening and saving a file with different encodings. ///-- */ ///-- void MainWindow::createEncodingMenu() @@ -1252,7 +1249,7 @@ void MainWindow::exportToHTML() ///-- SLOT(saveAsOtherEncoding(TQAction*))); ///-- } ///-- -///-- /*! +///-- /* ///-- \brief This slot calls the save dialog to save the current source file with another encoding. ///-- ///-- If the saving is successful and not aborted, the currently used encoding, visible in the @@ -1276,7 +1273,7 @@ void MainWindow::exportToHTML() ///-- } ///-- } ///-- -///-- /*! +///-- /* ///-- \brief This slot is called whenever an encoding is selected in the settings menu. ///-- */ ///-- void MainWindow::encodingChanged(TQAction *encodingAction) @@ -1307,7 +1304,7 @@ void MainWindow::exportToHTML() ///-- } ///-- } ///-- -///-- /*! +///-- /* ///-- \brief Creates a menu entry under the settings menu for all available text encodings. ///-- */ ///-- void MainWindow::createHighlighterMenu() @@ -1332,7 +1329,7 @@ void MainWindow::exportToHTML() ///-- SLOT(setHighlighterByAction(TQAction*))); ///-- } ///-- -///-- /*! +///-- /* ///-- \brief Is called whenever the white space visibility is being changed in the menu. ///-- */ ///-- void MainWindow::setWhiteSpaceVisibility(bool visible) @@ -1350,7 +1347,7 @@ void MainWindow::exportToHTML() ///-- } ///-- } ///-- -///-- /*! +///-- /* ///-- \brief This slot is called whenever the number of lines in the editor changes ///-- and adapts the margin for the displayed line numbers. ///-- */ @@ -1361,7 +1358,7 @@ void MainWindow::exportToHTML() ///-- _qSciSourceCodeEditor->setMarginWidth(1, lineNumbers); ///-- } ///-- -///-- /*! +///-- /* ///-- \brief Catches language change events and retranslates all needed widgets. ///-- */ ///-- void MainWindow::changeEvent(TQEvent *event) @@ -1421,7 +1418,7 @@ void MainWindow::exportToHTML() ///-- } ///-- } -/*! +/* \brief Updates the list of recently opened files. Therefore the currently open file is set at the lists first position regarding the in the _settings set maximum list length. Overheads of the @@ -1517,7 +1514,7 @@ void MainWindow::updateRecentlyOpenedList() ///-- } } -/*! +/* \brief This slot empties the list of recently opened files. */ void MainWindow::clearRecentlyOpenedList() @@ -1541,7 +1538,7 @@ void MainWindow::clearRecentlyOpenedList() ///-- _mainWindowForm->actionClearRecentlyOpenedList->setEnabled(false); } -/*! +/* \brief This slot is called if an entry from the list of recently opened files is being selected. */ @@ -1582,7 +1579,7 @@ void MainWindow::openFileFromRecentlyOpenedList(int recentlyOpenedActionId) ///-- } } -///-- /*! +///-- /* ///-- \brief If the dragged in object contains urls/paths to a file, accept the drag. ///-- */ ///-- void MainWindow::dragEnterEvent(TQDragEnterEvent *event) @@ -1593,7 +1590,7 @@ void MainWindow::openFileFromRecentlyOpenedList(int recentlyOpenedActionId) ///-- } ///-- } ///-- -///-- /*! +///-- /* ///-- \brief If the dropped in object contains urls/paths to a file, open that file. ///-- */ ///-- void MainWindow::dropEvent(TQDropEvent *event) @@ -1607,7 +1604,7 @@ void MainWindow::openFileFromRecentlyOpenedList(int recentlyOpenedActionId) ///-- event->acceptProposedAction(); ///-- } -/*! +/* \brief Show the About dialog. */ void MainWindow::showAboutDialog() @@ -1620,7 +1617,7 @@ void MainWindow::showAboutDialog() m_aboutDialog->show(); } -///-- /*! +///-- /* ///-- \brief Sets the label in the status bar to show the \a line and \a column number. ///-- */ ///-- void MainWindow::setStatusBarCursorPosInfo(int line, int column) |