Add config options for showing border/grid
This commit is contained in:
parent
f64b03d684
commit
7368f443f0
6 changed files with 50 additions and 0 deletions
|
@ -13,6 +13,7 @@ The **"Breaking Changes"** listed below are changes that have been made in the d
|
||||||
- Porymap is now compatible with Qt6.
|
- Porymap is now compatible with Qt6.
|
||||||
- Add tool to count the times each metatile or tile is used in the tileset editor.
|
- Add tool to count the times each metatile or tile is used in the tileset editor.
|
||||||
- Events, current metatile selections, and map images can now be copied and pasted, including between windows.
|
- Events, current metatile selections, and map images can now be copied and pasted, including between windows.
|
||||||
|
- The grid and map border visibility are now saved as config options.
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- New events will be placed in the center of the current view of the map.
|
- New events will be placed in the center of the current view of the map.
|
||||||
|
|
|
@ -44,6 +44,8 @@ public:
|
||||||
this->metatilesZoom = 30;
|
this->metatilesZoom = 30;
|
||||||
this->showPlayerView = false;
|
this->showPlayerView = false;
|
||||||
this->showCursorTile = true;
|
this->showCursorTile = true;
|
||||||
|
this->showBorder = true;
|
||||||
|
this->showGrid = false;
|
||||||
this->monitorFiles = true;
|
this->monitorFiles = true;
|
||||||
this->regionMapDimensions = QSize(32, 20);
|
this->regionMapDimensions = QSize(32, 20);
|
||||||
this->theme = "default";
|
this->theme = "default";
|
||||||
|
@ -61,6 +63,8 @@ public:
|
||||||
void setMetatilesZoom(int zoom);
|
void setMetatilesZoom(int zoom);
|
||||||
void setShowPlayerView(bool enabled);
|
void setShowPlayerView(bool enabled);
|
||||||
void setShowCursorTile(bool enabled);
|
void setShowCursorTile(bool enabled);
|
||||||
|
void setShowBorder(bool enabled);
|
||||||
|
void setShowGrid(bool enabled);
|
||||||
void setMonitorFiles(bool monitor);
|
void setMonitorFiles(bool monitor);
|
||||||
void setRegionMapDimensions(int width, int height);
|
void setRegionMapDimensions(int width, int height);
|
||||||
void setTheme(QString theme);
|
void setTheme(QString theme);
|
||||||
|
@ -77,6 +81,8 @@ public:
|
||||||
int getMetatilesZoom();
|
int getMetatilesZoom();
|
||||||
bool getShowPlayerView();
|
bool getShowPlayerView();
|
||||||
bool getShowCursorTile();
|
bool getShowCursorTile();
|
||||||
|
bool getShowBorder();
|
||||||
|
bool getShowGrid();
|
||||||
bool getMonitorFiles();
|
bool getMonitorFiles();
|
||||||
QSize getRegionMapDimensions();
|
QSize getRegionMapDimensions();
|
||||||
QString getTheme();
|
QString getTheme();
|
||||||
|
@ -109,6 +115,8 @@ private:
|
||||||
int metatilesZoom;
|
int metatilesZoom;
|
||||||
bool showPlayerView;
|
bool showPlayerView;
|
||||||
bool showCursorTile;
|
bool showCursorTile;
|
||||||
|
bool showBorder;
|
||||||
|
bool showGrid;
|
||||||
bool monitorFiles;
|
bool monitorFiles;
|
||||||
QSize regionMapDimensions;
|
QSize regionMapDimensions;
|
||||||
QString theme;
|
QString theme;
|
||||||
|
|
|
@ -201,6 +201,7 @@ private slots:
|
||||||
void onHoveredMapMovementPermissionCleared();
|
void onHoveredMapMovementPermissionCleared();
|
||||||
void onSelectedMetatilesChanged();
|
void onSelectedMetatilesChanged();
|
||||||
void onWheelZoom(int);
|
void onWheelZoom(int);
|
||||||
|
void onToggleGridClicked(bool);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void objectsChanged();
|
void objectsChanged();
|
||||||
|
|
|
@ -168,6 +168,18 @@ void PorymapConfig::parseConfigKeyValue(QString key, QString value) {
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
logWarn(QString("Invalid config value for show_cursor_tile: '%1'. Must be 0 or 1.").arg(value));
|
logWarn(QString("Invalid config value for show_cursor_tile: '%1'. Must be 0 or 1.").arg(value));
|
||||||
}
|
}
|
||||||
|
} else if (key == "show_border") {
|
||||||
|
bool ok;
|
||||||
|
this->showBorder = value.toInt(&ok);
|
||||||
|
if (!ok) {
|
||||||
|
logWarn(QString("Invalid config value for show_border: '%1'. Must be 0 or 1.").arg(value));
|
||||||
|
}
|
||||||
|
} else if (key == "show_grid") {
|
||||||
|
bool ok;
|
||||||
|
this->showGrid = value.toInt(&ok);
|
||||||
|
if (!ok) {
|
||||||
|
logWarn(QString("Invalid config value for show_grid: '%1'. Must be 0 or 1.").arg(value));
|
||||||
|
}
|
||||||
} else if (key == "monitor_files") {
|
} else if (key == "monitor_files") {
|
||||||
bool ok;
|
bool ok;
|
||||||
this->monitorFiles = value.toInt(&ok);
|
this->monitorFiles = value.toInt(&ok);
|
||||||
|
@ -215,6 +227,8 @@ QMap<QString, QString> PorymapConfig::getKeyValueMap() {
|
||||||
map.insert("metatiles_zoom", QString("%1").arg(this->metatilesZoom));
|
map.insert("metatiles_zoom", QString("%1").arg(this->metatilesZoom));
|
||||||
map.insert("show_player_view", this->showPlayerView ? "1" : "0");
|
map.insert("show_player_view", this->showPlayerView ? "1" : "0");
|
||||||
map.insert("show_cursor_tile", this->showCursorTile ? "1" : "0");
|
map.insert("show_cursor_tile", this->showCursorTile ? "1" : "0");
|
||||||
|
map.insert("show_border", this->showBorder ? "1" : "0");
|
||||||
|
map.insert("show_grid", this->showGrid ? "1" : "0");
|
||||||
map.insert("monitor_files", this->monitorFiles ? "1" : "0");
|
map.insert("monitor_files", this->monitorFiles ? "1" : "0");
|
||||||
map.insert("region_map_dimensions", QString("%1x%2").arg(this->regionMapDimensions.width())
|
map.insert("region_map_dimensions", QString("%1x%2").arg(this->regionMapDimensions.width())
|
||||||
.arg(this->regionMapDimensions.height()));
|
.arg(this->regionMapDimensions.height()));
|
||||||
|
@ -308,6 +322,16 @@ void PorymapConfig::setShowCursorTile(bool enabled) {
|
||||||
this->save();
|
this->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PorymapConfig::setShowBorder(bool enabled) {
|
||||||
|
this->showBorder = enabled;
|
||||||
|
this->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
void PorymapConfig::setShowGrid(bool enabled) {
|
||||||
|
this->showGrid = enabled;
|
||||||
|
this->save();
|
||||||
|
}
|
||||||
|
|
||||||
void PorymapConfig::setRegionMapDimensions(int width, int height) {
|
void PorymapConfig::setRegionMapDimensions(int width, int height) {
|
||||||
this->regionMapDimensions = QSize(width, height);
|
this->regionMapDimensions = QSize(width, height);
|
||||||
}
|
}
|
||||||
|
@ -392,6 +416,14 @@ bool PorymapConfig::getShowCursorTile() {
|
||||||
return this->showCursorTile;
|
return this->showCursorTile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool PorymapConfig::getShowBorder() {
|
||||||
|
return this->showBorder;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool PorymapConfig::getShowGrid() {
|
||||||
|
return this->showGrid;
|
||||||
|
}
|
||||||
|
|
||||||
bool PorymapConfig::getMonitorFiles() {
|
bool PorymapConfig::getMonitorFiles() {
|
||||||
return this->monitorFiles;
|
return this->monitorFiles;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1663,6 +1663,10 @@ int Editor::getBorderDrawDistance(int dimension) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Editor::onToggleGridClicked(bool checked) {
|
||||||
|
porymapConfig.setShowGrid(checked);
|
||||||
|
}
|
||||||
|
|
||||||
void Editor::displayMapGrid() {
|
void Editor::displayMapGrid() {
|
||||||
for (QGraphicsLineItem* item : gridLines) {
|
for (QGraphicsLineItem* item : gridLines) {
|
||||||
if (item && item->scene()) {
|
if (item && item->scene()) {
|
||||||
|
@ -1689,6 +1693,7 @@ void Editor::displayMapGrid() {
|
||||||
gridLines.append(line);
|
gridLines.append(line);
|
||||||
connect(ui->checkBox_ToggleGrid, &QCheckBox::toggled, [=](bool checked){line->setVisible(checked);});
|
connect(ui->checkBox_ToggleGrid, &QCheckBox::toggled, [=](bool checked){line->setVisible(checked);});
|
||||||
}
|
}
|
||||||
|
connect(ui->checkBox_ToggleGrid, &QCheckBox::toggled, this, &Editor::onToggleGridClicked);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::updateConnectionOffset(int offset) {
|
void Editor::updateConnectionOffset(int offset) {
|
||||||
|
@ -1915,6 +1920,7 @@ void Editor::toggleBorderVisibility(bool visible)
|
||||||
{
|
{
|
||||||
this->setBorderItemsVisible(visible);
|
this->setBorderItemsVisible(visible);
|
||||||
this->setConnectionsVisibility(visible);
|
this->setConnectionsVisibility(visible);
|
||||||
|
porymapConfig.setShowBorder(visible);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::updateCustomMapHeaderValues(QTableWidget *table)
|
void Editor::updateCustomMapHeaderValues(QTableWidget *table)
|
||||||
|
|
|
@ -456,6 +456,8 @@ void MainWindow::loadUserSettings() {
|
||||||
this->editor->settings->playerViewRectEnabled = porymapConfig.getShowPlayerView();
|
this->editor->settings->playerViewRectEnabled = porymapConfig.getShowPlayerView();
|
||||||
ui->actionCursor_Tile_Outline->setChecked(porymapConfig.getShowCursorTile());
|
ui->actionCursor_Tile_Outline->setChecked(porymapConfig.getShowCursorTile());
|
||||||
this->editor->settings->cursorTileRectEnabled = porymapConfig.getShowCursorTile();
|
this->editor->settings->cursorTileRectEnabled = porymapConfig.getShowCursorTile();
|
||||||
|
ui->checkBox_ToggleBorder->setChecked(porymapConfig.getShowBorder());
|
||||||
|
ui->checkBox_ToggleGrid->setChecked(porymapConfig.getShowGrid());
|
||||||
mapSortOrder = porymapConfig.getMapSortOrder();
|
mapSortOrder = porymapConfig.getMapSortOrder();
|
||||||
ui->horizontalSlider_CollisionTransparency->blockSignals(true);
|
ui->horizontalSlider_CollisionTransparency->blockSignals(true);
|
||||||
this->editor->collisionOpacity = static_cast<qreal>(porymapConfig.getCollisionOpacity()) / 100;
|
this->editor->collisionOpacity = static_cast<qreal>(porymapConfig.getCollisionOpacity()) / 100;
|
||||||
|
|
Loading…
Reference in a new issue