extend "Add New Map" to different MapSortOrders
This commit is contained in:
parent
8ccf036c6d
commit
19e7cc59f7
8 changed files with 195 additions and 39 deletions
|
@ -482,8 +482,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>469</width>
|
<width>545</width>
|
||||||
<height>608</height>
|
<height>587</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_8">
|
<layout class="QGridLayout" name="gridLayout_8">
|
||||||
|
@ -797,8 +797,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>324</width>
|
<width>256</width>
|
||||||
<height>77</height>
|
<height>74</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||||
|
@ -907,10 +907,10 @@
|
||||||
</property>
|
</property>
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>8</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>307</width>
|
<width>222</width>
|
||||||
<height>387</height>
|
<height>353</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
@ -1226,8 +1226,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>381</width>
|
<width>371</width>
|
||||||
<height>657</height>
|
<height>643</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_7">
|
<layout class="QGridLayout" name="gridLayout_7">
|
||||||
|
@ -1500,7 +1500,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>430</width>
|
<width>430</width>
|
||||||
<height>568</height>
|
<height>534</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
@ -2285,8 +2285,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>826</width>
|
<width>818</width>
|
||||||
<height>557</height>
|
<height>539</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_14">
|
<layout class="QGridLayout" name="gridLayout_14">
|
||||||
|
@ -2458,7 +2458,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>1117</width>
|
<width>1117</width>
|
||||||
<height>21</height>
|
<height>22</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QMenu" name="menuFile">
|
<widget class="QMenu" name="menuFile">
|
||||||
|
@ -2466,7 +2466,6 @@
|
||||||
<string>File</string>
|
<string>File</string>
|
||||||
</property>
|
</property>
|
||||||
<addaction name="action_Open_Project"/>
|
<addaction name="action_Open_Project"/>
|
||||||
<addaction name="action_NewMap"/>
|
|
||||||
<addaction name="action_Save"/>
|
<addaction name="action_Save"/>
|
||||||
<addaction name="action_Save_Project"/>
|
<addaction name="action_Save_Project"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
|
@ -2500,6 +2499,7 @@
|
||||||
<addaction name="actionMove"/>
|
<addaction name="actionMove"/>
|
||||||
<addaction name="actionMap_Shift"/>
|
<addaction name="actionMap_Shift"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
|
<addaction name="action_NewMap"/>
|
||||||
<addaction name="actionTileset_Editor"/>
|
<addaction name="actionTileset_Editor"/>
|
||||||
</widget>
|
</widget>
|
||||||
<addaction name="menuFile"/>
|
<addaction name="menuFile"/>
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>410</width>
|
<width>410</width>
|
||||||
<height>424</height>
|
<height>508</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -33,9 +33,26 @@
|
||||||
<enum>QFrame::Raised</enum>
|
<enum>QFrame::Raised</enum>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QFormLayout" name="formLayout_2">
|
<layout class="QFormLayout" name="formLayout_2">
|
||||||
|
<property name="sizeConstraint">
|
||||||
|
<enum>QLayout::SetFixedSize</enum>
|
||||||
|
</property>
|
||||||
<property name="verticalSpacing">
|
<property name="verticalSpacing">
|
||||||
<number>12</number>
|
<number>12</number>
|
||||||
</property>
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label_newMap_Name">
|
||||||
|
<property name="text">
|
||||||
|
<string>Name</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLineEdit" name="lineEdit_NewMap_Name">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>The name of the new map. If the name is invalid (red), it will be replaced with the default name of a new map.</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QLabel" name="label_NewMap_Group">
|
<widget class="QLabel" name="label_NewMap_Group">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -172,17 +189,45 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0">
|
<item row="9" column="0">
|
||||||
<widget class="QLabel" name="label_newMap_Name">
|
<widget class="QLabel" name="label_NewMap_Allow_Running">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Name</string>
|
<string>Allow Running</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="10" column="0">
|
||||||
<widget class="QLineEdit" name="lineEdit_NewMap_Name">
|
<widget class="QLabel" name="label_NewMap_Allow_Biking">
|
||||||
<property name="toolTip">
|
<property name="text">
|
||||||
<string><html><head/><body><p>The name of the new map. If the name is invalid (red), it will be replaced with the default name of a new map.</p></body></html></string>
|
<string>Allow Biking</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="11" column="0">
|
||||||
|
<widget class="QLabel" name="label_NewMap_Allow_Escape_Rope">
|
||||||
|
<property name="text">
|
||||||
|
<string>Allow Escape Rope</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="9" column="1">
|
||||||
|
<widget class="QCheckBox" name="checkBox_NewMap_Allow_Running">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="10" column="1">
|
||||||
|
<widget class="QCheckBox" name="checkBox_NewMap_Allow_Biking">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="11" column="1">
|
||||||
|
<widget class="QCheckBox" name="checkBox_NewMap_Allow_Escape_Rope">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
@ -48,7 +48,7 @@ private slots:
|
||||||
void onMapChanged(Map *map);
|
void onMapChanged(Map *map);
|
||||||
void onMapNeedsRedrawing();
|
void onMapNeedsRedrawing();
|
||||||
void onTilesetsSaved(QString, QString);
|
void onTilesetsSaved(QString, QString);
|
||||||
void openNewMapPopupWindow(int);
|
void openNewMapPopupWindow(int, QVariant);
|
||||||
void onNewMapCreated();
|
void onNewMapCreated();
|
||||||
|
|
||||||
void on_action_NewMap_triggered();
|
void on_action_NewMap_triggered();
|
||||||
|
@ -103,6 +103,8 @@ private slots:
|
||||||
|
|
||||||
void onOpenMapListContextMenu(const QPoint &point);
|
void onOpenMapListContextMenu(const QPoint &point);
|
||||||
void onAddNewMapToGroupClick(QAction* triggeredAction);
|
void onAddNewMapToGroupClick(QAction* triggeredAction);
|
||||||
|
void onAddNewMapToAreaClick(QAction* triggeredAction);
|
||||||
|
void onAddNewMapToLayoutClick(QAction* triggeredAction);
|
||||||
void onTilesetChanged(QString);
|
void onTilesetChanged(QString);
|
||||||
void currentMetatilesSelectionChanged();
|
void currentMetatilesSelectionChanged();
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ public:
|
||||||
|
|
||||||
void readMapGroups();
|
void readMapGroups();
|
||||||
Map* addNewMapToGroup(QString mapName, int groupNum);
|
Map* addNewMapToGroup(QString mapName, int groupNum);
|
||||||
Map* addNewMapToGroup(QString, int, Map*);
|
Map* addNewMapToGroup(QString, int, Map*, bool);
|
||||||
QString getNewMapName();
|
QString getNewMapName();
|
||||||
QString getProjectTitle();
|
QString getProjectTitle();
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,10 @@ public:
|
||||||
~NewMapPopup();
|
~NewMapPopup();
|
||||||
Map *map;
|
Map *map;
|
||||||
int group;
|
int group;
|
||||||
void init(int);
|
bool changeLayout;
|
||||||
|
QString layoutName;
|
||||||
|
void init(int, int, QString, QString);
|
||||||
|
void useLayout(QString);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void applied();
|
void applied();
|
||||||
|
@ -27,7 +30,7 @@ signals:
|
||||||
private:
|
private:
|
||||||
Ui::NewMapPopup *ui;
|
Ui::NewMapPopup *ui;
|
||||||
Project *project;
|
Project *project;
|
||||||
void setDefaultValues(int);
|
void setDefaultValues(int, QString);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_pushButton_NewMap_Accept_clicked();
|
void on_pushButton_NewMap_Accept_clicked();
|
||||||
|
|
|
@ -736,21 +736,48 @@ void MainWindow::onOpenMapListContextMenu(const QPoint &point)
|
||||||
actions->addAction(menu->addAction("Add New Map to Group"))->setData(groupNum);
|
actions->addAction(menu->addAction("Add New Map to Group"))->setData(groupNum);
|
||||||
connect(actions, SIGNAL(triggered(QAction*)), this, SLOT(onAddNewMapToGroupClick(QAction*)));
|
connect(actions, SIGNAL(triggered(QAction*)), this, SLOT(onAddNewMapToGroupClick(QAction*)));
|
||||||
menu->exec(QCursor::pos());
|
menu->exec(QCursor::pos());
|
||||||
|
} else if (itemType == "map_sec") {
|
||||||
|
QString secName = selectedItem->data(Qt::UserRole).toString();
|
||||||
|
QMenu* menu = new QMenu(this);
|
||||||
|
QActionGroup* actions = new QActionGroup(menu);
|
||||||
|
actions->addAction(menu->addAction("Add New Map to Area"))->setData(secName);
|
||||||
|
connect(actions, SIGNAL(triggered(QAction*)), this, SLOT(onAddNewMapToAreaClick(QAction*)));
|
||||||
|
menu->exec(QCursor::pos());
|
||||||
|
} else if (itemType == "map_layout") {
|
||||||
|
QString layoutName = selectedItem->data(Qt::UserRole).toString();
|
||||||
|
QMenu* menu = new QMenu(this);
|
||||||
|
QActionGroup* actions = new QActionGroup(menu);
|
||||||
|
actions->addAction(menu->addAction("Add New Map with Layout"))->setData(layoutName);
|
||||||
|
connect(actions, SIGNAL(triggered(QAction*)), this, SLOT(onAddNewMapToLayoutClick(QAction*)));
|
||||||
|
menu->exec(QCursor::pos());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onAddNewMapToGroupClick(QAction* triggeredAction)
|
void MainWindow::onAddNewMapToGroupClick(QAction* triggeredAction)
|
||||||
{
|
{
|
||||||
int groupNum = triggeredAction->data().toInt();
|
int groupNum = triggeredAction->data().toInt();
|
||||||
openNewMapPopupWindow(groupNum);
|
openNewMapPopupWindow(MapSortOrder::Group, groupNum);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::onAddNewMapToAreaClick(QAction* triggeredAction)
|
||||||
|
{
|
||||||
|
QString secName = triggeredAction->data().toString();
|
||||||
|
openNewMapPopupWindow(MapSortOrder::Area, secName);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::onAddNewMapToLayoutClick(QAction* triggeredAction)
|
||||||
|
{
|
||||||
|
QString layoutName = triggeredAction->data().toString();
|
||||||
|
openNewMapPopupWindow(MapSortOrder::Layout, layoutName);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onNewMapCreated() {
|
void MainWindow::onNewMapCreated() {
|
||||||
QString newMapName = this->newmapprompt->map->name;
|
QString newMapName = this->newmapprompt->map->name;
|
||||||
int newMapGroup = this->newmapprompt->group;
|
int newMapGroup = this->newmapprompt->group;
|
||||||
Map *newMap_ = this->newmapprompt->map;
|
Map *newMap_ = this->newmapprompt->map;
|
||||||
|
bool updateLayout = this->newmapprompt->changeLayout;
|
||||||
|
|
||||||
Map *newMap = editor->project->addNewMapToGroup(newMapName, newMapGroup, newMap_);
|
Map *newMap = editor->project->addNewMapToGroup(newMapName, newMapGroup, newMap_, updateLayout);
|
||||||
|
|
||||||
logInfo(QString("Created a new map named %1.").arg(newMapName));
|
logInfo(QString("Created a new map named %1.").arg(newMapName));
|
||||||
|
|
||||||
|
@ -774,7 +801,7 @@ void MainWindow::onNewMapCreated() {
|
||||||
disconnect(this->newmapprompt, SIGNAL(applied()), this, SLOT(onNewMapCreated()));
|
disconnect(this->newmapprompt, SIGNAL(applied()), this, SLOT(onNewMapCreated()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::openNewMapPopupWindow(int groupNum) {
|
void MainWindow::openNewMapPopupWindow(int type, QVariant data) {
|
||||||
if (!this->newmapprompt) {
|
if (!this->newmapprompt) {
|
||||||
this->newmapprompt = new NewMapPopup(this, this->editor->project);
|
this->newmapprompt = new NewMapPopup(this, this->editor->project);
|
||||||
}
|
}
|
||||||
|
@ -784,14 +811,25 @@ void MainWindow::openNewMapPopupWindow(int groupNum) {
|
||||||
this->newmapprompt->raise();
|
this->newmapprompt->raise();
|
||||||
this->newmapprompt->activateWindow();
|
this->newmapprompt->activateWindow();
|
||||||
}
|
}
|
||||||
this->newmapprompt->init(groupNum);
|
switch (type)
|
||||||
|
{
|
||||||
|
case MapSortOrder::Group:
|
||||||
|
this->newmapprompt->init(type, data.toInt(), QString(), QString());
|
||||||
|
break;
|
||||||
|
case MapSortOrder::Area:
|
||||||
|
this->newmapprompt->init(type, 0, data.toString(), QString());
|
||||||
|
break;
|
||||||
|
case MapSortOrder::Layout:
|
||||||
|
this->newmapprompt->init(type, 0, QString(), data.toString());
|
||||||
|
break;
|
||||||
|
}
|
||||||
connect(this->newmapprompt, SIGNAL(applied()), this, SLOT(onNewMapCreated()));
|
connect(this->newmapprompt, SIGNAL(applied()), this, SLOT(onNewMapCreated()));
|
||||||
connect(this->newmapprompt, &QObject::destroyed, [=](QObject *) { this->newmapprompt = nullptr; });
|
connect(this->newmapprompt, &QObject::destroyed, [=](QObject *) { this->newmapprompt = nullptr; });
|
||||||
this->newmapprompt->setAttribute(Qt::WA_DeleteOnClose);
|
this->newmapprompt->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_action_NewMap_triggered() {
|
void MainWindow::on_action_NewMap_triggered() {
|
||||||
openNewMapPopupWindow(0);
|
openNewMapPopupWindow(MapSortOrder::Group, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onTilesetChanged(QString mapName)
|
void MainWindow::onTilesetChanged(QString mapName)
|
||||||
|
|
|
@ -1238,7 +1238,7 @@ Map* Project::addNewMapToGroup(QString mapName, int groupNum) {
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
Map* Project::addNewMapToGroup(QString mapName, int groupNum, Map *newMap) {
|
Map* Project::addNewMapToGroup(QString mapName, int groupNum, Map *newMap, bool updateLayout) {
|
||||||
mapNames->append(mapName);
|
mapNames->append(mapName);
|
||||||
map_groups->insert(mapName, groupNum);
|
map_groups->insert(mapName, groupNum);
|
||||||
groupedMapNames[groupNum].append(mapName);
|
groupedMapNames[groupNum].append(mapName);
|
||||||
|
@ -1264,8 +1264,10 @@ Map* Project::addNewMapToGroup(QString mapName, int groupNum, Map *newMap) {
|
||||||
mapLayouts.insert(map->layout->label, map->layout);
|
mapLayouts.insert(map->layout->label, map->layout);
|
||||||
mapLayoutsTable.append(map->layout->label);
|
mapLayoutsTable.append(map->layout->label);
|
||||||
loadMapTilesets(map);
|
loadMapTilesets(map);
|
||||||
setNewMapBlockdata(map);
|
if (!updateLayout) {
|
||||||
setNewMapBorder(map);
|
setNewMapBlockdata(map);
|
||||||
|
setNewMapBorder(map);
|
||||||
|
}
|
||||||
setNewMapEvents(map);
|
setNewMapEvents(map);
|
||||||
setNewMapConnections(map);
|
setNewMapConnections(map);
|
||||||
map->commit();
|
map->commit();
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include "maplayout.h"
|
#include "maplayout.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "ui_newmappopup.h"
|
#include "ui_newmappopup.h"
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include <QSet>
|
#include <QSet>
|
||||||
|
@ -15,6 +16,7 @@ NewMapPopup::NewMapPopup(QWidget *parent, Project *project) :
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
this->project = project;
|
this->project = project;
|
||||||
|
this->changeLayout = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
NewMapPopup::~NewMapPopup()
|
NewMapPopup::~NewMapPopup()
|
||||||
|
@ -22,11 +24,32 @@ NewMapPopup::~NewMapPopup()
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NewMapPopup::init(int group) {
|
void NewMapPopup::init(int type, int group, QString sec, QString layout) {
|
||||||
setDefaultValues(group);
|
switch (type)
|
||||||
|
{
|
||||||
|
case MapSortOrder::Group:
|
||||||
|
setDefaultValues(group, QString());
|
||||||
|
break;
|
||||||
|
case MapSortOrder::Area:
|
||||||
|
setDefaultValues(group, sec);
|
||||||
|
break;
|
||||||
|
case MapSortOrder::Layout:
|
||||||
|
useLayout(layout);
|
||||||
|
setDefaultValues(group, QString());
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void NewMapPopup::setDefaultValues(int groupNum) {
|
void NewMapPopup::useLayout(QString mapName) {
|
||||||
|
this->changeLayout = true;
|
||||||
|
this->layoutName = mapName;
|
||||||
|
qDebug() << "will use layout of map" << layoutName;
|
||||||
|
}
|
||||||
|
|
||||||
|
// check for null QStrings
|
||||||
|
// TODO: if layout, set height and width then dont allow editing
|
||||||
|
// project->map_cache->mapname? ->layouot->{width, height, }
|
||||||
|
void NewMapPopup::setDefaultValues(int groupNum, QString mapSec) {
|
||||||
ui->lineEdit_NewMap_Name->setText(project->getNewMapName());
|
ui->lineEdit_NewMap_Name->setText(project->getNewMapName());
|
||||||
|
|
||||||
QMap<QString, QStringList> tilesets = project->getTilesets();
|
QMap<QString, QStringList> tilesets = project->getTilesets();
|
||||||
|
@ -36,13 +59,45 @@ void NewMapPopup::setDefaultValues(int groupNum) {
|
||||||
ui->comboBox_NewMap_Group->addItems(*project->groupNames);
|
ui->comboBox_NewMap_Group->addItems(*project->groupNames);
|
||||||
ui->comboBox_NewMap_Group->setCurrentText("gMapGroup" + QString::number(groupNum));
|
ui->comboBox_NewMap_Group->setCurrentText("gMapGroup" + QString::number(groupNum));
|
||||||
|
|
||||||
ui->spinBox_NewMap_Width->setValue(20);
|
if (changeLayout) {
|
||||||
ui->spinBox_NewMap_Height->setValue(20);
|
ui->spinBox_NewMap_Width->setValue(project->mapLayouts.value(layoutName)->width.toInt(nullptr, 0));
|
||||||
|
ui->spinBox_NewMap_Height->setValue(project->mapLayouts.value(layoutName)->height.toInt(nullptr, 0));
|
||||||
|
ui->comboBox_NewMap_Primary_Tileset->setCurrentText(project->mapLayouts.value(layoutName)->tileset_primary_label);
|
||||||
|
ui->comboBox_NewMap_Secondary_Tileset->setCurrentText(project->mapLayouts.value(layoutName)->tileset_secondary_label);
|
||||||
|
ui->spinBox_NewMap_Width->setDisabled(true);
|
||||||
|
ui->spinBox_NewMap_Height->setDisabled(true);
|
||||||
|
ui->comboBox_NewMap_Primary_Tileset->setDisabled(true);
|
||||||
|
ui->comboBox_NewMap_Secondary_Tileset->setDisabled(true);
|
||||||
|
} else {
|
||||||
|
ui->spinBox_NewMap_Width->setValue(20);
|
||||||
|
ui->spinBox_NewMap_Height->setValue(20);
|
||||||
|
}
|
||||||
|
|
||||||
ui->comboBox_NewMap_Type->addItems(*project->mapTypes);
|
ui->comboBox_NewMap_Type->addItems(*project->mapTypes);
|
||||||
ui->comboBox_NewMap_Location->addItems(*project->regionMapSections);
|
ui->comboBox_NewMap_Location->addItems(*project->regionMapSections);
|
||||||
|
if (!mapSec.isEmpty()) ui->comboBox_NewMap_Location->setCurrentText(mapSec);
|
||||||
|
|
||||||
ui->frame_NewMap_Options->setEnabled(true);
|
ui->frame_NewMap_Options->setEnabled(true);
|
||||||
|
|
||||||
|
switch (projectConfig.getBaseGameVersion())
|
||||||
|
{
|
||||||
|
case BaseGameVersion::pokeruby:
|
||||||
|
ui->checkBox_NewMap_Allow_Running->setVisible(false);
|
||||||
|
ui->checkBox_NewMap_Allow_Biking->setVisible(false);
|
||||||
|
ui->checkBox_NewMap_Allow_Escape_Rope->setVisible(false);
|
||||||
|
ui->label_NewMap_Allow_Running->setVisible(false);
|
||||||
|
ui->label_NewMap_Allow_Biking->setVisible(false);
|
||||||
|
ui->label_NewMap_Allow_Escape_Rope->setVisible(false);
|
||||||
|
break;
|
||||||
|
case BaseGameVersion::pokeemerald:
|
||||||
|
ui->checkBox_NewMap_Allow_Running->setVisible(true);
|
||||||
|
ui->checkBox_NewMap_Allow_Biking->setVisible(true);
|
||||||
|
ui->checkBox_NewMap_Allow_Escape_Rope->setVisible(true);
|
||||||
|
ui->label_NewMap_Allow_Running->setVisible(true);
|
||||||
|
ui->label_NewMap_Allow_Biking->setVisible(true);
|
||||||
|
ui->label_NewMap_Allow_Escape_Rope->setVisible(true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void NewMapPopup::on_lineEdit_NewMap_Name_textChanged(const QString &text) {
|
void NewMapPopup::on_lineEdit_NewMap_Name_textChanged(const QString &text) {
|
||||||
|
@ -82,10 +137,21 @@ void NewMapPopup::on_pushButton_NewMap_Accept_clicked() {
|
||||||
layout->blockdata_label = QString("%1_MapBlockdata").arg(newMap->name);
|
layout->blockdata_label = QString("%1_MapBlockdata").arg(newMap->name);
|
||||||
layout->blockdata_path = QString("data/layouts/%1/map.bin").arg(newMap->name);
|
layout->blockdata_path = QString("data/layouts/%1/map.bin").arg(newMap->name);
|
||||||
|
|
||||||
|
if (changeLayout) {
|
||||||
|
layout->blockdata = project->mapLayouts.value(layoutName)->blockdata;
|
||||||
|
layout->border = project->mapLayouts.value(layoutName)->border;
|
||||||
|
}
|
||||||
|
|
||||||
if (this->ui->checkBox_NewMap_Flyable->isChecked()) {
|
if (this->ui->checkBox_NewMap_Flyable->isChecked()) {
|
||||||
newMap->isFlyable = "TRUE";
|
newMap->isFlyable = "TRUE";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (projectConfig.getBaseGameVersion() == BaseGameVersion::pokeemerald) {
|
||||||
|
newMap->allowRunning = this->ui->checkBox_NewMap_Allow_Running->isChecked() ? "1" : "0";
|
||||||
|
newMap->allowBiking = this->ui->checkBox_NewMap_Allow_Biking->isChecked() ? "1" : "0";
|
||||||
|
newMap->allowEscapeRope = this->ui->checkBox_NewMap_Allow_Escape_Rope->isChecked() ? "1" : "0";
|
||||||
|
}
|
||||||
|
|
||||||
newMap->layout = layout;
|
newMap->layout = layout;
|
||||||
newMap->layout_label = layout->label;
|
newMap->layout_label = layout->label;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue