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

View File

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