mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-18 17:40:48 +02:00
Few more fixes
This commit is contained in:
parent
5839ba4ce8
commit
3430edba22
@ -58,7 +58,8 @@ void init()
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent) :
|
||||
QMainWindow(parent),
|
||||
ui(new Ui::MainWindow)
|
||||
ui(new Ui::MainWindow),
|
||||
controller(this)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
@ -156,13 +157,22 @@ void MainWindow::reloadMap(int level)
|
||||
//sceneMini->addPixmap(minimap);
|
||||
}
|
||||
|
||||
void MainWindow::mapChanged()
|
||||
{
|
||||
unsaved = true;
|
||||
setWindowTitle(filename + "* - VCMI Map Editor");
|
||||
}
|
||||
|
||||
void MainWindow::initializeMap(bool isNew)
|
||||
{
|
||||
unsaved = isNew;
|
||||
if(isNew)
|
||||
{
|
||||
filename.clear();
|
||||
|
||||
setWindowTitle(filename + "* - VCMI Map Editor");
|
||||
setWindowTitle("* - VCMI Map Editor");
|
||||
}
|
||||
else
|
||||
setWindowTitle(filename + " - VCMI Map Editor");
|
||||
|
||||
mapLevel = 0;
|
||||
ui->mapView->setScene(controller.scene(mapLevel));
|
||||
@ -171,6 +181,7 @@ void MainWindow::initializeMap(bool isNew)
|
||||
|
||||
//enable settings
|
||||
ui->actionMapSettings->setEnabled(true);
|
||||
ui->actionPlayers_settings->setEnabled(true);
|
||||
}
|
||||
|
||||
void MainWindow::on_actionOpen_triggered()
|
||||
|
@ -83,6 +83,7 @@ public slots:
|
||||
|
||||
void treeViewSelected(const QModelIndex &selected, const QModelIndex &deselected);
|
||||
void loadInspector(CGObjectInstance * obj);
|
||||
void mapChanged();
|
||||
|
||||
private:
|
||||
void preparePreview(const QModelIndex &index, bool createNew);
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include "inspector.h"
|
||||
|
||||
|
||||
MapController::MapController()
|
||||
MapController::MapController(MainWindow * m): main(m)
|
||||
{
|
||||
_scenes[0].reset(new MapScene(0));
|
||||
_scenes[1].reset(new MapScene(1));
|
||||
@ -42,8 +42,8 @@ MapScene * MapController::scene(int level)
|
||||
void MapController::setMap(std::unique_ptr<CMap> cmap)
|
||||
{
|
||||
_map = std::move(cmap);
|
||||
//_scenes[0].reset(new MapScene(0));
|
||||
//_scenes[1].reset(new MapScene(1));
|
||||
_scenes[0].reset(new MapScene(0));
|
||||
_scenes[1].reset(new MapScene(1));
|
||||
resetMapHandler();
|
||||
sceneForceUpdate();
|
||||
}
|
||||
@ -83,6 +83,8 @@ void MapController::commitTerrainChange(int level, const Terrain & terrain)
|
||||
for(auto & t : v)
|
||||
_scenes[level]->terrainView.setDirty(t);
|
||||
_scenes[level]->terrainView.draw();
|
||||
|
||||
main->mapChanged();
|
||||
}
|
||||
|
||||
void MapController::commitObjectErase(int level)
|
||||
@ -95,6 +97,8 @@ void MapController::commitObjectErase(int level)
|
||||
_scenes[level]->selectionObjectsView.clear();
|
||||
resetMapHandler();
|
||||
_scenes[level]->updateViews();
|
||||
|
||||
main->mapChanged();
|
||||
}
|
||||
|
||||
bool MapController::discardObject(int level) const
|
||||
@ -144,6 +148,8 @@ void MapController::commitObstacleFill(int level)
|
||||
|
||||
resetMapHandler();
|
||||
_scenes[level]->updateViews();
|
||||
|
||||
main->mapChanged();
|
||||
}
|
||||
|
||||
void MapController::commitObjectChange(int level)
|
||||
@ -151,12 +157,15 @@ void MapController::commitObjectChange(int level)
|
||||
resetMapHandler();
|
||||
_scenes[level]->objectsView.draw();
|
||||
_scenes[level]->selectionObjectsView.draw();
|
||||
|
||||
main->mapChanged();
|
||||
}
|
||||
|
||||
|
||||
void MapController::commitChangeWithoutRedraw()
|
||||
{
|
||||
//DO NOT REDRAW
|
||||
main->mapChanged();
|
||||
}
|
||||
|
||||
void MapController::commitObjectShiftOrCreate(int level)
|
||||
@ -188,6 +197,8 @@ void MapController::commitObjectShiftOrCreate(int level)
|
||||
|
||||
resetMapHandler();
|
||||
_scenes[level]->updateViews();
|
||||
|
||||
main->mapChanged();
|
||||
}
|
||||
|
||||
void MapController::commitObjectCreate(int level)
|
||||
@ -197,4 +208,6 @@ void MapController::commitObjectCreate(int level)
|
||||
return;
|
||||
_map->getEditManager()->insertObject(newObj);
|
||||
Initializer init(newObj);
|
||||
|
||||
main->mapChanged();
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ class MainWindow;
|
||||
class MapController
|
||||
{
|
||||
public:
|
||||
MapController();
|
||||
MapController(MainWindow *);
|
||||
MapController(const MapController &) = delete;
|
||||
MapController(const MapController &&) = delete;
|
||||
~MapController();
|
||||
@ -40,6 +40,7 @@ public:
|
||||
private:
|
||||
std::unique_ptr<CMap> _map;
|
||||
std::unique_ptr<MapHandler> _mapHandler;
|
||||
MainWindow * main;
|
||||
mutable std::array<std::unique_ptr<MapScene>, 2> _scenes;
|
||||
};
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include "playersettings.h"
|
||||
#include "ui_playersettings.h"
|
||||
#include "playerparams.h"
|
||||
#include "mainwindow.h"
|
||||
|
||||
PlayerSettings::PlayerSettings(CMapHeader & mapHeader, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
@ -35,8 +36,7 @@ PlayerSettings::~PlayerSettings()
|
||||
|
||||
void PlayerSettings::on_playersCount_currentIndexChanged(int index)
|
||||
{
|
||||
assert(index + 2 == paramWidgets.size());
|
||||
assert(index + 2 < header.players.size());
|
||||
assert(index + 2 <= header.players.size());
|
||||
|
||||
for(int i = 0; i < index + 2; ++i)
|
||||
{
|
||||
@ -69,6 +69,7 @@ void PlayerSettings::on_pushButton_clicked()
|
||||
header.players[w->playerColor] = w->playerInfo;
|
||||
}
|
||||
|
||||
static_cast<MainWindow*>(parent())->controller.commitChangeWithoutRedraw();
|
||||
close();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user