forked from mirror/openmw-tes3mp
added provisional startup dialogue
This commit is contained in:
parent
19dff822f4
commit
67a1ec5166
9 changed files with 104 additions and 6 deletions
|
@ -12,7 +12,7 @@ set (OPENCS_SRC
|
|||
model/tools/mandatoryid.cpp model/tools/reportmodel.cpp
|
||||
|
||||
view/doc/viewmanager.cpp view/doc/view.cpp view/doc/operations.cpp view/doc/operation.cpp view/doc/subviewfactory.cpp
|
||||
view/doc/subview.cpp
|
||||
view/doc/subview.cpp view/doc/startup.cpp
|
||||
|
||||
view/world/table.cpp view/world/tablesubview.cpp view/world/subviews.cpp view/world/util.cpp
|
||||
view/world/dialoguesubview.cpp
|
||||
|
@ -33,7 +33,7 @@ set (OPENCS_HDR
|
|||
model/tools/mandatoryid.hpp model/tools/reportmodel.hpp
|
||||
|
||||
view/doc/viewmanager.hpp view/doc/view.hpp view/doc/operations.hpp view/doc/operation.hpp view/doc/subviewfactory.hpp
|
||||
view/doc/subview.hpp view/doc/subviewfactoryimp.hpp
|
||||
view/doc/subview.hpp view/doc/subviewfactoryimp.hpp view/doc/startup.hpp
|
||||
|
||||
view/world/table.hpp view/world/tablesubview.hpp view/world/subviews.hpp view/world/util.hpp
|
||||
view/world/dialoguesubview.hpp
|
||||
|
|
|
@ -11,10 +11,19 @@
|
|||
CS::Editor::Editor() : mViewManager (mDocumentManager), mNewDocumentIndex (0)
|
||||
{
|
||||
connect (&mViewManager, SIGNAL (newDocumentRequest ()), this, SLOT (createDocument ()));
|
||||
connect (&mViewManager, SIGNAL (loadDocumentRequest ()), this, SLOT (loadDocument ()));
|
||||
|
||||
connect (&mStartup, SIGNAL (createDocument()), this, SLOT (createDocument ()));
|
||||
connect (&mStartup, SIGNAL (loadDocument()), this, SLOT (loadDocument ()));
|
||||
}
|
||||
|
||||
void CS::Editor::createDocument()
|
||||
{
|
||||
mStartup.hide();
|
||||
|
||||
/// \todo open the ESX picker instead
|
||||
/// \todo remove the following code for creating initial records into the document manager
|
||||
|
||||
std::ostringstream stream;
|
||||
|
||||
stream << "NewDocument" << (++mNewDocumentIndex);
|
||||
|
@ -23,7 +32,39 @@ void CS::Editor::createDocument()
|
|||
|
||||
static const char *sGlobals[] =
|
||||
{
|
||||
"Day", "DaysPassed", "GameHour", "Month", "PCRace", "PCVampire", "PCWerewolf", "PCYear", 0
|
||||
"Day", "DaysPassed", "GameHour", "Month", "PCRace", "PCVampire", "PCWerewolf", "PCYear", 0
|
||||
};
|
||||
|
||||
for (int i=0; sGlobals[i]; ++i)
|
||||
{
|
||||
ESM::Global record;
|
||||
record.mId = sGlobals[i];
|
||||
record.mValue = i==0 ? 1 : 0;
|
||||
record.mType = ESM::VT_Float;
|
||||
document->getData().getGlobals().add (record);
|
||||
}
|
||||
|
||||
document->getData().merge(); /// \todo remove once proper ESX loading is implemented
|
||||
|
||||
mViewManager.addView (document);
|
||||
}
|
||||
|
||||
void CS::Editor::loadDocument()
|
||||
{
|
||||
mStartup.hide();
|
||||
|
||||
/// \todo open the ESX picker instead
|
||||
/// \todo replace the manual record creation and load the ESX files instead
|
||||
|
||||
std::ostringstream stream;
|
||||
|
||||
stream << "Document" << (++mNewDocumentIndex);
|
||||
|
||||
CSMDoc::Document *document = mDocumentManager.addDocument (stream.str());
|
||||
|
||||
static const char *sGlobals[] =
|
||||
{
|
||||
"Day", "DaysPassed", "GameHour", "Month", "PCRace", "PCVampire", "PCWerewolf", "PCYear", 0
|
||||
};
|
||||
|
||||
for (int i=0; sGlobals[i]; ++i)
|
||||
|
@ -42,8 +83,7 @@ void CS::Editor::createDocument()
|
|||
|
||||
int CS::Editor::run()
|
||||
{
|
||||
/// \todo Instead of creating an empty document, open a small welcome dialogue window with buttons for new/load/recent projects
|
||||
createDocument();
|
||||
mStartup.show();
|
||||
|
||||
return QApplication::exec();
|
||||
}
|
|
@ -4,7 +4,9 @@
|
|||
#include <QObject>
|
||||
|
||||
#include "model/doc/documentmanager.hpp"
|
||||
|
||||
#include "view/doc/viewmanager.hpp"
|
||||
#include "view/doc/startup.hpp"
|
||||
|
||||
namespace CS
|
||||
{
|
||||
|
@ -16,6 +18,7 @@ namespace CS
|
|||
|
||||
CSMDoc::DocumentManager mDocumentManager;
|
||||
CSVDoc::ViewManager mViewManager;
|
||||
CSVDoc::StartupDialogue mStartup;
|
||||
|
||||
// not implemented
|
||||
Editor (const Editor&);
|
||||
|
@ -28,9 +31,11 @@ namespace CS
|
|||
int run();
|
||||
///< \return error status
|
||||
|
||||
public slots:
|
||||
private slots:
|
||||
|
||||
void createDocument();
|
||||
|
||||
void loadDocument();
|
||||
};
|
||||
}
|
||||
|
||||
|
|
20
apps/opencs/view/doc/startup.cpp
Normal file
20
apps/opencs/view/doc/startup.cpp
Normal file
|
@ -0,0 +1,20 @@
|
|||
|
||||
#include "startup.hpp"
|
||||
|
||||
#include <QPushButton>
|
||||
#include <QHBoxLayout>
|
||||
|
||||
CSVDoc::StartupDialogue::StartupDialogue()
|
||||
{
|
||||
QHBoxLayout *layout = new QHBoxLayout (this);
|
||||
|
||||
QPushButton *createDocument = new QPushButton ("new", this);
|
||||
connect (createDocument, SIGNAL (clicked()), this, SIGNAL (createDocument()));
|
||||
layout->addWidget (createDocument);
|
||||
|
||||
QPushButton *loadDocument = new QPushButton ("load", this);
|
||||
connect (loadDocument, SIGNAL (clicked()), this, SIGNAL (loadDocument()));
|
||||
layout->addWidget (loadDocument);
|
||||
|
||||
setLayout (layout);
|
||||
}
|
24
apps/opencs/view/doc/startup.hpp
Normal file
24
apps/opencs/view/doc/startup.hpp
Normal file
|
@ -0,0 +1,24 @@
|
|||
#ifndef CSV_DOC_STARTUP_H
|
||||
#define CSV_DOC_STARTUP_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
namespace CSVDoc
|
||||
{
|
||||
class StartupDialogue : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
StartupDialogue();
|
||||
|
||||
signals:
|
||||
|
||||
void createDocument();
|
||||
|
||||
void loadDocument();
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
|
@ -32,6 +32,10 @@ void CSVDoc::View::setupFileMenu()
|
|||
connect (new_, SIGNAL (triggered()), this, SIGNAL (newDocumentRequest()));
|
||||
file->addAction (new_);
|
||||
|
||||
QAction *open = new QAction (tr ("Open"), this);
|
||||
connect (open, SIGNAL (triggered()), this, SIGNAL (loadDocumentRequest()));
|
||||
file->addAction (open);
|
||||
|
||||
mSave = new QAction (tr ("&Save"), this);
|
||||
connect (mSave, SIGNAL (triggered()), this, SLOT (save()));
|
||||
file->addAction (mSave);
|
||||
|
|
|
@ -84,6 +84,8 @@ namespace CSVDoc
|
|||
|
||||
void newDocumentRequest();
|
||||
|
||||
void loadDocumentRequest();
|
||||
|
||||
public slots:
|
||||
|
||||
void addSubView (const CSMWorld::UniversalId& id);
|
||||
|
|
|
@ -57,6 +57,7 @@ CSVDoc::View *CSVDoc::ViewManager::addView (CSMDoc::Document *document)
|
|||
view->show();
|
||||
|
||||
connect (view, SIGNAL (newDocumentRequest ()), this, SIGNAL (newDocumentRequest()));
|
||||
connect (view, SIGNAL (loadDocumentRequest ()), this, SIGNAL (loadDocumentRequest()));
|
||||
|
||||
updateIndices();
|
||||
|
||||
|
|
|
@ -46,6 +46,8 @@ namespace CSVDoc
|
|||
|
||||
void newDocumentRequest();
|
||||
|
||||
void loadDocumentRequest();
|
||||
|
||||
private slots:
|
||||
|
||||
void documentStateChanged (int state, CSMDoc::Document *document);
|
||||
|
|
Loading…
Reference in a new issue