fix new map popup window to allow layout selection
This commit is contained in:
parent
f8c7ada585
commit
a4fdb0de64
5 changed files with 234 additions and 86 deletions
|
@ -7,7 +7,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>410</width>
|
<width>410</width>
|
||||||
<height>621</height>
|
<height>687</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -73,14 +73,14 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="4" column="0">
|
||||||
<widget class="QLabel" name="label_NewMap_Width">
|
<widget class="QLabel" name="label_NewMap_Width">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Map Width</string>
|
<string>Map Width</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1">
|
<item row="4" column="1">
|
||||||
<widget class="QSpinBox" name="spinBox_NewMap_Width">
|
<widget class="QSpinBox" name="spinBox_NewMap_Width">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string><html><head/><body><p>Width (in blocks) of the new map.</p></body></html></string>
|
<string><html><head/><body><p>Width (in blocks) of the new map.</p></body></html></string>
|
||||||
|
@ -90,14 +90,14 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
<item row="5" column="0">
|
||||||
<widget class="QLabel" name="label_NewMap_Height">
|
<widget class="QLabel" name="label_NewMap_Height">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Map Height</string>
|
<string>Map Height</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="1">
|
<item row="5" column="1">
|
||||||
<widget class="QSpinBox" name="spinBox_NewMap_Height">
|
<widget class="QSpinBox" name="spinBox_NewMap_Height">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string><html><head/><body><p>Height (in blocks) of the new map.</p></body></html></string>
|
<string><html><head/><body><p>Height (in blocks) of the new map.</p></body></html></string>
|
||||||
|
@ -107,14 +107,14 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="0">
|
<item row="6" column="0">
|
||||||
<widget class="QLabel" name="label_NewMap_BorderWidth">
|
<widget class="QLabel" name="label_NewMap_BorderWidth">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Border Width</string>
|
<string>Border Width</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="1">
|
<item row="6" column="1">
|
||||||
<widget class="QSpinBox" name="spinBox_NewMap_BorderWidth">
|
<widget class="QSpinBox" name="spinBox_NewMap_BorderWidth">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string><html><head/><body><p>Width (in blocks) of the new map's border.</p></body></html></string>
|
<string><html><head/><body><p>Width (in blocks) of the new map's border.</p></body></html></string>
|
||||||
|
@ -124,14 +124,14 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="0">
|
<item row="7" column="0">
|
||||||
<widget class="QLabel" name="label_NewMap_BorderHeight">
|
<widget class="QLabel" name="label_NewMap_BorderHeight">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Border Height</string>
|
<string>Border Height</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="1">
|
<item row="7" column="1">
|
||||||
<widget class="QSpinBox" name="spinBox_NewMap_BorderHeight">
|
<widget class="QSpinBox" name="spinBox_NewMap_BorderHeight">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string><html><head/><body><p>Height (in blocks) of the new map's border.</p></body></html></string>
|
<string><html><head/><body><p>Height (in blocks) of the new map's border.</p></body></html></string>
|
||||||
|
@ -141,14 +141,14 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="0">
|
<item row="8" column="0">
|
||||||
<widget class="QLabel" name="label_NewMap_Primary_Tileset">
|
<widget class="QLabel" name="label_NewMap_Primary_Tileset">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Primary Tileset</string>
|
<string>Primary Tileset</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="1">
|
<item row="8" column="1">
|
||||||
<widget class="NoScrollComboBox" name="comboBox_NewMap_Primary_Tileset">
|
<widget class="NoScrollComboBox" name="comboBox_NewMap_Primary_Tileset">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string><html><head/><body><p>The primary tileset for the new map.</p></body></html></string>
|
<string><html><head/><body><p>The primary tileset for the new map.</p></body></html></string>
|
||||||
|
@ -158,14 +158,14 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="7" column="0">
|
<item row="9" column="0">
|
||||||
<widget class="QLabel" name="label_NewMap_Secondary_Tileset">
|
<widget class="QLabel" name="label_NewMap_Secondary_Tileset">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Secondary Tileset</string>
|
<string>Secondary Tileset</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="7" column="1">
|
<item row="9" column="1">
|
||||||
<widget class="NoScrollComboBox" name="comboBox_NewMap_Secondary_Tileset">
|
<widget class="NoScrollComboBox" name="comboBox_NewMap_Secondary_Tileset">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string><html><head/><body><p>The secondary tileset for the new map.</p></body></html></string>
|
<string><html><head/><body><p>The secondary tileset for the new map.</p></body></html></string>
|
||||||
|
@ -175,14 +175,14 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="8" column="0">
|
<item row="10" column="0">
|
||||||
<widget class="QLabel" name="label_NewMap_Type">
|
<widget class="QLabel" name="label_NewMap_Type">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Type</string>
|
<string>Type</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="8" column="1">
|
<item row="10" column="1">
|
||||||
<widget class="NoScrollComboBox" name="comboBox_NewMap_Type">
|
<widget class="NoScrollComboBox" name="comboBox_NewMap_Type">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string><html><head/><body><p>The map type is a general attribute, which is used for many different things. For example. it determines whether biking or running is allowed.</p></body></html></string>
|
<string><html><head/><body><p>The map type is a general attribute, which is used for many different things. For example. it determines whether biking or running is allowed.</p></body></html></string>
|
||||||
|
@ -192,14 +192,14 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="9" column="0">
|
<item row="11" column="0">
|
||||||
<widget class="QLabel" name="label_NewMap_Location">
|
<widget class="QLabel" name="label_NewMap_Location">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Location</string>
|
<string>Location</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="9" column="1">
|
<item row="11" column="1">
|
||||||
<widget class="NoScrollComboBox" name="comboBox_NewMap_Location">
|
<widget class="NoScrollComboBox" name="comboBox_NewMap_Location">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string><html><head/><body><p>The section of the region map which the map is grouped under. This also determines the name of the map that is displayed when the player enters it.</p></body></html></string>
|
<string><html><head/><body><p>The section of the region map which the map is grouped under. This also determines the name of the map that is displayed when the player enters it.</p></body></html></string>
|
||||||
|
@ -209,14 +209,14 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="10" column="0">
|
<item row="12" column="0">
|
||||||
<widget class="QLabel" name="label_Song">
|
<widget class="QLabel" name="label_Song">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Song</string>
|
<string>Song</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="10" column="1">
|
<item row="12" column="1">
|
||||||
<widget class="NoScrollComboBox" name="comboBox_NewMap_Song">
|
<widget class="NoScrollComboBox" name="comboBox_NewMap_Song">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string><html><head/><body><p>The default background music for this map.</p></body></html></string>
|
<string><html><head/><body><p>The default background music for this map.</p></body></html></string>
|
||||||
|
@ -226,14 +226,14 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="11" column="0">
|
<item row="13" column="0">
|
||||||
<widget class="QLabel" name="label_NewMap_Flyable">
|
<widget class="QLabel" name="label_NewMap_Flyable">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Can Fly To</string>
|
<string>Can Fly To</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="11" column="1">
|
<item row="13" column="1">
|
||||||
<widget class="QCheckBox" name="checkBox_NewMap_Flyable">
|
<widget class="QCheckBox" name="checkBox_NewMap_Flyable">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string><html><head/><body><p>Whether to add a heal location to the new map.</p></body></html></string>
|
<string><html><head/><body><p>Whether to add a heal location to the new map.</p></body></html></string>
|
||||||
|
@ -243,14 +243,14 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="12" column="0">
|
<item row="14" column="0">
|
||||||
<widget class="QLabel" name="label_NewMap_Show_Location">
|
<widget class="QLabel" name="label_NewMap_Show_Location">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Show Location Name</string>
|
<string>Show Location Name</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="12" column="1">
|
<item row="14" column="1">
|
||||||
<widget class="QCheckBox" name="checkBox_NewMap_Show_Location">
|
<widget class="QCheckBox" name="checkBox_NewMap_Show_Location">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string><html><head/><body><p>Whether or not to display the location name when the player enters the map.</p></body></html></string>
|
<string><html><head/><body><p>Whether or not to display the location name when the player enters the map.</p></body></html></string>
|
||||||
|
@ -260,14 +260,14 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="13" column="0">
|
<item row="15" column="0">
|
||||||
<widget class="QLabel" name="label_NewMap_Allow_Running">
|
<widget class="QLabel" name="label_NewMap_Allow_Running">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Allow Running</string>
|
<string>Allow Running</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="13" column="1">
|
<item row="15" column="1">
|
||||||
<widget class="QCheckBox" name="checkBox_NewMap_Allow_Running">
|
<widget class="QCheckBox" name="checkBox_NewMap_Allow_Running">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string><html><head/><body><p>Allows the player to use Running Shoes</p></body></html></string>
|
<string><html><head/><body><p>Allows the player to use Running Shoes</p></body></html></string>
|
||||||
|
@ -277,14 +277,14 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="14" column="0">
|
<item row="16" column="0">
|
||||||
<widget class="QLabel" name="label_NewMap_Allow_Biking">
|
<widget class="QLabel" name="label_NewMap_Allow_Biking">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Allow Biking</string>
|
<string>Allow Biking</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="14" column="1">
|
<item row="16" column="1">
|
||||||
<widget class="QCheckBox" name="checkBox_NewMap_Allow_Biking">
|
<widget class="QCheckBox" name="checkBox_NewMap_Allow_Biking">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string><html><head/><body><p>Allows the player to use a Bike</p></body></html></string>
|
<string><html><head/><body><p>Allows the player to use a Bike</p></body></html></string>
|
||||||
|
@ -294,14 +294,14 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="15" column="0">
|
<item row="17" column="0">
|
||||||
<widget class="QLabel" name="label_NewMap_Allow_Escape_Rope">
|
<widget class="QLabel" name="label_NewMap_Allow_Escape_Rope">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Allow Dig & Escape Rope</string>
|
<string>Allow Dig & Escape Rope</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="15" column="1">
|
<item row="17" column="1">
|
||||||
<widget class="QCheckBox" name="checkBox_NewMap_Allow_Escape_Rope">
|
<widget class="QCheckBox" name="checkBox_NewMap_Allow_Escape_Rope">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string><html><head/><body><p>Allows the player to use Dig or Escape Rope</p></body></html></string>
|
<string><html><head/><body><p>Allows the player to use Dig or Escape Rope</p></body></html></string>
|
||||||
|
@ -311,14 +311,14 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="16" column="0">
|
<item row="18" column="0">
|
||||||
<widget class="QLabel" name="label_NewMap_Floor_Number">
|
<widget class="QLabel" name="label_NewMap_Floor_Number">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Floor Number</string>
|
<string>Floor Number</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="16" column="1">
|
<item row="18" column="1">
|
||||||
<widget class="QSpinBox" name="spinBox_NewMap_Floor_Number">
|
<widget class="QSpinBox" name="spinBox_NewMap_Floor_Number">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string><html><head/><body><p>Floor number to be used for maps with elevators.</p></body></html></string>
|
<string><html><head/><body><p>Floor number to be used for maps with elevators.</p></body></html></string>
|
||||||
|
@ -328,6 +328,96 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
|
<widget class="NoScrollComboBox" name="comboBox_Layout">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Layout</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="text">
|
||||||
|
<string>Use Existing Layout</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkBox_UseExistingLayout">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_4">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_3">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -396,7 +486,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>410</width>
|
<width>410</width>
|
||||||
<height>21</height>
|
<height>22</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
|
@ -23,6 +23,7 @@ public:
|
||||||
bool importedMap;
|
bool importedMap;
|
||||||
QString layoutId;
|
QString layoutId;
|
||||||
void init();
|
void init();
|
||||||
|
void initUi();
|
||||||
void init(MapSortOrder type, QVariant data);
|
void init(MapSortOrder type, QVariant data);
|
||||||
void init(Layout *);
|
void init(Layout *);
|
||||||
static void setDefaultSettings(Project *project);
|
static void setDefaultSettings(Project *project);
|
||||||
|
@ -60,6 +61,8 @@ private:
|
||||||
static struct Settings settings;
|
static struct Settings settings;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
void on_checkBox_UseExistingLayout_stateChanged(int state);
|
||||||
|
void on_comboBox_Layout_currentTextChanged(const QString &text);
|
||||||
void on_pushButton_NewMap_Accept_clicked();
|
void on_pushButton_NewMap_Accept_clicked();
|
||||||
void on_lineEdit_NewMap_Name_textChanged(const QString &);
|
void on_lineEdit_NewMap_Name_textChanged(const QString &);
|
||||||
};
|
};
|
||||||
|
|
|
@ -1153,68 +1153,79 @@ void MainWindow::sortMapList() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onOpenMapListContextMenu(const QPoint &point) {
|
void MainWindow::onOpenMapListContextMenu(const QPoint &point) {
|
||||||
/// !TODO
|
QStandardItemModel *model;
|
||||||
// QModelIndex index = mapListProxyModel->mapToSource(ui->mapList->indexAt(point));
|
int dataRole;
|
||||||
// if (!index.isValid()) {
|
FilterChildrenProxyModel *proxy;
|
||||||
// return;
|
QTreeView *list;
|
||||||
// }
|
void (MainWindow::*addFunction)(QAction *);
|
||||||
|
QString actionText;
|
||||||
|
|
||||||
switch (ui->mapListContainer->currentIndex()) {
|
switch (this->mapSortOrder) {
|
||||||
//
|
case MapSortOrder::SortByGroup:
|
||||||
case MapListTab::Groups:
|
model = this->mapGroupModel;
|
||||||
|
dataRole = MapListRoles::GroupRole;
|
||||||
|
proxy = this->groupListProxyModel;
|
||||||
|
list = this->ui->mapList;
|
||||||
|
addFunction = &MainWindow::onAddNewMapToGroupClick;
|
||||||
|
actionText = "Add New Map to Group";
|
||||||
break;
|
break;
|
||||||
case MapListTab::Areas:
|
case MapSortOrder::SortByArea:
|
||||||
|
model = this->mapAreaModel;
|
||||||
|
dataRole = Qt::UserRole;
|
||||||
|
proxy = this->areaListProxyModel;
|
||||||
|
list = this->ui->areaList;
|
||||||
|
addFunction = &MainWindow::onAddNewMapToAreaClick;
|
||||||
|
actionText = "Add New Map to Area";
|
||||||
break;
|
break;
|
||||||
case MapListTab::Layouts:
|
case MapSortOrder::SortByLayout:
|
||||||
|
model = this->layoutTreeModel;
|
||||||
|
dataRole = Qt::UserRole;
|
||||||
|
proxy = this->layoutListProxyModel;
|
||||||
|
list = this->ui->layoutList;
|
||||||
|
addFunction = &MainWindow::onAddNewMapToLayoutClick;
|
||||||
|
actionText = "Add New Map with Layout";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// QStandardItem *selectedItem = mapListModel->itemFromIndex(index);
|
QModelIndex index = proxy->mapToSource(list->indexAt(point));
|
||||||
// QVariant itemType = selectedItem->data(MapListUserRoles::TypeRole);
|
if (!index.isValid()) {
|
||||||
// if (!itemType.isValid()) {
|
return;
|
||||||
// return;
|
}
|
||||||
// }
|
|
||||||
|
|
||||||
// // Build custom context menu depending on which type of item was selected (map group, map name, etc.)
|
QStandardItem *selectedItem = model->itemFromIndex(index);
|
||||||
// if (itemType == "map_group") {
|
|
||||||
// QString groupName = selectedItem->data(Qt::UserRole).toString();
|
if (selectedItem->parent()) {
|
||||||
// int groupNum = selectedItem->data(MapListUserRoles::GroupRole).toInt();
|
return;
|
||||||
// QMenu* menu = new QMenu(this);
|
}
|
||||||
// QActionGroup* actions = new QActionGroup(menu);
|
|
||||||
// actions->addAction(menu->addAction("Add New Map to Group"))->setData(groupNum);
|
QVariant itemData = selectedItem->data(dataRole);
|
||||||
// connect(actions, &QActionGroup::triggered, this, &MainWindow::onAddNewMapToGroupClick);
|
if (!itemData.isValid()) {
|
||||||
// menu->exec(QCursor::pos());
|
return;
|
||||||
// } else if (itemType == "map_sec") {
|
}
|
||||||
// QString secName = selectedItem->data(Qt::UserRole).toString();
|
|
||||||
// QMenu* menu = new QMenu(this);
|
QMenu menu(this);
|
||||||
// QActionGroup* actions = new QActionGroup(menu);
|
QActionGroup actions(&menu);
|
||||||
// actions->addAction(menu->addAction("Add New Map to Area"))->setData(secName);
|
actions.addAction(menu.addAction(actionText))->setData(itemData);
|
||||||
// connect(actions, &QActionGroup::triggered, this, &MainWindow::onAddNewMapToAreaClick);
|
(this->*addFunction)(menu.exec(QCursor::pos()));
|
||||||
// menu->exec(QCursor::pos());
|
|
||||||
// } else if (itemType == "map_layout") {
|
|
||||||
// QString layoutId = selectedItem->data(MapListUserRoles::TypeRole2).toString();
|
|
||||||
// QMenu* menu = new QMenu(this);
|
|
||||||
// QActionGroup* actions = new QActionGroup(menu);
|
|
||||||
// actions->addAction(menu->addAction("Add New Map with Layout"))->setData(layoutId);
|
|
||||||
// connect(actions, &QActionGroup::triggered, this, &MainWindow::onAddNewMapToLayoutClick);
|
|
||||||
// menu->exec(QCursor::pos());
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onAddNewMapToGroupClick(QAction* triggeredAction)
|
void MainWindow::onAddNewMapToGroupClick(QAction* triggeredAction) {
|
||||||
{
|
if (!triggeredAction) return;
|
||||||
|
|
||||||
openNewMapPopupWindow();
|
openNewMapPopupWindow();
|
||||||
this->newMapPrompt->init(MapSortOrder::SortByGroup, triggeredAction->data());
|
this->newMapPrompt->init(MapSortOrder::SortByGroup, triggeredAction->data());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onAddNewMapToAreaClick(QAction* triggeredAction)
|
void MainWindow::onAddNewMapToAreaClick(QAction* triggeredAction) {
|
||||||
{
|
if (!triggeredAction) return;
|
||||||
|
|
||||||
openNewMapPopupWindow();
|
openNewMapPopupWindow();
|
||||||
this->newMapPrompt->init(MapSortOrder::SortByArea, triggeredAction->data());
|
this->newMapPrompt->init(MapSortOrder::SortByArea, triggeredAction->data());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onAddNewMapToLayoutClick(QAction* triggeredAction)
|
void MainWindow::onAddNewMapToLayoutClick(QAction* triggeredAction) {
|
||||||
{
|
if (!triggeredAction) return;
|
||||||
|
|
||||||
openNewMapPopupWindow();
|
openNewMapPopupWindow();
|
||||||
this->newMapPrompt->init(MapSortOrder::SortByLayout, triggeredAction->data());
|
this->newMapPrompt->init(MapSortOrder::SortByLayout, triggeredAction->data());
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@ QStandardItem *MapGroupModel::createMapItem(QString mapName, int groupIndex, int
|
||||||
map->setEditable(false);
|
map->setEditable(false);
|
||||||
map->setData(mapName, Qt::UserRole);
|
map->setData(mapName, Qt::UserRole);
|
||||||
map->setData("map_name", MapListRoles::TypeRole);
|
map->setData("map_name", MapListRoles::TypeRole);
|
||||||
|
map->setData(groupIndex, MapListRoles::GroupRole);
|
||||||
// map->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsDragEnabled);
|
// map->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsDragEnabled);
|
||||||
this->mapItems.insert(mapName, map);
|
this->mapItems.insert(mapName, map);
|
||||||
return map;
|
return map;
|
||||||
|
|
|
@ -26,7 +26,7 @@ NewMapPopup::~NewMapPopup()
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NewMapPopup::init() {
|
void NewMapPopup::initUi() {
|
||||||
// Populate combo boxes
|
// Populate combo boxes
|
||||||
ui->comboBox_NewMap_Primary_Tileset->addItems(project->primaryTilesetLabels);
|
ui->comboBox_NewMap_Primary_Tileset->addItems(project->primaryTilesetLabels);
|
||||||
ui->comboBox_NewMap_Secondary_Tileset->addItems(project->secondaryTilesetLabels);
|
ui->comboBox_NewMap_Secondary_Tileset->addItems(project->secondaryTilesetLabels);
|
||||||
|
@ -35,6 +35,10 @@ void NewMapPopup::init() {
|
||||||
ui->comboBox_NewMap_Type->addItems(project->mapTypes);
|
ui->comboBox_NewMap_Type->addItems(project->mapTypes);
|
||||||
ui->comboBox_NewMap_Location->addItems(project->mapSectionValueToName.values());
|
ui->comboBox_NewMap_Location->addItems(project->mapSectionValueToName.values());
|
||||||
|
|
||||||
|
const QSignalBlocker b(ui->comboBox_Layout);
|
||||||
|
ui->comboBox_Layout->addItems(project->mapLayoutsTable);
|
||||||
|
this->layoutId = project->mapLayoutsTable.first();
|
||||||
|
|
||||||
// Set spin box limits
|
// Set spin box limits
|
||||||
ui->spinBox_NewMap_Width->setMinimum(1);
|
ui->spinBox_NewMap_Width->setMinimum(1);
|
||||||
ui->spinBox_NewMap_Height->setMinimum(1);
|
ui->spinBox_NewMap_Height->setMinimum(1);
|
||||||
|
@ -66,6 +70,10 @@ void NewMapPopup::init() {
|
||||||
ui->spinBox_NewMap_Floor_Number->setVisible(hasFloorNumber);
|
ui->spinBox_NewMap_Floor_Number->setVisible(hasFloorNumber);
|
||||||
ui->label_NewMap_Floor_Number->setVisible(hasFloorNumber);
|
ui->label_NewMap_Floor_Number->setVisible(hasFloorNumber);
|
||||||
|
|
||||||
|
this->updateGeometry();
|
||||||
|
}
|
||||||
|
|
||||||
|
void NewMapPopup::init() {
|
||||||
// Restore previous settings
|
// Restore previous settings
|
||||||
ui->lineEdit_NewMap_Name->setText(project->getNewMapName());
|
ui->lineEdit_NewMap_Name->setText(project->getNewMapName());
|
||||||
ui->comboBox_NewMap_Group->setTextItem(settings.group);
|
ui->comboBox_NewMap_Group->setTextItem(settings.group);
|
||||||
|
@ -86,6 +94,7 @@ void NewMapPopup::init() {
|
||||||
ui->spinBox_NewMap_Floor_Number->setValue(settings.floorNumber);
|
ui->spinBox_NewMap_Floor_Number->setValue(settings.floorNumber);
|
||||||
|
|
||||||
// Connect signals
|
// Connect signals
|
||||||
|
// !TODO: make sure this doesnt reconnect a million times
|
||||||
connect(ui->spinBox_NewMap_Width, QOverload<int>::of(&QSpinBox::valueChanged), [=](int){checkNewMapDimensions();});
|
connect(ui->spinBox_NewMap_Width, QOverload<int>::of(&QSpinBox::valueChanged), [=](int){checkNewMapDimensions();});
|
||||||
connect(ui->spinBox_NewMap_Height, QOverload<int>::of(&QSpinBox::valueChanged), [=](int){checkNewMapDimensions();});
|
connect(ui->spinBox_NewMap_Height, QOverload<int>::of(&QSpinBox::valueChanged), [=](int){checkNewMapDimensions();});
|
||||||
|
|
||||||
|
@ -94,6 +103,7 @@ void NewMapPopup::init() {
|
||||||
|
|
||||||
// Creating new map by right-clicking in the map list
|
// Creating new map by right-clicking in the map list
|
||||||
void NewMapPopup::init(MapSortOrder type, QVariant data) {
|
void NewMapPopup::init(MapSortOrder type, QVariant data) {
|
||||||
|
initUi();
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case MapSortOrder::SortByGroup:
|
case MapSortOrder::SortByGroup:
|
||||||
|
@ -103,6 +113,7 @@ void NewMapPopup::init(MapSortOrder type, QVariant data) {
|
||||||
settings.location = data.toString();
|
settings.location = data.toString();
|
||||||
break;
|
break;
|
||||||
case MapSortOrder::SortByLayout:
|
case MapSortOrder::SortByLayout:
|
||||||
|
this->ui->checkBox_UseExistingLayout->setCheckState(Qt::Checked);
|
||||||
useLayout(data.toString());
|
useLayout(data.toString());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -205,26 +216,58 @@ void NewMapPopup::saveSettings() {
|
||||||
|
|
||||||
void NewMapPopup::useLayoutSettings(Layout *layout) {
|
void NewMapPopup::useLayoutSettings(Layout *layout) {
|
||||||
if (!layout) return;
|
if (!layout) return;
|
||||||
|
|
||||||
settings.width = layout->width;
|
settings.width = layout->width;
|
||||||
|
ui->spinBox_NewMap_Width->setValue(layout->width);
|
||||||
|
|
||||||
settings.height = layout->height;
|
settings.height = layout->height;
|
||||||
|
ui->spinBox_NewMap_Height->setValue(layout->height);
|
||||||
|
|
||||||
settings.borderWidth = layout->border_width;
|
settings.borderWidth = layout->border_width;
|
||||||
|
ui->spinBox_NewMap_BorderWidth->setValue(layout->border_width);
|
||||||
|
|
||||||
settings.borderHeight = layout->border_height;
|
settings.borderHeight = layout->border_height;
|
||||||
|
ui->spinBox_NewMap_BorderWidth->setValue(layout->border_height);
|
||||||
|
|
||||||
settings.primaryTilesetLabel = layout->tileset_primary_label;
|
settings.primaryTilesetLabel = layout->tileset_primary_label;
|
||||||
|
ui->comboBox_NewMap_Primary_Tileset->setCurrentIndex(ui->comboBox_NewMap_Primary_Tileset->findText(layout->tileset_primary_label));
|
||||||
|
|
||||||
settings.secondaryTilesetLabel = layout->tileset_secondary_label;
|
settings.secondaryTilesetLabel = layout->tileset_secondary_label;
|
||||||
|
ui->comboBox_NewMap_Secondary_Tileset->setCurrentIndex(ui->comboBox_NewMap_Secondary_Tileset->findText(layout->tileset_secondary_label));
|
||||||
}
|
}
|
||||||
|
|
||||||
void NewMapPopup::useLayout(QString layoutId) {
|
void NewMapPopup::useLayout(QString layoutId) {
|
||||||
this->existingLayout = true;
|
this->existingLayout = true;
|
||||||
this->layoutId = layoutId;
|
this->layoutId = layoutId;
|
||||||
useLayoutSettings(project->mapLayouts.value(this->layoutId));
|
|
||||||
|
|
||||||
// Dimensions and tilesets can't be changed for new maps using an existing layout
|
this->ui->comboBox_Layout->setCurrentIndex(this->ui->comboBox_Layout->findText(layoutId));
|
||||||
ui->spinBox_NewMap_Width->setDisabled(true);
|
|
||||||
ui->spinBox_NewMap_Height->setDisabled(true);
|
useLayoutSettings(project->mapLayouts.value(this->layoutId));
|
||||||
ui->spinBox_NewMap_BorderWidth->setDisabled(true);
|
}
|
||||||
ui->spinBox_NewMap_BorderHeight->setDisabled(true);
|
|
||||||
ui->comboBox_NewMap_Primary_Tileset->setDisabled(true);
|
void NewMapPopup::on_checkBox_UseExistingLayout_stateChanged(int state) {
|
||||||
ui->comboBox_NewMap_Secondary_Tileset->setDisabled(true);
|
bool layoutEditsEnabled = (state == Qt::Unchecked);
|
||||||
|
|
||||||
|
this->ui->comboBox_Layout->setEnabled(!layoutEditsEnabled);
|
||||||
|
|
||||||
|
this->ui->spinBox_NewMap_Width->setEnabled(layoutEditsEnabled);
|
||||||
|
this->ui->spinBox_NewMap_Height->setEnabled(layoutEditsEnabled);
|
||||||
|
this->ui->spinBox_NewMap_BorderWidth->setEnabled(layoutEditsEnabled);
|
||||||
|
this->ui->spinBox_NewMap_BorderWidth->setEnabled(layoutEditsEnabled);
|
||||||
|
this->ui->comboBox_NewMap_Primary_Tileset->setEnabled(layoutEditsEnabled);
|
||||||
|
this->ui->comboBox_NewMap_Secondary_Tileset->setEnabled(layoutEditsEnabled);
|
||||||
|
|
||||||
|
if (!layoutEditsEnabled) {
|
||||||
|
useLayout(this->layoutId);//this->ui->comboBox_Layout->currentText());
|
||||||
|
} else {
|
||||||
|
this->existingLayout = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void NewMapPopup::on_comboBox_Layout_currentTextChanged(const QString &text) {
|
||||||
|
if (this->project->mapLayoutsTable.contains(text)) {
|
||||||
|
useLayout(text);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void NewMapPopup::on_lineEdit_NewMap_Name_textChanged(const QString &text) {
|
void NewMapPopup::on_lineEdit_NewMap_Name_textChanged(const QString &text) {
|
||||||
|
|
Loading…
Reference in a new issue