1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-21 08:23:53 +00:00
openmw/apps/opencs/editor.cpp

29 lines
705 B
C++
Raw Normal View History

2012-11-22 12:30:02 +00:00
#include "editor.hpp"
2012-11-23 13:05:49 +00:00
#include <sstream>
2012-11-22 12:30:02 +00:00
#include <QtGui/QApplication>
2012-11-23 13:05:49 +00:00
CS::Editor::Editor() : mViewManager (mDocumentManager), mNewDocumentIndex (0)
2012-11-22 12:30:02 +00:00
{
2012-11-23 13:05:49 +00:00
connect (&mViewManager, SIGNAL (newDocumentRequest ()), this, SLOT (createDocument ()));
2012-11-22 12:30:02 +00:00
}
void CS::Editor::createDocument()
{
2012-11-23 13:05:49 +00:00
std::ostringstream stream;
stream << "NewDocument" << (++mNewDocumentIndex);
CSMDoc::Document *document = mDocumentManager.addDocument (stream.str());
2012-11-22 12:30:02 +00:00
mViewManager.addView (document);
}
int CS::Editor::run()
{
2012-11-23 13:05:49 +00:00
/// \todo Instead of creating an empty document, open a small welcome dialogue window with buttons for new/load/recent projects
2012-11-22 12:30:02 +00:00
createDocument();
return QApplication::exec();
}