|
74 | 74 | #include "world.h" |
75 | 75 | #include "worlddocument.h" |
76 | 76 | #include "worldmanager.h" |
| 77 | +#include "worldpropertiesdialog.h" |
77 | 78 | #include "zoomable.h" |
78 | 79 |
|
79 | 80 | #include <QActionGroup> |
@@ -310,6 +311,7 @@ MainWindow::MainWindow(QWidget *parent, Qt::WindowFlags flags) |
310 | 311 | ActionManager::registerAction(mUi->actionSnapToGrid, "SnapToGrid"); |
311 | 312 | ActionManager::registerAction(mUi->actionSnapToPixels, "SnapToPixels"); |
312 | 313 | ActionManager::registerAction(mUi->actionTilesetProperties, "TilesetProperties"); |
| 314 | + ActionManager::registerAction(mUi->actionWorldProperties, "WorldProperties"); |
313 | 315 | ActionManager::registerAction(mUi->actionZoomIn, "ZoomIn"); |
314 | 316 | ActionManager::registerAction(mUi->actionZoomNormal, "ZoomNormal"); |
315 | 317 | ActionManager::registerAction(mUi->actionZoomOut, "ZoomOut"); |
@@ -679,6 +681,13 @@ MainWindow::MainWindow(QWidget *parent, Qt::WindowFlags flags) |
679 | 681 | connect(mUi->actionTilesetProperties, &QAction::triggered, |
680 | 682 | this, &MainWindow::editTilesetProperties); |
681 | 683 |
|
| 684 | + connect(mUi->actionWorldProperties, &QAction::triggered, |
| 685 | + this, &MainWindow::editWorldProperties); |
| 686 | + |
| 687 | + mUi->actionWorldProperties->setEnabled(false); |
| 688 | + connect(&WorldManager::instance(), &WorldManager::worldsChanged, this, [this] { |
| 689 | + mUi->actionWorldProperties->setDisabled(WorldManager::instance().worlds().empty()); |
| 690 | + }); |
682 | 691 | connect(mUi->actionNewProject, &QAction::triggered, this, &MainWindow::newProject); |
683 | 692 | connect(mUi->actionCloseProject, &QAction::triggered, this, &MainWindow::closeProject); |
684 | 693 | connect(mUi->actionAddFolderToProject, &QAction::triggered, mProjectDock, &ProjectDock::addFolderToProject); |
@@ -1954,6 +1963,20 @@ void MainWindow::editTilesetProperties() |
1954 | 1963 | emit tilesetDocument->editCurrentObject(); |
1955 | 1964 | } |
1956 | 1965 |
|
| 1966 | +void MainWindow::editWorldProperties() |
| 1967 | +{ |
| 1968 | + if (WorldManager::instance().worlds().empty()) |
| 1969 | + return; |
| 1970 | + QSharedPointer<WorldDocument> world; |
| 1971 | + Document *currentDocument = DocumentManager::instance()->currentDocument(); |
| 1972 | + if (currentDocument && currentDocument->type() == Document::MapDocumentType) |
| 1973 | + world = WorldManager::instance().worldForMap(currentDocument->fileName()); |
| 1974 | + if (!world) |
| 1975 | + world = WorldManager::instance().worlds().first(); |
| 1976 | + |
| 1977 | + WorldPropertiesDialog(world, this).exec(); |
| 1978 | +} |
| 1979 | + |
1957 | 1980 | void MainWindow::autoMappingError(bool automatic) |
1958 | 1981 | { |
1959 | 1982 | QString error = mAutomappingManager->errorString(); |
|
0 commit comments