summaryrefslogtreecommitdiffstats
path: root/src/MainWindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/MainWindow.cpp')
-rw-r--r--src/MainWindow.cpp71
1 files changed, 31 insertions, 40 deletions
diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp
index 851037b..e771580 100644
--- a/src/MainWindow.cpp
+++ b/src/MainWindow.cpp
@@ -38,6 +38,7 @@
#include <tqapplication.h>
#include <tqcheckbox.h>
#include <tqcursor.h>
+#include <tqdragobject.h>
#include <tqfile.h>
#include <tqfiledialog.h>
#include <tqfileinfo.h>
@@ -56,20 +57,16 @@
#include <tqextscintilla.h>
///-- #include <Qsci/qsciprinter.h>
-///--
-///-- using namespace tschweitzer;
-// \defgroup grp_MainWindow All concerning main window functionality.
+///-- using namespace tschweitzer;
/*
- \class MainWindow
- \ingroup grp_MainWindow
- \brief Is the main window of UniversalIndentGUI
+ \brief Main window of UniversalIndentGUI-tqt
The MainWindow class is responsible for generating and displaying most of the gui elements.
Its look is set in the file "mainwindow.ui". An object for the indent handler is generated here
- and user actions are being controlled. Is responsible for file open dialogs and indenter selection.
+ and user actions are being controlled. It is responsible for file open dialogs and indenter selection.
*/
/*
@@ -82,9 +79,8 @@ MainWindow::MainWindow(TQString file2OpenOnStart, TQWidget *parent) :
m_encodingActionGroup(nullptr), m_saveEncodedActionGroup(nullptr),
m_highlighterActionGroup(nullptr), m_documentModified(false), m_previewToggled(true),
m_indentHandler(nullptr), m_centralSplitter(nullptr), m_settingsDialog(nullptr),
- m_highlighter(nullptr), m_highlightingActions()
-///_aboutDialogGraphicsView(nullptr)
-///- m_textEditVScrollBar(nullptr), _toolBarWidget(nullptr)
+ m_highlighter(nullptr), m_highlightingActions(), m_toolBarWidget(nullptr)
+///_aboutDialogGraphicsView(nullptr), m_textEditVScrollBar(nullptr)
{
// Init of some variables.
m_sourceCodeChanged = false;
@@ -99,7 +95,7 @@ MainWindow::MainWindow(TQString file2OpenOnStart, TQWidget *parent) :
initMainWindow();
// Create toolbar and insert it into the main window.
- initToolBar();
+ initToolBar();
// Create the text edit component using the TQScintilla widget.
initTextEditor();
@@ -120,9 +116,9 @@ MainWindow::MainWindow(TQString file2OpenOnStart, TQWidget *parent) :
///-- _aboutDialogGraphicsView = new AboutDialogGraphicsView(m_aboutDialog, this);
connect(actionAboutUniversalIndentGUITQt, SIGNAL(activated()), this, SLOT(showAboutDialog()));
- // Generate settings dialog box
- m_settingsDialog = new UiGuiSettingsDialog(this, m_settings);
- connect(actionShowSettings, SIGNAL(activated()), m_settingsDialog, SLOT(showDialog()));
+ // Generate settings dialog box
+ m_settingsDialog = new UiGuiSettingsDialog(this, m_settings);
+ connect(actionShowSettings, SIGNAL(activated()), m_settingsDialog, SLOT(showDialog()));
if (TQFile::exists(file2OpenOnStart))
{
@@ -137,8 +133,8 @@ MainWindow::MainWindow(TQString file2OpenOnStart, TQWidget *parent) :
updateSyntaxHighlighting();
-///-- // Enable accept dropping of files.
-///-- setAcceptDrops(true);
+ // Enable accept dropping of files.
+ setAcceptDrops(true);
}
MainWindow::~MainWindow()
@@ -1513,30 +1509,25 @@ 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)
-///-- {
-///-- if (event->mimeData()->hasUrls())
-///-- {
-///-- event->acceptProposedAction();
-///-- }
-///-- }
-///--
-///-- /*
-///-- \brief If the dropped in object contains urls/paths to a file, open that file.
-///-- */
-///-- void MainWindow::dropEvent(TQDropEvent *event)
-///-- {
-///-- if (event->mimeData()->hasUrls())
-///-- {
-///-- TQString filePathName = event->mimeData()->urls().first().toLocalFile();
-///-- openSourceFileDialog(filePathName);
-///-- }
-///--
-///-- event->acceptProposedAction();
-///-- }
+/*
+ \brief If the dragged in object contains urls/paths to a file, accept the drag.
+ */
+void MainWindow::dragEnterEvent(TQDragEnterEvent *event)
+{
+ event->accept(TQUriDrag::canDecode(event));
+}
+
+/*
+ \brief If the dropped in object contains urls/paths to a file, open that file.
+ */
+void MainWindow::dropEvent(TQDropEvent *event)
+{
+ TQStringList droppedFileNames;
+ if (TQUriDrag::decodeLocalFiles(event, droppedFileNames))
+ {
+ openSourceFileDialog(droppedFileNames[0]);
+ }
+}
/*
\brief Show the About dialog.