Added support for new typ document creation.

This commit is contained in:
dfighter1985 2014-09-03 19:28:01 +02:00
parent 3e3a9b8585
commit d139bc9f8d
4 changed files with 50 additions and 19 deletions

View file

@ -142,6 +142,18 @@ namespace GeorgesQt
void GeorgesEditorForm::newTyp()
{
QString fileName = QFileDialog::getSaveFileName( this,
tr( "New Type" ),
"",
"Type files (*.typ)" );
if( fileName.isEmpty() )
return;
GeorgesTypDialog *d = new GeorgesTypDialog();
d->newDocument( fileName );
addGeorgesWidget( d );
setModified();
}
void GeorgesEditorForm::newDfn()
@ -190,6 +202,28 @@ namespace GeorgesQt
settings->sync();
}
void GeorgesEditorForm::addGeorgesWidget( GeorgesDockWidget *w )
{
w->setUndoStack(UndoStack);
m_lastActiveDock = w;
m_dockedWidgets.append(w);
connect(m_dockedWidgets.last(), SIGNAL(closing()), this, SLOT(closingTreeView()));
connect(m_dockedWidgets.last(), SIGNAL(visibilityChanged(bool)), m_dockedWidgets.last(), SLOT(checkVisibility(bool)));
// If there is more than one form open - tabify the new form. If this is the first form open add it to the dock.
if(m_dockedWidgets.size() > 1)
{
m_mainDock->tabifyDockWidget(m_dockedWidgets.at(m_dockedWidgets.size() - 2), m_dockedWidgets.last());
}
else
{
m_mainDock->addDockWidget(Qt::RightDockWidgetArea, m_dockedWidgets.last());
}
w->raise();
}
void GeorgesEditorForm::settingsChanged()
{
QSettings *settings = Core::ICore::instance()->settings();
@ -255,25 +289,7 @@ namespace GeorgesQt
return;
}
w->setUndoStack(UndoStack);
m_lastActiveDock = w;
m_dockedWidgets.append(w);
connect(m_dockedWidgets.last(), SIGNAL(closing()), this, SLOT(closingTreeView()));
connect(m_dockedWidgets.last(), SIGNAL(visibilityChanged(bool)), m_dockedWidgets.last(), SLOT(checkVisibility(bool)));
// If there is more than one form open - tabify the new form. If this is the first form open add it to the dock.
if(m_dockedWidgets.size() > 1)
{
m_mainDock->tabifyDockWidget(m_dockedWidgets.at(m_dockedWidgets.size() - 2), m_dockedWidgets.last());
}
else
{
m_mainDock->addDockWidget(Qt::RightDockWidgetArea, m_dockedWidgets.last());
}
w->raise();
addGeorgesWidget( w );
}
void GeorgesEditorForm::closingTreeView()

View file

@ -61,6 +61,8 @@ private:
void readSettings();
void writeSettings();
void addGeorgesWidget( GeorgesDockWidget *w );
GeorgesDockWidget* loadTypDialog(const QString &fileName);
GeorgesDockWidget* loadDfnDialog(const QString &fileName);
GeorgesDockWidget* loadFormDialog(const QString &fileName);

View file

@ -105,6 +105,18 @@ void GeorgesTypDialog::write()
setWindowTitle( windowTitle().remove( "*" ) );
}
void GeorgesTypDialog::newDocument( const QString &fileName )
{
m_pvt->typ = new NLGEORGES::CType();
m_fileName = fileName;
QFileInfo info( fileName );
setWindowTitle( info.fileName() + "*" );
setModified( true );
loadTyp();
}
void GeorgesTypDialog::onAddClicked()
{
QString label = QInputDialog::getText( this,

View file

@ -33,6 +33,7 @@ public:
bool load( const QString &fileName );
void write();
void newDocument( const QString &fileName );
Q_SIGNALS:
void modified();