diff options
author | Michele Calgaro <michele.calgaro@yahoo.it> | 2022-09-18 20:19:47 +0900 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2022-09-18 20:39:48 +0900 |
commit | a80a494efee7979c28ab1090734270e5c0515352 (patch) | |
tree | 1cdaee39e3e5a2b32c171f8389b29b15c519c607 /src/MainWindow.cpp | |
parent | 14f7e49438caa24af81a0d7d7864ce71d96791e4 (diff) | |
download | universal-indent-gui-tqt-a80a494efee7979c28ab1090734270e5c0515352.tar.gz universal-indent-gui-tqt-a80a494efee7979c28ab1090734270e5c0515352.zip |
Added main window menubar GUI. The logic of each action has not been implemented yet.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'src/MainWindow.cpp')
-rw-r--r-- | src/MainWindow.cpp | 328 |
1 files changed, 175 insertions, 153 deletions
diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 1aa68a3..242797d 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -17,10 +17,10 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ +#include "config.h" #include "MainWindow.h" -///-- #include "ui_MainWindow.h" -///-- -///-- #include "UiGuiVersion.h" +#include "UiGuiVersion.h" + ///-- #include "debugging/TSLogger.h" ///-- #include "SettingsPaths.h" ///-- @@ -33,25 +33,28 @@ ///-- #include "IndentHandler.h" ///-- #include "UpdateCheckDialog.h" ///-- -///-- #include <tntqwidget.h> -///-- #include <tntqlabel.h> -///-- #include <tntqstring.h> -///-- #include <tntqscrollbar.h> +#include <tqpixmap.h> +#include <tqaction.h> +#include <tqpopupmenu.h> +///-- #include <tqwidget.h> +///-- #include <tqlabel.h> +///-- #include <tqstring.h> +///-- #include <tqscrollbar.h> ///-- #include <tqtextcursor.h> -///-- #include <tntqfiledialog.h> -///-- #include <tntqtextstream.h> +///-- #include <tqfiledialog.h> +///-- #include <tqtextstream.h> ///-- #include <tqtextdocument.h> -///-- #include <tntqprinter.h> -///-- #include <tntqprintdialog.h> +///-- #include <tqprinter.h> +///-- #include <tqprintdialog.h> ///-- #include <tqcloseevent.h> ///-- #include <tqhelpevent.h> -///-- #include <tntqtooltip.h> -///-- #include <tntqtranslator.h> -///-- #include <tntqlocale.h> -///-- #include <tntqtextcodec.h> +///-- #include <tqtooltip.h> +///-- #include <tqtranslator.h> +///-- #include <tqlocale.h> +///-- #include <tqtextcodec.h> ///-- #include <tqdate.h> -///-- #include <tntqurl.h> -///-- #include <tntqmessagebox.h> +///-- #include <tqurl.h> +///-- #include <tqmessagebox.h> ///-- #include <tqtdebug.h> ///-- ///-- #include <Qsci/qsciscintilla.h> @@ -75,7 +78,7 @@ \brief Constructs the main window. */ MainWindow::MainWindow(TQString file2OpenOnStart, TQWidget *parent) : - TQMainWindow(parent) + MainWindowBase(parent) ///- , _mainWindowForm(NULL), _qSciSourceCodeEditor(NULL), _settings(NULL), ///- _highlighter(NULL), _textEditVScrollBar(NULL), _aboutDialog(NULL), _aboutDialogGraphicsView( ///- NULL), _settingsDialog(NULL), _encodingActionGroup(NULL), _saveEncodedActionGroup(NULL), @@ -93,7 +96,7 @@ MainWindow::MainWindow(TQString file2OpenOnStart, TQWidget *parent) : ///-- initApplicationLanguage(); ///-- ///-- // Creates the main window and initializes it. -///-- initMainWindow(); + initMainWindow(); ///-- ///-- // Create toolbar and insert it into the main window. ///-- initToolBar(); @@ -116,12 +119,11 @@ MainWindow::MainWindow(TQString file2OpenOnStart, TQWidget *parent) : ///-- _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())); + connect(actionAboutUniversalIndentGUITQt, SIGNAL(activated()), this, SLOT(showAboutDialog())); ///-- ///-- // Generate settings dialog box ///-- _settingsDialog = new UiGuiSettingsDialog(this, _settings); -///-- connect(_mainWindowForm->actionShowSettings, SIGNAL(triggered()), _settingsDialog, +///-- connect(actionShowSettings, SIGNAL(activated()), _settingsDialog, ///-- SLOT(showDialog())); ///-- ///-- // If a file that should be opened on start has been handed over to the constructor exists, load @@ -153,12 +155,37 @@ MainWindow::MainWindow(TQString file2OpenOnStart, TQWidget *parent) : ///-- /*! ///-- \brief Initializes the main window by creating the main gui and make some _settings. ///-- */ -///-- void MainWindow::initMainWindow() -///-- { -///-- // Generate gui as it is build in the file "mainwindow.ui" -///-- _mainWindowForm = new Ui::MainWindowUi(); -///-- _mainWindowForm->setupUi(this); -///-- +void MainWindow::initMainWindow() +{ + // Setup icons + TQString ICONS_PATH(APP_ICONS_PATH); + // Application icon + setIcon(TQPixmap(ICONS_PATH + "universalIndentGUI_64x64.png")); + // Menu icons + // - File menu + actionOpenSourceFile->setIconSet(TQPixmap(ICONS_PATH + "document-open.png")); + actionMenuRecentlyOpenedFiles->setIconSet(TQPixmap(ICONS_PATH + "document-open.png")); + actionClearRecentlyOpenedList->setIconSet(TQPixmap(ICONS_PATH + "edit-clear.png")); + actionMenuEncoding->setIconSet(TQPixmap(ICONS_PATH + "document-open.png")); + actionSaveSourceFile->setIconSet(TQPixmap(ICONS_PATH + "document-save.png")); + actionSaveSourceFileAs->setIconSet(TQPixmap(ICONS_PATH + "document-save-as.png")); + actionMenuSaveEncoded->setIconSet(TQPixmap(ICONS_PATH + "document-save-as.png")); + actionMenuExport->setIconSet(TQPixmap(ICONS_PATH + "exporthtml.png")); + actionExportPDF->setIconSet(TQPixmap(ICONS_PATH + "exportpdf.png")); + actionExportHTML->setIconSet(TQPixmap(ICONS_PATH + "exporthtml.png")); + actionExit->setIconSet(TQPixmap(ICONS_PATH + "system-log-out.png")); + // - Setting menu + actionLiveIndentPreview->setIconSet(TQPixmap(ICONS_PATH + "live-preview.png")); + actionEnableSyntaxHighlighting->setIconSet(TQPixmap(ICONS_PATH + "syntax-highlight.png")); + actionIndenterParameterTooltipsEnabled->setIconSet(TQPixmap(ICONS_PATH + "tooltip.png")); + actionShowSettings->setIconSet(TQPixmap(ICONS_PATH + "preferences-system.png")); + // - Help menu + actionShowLog->setIconSet(TQPixmap(ICONS_PATH + "document-properties.png")); + actionAboutUniversalIndentGUITQt->setIconSet(TQPixmap(ICONS_PATH + "info.png")); + // Menu ids + _actionClearRecentlyOpenedListId = popupMenuRecentlyOpenedFiles->idAt( + popupMenuRecentlyOpenedFiles->count() - 1); + ///-- // Handle last opened window size ///-- // ------------------------------ ///-- bool maximized = _settings->getValueByName("maximized").toBool(); @@ -194,39 +221,36 @@ MainWindow::MainWindow(TQString file2OpenOnStart, TQWidget *parent) : ///-- _updateCheckDialog = new UpdateCheckDialog(_settings, this); ///-- ///-- // Register the load last file setting in the menu to the _settings object. -///-- _settings->registerObjectProperty(_mainWindowForm->loadLastOpenedFileOnStartupAction, "checked", +///-- _settings->registerObjectProperty(actionLoadLastOpenedFileOnStartup, "checked", ///-- "loadLastSourceCodeFileOnStartup"); ///-- ///-- // Tell the TQScintilla editor if it has to show white space. -///-- connect(_mainWindowForm->whiteSpaceIsVisibleAction, SIGNAL(toggled(bool)), this, +///-- connect(_mainWindowForm->actionWhiteSpaceIsVisible, SIGNAL(acivated(bool)), this, ///-- SLOT(setWhiteSpaceVisibility(bool))); ///-- // Register the white space setting in the menu to the _settings object. -///-- _settings->registerObjectProperty(_mainWindowForm->whiteSpaceIsVisibleAction, "checked", +///-- _settings->registerObjectProperty(actionWhiteSpaceIsVisible, "checked", ///-- "whiteSpaceIsVisible"); ///-- ///-- // Connect the remaining menu items. -///-- connect(_mainWindowForm->actionOpen_Source_File, SIGNAL(triggered()), this, -///-- SLOT(openSourceFileDialog())); -///-- connect(_mainWindowForm->actionSave_Source_File_As, SIGNAL(triggered()), this, -///-- SLOT(saveasSourceFileDialog())); -///-- connect(_mainWindowForm->actionSave_Source_File, SIGNAL(triggered()), this, -///-- SLOT(saveSourceFile())); -///-- connect(_mainWindowForm->actionExportPDF, SIGNAL(triggered()), this, SLOT(exportToPDF())); -///-- connect(_mainWindowForm->actionExportHTML, SIGNAL(triggered()), this, SLOT(exportToHTML())); + connect(actionOpenSourceFile, SIGNAL(activated()), this, SLOT(openSourceFileDialog())); + connect(actionSaveSourceFile, SIGNAL(activated()), this, SLOT(saveSourceFile())); + connect(actionSaveSourceFileAs, SIGNAL(activated()), this, SLOT(saveasSourceFileDialog())); + connect(actionExportPDF, SIGNAL(activated()), this, SLOT(exportToPDF())); + connect(actionExportHTML, SIGNAL(activated()), this, SLOT(exportToHTML())); ///-- connect(_mainWindowForm->actionCheck_for_update, SIGNAL(triggered()), _updateCheckDialog, ///-- SLOT(checkForUpdateAndShowDialog())); -///-- connect(_mainWindowForm->actionShowLog, SIGNAL(triggered()), +///-- connect(actionShowLog, SIGNAL(activated()), ///-- debugging::TSLogger::getInstance(), SLOT(show())); ///-- -///-- // Init the menu for selecting one of the recently opened files. -///-- updateRecentlyOpenedList(); -///-- connect(_mainWindowForm->menuRecently_Opened_Files, SIGNAL(triggered(TQAction*)), this, -///-- SLOT(openFileFromRecentlyOpenedList(TQAction*))); + // Init the menu for selecting one of the recently opened files. + updateRecentlyOpenedList(); + connect(popupMenuRecentlyOpenedFiles, SIGNAL(activated(int)), + this, SLOT(openFileFromRecentlyOpenedList(int))); ///-- //connect( _settings, SIGNAL(recentlyOpenedListSize(int)), this, SLOT(updateRecentlyOpenedList()) ///-- // ); ///-- _settings->registerObjectSlot(this, "updateRecentlyOpenedList()", "recentlyOpenedListSize"); -///-- } -///-- +} + ///-- /*! ///-- \brief Creates and inits the tool bar. It is added to the main window. ///-- */ @@ -249,8 +273,8 @@ MainWindow::MainWindow(TQString file2OpenOnStart, TQWidget *parent) : ///-- connect(_toolBarWidget->cbLivePreview, SIGNAL(toggled(bool)), this, ///-- SLOT(previewTurnedOnOff(bool))); ///-- connect(_toolBarWidget->cbLivePreview, SIGNAL(toggled( -///-- bool)), _mainWindowForm->actionLive_Indent_Preview, SLOT(setChecked(bool))); -///-- connect(_mainWindowForm->actionLive_Indent_Preview, SIGNAL(toggled( +///-- bool)), actionLiveIndentPreview, SLOT(setChecked(bool))); +///-- connect(actionLiveIndentPreview, SIGNAL(toggled( ///-- bool)), _toolBarWidget->cbLivePreview, SLOT(setChecked(bool))); ///-- } ///-- @@ -323,11 +347,11 @@ MainWindow::MainWindow(TQString file2OpenOnStart, TQWidget *parent) : ///-- _highlighter = new UiGuiHighlighter(_qSciSourceCodeEditor); ///-- ///-- // Connect the syntax highlighting setting in the menu to the turnHighlightOnOff function. -///-- connect(_mainWindowForm->enableSyntaxHighlightingAction, SIGNAL(toggled(bool)), this, +///-- connect(actionEnableSyntaxHighlighting, SIGNAL(activated(bool)), this, ///-- SLOT(turnHighlightOnOff(bool))); ///-- ///-- // Register the syntax highlighting setting in the menu to the _settings object. -///-- _settings->registerObjectProperty(_mainWindowForm->enableSyntaxHighlightingAction, "checked", +///-- _settings->registerObjectProperty(actionEnableSyntaxHighlighting, "checked", ///-- "SyntaxHighlightingEnabled"); ///-- } ///-- @@ -421,7 +445,7 @@ MainWindow::MainWindow(TQString file2OpenOnStart, TQWidget *parent) : ///-- _previewToggled = true; ///-- ///-- // Handle if indenter parameter tool tips are enabled -///-- _settings->registerObjectProperty(_mainWindowForm->indenterParameterTooltipsEnabledAction, +///-- _settings->registerObjectProperty(actionIndenterParameterTooltipsEnabled, ///-- "checked", "indenterParameterTooltipsEnabled"); ///-- ///-- // Add the indenters context menu to the mainwindows menu. @@ -459,14 +483,13 @@ MainWindow::MainWindow(TQString file2OpenOnStart, TQWidget *parent) : ///-- } ///-- 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. -///-- */ -///-- void MainWindow::openSourceFileDialog(TQString fileName) -///-- { + +/*! + \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. + */ +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()) @@ -509,15 +532,14 @@ MainWindow::MainWindow(TQString file2OpenOnStart, TQWidget *parent) : ///-- _qSciSourceCodeEditor->setModified(false); ///-- setWindowModified(false); ///-- } -///-- } -///-- -///-- /*! -///-- \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. -///-- */ -///-- bool MainWindow::saveasSourceFileDialog(TQAction *chosenEncodingAction) -///-- { +} + +/*! + \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. + */ +bool MainWindow::saveasSourceFileDialog(TQAction *chosenEncodingAction) +{ ///-- TQString encoding; ///-- TQString fileExtensions = tr("Supported by indenter") + " (" + ///-- _indentHandler->getPossibleIndenterFileExtensions() + ");;" + tr("All files") + " (*.*)"; @@ -561,17 +583,16 @@ MainWindow::MainWindow(TQString file2OpenOnStart, TQWidget *parent) : ///-- setWindowModified(false); ///-- ///-- updateWindowTitle(); -///-- 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. -///-- */ -///-- bool MainWindow::saveSourceFile() -///-- { + 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. + */ +bool MainWindow::saveSourceFile() +{ ///-- if (_currentSourceFile.isEmpty()) ///-- { ///-- return saveasSourceFileDialog(); @@ -593,9 +614,9 @@ MainWindow::MainWindow(TQString file2OpenOnStart, TQWidget *parent) : ///-- _qSciSourceCodeEditor->setModified(false); ///-- setWindowModified(false); ///-- } -///-- return true; -///-- } -///-- + return true; +} + ///-- /*! ///-- \brief Shows a file open dialog. ///-- @@ -946,12 +967,12 @@ MainWindow::MainWindow(TQString file2OpenOnStart, TQWidget *parent) : ///-- this->setWindowTitle("UniversalIndentGUI " + TQString( ///-- PROGRAM_VERSION_STRING) + " [*]" + _currentSourceFile); ///-- } -///-- -///-- /*! -///-- \brief Opens a dialog to save the current source code as a PDF document. -///-- */ -///-- void MainWindow::exportToPDF() -///-- { + +/*! + \brief Opens a dialog to save the current source code as a PDF document. + */ +void MainWindow::exportToPDF() +{ ///-- TQString fileExtensions = tr("PDF Document") + " (*.pdf)"; ///-- ///-- TQString fileName = _currentSourceFile; @@ -969,13 +990,13 @@ MainWindow::MainWindow(TQString file2OpenOnStart, TQWidget *parent) : ///-- printer.setOutputFileName(fileName); ///-- printer.printRange(_qSciSourceCodeEditor); ///-- } -///-- } -///-- -///-- /*! -///-- \brief Opens a dialog to save the current source code as a HTML document. -///-- */ -///-- void MainWindow::exportToHTML() -///-- { +} + +/*! + \brief Opens a dialog to save the current source code as a HTML document. + */ +void MainWindow::exportToHTML() +{ ///-- TQString fileExtensions = tr("HTML Document") + " (*.html)"; ///-- ///-- TQString fileName = _currentSourceFile; @@ -1002,8 +1023,8 @@ MainWindow::MainWindow(TQString file2OpenOnStart, TQWidget *parent) : ///-- outSrcFile.write(sourceCodeAsHTML.toAscii()); ///-- outSrcFile.close(); ///-- } -///-- } -///-- +} + ///-- /*! ///-- \brief Loads the last opened file if this option is enabled in the _settings. ///-- @@ -1107,7 +1128,7 @@ MainWindow::MainWindow(TQString file2OpenOnStart, TQWidget *parent) : ///-- { ///-- if (event->type() == TQEvent::ToolTip) ///-- { -///-- if (_mainWindowForm->indenterParameterTooltipsEnabledAction->isChecked()) +///-- if (actionIndenterParameterTooltipsEnabled->isOn()) ///-- { ///-- return TQMainWindow::eventFilter(obj, event); ///-- } @@ -1220,11 +1241,11 @@ MainWindow::MainWindow(TQString file2OpenOnStart, TQWidget *parent) : ///-- encodingName); ///-- } ///-- -///-- _mainWindowForm->encodingMenu->addActions(_encodingActionGroup->actions()); +///-- _mainWindowForm->popupMenuEncoding->addActions(_encodingActionGroup->actions()); ///-- connect(_encodingActionGroup, SIGNAL(triggered(TQAction*)), this, ///-- SLOT(encodingChanged(TQAction*))); ///-- -///-- _mainWindowForm->saveEncodedMenu->addActions(_saveEncodedActionGroup->actions()); +///-- _mainWindowForm->popupMenuSaveEncoded->addActions(_saveEncodedActionGroup->actions()); ///-- connect(_saveEncodedActionGroup, SIGNAL(triggered(TQAction*)), this, ///-- SLOT(saveAsOtherEncoding(TQAction*))); ///-- } @@ -1301,9 +1322,9 @@ MainWindow::MainWindow(TQString file2OpenOnStart, TQWidget *parent) : ///-- highlighterAction->setStatusTip(tr("Set the syntax highlightning to ") + highlighterName); ///-- highlighterAction->setCheckable(true); ///-- } -///-- _mainWindowForm->highlighterMenu->addActions(_highlighterActionGroup->actions()); -///-- _mainWindowForm->menuSettings->insertMenu(_mainWindowForm->indenterParameterTooltipsEnabledAction, -///-- _mainWindowForm->highlighterMenu); +///-- _mainWindowForm->popupMenuHighlighter->addActions(_highlighterActionGroup->actions()); +///-- _mainWindowForm->menuSettings->insertMenu(actionIndenterParameterTooltipsEnabled, +///-- _mainWindowForm->popupMenuHighlighter); ///-- ///-- connect(_highlighterActionGroup, SIGNAL(triggered(TQAction*)), _highlighter, ///-- SLOT(setHighlighterByAction(TQAction*))); @@ -1378,7 +1399,7 @@ MainWindow::MainWindow(TQString file2OpenOnStart, TQWidget *parent) : ///-- } ///-- ///-- // Translate the _highlighter menu. -///-- TQList<TQAction*> actionList = _mainWindowForm->highlighterMenu->actions(); +///-- TQList<TQAction*> actionList = _mainWindowForm->popupMenuHighlighter->actions(); ///-- i = 0; ///-- foreach(TQString highlighterName, _highlighter->getAvailableHighlighters()) ///-- { @@ -1397,17 +1418,16 @@ MainWindow::MainWindow(TQString file2OpenOnStart, TQWidget *parent) : ///-- TQWidget::changeEvent(event); ///-- } ///-- } -///-- -///-- /*! -///-- \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 -///-- list will be cut off. The new list will be updated to the _settings and -///-- the recently opened menu will be updated too. -///-- */ -///-- void MainWindow::updateRecentlyOpenedList() -///-- { + +/*! + \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 + list will be cut off. The new list will be updated to the _settings and + the recently opened menu will be updated too. + */ +void MainWindow::updateRecentlyOpenedList() +{ ///-- TQString fileName; ///-- TQString filePath; ///-- TQStringList recentlyOpenedList = @@ -1484,22 +1504,22 @@ MainWindow::MainWindow(TQString file2OpenOnStart, TQWidget *parent) : ///-- // Write the new recently opened list to the _settings. ///-- _settings->setValueByName("lastSourceCodeFile", recentlyOpenedList.join("|")); ///-- -///-- // Enable or disable "actionClear_Recently_Opened_List" if list is [not] emtpy +///-- // Enable or disable "actionClearRecentlyOpenedList" if list is [not] emtpy ///-- if (recentlyOpenedList.isEmpty()) ///-- { -///-- _mainWindowForm->actionClear_Recently_Opened_List->setEnabled(false); +///-- _mainWindowForm->actionClearRecentlyOpenedList->setEnabled(false); ///-- } ///-- else ///-- { -///-- _mainWindowForm->actionClear_Recently_Opened_List->setEnabled(true); +///-- _mainWindowForm->actionClearRecentlyOpenedList->setEnabled(true); ///-- } -///-- } -///-- -///-- /*! -///-- \brief This slot empties the list of recently opened files. -///-- */ -///-- void MainWindow::clearRecentlyOpenedList() -///-- { +} + +/*! + \brief This slot empties the list of recently opened files. + */ +void MainWindow::clearRecentlyOpenedList() +{ ///-- TQStringList recentlyOpenedList = ///-- _settings->getValueByName("lastSourceCodeFile").toString().split("|"); ///-- TQList<TQAction*> recentlyOpenedActionList = @@ -1515,24 +1535,24 @@ MainWindow::MainWindow(TQString file2OpenOnStart, TQWidget *parent) : ///-- // Write the new recently opened list to the _settings. ///-- _settings->setValueByName("lastSourceCodeFile", recentlyOpenedList.join("|")); ///-- -///-- // Disable "actionClear_Recently_Opened_List" -///-- _mainWindowForm->actionClear_Recently_Opened_List->setEnabled(false); -///-- } -///-- -///-- /*! -///-- \brief This slot is called if an entry from the list of recently opened files is -///-- being selected. -///-- */ -///-- 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) -///-- { -///-- clearRecentlyOpenedList(); -///-- return; -///-- } -///-- +///-- // Disable "actionClearRecentlyOpenedList" +///-- _mainWindowForm->actionClearRecentlyOpenedList->setEnabled(false); +} + +/*! + \brief This slot is called if an entry from the list of recently opened files is + being selected. + */ +void MainWindow::openFileFromRecentlyOpenedList(int recentlyOpenedActionId) +{ + // 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 (recentlyOpenedActionId == _actionClearRecentlyOpenedListId) + { + clearRecentlyOpenedList(); + return; + } + ///-- TQString fileName = recentlyOpenedAction->text(); ///-- int indexOfSelectedFile = _mainWindowForm->menuRecently_Opened_Files->actions().indexOf( ///-- recentlyOpenedAction); @@ -1558,8 +1578,8 @@ MainWindow::MainWindow(TQString file2OpenOnStart, TQWidget *parent) : ///-- // any of these actions in updateRecentlyOpenedList() causes an error. ///-- TQTimer::singleShot(0, this, SLOT(updateRecentlyOpenedList())); ///-- } -///-- } -///-- +} + ///-- /*! ///-- \brief If the dragged in object contains urls/paths to a file, accept the drag. ///-- */ @@ -1584,19 +1604,19 @@ MainWindow::MainWindow(TQString file2OpenOnStart, TQWidget *parent) : ///-- ///-- event->acceptProposedAction(); ///-- } -///-- -///-- /*! -///-- \brief If the dropped in object contains urls/paths to a file, open that file. -///-- */ -///-- void MainWindow::showAboutDialog() -///-- { + +/*! + \brief Show the About dialog. +*/ +void MainWindow::showAboutDialog() +{ ///-- //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(); -///-- } -///-- +} + ///-- /*! ///-- \brief Sets the label in the status bar to show the \a line and \a column number. ///-- */ @@ -1604,3 +1624,5 @@ MainWindow::MainWindow(TQString file2OpenOnStart, TQWidget *parent) : ///-- { ///-- _textEditLineColumnInfoLabel->setText(tr("Line %1, Column %2").arg(line + 1).arg(column + 1)); ///-- } + +#include "MainWindow.moc" |