splitting new game and new addon functions (new game currently not working)

pull/51/head
Marc Zinnschlag 11 years ago
parent f7940d7d1a
commit ecedb60169

@ -43,7 +43,7 @@ opencs_units_noqt (model/tools
opencs_units (view/doc
viewmanager view operations operation subview startup filedialog
viewmanager view operations operation subview startup filedialog newgame
)

@ -12,12 +12,13 @@ CS::Editor::Editor() : mViewManager (mDocumentManager)
{
mIpcServerName = "org.openmw.OpenCS";
connect (&mViewManager, SIGNAL (newDocumentRequest ()), this, SLOT (createDocument ()));
connect (&mViewManager, SIGNAL (newGameRequest ()), this, SLOT (createGame ()));
connect (&mViewManager, SIGNAL (newAddonRequest ()), this, SLOT (createAddon ()));
connect (&mViewManager, SIGNAL (loadDocumentRequest ()), this, SLOT (loadDocument ()));
connect (&mViewManager, SIGNAL (editSettingsRequest()), this, SLOT (showSettings ()));
connect (&mStartup, SIGNAL (createGame()), this, SLOT (createDocument ())); /// \todo split
connect (&mStartup, SIGNAL (createAddon()), this, SLOT (createDocument ()));
connect (&mStartup, SIGNAL (createGame()), this, SLOT (createGame ()));
connect (&mStartup, SIGNAL (createAddon()), this, SLOT (createAddon ()));
connect (&mStartup, SIGNAL (loadDocument()), this, SLOT (loadDocument ()));
connect (&mStartup, SIGNAL (editConfig()), this, SLOT (showSettings ()));
@ -75,7 +76,18 @@ void CS::Editor::setupDataFiles()
}
void CS::Editor::createDocument()
void CS::Editor::createGame()
{
mStartup.hide();
if (mNewGame.isHidden())
mNewGame.show();
mNewGame.raise();
mNewGame.activateWindow();
}
void CS::Editor::createAddon()
{
mStartup.hide();

@ -16,6 +16,7 @@
#include "view/doc/viewmanager.hpp"
#include "view/doc/startup.hpp"
#include "view/doc/filedialog.hpp"
#include "view/doc/newgame.hpp"
#include "view/settings/usersettingsdialog.hpp"
@ -29,6 +30,7 @@ namespace CS
CSMDoc::DocumentManager mDocumentManager;
CSVDoc::ViewManager mViewManager;
CSVDoc::StartupDialogue mStartup;
CSVDoc::NewGameDialogue mNewGame;
CSVSettings::UserSettingsDialog mSettings;
FileDialog mFileDialog;
@ -51,7 +53,8 @@ namespace CS
private slots:
void createDocument();
void createGame();
void createAddon();
void loadDocument();
void openFiles();

@ -0,0 +1,14 @@
#include "newgame.hpp"
#include <QApplication>
#include <QDesktopWidget>
CSVDoc::NewGameDialogue::NewGameDialogue()
{
setWindowTitle ("Create New Game");
QRect scr = QApplication::desktop()->screenGeometry();
QRect rect = geometry();
move (scr.center().x() - rect.center().x(), scr.center().y() - rect.center().y());
}

@ -0,0 +1,18 @@
#ifndef CSV_DOC_NEWGAME_H
#define CSV_DOC_NEWGAME_H
#include <QWidget>
namespace CSVDoc
{
class NewGameDialogue : public QWidget
{
Q_OBJECT
public:
NewGameDialogue();
};
}
#endif

@ -27,9 +27,13 @@ void CSVDoc::View::setupFileMenu()
{
QMenu *file = menuBar()->addMenu (tr ("&File"));
QAction *new_ = new QAction (tr ("New"), this);
connect (new_, SIGNAL (triggered()), this, SIGNAL (newDocumentRequest()));
file->addAction (new_);
QAction *newGame = new QAction (tr ("New Game"), this);
connect (newGame, SIGNAL (triggered()), this, SIGNAL (newGameRequest()));
file->addAction (newGame);
QAction *newAddon = new QAction (tr ("New Addon"), this);
connect (newAddon, SIGNAL (triggered()), this, SIGNAL (newAddonRequest()));
file->addAction (newAddon);
QAction *open = new QAction (tr ("&Open"), this);
connect (open, SIGNAL (triggered()), this, SIGNAL (loadDocumentRequest()));

@ -106,7 +106,9 @@ namespace CSVDoc
signals:
void newDocumentRequest();
void newGameRequest();
void newAddonRequest();
void loadDocumentRequest();

@ -107,12 +107,12 @@ CSVDoc::View *CSVDoc::ViewManager::addView (CSMDoc::Document *document)
View *view = new View (*this, document, countViews (document)+1);
mViews.push_back (view);
view->show();
connect (view, SIGNAL (newDocumentRequest ()), this, SIGNAL (newDocumentRequest()));
connect (view, SIGNAL (newGameRequest ()), this, SIGNAL (newGameRequest()));
connect (view, SIGNAL (newAddonRequest ()), this, SIGNAL (newAddonRequest()));
connect (view, SIGNAL (loadDocumentRequest ()), this, SIGNAL (loadDocumentRequest()));
connect (view, SIGNAL (editSettingsRequest()), this, SIGNAL (editSettingsRequest()));

@ -55,7 +55,9 @@ namespace CSVDoc
signals:
void newDocumentRequest();
void newGameRequest();
void newAddonRequest();
void loadDocumentRequest();

Loading…
Cancel
Save