Return to startup dialog when the open/create action is cancelled. Should resolve Bug #2588.

c++11
cc9cii 10 years ago
parent 9ad69d9085
commit 0aaac59cc3

@ -67,9 +67,11 @@ CS::Editor::Editor (OgreInit::OgreInit& ogreInit)
connect (&mFileDialog, SIGNAL(signalCreateNewFile (const boost::filesystem::path&)),
this, SLOT(createNewFile (const boost::filesystem::path&)));
connect (&mFileDialog, SIGNAL (rejected()), this, SLOT (cancelFileDialog ()));
connect (&mNewGame, SIGNAL (createRequest (const boost::filesystem::path&)),
this, SLOT (createNewGame (const boost::filesystem::path&)));
connect (&mNewGame, SIGNAL (cancelCreateGame()), this, SLOT (cancelCreateGame ()));
}
CS::Editor::~Editor ()
@ -176,12 +178,40 @@ void CS::Editor::createGame()
mNewGame.activateWindow();
}
void CS::Editor::cancelCreateGame()
{
if (!mDocumentManager.isEmpty())
return;
mNewGame.hide();
if (mStartup.isHidden())
mStartup.show();
mStartup.raise();
mStartup.activateWindow();
}
void CS::Editor::createAddon()
{
mStartup.hide();
mFileDialog.showDialog (CSVDoc::ContentAction_New);
}
void CS::Editor::cancelFileDialog()
{
if (!mDocumentManager.isEmpty())
return;
mFileDialog.hide();
if (mStartup.isHidden())
mStartup.show();
mStartup.raise();
mStartup.activateWindow();
}
void CS::Editor::loadDocument()
{
mStartup.hide();

@ -87,6 +87,8 @@ namespace CS
void createGame();
void createAddon();
void cancelCreateGame();
void cancelFileDialog();
void loadDocument();
void openFiles (const boost::filesystem::path &path);

@ -49,6 +49,11 @@ CSMDoc::DocumentManager::~DocumentManager()
delete *iter;
}
bool CSMDoc::DocumentManager::isEmpty()
{
return mDocuments.empty();
}
void CSMDoc::DocumentManager::addDocument (const std::vector<boost::filesystem::path>& files, const boost::filesystem::path& savePath,
bool new_)
{

@ -59,6 +59,8 @@ namespace CSMDoc
/// Ask OGRE for a list of available resources.
void listResources();
bool isEmpty();
private:
boost::filesystem::path mResDir;

@ -66,3 +66,9 @@ void CSVDoc::NewGameDialogue::create()
{
emit createRequest (mAdjusterWidget->getPath());
}
void CSVDoc::NewGameDialogue::reject()
{
emit cancelCreateGame ();
QDialog::reject();
}

@ -36,11 +36,15 @@ namespace CSVDoc
void createRequest (const boost::filesystem::path& file);
void cancelCreateGame ();
private slots:
void stateChanged (bool valid);
void create();
void reject();
};
}

Loading…
Cancel
Save