1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-18 17:40:48 +02:00

Fix saving bug and window modality bug

This commit is contained in:
nordsoft 2022-09-05 20:55:30 +04:00
parent 8903d2edaf
commit f87117b581
5 changed files with 38 additions and 6 deletions

View File

@ -230,7 +230,7 @@ void MainWindow::saveMap()
CMapService mapService;
try
{
mapService.saveMap(std::unique_ptr<CMap>(controller.map()), filename.toStdString());
mapService.saveMap(controller.getMapUniquePtr(), filename.toStdString());
}
catch(const std::exception & e)
{
@ -762,13 +762,15 @@ void MainWindow::on_inspectorWidget_itemChanged(QTableWidgetItem *item)
void MainWindow::on_actionMapSettings_triggered()
{
auto mapSettingsDialog = new MapSettings(controller, this);
mapSettingsDialog->setModal(true);
auto settingsDialog = new MapSettings(controller, this);
settingsDialog->setWindowModality(Qt::WindowModal);
settingsDialog->setModal(true);
}
void MainWindow::on_actionPlayers_settings_triggered()
{
auto mapSettingsDialog = new PlayerSettings(*controller.map(), this);
mapSettingsDialog->setModal(true);
auto settingsDialog = new PlayerSettings(*controller.map(), this);
settingsDialog->setWindowModality(Qt::WindowModal);
settingsDialog->setModal(true);
}

View File

@ -70,8 +70,15 @@
<addaction name="actionMapSettings"/>
<addaction name="actionPlayers_settings"/>
</widget>
<widget class="QMenu" name="menuPlayer">
<property name="title">
<string>Player</string>
</property>
<addaction name="actionNeutral"/>
</widget>
<addaction name="menuFile"/>
<addaction name="menuMap"/>
<addaction name="menuPlayer"/>
</widget>
<widget class="QToolBar" name="toolBar">
<property name="windowTitle">
@ -823,6 +830,14 @@
<string>Players settings</string>
</property>
</action>
<action name="actionNeutral">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Neutral</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>

View File

@ -26,6 +26,11 @@ MapController::~MapController()
{
}
const std::unique_ptr<CMap> & MapController::getMapUniquePtr() const
{
return _map;
}
CMap * MapController::map()
{
return _map.get();

View File

@ -17,6 +17,7 @@ public:
void setMap(std::unique_ptr<CMap>);
const std::unique_ptr<CMap> & getMapUniquePtr() const; //to be used for map saving
CMap * map();
MapHandler * mapHandler();
MapScene * scene(int level);

View File

@ -2,6 +2,9 @@
<ui version="4.0">
<class>PlayerSettings</class>
<widget class="QDialog" name="PlayerSettings">
<property name="windowModality">
<enum>Qt::WindowModal</enum>
</property>
<property name="geometry">
<rect>
<x>0</x>
@ -10,8 +13,14 @@
<height>283</height>
</rect>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="windowTitle">
<string>Dialog</string>
<string>Player settings</string>
</property>
<property name="modal">
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="0" colspan="8">