Added support for new typ document creation.
--HG-- branch : dfighter-tools
This commit is contained in:
parent
22d1fe0cbc
commit
ca127f756c
4 changed files with 50 additions and 19 deletions
|
@ -142,6 +142,18 @@ namespace GeorgesQt
|
||||||
|
|
||||||
void GeorgesEditorForm::newTyp()
|
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()
|
void GeorgesEditorForm::newDfn()
|
||||||
|
@ -190,6 +202,28 @@ namespace GeorgesQt
|
||||||
settings->sync();
|
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()
|
void GeorgesEditorForm::settingsChanged()
|
||||||
{
|
{
|
||||||
QSettings *settings = Core::ICore::instance()->settings();
|
QSettings *settings = Core::ICore::instance()->settings();
|
||||||
|
@ -255,25 +289,7 @@ namespace GeorgesQt
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
w->setUndoStack(UndoStack);
|
addGeorgesWidget( w );
|
||||||
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::closingTreeView()
|
void GeorgesEditorForm::closingTreeView()
|
||||||
|
|
|
@ -61,6 +61,8 @@ private:
|
||||||
void readSettings();
|
void readSettings();
|
||||||
void writeSettings();
|
void writeSettings();
|
||||||
|
|
||||||
|
void addGeorgesWidget( GeorgesDockWidget *w );
|
||||||
|
|
||||||
GeorgesDockWidget* loadTypDialog(const QString &fileName);
|
GeorgesDockWidget* loadTypDialog(const QString &fileName);
|
||||||
GeorgesDockWidget* loadDfnDialog(const QString &fileName);
|
GeorgesDockWidget* loadDfnDialog(const QString &fileName);
|
||||||
GeorgesDockWidget* loadFormDialog(const QString &fileName);
|
GeorgesDockWidget* loadFormDialog(const QString &fileName);
|
||||||
|
|
|
@ -105,6 +105,18 @@ void GeorgesTypDialog::write()
|
||||||
setWindowTitle( windowTitle().remove( "*" ) );
|
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()
|
void GeorgesTypDialog::onAddClicked()
|
||||||
{
|
{
|
||||||
QString label = QInputDialog::getText( this,
|
QString label = QInputDialog::getText( this,
|
||||||
|
|
|
@ -33,6 +33,7 @@ public:
|
||||||
|
|
||||||
bool load( const QString &fileName );
|
bool load( const QString &fileName );
|
||||||
void write();
|
void write();
|
||||||
|
void newDocument( const QString &fileName );
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void modified();
|
void modified();
|
||||||
|
|
Loading…
Reference in a new issue