Added GUI stub for new types/Dfns/forms.

This commit is contained in:
dfighter1985 2014-09-03 18:33:09 +02:00
parent 516e4eef93
commit 4030b88d4a
2 changed files with 33 additions and 19 deletions

View file

@ -70,11 +70,20 @@ namespace GeorgesQt
Core::MenuManager *menuManager = Core::ICore::instance()->menuManager(); Core::MenuManager *menuManager = Core::ICore::instance()->menuManager();
m_openAction = menuManager->action(Core::Constants::OPEN); m_openAction = menuManager->action(Core::Constants::OPEN);
m_newAction = new QAction(tr("&New..."), this); m_newTypAction = new QAction(tr("New Type"), this );
m_newAction->setIcon(QIcon(Core::Constants::ICON_NEW)); m_newTypAction->setIcon(QIcon(Core::Constants::ICON_NEW));
m_newAction->setShortcut(QKeySequence::New); m_newTypAction->setStatusTip(tr("Create a new type file"));
m_newAction->setStatusTip(tr("Create a new file")); connect( m_newTypAction, SIGNAL(triggered()), this, SLOT(newTyp()));
connect(m_newAction, SIGNAL(triggered()), this, SLOT(newFile()));
m_newDfnAction = new QAction(tr("New DFN"), this );
m_newDfnAction->setIcon(QIcon(Core::Constants::ICON_NEW));
m_newDfnAction->setStatusTip(tr("Create a new definition file"));
connect( m_newDfnAction, SIGNAL(triggered()), this, SLOT(newDfn()));
m_newFormAction = new QAction(tr("New Form"), this );
m_newFormAction->setIcon(QIcon(Core::Constants::ICON_NEW));
m_newFormAction->setStatusTip(tr("Create a new form file"));
connect( m_newFormAction, SIGNAL(triggered()), this, SLOT(newForm()));
m_saveAction = new QAction(tr("&Save..."), this); m_saveAction = new QAction(tr("&Save..."), this);
m_saveAction->setIcon(QIcon(Core::Constants::ICON_SAVE)); m_saveAction->setIcon(QIcon(Core::Constants::ICON_SAVE));
@ -83,8 +92,10 @@ namespace GeorgesQt
connect(m_saveAction, SIGNAL(triggered()), this, SLOT(save())); connect(m_saveAction, SIGNAL(triggered()), this, SLOT(save()));
m_fileToolBar = addToolBar(tr("&File")); m_fileToolBar = addToolBar(tr("&File"));
m_fileToolBar->addAction(m_newTypAction);
m_fileToolBar->addAction(m_newDfnAction);
m_fileToolBar->addAction(m_newFormAction);
m_fileToolBar->addAction(m_openAction); m_fileToolBar->addAction(m_openAction);
m_fileToolBar->addAction(m_newAction);
m_fileToolBar->addAction(m_saveAction); m_fileToolBar->addAction(m_saveAction);
m_saveAction->setEnabled(false); m_saveAction->setEnabled(false);
@ -128,19 +139,16 @@ namespace GeorgesQt
loadFile(fileName); loadFile(fileName);
} }
void GeorgesEditorForm::newFile() void GeorgesEditorForm::newTyp()
{ {
// 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::newDfn()
{
}
void GeorgesEditorForm::newForm()
{
} }
void GeorgesEditorForm::save() void GeorgesEditorForm::save()

View file

@ -46,7 +46,11 @@ public Q_SLOTS:
void open(); void open();
void loadFile(const QString &fileName); void loadFile(const QString &fileName);
void loadFile(const QString &fileName, bool loadFromDfn); void loadFile(const QString &fileName, bool loadFromDfn);
void newFile();
void newTyp();
void newDfn();
void newForm();
void save(); void save();
void settingsChanged(); void settingsChanged();
void closingTreeView(); void closingTreeView();
@ -67,7 +71,9 @@ private:
CGeorgesDirTreeDialog *m_georgesDirTreeDialog; CGeorgesDirTreeDialog *m_georgesDirTreeDialog;
QToolBar *m_fileToolBar; QToolBar *m_fileToolBar;
QAction *m_openAction; QAction *m_openAction;
QAction *m_newAction; QAction *m_newTypAction;
QAction *m_newDfnAction;
QAction *m_newFormAction;
QAction *m_saveAction; QAction *m_saveAction;
QString m_leveldesignPath; QString m_leveldesignPath;