|
|
@ -39,6 +39,7 @@
|
|
|
|
#include <tqcheckbox.h>
|
|
|
|
#include <tqcheckbox.h>
|
|
|
|
#include <tqcursor.h>
|
|
|
|
#include <tqcursor.h>
|
|
|
|
#include <tqfile.h>
|
|
|
|
#include <tqfile.h>
|
|
|
|
|
|
|
|
#include <tqfiledialog.h>
|
|
|
|
#include <tqfileinfo.h>
|
|
|
|
#include <tqfileinfo.h>
|
|
|
|
#include <tqlabel.h>
|
|
|
|
#include <tqlabel.h>
|
|
|
|
#include <tqlocale.h>
|
|
|
|
#include <tqlocale.h>
|
|
|
@ -53,7 +54,6 @@
|
|
|
|
///-- #include <tqstring.h>
|
|
|
|
///-- #include <tqstring.h>
|
|
|
|
///-- #include <tqscrollbar.h>
|
|
|
|
///-- #include <tqscrollbar.h>
|
|
|
|
///-- #include <tqtextcursor.h>
|
|
|
|
///-- #include <tqtextcursor.h>
|
|
|
|
///-- #include <tqfiledialog.h>
|
|
|
|
|
|
|
|
///-- #include <tqtextstream.h>
|
|
|
|
///-- #include <tqtextstream.h>
|
|
|
|
///-- #include <tqtextdocument.h>
|
|
|
|
///-- #include <tqtextdocument.h>
|
|
|
|
///-- #include <tqprinter.h>
|
|
|
|
///-- #include <tqprinter.h>
|
|
|
@ -156,12 +156,12 @@ MainWindow::MainWindow(TQString file2OpenOnStart, TQWidget *parent) :
|
|
|
|
MainWindow::~MainWindow()
|
|
|
|
MainWindow::~MainWindow()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
delete m_aboutDialog;
|
|
|
|
delete m_aboutDialog;
|
|
|
|
///-- _settings.clear();
|
|
|
|
UiGuiSettings::deleteInstance();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
///-- /*
|
|
|
|
/*
|
|
|
|
///-- \brief Initializes the main window by creating the main gui and make some _settings.
|
|
|
|
\brief Initializes the main window by creating the main gui and make some settings.
|
|
|
|
///-- */
|
|
|
|
*/
|
|
|
|
void MainWindow::initMainWindow()
|
|
|
|
void MainWindow::initMainWindow()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// For icon setup
|
|
|
|
// For icon setup
|
|
|
@ -296,11 +296,6 @@ void MainWindow::initToolBar()
|
|
|
|
void MainWindow::initTextEditor()
|
|
|
|
void MainWindow::initTextEditor()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Create the TQScintilla widget and add it to the layout.
|
|
|
|
// 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
|
|
|
|
try
|
|
|
|
{
|
|
|
|
{
|
|
|
|
m_qSciSourceCodeEditor = new TQextScintilla(this);
|
|
|
|
m_qSciSourceCodeEditor = new TQextScintilla(this);
|
|
|
@ -504,52 +499,54 @@ TQString MainWindow::loadFile(const TQString &filePath)
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
\brief Calls the source file open dialog to load a source file for the formatting preview.
|
|
|
|
\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.
|
|
|
|
If the file was successfully loaded, the indenter will be called to generate the formatted source code.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
void MainWindow::openSourceFileDialog(TQString fileName)
|
|
|
|
void MainWindow::openSourceFileDialog(const TQString &fileName)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
///-- // If the source code file is changed and the shown dialog for saving the file
|
|
|
|
// If the source code file is changed and the shown dialog for saving the file
|
|
|
|
///-- // is canceled, also stop opening another source file.
|
|
|
|
// is canceled, also stop opening another source file.
|
|
|
|
///-- if (!maybeSave())
|
|
|
|
if (!maybeSave())
|
|
|
|
///-- {
|
|
|
|
{
|
|
|
|
///-- return;
|
|
|
|
return;
|
|
|
|
///-- }
|
|
|
|
}
|
|
|
|
///-- TQString openedSourceFileContent = "";
|
|
|
|
TQString openedSourceFileContent = "";
|
|
|
|
|
|
|
|
TQString fileExtensions = "*.h *.c *.cpp *.*"; // Remove this line when the indenter is available
|
|
|
|
///-- TQString fileExtensions = tr("Supported by indenter") + " (" +
|
|
|
|
///-- TQString fileExtensions = tr("Supported by indenter") + " (" +
|
|
|
|
///-- _indentHandler->getPossibleIndenterFileExtensions() + ");;" + tr("All files") + " (*.*)";
|
|
|
|
///-- _indentHandler->getPossibleIndenterFileExtensions() + ");;" + tr("All files") + " (*.*)";
|
|
|
|
///--
|
|
|
|
///--
|
|
|
|
///-- //TQString openedSourceFileContent = openFileDialog( tr("Choose source code file"), "./",
|
|
|
|
///-- //TQString openedSourceFileContent = openFileDialog( tr("Choose source code file"), "./",
|
|
|
|
///-- // fileExtensions );
|
|
|
|
///-- // fileExtensions );
|
|
|
|
///-- if (fileName.isEmpty())
|
|
|
|
TQString fileToOpen = fileName;
|
|
|
|
///-- {
|
|
|
|
if (fileToOpen.isEmpty())
|
|
|
|
///-- fileName = TQFileDialog::getOpenFileName(this, tr(
|
|
|
|
{
|
|
|
|
///-- "Choose source code file"), m_currentSourceFile, fileExtensions);
|
|
|
|
fileToOpen = TQFileDialog::getOpenFileName(m_currentSourceFile, fileExtensions, this, nullptr,
|
|
|
|
///-- }
|
|
|
|
tr("Choose source code file"));
|
|
|
|
///--
|
|
|
|
}
|
|
|
|
///-- if (fileName != "")
|
|
|
|
|
|
|
|
///-- {
|
|
|
|
if (!fileToOpen.isEmpty())
|
|
|
|
///-- m_currentSourceFile = fileName;
|
|
|
|
{
|
|
|
|
///-- TQFileInfo fileInfo(fileName);
|
|
|
|
m_currentSourceFile = fileToOpen;
|
|
|
|
///-- m_currentSourceFileExtension = fileInfo.suffix();
|
|
|
|
TQFileInfo fileInfo(fileToOpen);
|
|
|
|
///--
|
|
|
|
m_currentSourceFileExtension = fileInfo.extension(false);
|
|
|
|
///-- openedSourceFileContent = loadFile(fileName);
|
|
|
|
|
|
|
|
///-- m_sourceFileContent = openedSourceFileContent;
|
|
|
|
openedSourceFileContent = loadFile(fileToOpen);
|
|
|
|
///-- if (m_toolBarWidget->cbLivePreview->isChecked())
|
|
|
|
m_sourceFileContent = openedSourceFileContent;
|
|
|
|
///-- {
|
|
|
|
if (m_toolBarWidget->cbLivePreview->isChecked())
|
|
|
|
///-- callIndenter();
|
|
|
|
{
|
|
|
|
///-- }
|
|
|
|
callIndenter();
|
|
|
|
///-- m_sourceCodeChanged = true;
|
|
|
|
}
|
|
|
|
///-- m_previewToggled = true;
|
|
|
|
m_sourceCodeChanged = true;
|
|
|
|
///-- updateSourceView();
|
|
|
|
m_previewToggled = true;
|
|
|
|
///-- updateWindowTitle();
|
|
|
|
updateSourceView();
|
|
|
|
///-- updateRecentlyOpenedList();
|
|
|
|
updateWindowTitle();
|
|
|
|
|
|
|
|
updateRecentlyOpenedList();
|
|
|
|
///-- _textEditLastScrollPos = 0;
|
|
|
|
///-- _textEditLastScrollPos = 0;
|
|
|
|
///-- m_textEditVScrollBar->setValue(_textEditLastScrollPos);
|
|
|
|
///-- m_textEditVScrollBar->setValue(_textEditLastScrollPos);
|
|
|
|
///--
|
|
|
|
|
|
|
|
///-- m_savedSourceContent = openedSourceFileContent;
|
|
|
|
m_savedSourceContent = openedSourceFileContent;
|
|
|
|
///-- m_qSciSourceCodeEditor->setModified(false);
|
|
|
|
m_qSciSourceCodeEditor->setModified(false);
|
|
|
|
///-- m_documentModified = false;
|
|
|
|
m_documentModified = false;
|
|
|
|
///-- }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
@ -689,19 +686,19 @@ void MainWindow::updateSourceView()
|
|
|
|
///-- m_textEditVScrollBar->setValue(_textEditLastScrollPos);
|
|
|
|
///-- m_textEditVScrollBar->setValue(_textEditLastScrollPos);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
///-- /*
|
|
|
|
/*
|
|
|
|
///-- \brief Calls the selected indenter with the currently loaded source code to retrieve the formatted source code.
|
|
|
|
\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.
|
|
|
|
The original loaded source code file will not be changed.
|
|
|
|
///-- */
|
|
|
|
*/
|
|
|
|
///-- void MainWindow::callIndenter()
|
|
|
|
void MainWindow::callIndenter()
|
|
|
|
///-- {
|
|
|
|
{
|
|
|
|
///-- TQApplication::setOverrideCursor(TQCursor(TQt::WaitCursor));
|
|
|
|
TQApplication::setOverrideCursor(TQCursor(TQt::WaitCursor));
|
|
|
|
///-- m_sourceFormattedContent = _indentHandler->callIndenter(m_sourceFileContent,
|
|
|
|
///-- m_sourceFormattedContent = _indentHandler->callIndenter(m_sourceFileContent,
|
|
|
|
///-- m_currentSourceFileExtension);
|
|
|
|
///-- m_currentSourceFileExtension);
|
|
|
|
///-- //updateSourceView();
|
|
|
|
updateSourceView();
|
|
|
|
///-- TQApplication::restoreOverrideCursor();
|
|
|
|
TQApplication::restoreOverrideCursor();
|
|
|
|
///-- }
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
\brief Switches the syntax highlighting corresponding to the value \a turnOn either on or off.
|
|
|
|
\brief Switches the syntax highlighting corresponding to the value \a turnOn either on or off.
|
|
|
|