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&)), connect (&mFileDialog, SIGNAL(signalCreateNewFile (const boost::filesystem::path&)),
this, SLOT(createNewFile (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&)), connect (&mNewGame, SIGNAL (createRequest (const boost::filesystem::path&)),
this, SLOT (createNewGame (const boost::filesystem::path&))); this, SLOT (createNewGame (const boost::filesystem::path&)));
connect (&mNewGame, SIGNAL (cancelCreateGame()), this, SLOT (cancelCreateGame ()));
} }
CS::Editor::~Editor () CS::Editor::~Editor ()
@ -176,12 +178,40 @@ void CS::Editor::createGame()
mNewGame.activateWindow(); 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() void CS::Editor::createAddon()
{ {
mStartup.hide(); mStartup.hide();
mFileDialog.showDialog (CSVDoc::ContentAction_New); 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() void CS::Editor::loadDocument()
{ {
mStartup.hide(); mStartup.hide();

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

@ -49,6 +49,11 @@ CSMDoc::DocumentManager::~DocumentManager()
delete *iter; 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, void CSMDoc::DocumentManager::addDocument (const std::vector<boost::filesystem::path>& files, const boost::filesystem::path& savePath,
bool new_) bool new_)
{ {

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

@ -66,3 +66,9 @@ void CSVDoc::NewGameDialogue::create()
{ {
emit createRequest (mAdjusterWidget->getPath()); 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 createRequest (const boost::filesystem::path& file);
void cancelCreateGame ();
private slots: private slots:
void stateChanged (bool valid); void stateChanged (bool valid);
void create(); void create();
void reject();
}; };
} }

Loading…
Cancel
Save