Added GUI for DFN dialog.

This commit is contained in:
dfighter1985 2014-08-31 20:21:31 +02:00
parent 59a4f6e677
commit a0df8bf7c7
8 changed files with 240 additions and 1 deletions

View file

@ -18,11 +18,15 @@ SET(OVQT_PLUG_GEORGES_EDITOR_HDR georges_editor_plugin.h
expandable_headerview.h expandable_headerview.h
browser_ctrl.h browser_ctrl.h
browser_ctrl_pvt.h browser_ctrl_pvt.h
dfn_browser_ctrl.h
georges_dfn_dialog.h
) )
SET(OVQT_PLUG_GEORGES_EDITOR_UIS georges_editor_form.ui SET(OVQT_PLUG_GEORGES_EDITOR_UIS georges_editor_form.ui
georges_dirtree_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) SET(OVQT_PLUGIN_GEORGES_EDITOR_RCS georges_editor.qrc)

View file

@ -0,0 +1,2 @@
#include "dfn_browser_ctrl.h"

View file

@ -0,0 +1,4 @@
#ifndef DFN_BROWSER_CTRL
#define DFN_BROWSER_CTRL
#endif

View file

@ -0,0 +1,52 @@
#include "georges_dfn_dialog.h"
#include <QInputDialog>
#include <QMessageBox>
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() ) );
}

View file

@ -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

View file

@ -0,0 +1,136 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>GeorgesDFNDialog</class>
<widget class="QDockWidget" name="GeorgesDFNDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>693</width>
<height>559</height>
</rect>
</property>
<property name="windowTitle">
<string/>
</property>
<widget class="QWidget" name="dockWidgetContents">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QTabWidget" name="tabWidget">
<property name="tabPosition">
<enum>QTabWidget::West</enum>
</property>
<property name="tabShape">
<enum>QTabWidget::Rounded</enum>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<property name="documentMode">
<bool>false</bool>
</property>
<property name="movable">
<bool>false</bool>
</property>
<widget class="QWidget" name="dfnTab">
<property name="accessibleName">
<string/>
</property>
<attribute name="title">
<string>Dfn</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0" colspan="3">
<widget class="QSplitter" name="splitter">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<widget class="QListWidget" name="list"/>
<widget class="QtTreePropertyBrowser" name="browser" native="true"/>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="addButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Add</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="removeButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Remove</string>
</property>
</widget>
</item>
<item row="1" column="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>466</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="commentTab">
<attribute name="title">
<string>Comments</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QPlainTextEdit" name="commentsEdit">
<property name="textInteractionFlags">
<set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="logTab">
<attribute name="title">
<string>Log</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QPlainTextEdit" name="logEdit">
<property name="textInteractionFlags">
<set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
</widget>
<customwidgets>
<customwidget>
<class>QtTreePropertyBrowser</class>
<extends>QWidget</extends>
<header>qttreepropertybrowser.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View file

@ -20,6 +20,7 @@
#include "georges_editor_constants.h" #include "georges_editor_constants.h"
#include "georges_dirtree_dialog.h" #include "georges_dirtree_dialog.h"
#include "georges_treeview_dialog.h" #include "georges_treeview_dialog.h"
#include "georges_dfn_dialog.h"
#include "../core/icore.h" #include "../core/icore.h"
#include "../core/menu_manager.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); CGeorgesTreeViewDialog *dock = new CGeorgesTreeViewDialog(m_mainDock);
dock->setUndoStack(UndoStack); dock->setUndoStack(UndoStack);
m_lastActiveDock = dock; 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 */ } /* namespace GeorgesQt */

View file

@ -56,6 +56,8 @@ private:
void readSettings(); void readSettings();
void writeSettings(); void writeSettings();
void loadDfnDialog(const QString &fileName);
Ui::GeorgesEditorForm m_ui; Ui::GeorgesEditorForm m_ui;
CGeorgesDirTreeDialog *m_georgesDirTreeDialog; CGeorgesDirTreeDialog *m_georgesDirTreeDialog;