Clean up project settings editor UI

This commit is contained in:
GriffinR 2023-09-08 13:05:38 -04:00
parent 61cbbbf08a
commit 7a399daaff
2 changed files with 401 additions and 370 deletions

View file

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>563</width>
<height>1129</height>
<width>611</width>
<height>1137</height>
</rect>
</property>
<property name="windowTitle">
@ -28,15 +28,15 @@
<rect>
<x>0</x>
<y>0</y>
<width>537</width>
<height>1427</height>
<width>585</width>
<height>1486</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<widget class="QGroupBox" name="groupBox_UserConfig">
<property name="title">
<string>User config</string>
<string>Preferences</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
@ -232,6 +232,18 @@
</property>
</widget>
</item>
<item>
<widget class="QFrame" name="frame_Warning">
<property name="styleSheet">
<string notr="true">.QFrame { border: 1px solid red; }</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QLabel" name="label_Warning">
<property name="font">
@ -442,19 +454,10 @@
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_ProjectPaths">
<property name="minimumSize">
<size>
<width>0</width>
<height>320</height>
</size>
</property>
<property name="title">
<string>Path Overrides</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<widget class="QWidget" name="widget_ProjectPaths" native="true">
<layout class="QVBoxLayout" name="verticalLayout_6">
<property name="spacing">
<number>1</number>
<number>2</number>
</property>
<property name="leftMargin">
<number>0</number>
@ -469,12 +472,31 @@
<number>0</number>
</property>
<item>
<widget class="QScrollArea" name="scrollArea_ProjectPaths">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
<widget class="QLabel" name="label_ProjectFiles">
<property name="text">
<string> &lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;a href=&quot;https://huderlem.github.io/porymap/manual/project-files.html&quot;&gt;&lt;span style=&quot; text-decoration: underline;&quot;&gt;Project Files&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
<property name="alignment">
<set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QScrollArea" name="scrollArea_ProjectPaths">
<property name="minimumSize">
<size>
<width>0</width>
<height>320</height>
</size>
</property>
<property name="lineWidth">
<number>2</number>
</property>
<property name="widgetResizable">
<bool>true</bool>
@ -484,11 +506,21 @@
<rect>
<x>0</x>
<y>0</y>
<width>507</width>
<height>295</height>
<width>533</width>
<height>318</height>
</rect>
</property>
<layout class="QFormLayout" name="layout_ProjectPaths"/>
<layout class="QFormLayout" name="layout_ProjectPaths">
<property name="verticalSpacing">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>4</number>
</property>
</layout>
</widget>
</widget>
</item>
@ -501,6 +533,27 @@
<string>Events</string>
</property>
<layout class="QGridLayout" name="gridLayout_5">
<item row="2" column="0">
<widget class="QCheckBox" name="checkBox_EnableWeatherTriggers">
<property name="text">
<string>Enable Weather Triggers</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="checkBox_EnableSecretBases">
<property name="text">
<string>Enable Secret Bases</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="checkBox_EnableCloneObjects">
<property name="text">
<string>Enable Clone Objects</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="checkBox_EnableRequiresItemfinder">
<property name="text">
@ -515,6 +568,13 @@
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="checkBox_EnableRespawn">
<property name="text">
<string>Enable 'Respawn Map/NPC' for Heal Locations</string>
</property>
</widget>
</item>
<item row="0" column="2">
<spacer name="horizontalSpacer_2">
<property name="orientation">
@ -528,34 +588,6 @@
</property>
</spacer>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="checkBox_EnableSecretBases">
<property name="text">
<string>Enable Secret Bases</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="checkBox_EnableWeatherTriggers">
<property name="text">
<string>Enable Weather Triggers</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="checkBox_EnableCloneObjects">
<property name="text">
<string>Enable Clone Objects</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="checkBox_EnableRespawn">
<property name="text">
<string>Enable 'Respawn Map/NPC' for Heal Locations</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@ -613,6 +645,9 @@
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item>

View file

@ -11,8 +11,6 @@
Editor for the settings in a user's porymap.project.cfg file (and 'use_encounter_json' in porymap.user.cfg).
*/
// TODO: Better red outline around warning section
ProjectSettingsEditor::ProjectSettingsEditor(QWidget *parent, Project *project) :
QMainWindow(parent),
ui(new Ui::ProjectSettingsEditor),
@ -78,14 +76,12 @@ void ProjectSettingsEditor::initUi() {
ui->spinBox_TerrainTypeMask->setMaximum(INT_MAX);
}
// TODO: Reduce vertical space between entries
// TODO: Fix vertical misalignment between label and edit area
// TODO: Add description / manual link at top?
void ProjectSettingsEditor::createProjectPathsTable() {
auto pathPairs = ProjectConfig::defaultPaths.values();
for (auto pathPair : pathPairs) {
// Name of the path
auto name = new QLabel();
name->setAlignment(Qt::AlignBottom);
name->setText(pathPair.first);
// Editable area of the path
@ -99,11 +95,11 @@ void ProjectSettingsEditor::createProjectPathsTable() {
//connect(button, &QAbstractButton::clicked, this, &ProjectSettingsEditor::);
// Add to list
auto editFrame = new QFrame();
auto layout = new QHBoxLayout(editFrame);
auto editArea = new QWidget();
auto layout = new QHBoxLayout(editArea);
layout->addWidget(path);
layout->addWidget(button);
ui->layout_ProjectPaths->addRow(name, editFrame);
ui->layout_ProjectPaths->addRow(name, editArea);
}
}