1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-25 15:35:23 +00:00
OpenMW/apps/opencs/editor.cpp

29 lines
705 B
C++
Raw Normal View History

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