|
|
|
@ -92,6 +92,13 @@ namespace GeorgesQt
|
|
|
|
|
addDockWidget(Qt::LeftDockWidgetArea, m_georgesDirTreeDialog);
|
|
|
|
|
restoreDockWidget(m_georgesDirTreeDialog);
|
|
|
|
|
|
|
|
|
|
// Set the default sheet dir dir to the level design path.
|
|
|
|
|
m_lastSheetDir = ".";
|
|
|
|
|
QSettings *settings = Core::ICore::instance()->settings();
|
|
|
|
|
settings->beginGroup(Core::Constants::DATA_PATH_SECTION);
|
|
|
|
|
m_lastSheetDir = settings->value(Core::Constants::LEVELDESIGN_PATH, "l:/leveldesign").toString();
|
|
|
|
|
settings->endGroup();
|
|
|
|
|
|
|
|
|
|
connect(Core::ICore::instance(), SIGNAL(changeSettings()),
|
|
|
|
|
this, SLOT(settingsChanged()));
|
|
|
|
|
connect(m_georgesDirTreeDialog, SIGNAL(selectedForm(const QString)),
|
|
|
|
@ -117,9 +124,19 @@ namespace GeorgesQt
|
|
|
|
|
loadFile(fileName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GeorgesEditorForm::newFile()
|
|
|
|
|
void GeorgesEditorForm::newFile()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// Assume it is a form, for now. We'll have to retrieve the DFN we'll be using as a base.
|
|
|
|
|
QString fileName = QFileDialog::getOpenFileName(this, tr("Select Base Form Definition"), m_lastSheetDir, "Form Definition (*.dfn)");
|
|
|
|
|
if(!fileName.isNull())
|
|
|
|
|
{
|
|
|
|
|
// Use the file loader to create the new form.
|
|
|
|
|
loadFile(fileName, true);
|
|
|
|
|
|
|
|
|
|
// Save the folder we just opened for future dialogs.
|
|
|
|
|
QFileInfo pathInfo( fileName );
|
|
|
|
|
m_lastSheetDir = pathInfo.absolutePath();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GeorgesEditorForm::save()
|
|
|
|
@ -171,26 +188,18 @@ namespace GeorgesQt
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GeorgesEditorForm::loadFile(const QString fileName)
|
|
|
|
|
void GeorgesEditorForm::loadFile(const QString fileName)
|
|
|
|
|
{
|
|
|
|
|
loadFile(fileName, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GeorgesEditorForm::loadFile(const QString fileName, bool loadFromDfn)
|
|
|
|
|
{
|
|
|
|
|
QFileInfo info(fileName);
|
|
|
|
|
|
|
|
|
|
if (!m_dockedWidgets.size())
|
|
|
|
|
{
|
|
|
|
|
CGeorgesTreeViewDialog *dock = new CGeorgesTreeViewDialog(m_mainDock);
|
|
|
|
|
dock->setUndoStack(m_undoStack);
|
|
|
|
|
m_lastActiveDock = dock;
|
|
|
|
|
m_dockedWidgets.append(dock);
|
|
|
|
|
|
|
|
|
|
m_mainDock->addDockWidget(Qt::RightDockWidgetArea, m_dockedWidgets.last());
|
|
|
|
|
connect(m_dockedWidgets.last(), SIGNAL(closing()),
|
|
|
|
|
this, SLOT(closingTreeView()));
|
|
|
|
|
connect(m_dockedWidgets.last(), SIGNAL(visibilityChanged(bool)),
|
|
|
|
|
m_dockedWidgets.last(), SLOT(checkVisibility(bool)));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
// Check to see if the form is already loaded, if it is just raise it.
|
|
|
|
|
if (m_dockedWidgets.size())
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
Q_FOREACH(CGeorgesTreeViewDialog *wgt, m_dockedWidgets)
|
|
|
|
|
{
|
|
|
|
|
if (info.fileName() == wgt->loadedForm)
|
|
|
|
@ -199,18 +208,38 @@ namespace GeorgesQt
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
CGeorgesTreeViewDialog *dock = new CGeorgesTreeViewDialog(m_mainDock);
|
|
|
|
|
dock->setUndoStack(m_undoStack);
|
|
|
|
|
m_dockedWidgets.append(dock);
|
|
|
|
|
|
|
|
|
|
connect(m_dockedWidgets.last(), SIGNAL(closing()),
|
|
|
|
|
this, SLOT(closingTreeView()));
|
|
|
|
|
connect(m_dockedWidgets.last(), SIGNAL(visibilityChanged(bool)),
|
|
|
|
|
m_dockedWidgets.last(), SLOT(checkVisibility(bool)));
|
|
|
|
|
Q_ASSERT(m_dockedWidgets.size() > 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CGeorgesTreeViewDialog *dock = new CGeorgesTreeViewDialog(m_mainDock);
|
|
|
|
|
dock->setUndoStack(m_undoStack);
|
|
|
|
|
m_lastActiveDock = dock;
|
|
|
|
|
m_dockedWidgets.append(dock);
|
|
|
|
|
|
|
|
|
|
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());
|
|
|
|
|
}
|
|
|
|
|
CForm *form = m_dockedWidgets.last()->getFormByName(info.fileName());
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
m_mainDock->addDockWidget(Qt::RightDockWidgetArea, m_dockedWidgets.last());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Retrieve the form and load the form.
|
|
|
|
|
NLGEORGES::CForm *form;
|
|
|
|
|
if(loadFromDfn)
|
|
|
|
|
{
|
|
|
|
|
// Get the form by DFN name.
|
|
|
|
|
form = m_dockedWidgets.last()->getFormByDfnName(info.fileName());
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
form = m_dockedWidgets.last()->getFormByName(info.fileName());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (form)
|
|
|
|
|
{
|
|
|
|
|
m_dockedWidgets.last()->setForm(form);
|
|
|
|
@ -224,6 +253,7 @@ namespace GeorgesQt
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
nlwarning("Failed to load form: %s", info.fileName().toStdString().c_str());
|
|
|
|
|
m_dockedWidgets.last()->close();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|