From ff88a345a86a0e0f043079bc1c669c740b39f513 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Sun, 31 Aug 2014 20:21:31 +0200 Subject: [PATCH] Added GUI for DFN dialog. --- .../src/plugins/georges_editor/CMakeLists.txt | 6 +- .../georges_editor/dfn_browser_ctrl.cpp | 2 + .../plugins/georges_editor/dfn_browser_ctrl.h | 4 + .../georges_editor/georges_dfn_dialog.cpp | 52 +++++++ .../georges_editor/georges_dfn_dialog.h | 24 ++++ .../georges_editor/georges_dfn_dialog.ui | 136 ++++++++++++++++++ .../georges_editor/georges_editor_form.cpp | 15 ++ .../georges_editor/georges_editor_form.h | 2 + 8 files changed, 240 insertions(+), 1 deletion(-) create mode 100644 code/studio/src/plugins/georges_editor/dfn_browser_ctrl.cpp create mode 100644 code/studio/src/plugins/georges_editor/dfn_browser_ctrl.h create mode 100644 code/studio/src/plugins/georges_editor/georges_dfn_dialog.cpp create mode 100644 code/studio/src/plugins/georges_editor/georges_dfn_dialog.h create mode 100644 code/studio/src/plugins/georges_editor/georges_dfn_dialog.ui diff --git a/code/studio/src/plugins/georges_editor/CMakeLists.txt b/code/studio/src/plugins/georges_editor/CMakeLists.txt index c2d3c1da7..62b9de685 100644 --- a/code/studio/src/plugins/georges_editor/CMakeLists.txt +++ b/code/studio/src/plugins/georges_editor/CMakeLists.txt @@ -18,11 +18,15 @@ SET(OVQT_PLUG_GEORGES_EDITOR_HDR georges_editor_plugin.h expandable_headerview.h browser_ctrl.h browser_ctrl_pvt.h + dfn_browser_ctrl.h + georges_dfn_dialog.h ) SET(OVQT_PLUG_GEORGES_EDITOR_UIS georges_editor_form.ui georges_dirtree_form.ui - georges_treeview_form.ui) + georges_treeview_form.ui + georges_dfn_dialog.ui + ) SET(OVQT_PLUGIN_GEORGES_EDITOR_RCS georges_editor.qrc) diff --git a/code/studio/src/plugins/georges_editor/dfn_browser_ctrl.cpp b/code/studio/src/plugins/georges_editor/dfn_browser_ctrl.cpp new file mode 100644 index 000000000..4183e6f6c --- /dev/null +++ b/code/studio/src/plugins/georges_editor/dfn_browser_ctrl.cpp @@ -0,0 +1,2 @@ +#include "dfn_browser_ctrl.h" + diff --git a/code/studio/src/plugins/georges_editor/dfn_browser_ctrl.h b/code/studio/src/plugins/georges_editor/dfn_browser_ctrl.h new file mode 100644 index 000000000..fae44bd1e --- /dev/null +++ b/code/studio/src/plugins/georges_editor/dfn_browser_ctrl.h @@ -0,0 +1,4 @@ +#ifndef DFN_BROWSER_CTRL +#define DFN_BROWSER_CTRL +#endif + diff --git a/code/studio/src/plugins/georges_editor/georges_dfn_dialog.cpp b/code/studio/src/plugins/georges_editor/georges_dfn_dialog.cpp new file mode 100644 index 000000000..e9441aa6e --- /dev/null +++ b/code/studio/src/plugins/georges_editor/georges_dfn_dialog.cpp @@ -0,0 +1,52 @@ +#include "georges_dfn_dialog.h" +#include +#include + +GeorgesDFNDialog::GeorgesDFNDialog( QWidget *parent ) : +QDockWidget( parent ) +{ + m_ui.setupUi( this ); + setupConnections(); + + m_ui.addButton->setEnabled( false ); + m_ui.removeButton->setEnabled( false ); +} + +GeorgesDFNDialog::~GeorgesDFNDialog() +{ +} + +void GeorgesDFNDialog::onAddClicked() +{ + QString name = QInputDialog::getText( this, + tr( "New element" ), + tr( "Enter name of the new element" ) ); + + QList< QListWidgetItem* > list = m_ui.list->findItems( name, Qt::MatchFixedString ); + if( !list.isEmpty() ) + { + QMessageBox::information( this, + tr( "Item already exists" ), + tr( "That item already exists!" ) ); + return; + } + + m_ui.list->addItem( name ); +} + +void GeorgesDFNDialog::onRemoveClicked() +{ + int row = m_ui.list->currentRow(); + if( row < 0 ) + return; + + QListWidgetItem *item = m_ui.list->takeItem( row ); + delete item; +} + +void GeorgesDFNDialog::setupConnections() +{ + connect( m_ui.addButton, SIGNAL( clicked( bool ) ), this, SLOT( onAddClicked() ) ); + connect( m_ui.removeButton, SIGNAL( clicked( bool ) ), this, SLOT( onRemoveClicked() ) ); +} + diff --git a/code/studio/src/plugins/georges_editor/georges_dfn_dialog.h b/code/studio/src/plugins/georges_editor/georges_dfn_dialog.h new file mode 100644 index 000000000..d8811e8ed --- /dev/null +++ b/code/studio/src/plugins/georges_editor/georges_dfn_dialog.h @@ -0,0 +1,24 @@ +#ifndef GEORGES_DFN_DIALOG +#define GEORGES_DFN_DIALOG + +#include "ui_georges_dfn_dialog.h" + +class GeorgesDFNDialog : public QDockWidget +{ + Q_OBJECT +public: + GeorgesDFNDialog( QWidget *parent = NULL ); + ~GeorgesDFNDialog(); + +private Q_SLOTS: + void onAddClicked(); + void onRemoveClicked(); + +private: + void setupConnections(); + + Ui::GeorgesDFNDialog m_ui; +}; + +#endif + diff --git a/code/studio/src/plugins/georges_editor/georges_dfn_dialog.ui b/code/studio/src/plugins/georges_editor/georges_dfn_dialog.ui new file mode 100644 index 000000000..3cbdb7419 --- /dev/null +++ b/code/studio/src/plugins/georges_editor/georges_dfn_dialog.ui @@ -0,0 +1,136 @@ + + + GeorgesDFNDialog + + + + 0 + 0 + 693 + 559 + + + + + + + + + + + QTabWidget::West + + + QTabWidget::Rounded + + + 0 + + + false + + + false + + + + + + + Dfn + + + + + + Qt::Horizontal + + + + + + + + + + 0 + 0 + + + + Add + + + + + + + + 0 + 0 + + + + Remove + + + + + + + Qt::Horizontal + + + + 466 + 20 + + + + + + + + + Comments + + + + + + Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + + + Log + + + + + + Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + + + + + + + + QtTreePropertyBrowser + QWidget +
qttreepropertybrowser.h
+ 1 +
+
+ + +
diff --git a/code/studio/src/plugins/georges_editor/georges_editor_form.cpp b/code/studio/src/plugins/georges_editor/georges_editor_form.cpp index 166243adf..9e47fd4cb 100644 --- a/code/studio/src/plugins/georges_editor/georges_editor_form.cpp +++ b/code/studio/src/plugins/georges_editor/georges_editor_form.cpp @@ -20,6 +20,7 @@ #include "georges_editor_constants.h" #include "georges_dirtree_dialog.h" #include "georges_treeview_dialog.h" +#include "georges_dfn_dialog.h" #include "../core/icore.h" #include "../core/menu_manager.h" @@ -216,6 +217,12 @@ namespace GeorgesQt } } + if( info.suffix() == "dfn" ) + { + loadDfnDialog( fileName ); + return; + } + CGeorgesTreeViewDialog *dock = new CGeorgesTreeViewDialog(m_mainDock); dock->setUndoStack(UndoStack); m_lastActiveDock = dock; @@ -319,4 +326,12 @@ namespace GeorgesQt } } } + + + void GeorgesEditorForm::loadDfnDialog( const QString &fileName ) + { + GeorgesDFNDialog *d = new GeorgesDFNDialog(); + m_mainDock->addDockWidget( Qt::RightDockWidgetArea, d ); + } + } /* namespace GeorgesQt */ diff --git a/code/studio/src/plugins/georges_editor/georges_editor_form.h b/code/studio/src/plugins/georges_editor/georges_editor_form.h index 6b4e33fcd..a1a4df0d4 100644 --- a/code/studio/src/plugins/georges_editor/georges_editor_form.h +++ b/code/studio/src/plugins/georges_editor/georges_editor_form.h @@ -56,6 +56,8 @@ private: void readSettings(); void writeSettings(); + void loadDfnDialog(const QString &fileName); + Ui::GeorgesEditorForm m_ui; CGeorgesDirTreeDialog *m_georgesDirTreeDialog;