Fixed save and save+cook buttons being enabled when no area is open

This commit is contained in:
Aruki 2017-07-07 20:52:14 -06:00
parent 2b4a9a2274
commit 5c1d4f70ae
2 changed files with 14 additions and 4 deletions

View File

@ -247,6 +247,8 @@ bool CWorldEditor::CloseWorld()
gpResourceStore->DestroyUnreferencedResources(); // this should destroy the area! gpResourceStore->DestroyUnreferencedResources(); // this should destroy the area!
UpdateWindowTitle(); UpdateWindowTitle();
ui->ActionSave->setEnabled(false);
ui->ActionSaveAndRepack->setEnabled(false);
emit MapChanged(mpWorld, mpArea); emit MapChanged(mpWorld, mpArea);
return true; return true;
} }
@ -292,8 +294,6 @@ bool CWorldEditor::SetArea(CWorld *pWorld, int AreaIndex)
CMasterTemplate *pMaster = CMasterTemplate::MasterForGame(mpArea->Game()); CMasterTemplate *pMaster = CMasterTemplate::MasterForGame(mpArea->Game());
mpLinkDialog->SetMaster(pMaster); mpLinkDialog->SetMaster(pMaster);
QString ProjectName = TO_QSTRING(gpEdApp->ActiveProject()->Name());
QString WorldName = TO_QSTRING(mpWorld->InGameName());
QString AreaName = TO_QSTRING(mpWorld->AreaInGameName(AreaIndex)); QString AreaName = TO_QSTRING(mpWorld->AreaInGameName(AreaIndex));
if (CurrentGame() < eReturns) if (CurrentGame() < eReturns)
@ -304,6 +304,10 @@ bool CWorldEditor::SetArea(CWorld *pWorld, int AreaIndex)
// Update paste action // Update paste action
OnClipboardDataModified(); OnClipboardDataModified();
// Update toolbar actions
ui->ActionSave->setEnabled(true);
ui->ActionSaveAndRepack->setEnabled(true);
// Emit signals // Emit signals
emit MapChanged(mpWorld, mpArea); emit MapChanged(mpWorld, mpArea);
emit LayersModified(); emit LayersModified();

View File

@ -366,6 +366,9 @@
</attribute> </attribute>
</widget> </widget>
<action name="ActionSave"> <action name="ActionSave">
<property name="enabled">
<bool>false</bool>
</property>
<property name="icon"> <property name="icon">
<iconset resource="../Icons.qrc"> <iconset resource="../Icons.qrc">
<normaloff>:/icons/Save.png</normaloff>:/icons/Save.png</iconset> <normaloff>:/icons/Save.png</normaloff>:/icons/Save.png</iconset>
@ -673,15 +676,18 @@
</property> </property>
</action> </action>
<action name="ActionSaveAndRepack"> <action name="ActionSaveAndRepack">
<property name="enabled">
<bool>false</bool>
</property>
<property name="icon"> <property name="icon">
<iconset resource="../Icons.qrc"> <iconset resource="../Icons.qrc">
<normaloff>:/icons/SaveAndRepack_32px.png</normaloff>:/icons/SaveAndRepack_32px.png</iconset> <normaloff>:/icons/SaveAndRepack_32px.png</normaloff>:/icons/SaveAndRepack_32px.png</iconset>
</property> </property>
<property name="text"> <property name="text">
<string>Save and Repack</string> <string>Save and Cook</string>
</property> </property>
<property name="toolTip"> <property name="toolTip">
<string>Save and Repack</string> <string>Save and Cook</string>
</property> </property>
</action> </action>
<action name="ActionCollisionRenderSettings"> <action name="ActionCollisionRenderSettings">