Remember window sizes, add new map popup window (#54)

* save window state on app close

* new map popup window

* window title, groupItem fix

* fix new map heal location generation

* fix newmappopup form size

* empty map name check, increase max dimensions

* tool tips

* delete new window

* fix mainwindow.ui new map action

* use new config for window state

* clean window restore config settings

* extend "Add New Map" to different MapSortOrders

* fix crash when creating new map from unloaded layout

* fix new map from layout extra files
This commit is contained in:
garak
2019-01-07 18:14:44 -05:00
committed by huderlem
parent aa0709243d
commit d13a4da50a
14 changed files with 736 additions and 31 deletions

View File

@@ -16,7 +16,7 @@
<widget class="QWidget" name="centralWidget">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QSplitter" name="splitter">
<widget class="QSplitter" name="splitter_main">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@@ -197,7 +197,7 @@
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QSplitter" name="splitter_2">
<widget class="QSplitter" name="splitter_map">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@@ -482,8 +482,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>469</width>
<height>608</height>
<width>545</width>
<height>587</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_8">
@@ -797,8 +797,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>324</width>
<height>77</height>
<width>256</width>
<height>74</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_7">
@@ -907,10 +907,10 @@
</property>
<property name="geometry">
<rect>
<x>0</x>
<x>8</x>
<y>0</y>
<width>307</width>
<height>387</height>
<width>222</width>
<height>353</height>
</rect>
</property>
<property name="sizePolicy">
@@ -1224,7 +1224,7 @@
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QSplitter" name="splitter_3">
<widget class="QSplitter" name="splitter_events">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
@@ -1249,8 +1249,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>381</width>
<height>657</height>
<width>371</width>
<height>643</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_7">
@@ -1523,7 +1523,7 @@
<x>0</x>
<y>0</y>
<width>430</width>
<height>568</height>
<height>534</height>
</rect>
</property>
<property name="sizePolicy">
@@ -2308,8 +2308,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>826</width>
<height>557</height>
<width>818</width>
<height>539</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_14">
@@ -2481,7 +2481,7 @@
<x>0</x>
<y>0</y>
<width>1117</width>
<height>21</height>
<height>22</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
@@ -2522,6 +2522,7 @@
<addaction name="actionMove"/>
<addaction name="actionMap_Shift"/>
<addaction name="separator"/>
<addaction name="action_NewMap"/>
<addaction name="actionTileset_Editor"/>
</widget>
<addaction name="menuFile"/>
@@ -2562,6 +2563,14 @@
<string>Ctrl+S</string>
</property>
</action>
<action name="action_NewMap">
<property name="text">
<string>New Map</string>
</property>
<property name="shortcut">
<string>Ctrl+N</string>
</property>
</action>
<action name="actionUndo">
<property name="text">
<string>Undo</string>

267
forms/newmappopup.ui Normal file
View File

@@ -0,0 +1,267 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>NewMapPopup</class>
<widget class="QMainWindow" name="NewMapPopup">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>410</width>
<height>508</height>
</rect>
</property>
<property name="windowTitle">
<string>New Map Options</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="1">
<widget class="QFrame" name="frame_NewMap_Options">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QFormLayout" name="formLayout_2">
<property name="sizeConstraint">
<enum>QLayout::SetFixedSize</enum>
</property>
<property name="verticalSpacing">
<number>12</number>
</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>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The name of the new map. If the name is invalid (red), it will be replaced with the default name of a new map.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_NewMap_Group">
<property name="text">
<string>Group</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="comboBox_NewMap_Group">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;New map group.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="editable">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_NewMap_Width">
<property name="text">
<string>Width</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QSpinBox" name="spinBox_NewMap_Width">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Width (in blocks) of the new map.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="maximum">
<number>200</number>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_NewMap_Height">
<property name="text">
<string>Height</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QSpinBox" name="spinBox_NewMap_Height">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Height (in blocks) of the new map.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="maximum">
<number>200</number>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_NewMap_Primary_Tileset">
<property name="text">
<string>Primary Tileset</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="NoScrollComboBox" name="comboBox_NewMap_Primary_Tileset">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The primary tileset for the new map.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="editable">
<bool>true</bool>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_NewMap_Secondary_Tileset">
<property name="text">
<string>Secondary Tileset</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="NoScrollComboBox" name="comboBox_NewMap_Secondary_Tileset">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The secondary tileset for the new map.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="editable">
<bool>true</bool>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_NewMap_Type">
<property name="text">
<string>Type</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QComboBox" name="comboBox_NewMap_Type">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The map type is a general attribute, which is used for many different things. For example. it determines whether biking or running is allowed.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="editable">
<bool>true</bool>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_NewMap_Location">
<property name="text">
<string>Location</string>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QComboBox" name="comboBox_NewMap_Location">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;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.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="editable">
<bool>true</bool>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="label_NewMap_Flyable">
<property name="text">
<string>Can Fly To</string>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QCheckBox" name="checkBox_NewMap_Flyable">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Whether to add a heal location to the new map.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="9" column="0">
<widget class="QLabel" name="label_NewMap_Allow_Running">
<property name="text">
<string>Allow Running</string>
</property>
</widget>
</item>
<item row="10" column="0">
<widget class="QLabel" name="label_NewMap_Allow_Biking">
<property name="text">
<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>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="pushButton_NewMap_Accept">
<property name="text">
<string>Accept</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>410</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QStatusBar" name="statusbar"/>
</widget>
<customwidgets>
<customwidget>
<class>NoScrollComboBox</class>
<extends>QComboBox</extends>
<header>noscrollcombobox.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>