|
|
|
@ -185,31 +185,18 @@ void MainWindow::initMainWindow()
|
|
|
|
|
_actionClearRecentlyOpenedListId = popupMenuRecentlyOpenedFiles->idAt(
|
|
|
|
|
popupMenuRecentlyOpenedFiles->count() - 1);
|
|
|
|
|
|
|
|
|
|
///-- // Handle last opened window size
|
|
|
|
|
///-- // ------------------------------
|
|
|
|
|
///-- bool maximized = _settings->getValueByName("maximized").toBool();
|
|
|
|
|
///-- TQPoint pos = _settings->getValueByName("position").toPoint();
|
|
|
|
|
///-- TQSize size = _settings->getValueByName("size").toSize();
|
|
|
|
|
///-- resize(size);
|
|
|
|
|
///-- move(pos);
|
|
|
|
|
///-- if (maximized)
|
|
|
|
|
///-- {
|
|
|
|
|
///-- showMaximized();
|
|
|
|
|
///-- }
|
|
|
|
|
///--
|
|
|
|
|
///-- // Handle if first run of this version
|
|
|
|
|
///-- // -----------------------------------
|
|
|
|
|
///-- TQString readVersion = _settings->getValueByName("version").toString();
|
|
|
|
|
///-- // If version strings are not equal set first run true.
|
|
|
|
|
///-- if (readVersion != PROGRAM_VERSION_STRING)
|
|
|
|
|
///-- {
|
|
|
|
|
///-- _isFirstRunOfThisVersion = true;
|
|
|
|
|
///-- }
|
|
|
|
|
///-- else
|
|
|
|
|
///-- {
|
|
|
|
|
///-- _isFirstRunOfThisVersion = false;
|
|
|
|
|
///-- }
|
|
|
|
|
///--
|
|
|
|
|
// Handle last opened window size
|
|
|
|
|
// ------------------------------
|
|
|
|
|
bool maximized = m_settings->getValueByName("WindowIsMaximized").toBool();
|
|
|
|
|
TQPoint pos = m_settings->getValueByName("WindowPosition").toPoint();
|
|
|
|
|
TQSize size = m_settings->getValueByName("WindowSize").toSize();
|
|
|
|
|
resize(size);
|
|
|
|
|
move(pos);
|
|
|
|
|
if (maximized)
|
|
|
|
|
{
|
|
|
|
|
showMaximized();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
///-- // Get last selected file encoding
|
|
|
|
|
///-- // -------------------------------
|
|
|
|
|
///-- _currentEncoding = _settings->getValueByName("encoding").toString();
|
|
|
|
@ -1078,44 +1065,44 @@ void MainWindow::exportToHTML()
|
|
|
|
|
///-- // Update the mainwindow title to show the name of the loaded source code file.
|
|
|
|
|
///-- 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.
|
|
|
|
|
///-- */
|
|
|
|
|
///-- void MainWindow::saveSettings()
|
|
|
|
|
///-- {
|
|
|
|
|
///-- _settings->setValueByName("encoding", _currentEncoding);
|
|
|
|
|
///-- _settings->setValueByName("version", PROGRAM_VERSION_STRING);
|
|
|
|
|
///-- _settings->setValueByName("maximized", isMaximized());
|
|
|
|
|
///-- if (!isMaximized())
|
|
|
|
|
///-- {
|
|
|
|
|
///-- _settings->setValueByName("position", pos());
|
|
|
|
|
///-- _settings->setValueByName("size", size());
|
|
|
|
|
///-- }
|
|
|
|
|
///-- _settings->setValueByName("MainWindowState", saveState());
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
\brief Saves the m_settings for the main application to the file "UniversalIndentGUI.ini".
|
|
|
|
|
|
|
|
|
|
Settings are for example last selected indenter, last loaded config file and so on.
|
|
|
|
|
*/
|
|
|
|
|
void MainWindow::saveSettings()
|
|
|
|
|
{
|
|
|
|
|
///-- m_settings->setValueByName("encoding", _currentEncoding);
|
|
|
|
|
///-- m_settings->setValueByName("version", PROGRAM_VERSION_STRING);
|
|
|
|
|
m_settings->setValueByName("WindowIsMaximized", isMaximized());
|
|
|
|
|
if (!isMaximized())
|
|
|
|
|
{
|
|
|
|
|
m_settings->setValueByName("WindowPosition", pos());
|
|
|
|
|
m_settings->setValueByName("WindowSize", size());
|
|
|
|
|
}
|
|
|
|
|
///-- m_settings->setValueByName("MainWindowState", saveState());
|
|
|
|
|
///--
|
|
|
|
|
///-- // Also save the syntax highlight style for all lexers.
|
|
|
|
|
///-- _highlighter->writeCurrentSettings("");
|
|
|
|
|
///-- }
|
|
|
|
|
///--
|
|
|
|
|
///-- /*
|
|
|
|
|
///-- \brief Is always called when the program is quit. Calls the saveSettings function before really quits.
|
|
|
|
|
///-- */
|
|
|
|
|
///-- void MainWindow::closeEvent(TQCloseEvent *event)
|
|
|
|
|
///-- {
|
|
|
|
|
///-- if (maybeSave())
|
|
|
|
|
///-- {
|
|
|
|
|
///-- saveSettings();
|
|
|
|
|
///-- event->accept();
|
|
|
|
|
///-- }
|
|
|
|
|
///-- else
|
|
|
|
|
///-- {
|
|
|
|
|
///-- event->ignore();
|
|
|
|
|
///-- }
|
|
|
|
|
///-- }
|
|
|
|
|
///--
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
\brief Called when the program exits. Calls the saveSettings function before really quits.
|
|
|
|
|
*/
|
|
|
|
|
void MainWindow::closeEvent(TQCloseEvent *event)
|
|
|
|
|
{
|
|
|
|
|
if (maybeSave())
|
|
|
|
|
{
|
|
|
|
|
saveSettings();
|
|
|
|
|
event->accept();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
event->ignore();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
///-- /*
|
|
|
|
|
///-- \brief This function is setup to capture tooltip events.
|
|
|
|
|
///--
|
|
|
|
@ -1143,12 +1130,13 @@ void MainWindow::exportToHTML()
|
|
|
|
|
///-- return TQMainWindow::eventFilter(obj, event);
|
|
|
|
|
///-- }
|
|
|
|
|
///-- }
|
|
|
|
|
///--
|
|
|
|
|
///-- /*
|
|
|
|
|
///-- \brief Is called at application exit and asks whether to save the source code file, if it has been changed.
|
|
|
|
|
///-- */
|
|
|
|
|
///-- bool MainWindow::maybeSave()
|
|
|
|
|
///-- {
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
\brief Is called at application exit and asks whether to save the source code file,
|
|
|
|
|
if it has been changed.
|
|
|
|
|
*/
|
|
|
|
|
bool MainWindow::maybeSave()
|
|
|
|
|
{
|
|
|
|
|
///-- if (isWindowModified())
|
|
|
|
|
///-- {
|
|
|
|
|
///-- int ret = TQMessageBox::warning(this, tr("Modified code"), tr(
|
|
|
|
@ -1163,9 +1151,9 @@ void MainWindow::exportToHTML()
|
|
|
|
|
///-- return false;
|
|
|
|
|
///-- }
|
|
|
|
|
///-- }
|
|
|
|
|
///-- return true;
|
|
|
|
|
///-- }
|
|
|
|
|
///--
|
|
|
|
|
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.
|
|
|
|
|