added "new map" button

fixed minor model/logic issues
This commit is contained in:
2017-05-24 17:54:09 +02:00
parent 6fb1c3a5fc
commit 489a64fd69
8 changed files with 49 additions and 7 deletions

View File

@@ -81,7 +81,8 @@ MainController::MainController() {
connect(mapModel, SIGNAL(reset()), this, SLOT(onMapModelReset()));
mapModel->addListener(this);
// load/save
// new/load/save
connect(mw->getActionWidget(), SIGNAL(onNew()), this, SLOT(onNew()));
connect(mw->getActionWidget(), SIGNAL(onLoad()), this, SLOT(onLoad()));
connect(mw->getActionWidget(), SIGNAL(onSave()), this, SLOT(onSave()));
@@ -96,6 +97,8 @@ MainController::MainController() {
mapModel->load("../IndoorMap/maps/SHL38_no_elev.xml");
//mapModel->load("/apps/android/workspace/testmap.xml");
//mapModel->resize(0.983, 0.983, 1, -0.2, -0.3, 0);
@@ -168,6 +171,8 @@ void MainController::onMapModelAboutToReset() {
mw->getLayerParamWidget()->setElement(nullptr);
mw->getToolBoxWidget()->setSelectedLayer(nullptr);
mw->getMapView2D()->update();
mw->getMapView3D()->update();
//mw->getToolBoxWidget()->
}
void MainController::onMapModelNeedsRepaint() {
@@ -180,6 +185,14 @@ void MainController::onMapModelReset() {
mw->getLINT()->update(mapModel->getMap());
}
void MainController::onNew() {
const int res = QMessageBox::question(nullptr, "New Map", "really start a new map?", QMessageBox::Yes, QMessageBox::No);
if (res == QMessageBox::Yes) {
mapModel->startEmpty();
}
}
void MainController::onLoad() {
QString file = QFileDialog::getOpenFileName(mw, "open a map");
if (file != "") {