Clean up for new editor windows
This commit is contained in:
parent
2aa18da255
commit
885695e705
9 changed files with 81 additions and 40 deletions
|
@ -78,7 +78,7 @@
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_Manual">
|
<widget class="QLabel" name="label_Manual">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string><html><head/><body><p>Official Documentation: <a href="https://huderlem.github.io/porymap/"><span style=" text-decoration: underline; color:#0000ff;">https://huderlem.github.io/porymap/</span></a></p></body></html></string>
|
<string><html><head/><body><p>Official Documentation: <a href="https://huderlem.github.io/porymap/"><span style=" text-decoration: underline;">https://huderlem.github.io/porymap/</span></a></p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignCenter</set>
|
<set>Qt::AlignCenter</set>
|
||||||
|
|
|
@ -89,7 +89,7 @@
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_Manual">
|
<widget class="QLabel" name="label_Manual">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string><html><head/><body><p><a href="https://huderlem.github.io/porymap/manual/scripting-capabilities.html"><span style=" text-decoration: underline; color:#0000ff;">What are custom scripts?</span></a></p></body></html></string>
|
<string><html><head/><body><p><a href="https://huderlem.github.io/porymap/manual/scripting-capabilities.html"><span style=" text-decoration: underline;">What are custom scripts?</span></a></p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="openExternalLinks">
|
<property name="openExternalLinks">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
|
|
|
@ -52,6 +52,9 @@
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="checkBox_Enable">
|
<widget class="QCheckBox" name="checkBox_Enable">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>If unchecked this script will be ignored</string>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="checkBox_UsePoryscript">
|
<widget class="QCheckBox" name="checkBox_UsePoryscript">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string/>
|
<string>Whether map script files should prefer using .pory</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Use Poryscript</string>
|
<string>Use Poryscript</string>
|
||||||
|
@ -95,13 +95,14 @@
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_3">
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
<item row="0" column="1" colspan="2">
|
<item row="0" column="1" colspan="2">
|
||||||
<widget class="QLineEdit" name="lineEdit_BorderMetatiles"/>
|
<widget class="QLineEdit" name="lineEdit_BorderMetatiles">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>A comma-separated list of metatile values that will be used to fill new map borders</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="2" column="0">
|
||||||
<widget class="QLabel" name="label_Elevation">
|
<widget class="QLabel" name="label_Elevation">
|
||||||
<property name="toolTip">
|
|
||||||
<string>The default elevation that will be used to fill new maps</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Elevation</string>
|
<string>Elevation</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -131,13 +132,14 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1">
|
<item row="2" column="1">
|
||||||
<widget class="QSpinBox" name="spinBox_Elevation"/>
|
<widget class="QSpinBox" name="spinBox_Elevation">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>The default elevation that will be used to fill new maps</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QLabel" name="label_FillMetatile">
|
<widget class="QLabel" name="label_FillMetatile">
|
||||||
<property name="toolTip">
|
|
||||||
<string>The default metatile value that will be used to fill new maps</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Fill Metatile</string>
|
<string>Fill Metatile</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -145,9 +147,6 @@
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="label_BorderMetatiles">
|
<widget class="QLabel" name="label_BorderMetatiles">
|
||||||
<property name="toolTip">
|
|
||||||
<string>A comma-separated list of metatile values that will be used to fill new map borders</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Border Metatiles</string>
|
<string>Border Metatiles</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -155,6 +154,9 @@
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="1" column="1">
|
||||||
<widget class="QSpinBox" name="spinBox_FillMetatile">
|
<widget class="QSpinBox" name="spinBox_FillMetatile">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>The default metatile value that will be used to fill new maps</string>
|
||||||
|
</property>
|
||||||
<property name="prefix">
|
<property name="prefix">
|
||||||
<string>0x</string>
|
<string>0x</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -198,13 +200,20 @@
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QPushButton" name="button_ImportDefaultPrefabs">
|
<widget class="QPushButton" name="button_ImportDefaultPrefabs">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Restore the data in the prefabs file to the version defaults. Will create a new file if one doesn't exist.</string>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Import Defaults</string>
|
<string>Import Defaults</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="QLineEdit" name="lineEdit_PrefabsPath"/>
|
<widget class="QLineEdit" name="lineEdit_PrefabsPath">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>The file that will be used to populate the Prefabs tab</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="label_PrefabsPath">
|
<widget class="QLabel" name="label_PrefabsPath">
|
||||||
|
@ -301,6 +310,9 @@
|
||||||
</item>
|
</item>
|
||||||
<item row="7" column="1">
|
<item row="7" column="1">
|
||||||
<widget class="QSpinBox" name="spinBox_TerrainTypeMask">
|
<widget class="QSpinBox" name="spinBox_TerrainTypeMask">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>The mask used to read/write Terrain Type from the metatile's attributes data. If 0, this attribute is disabled.</string>
|
||||||
|
</property>
|
||||||
<property name="prefix">
|
<property name="prefix">
|
||||||
<string>0x</string>
|
<string>0x</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -321,9 +333,6 @@
|
||||||
</item>
|
</item>
|
||||||
<item row="7" column="0">
|
<item row="7" column="0">
|
||||||
<widget class="QLabel" name="label_TerrainTypeMask">
|
<widget class="QLabel" name="label_TerrainTypeMask">
|
||||||
<property name="toolTip">
|
|
||||||
<string>The mask used to read/write Terrain Type from the metatile's attributes data. If 0, this attribute is disabled.</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Terrain Type mask</string>
|
<string>Terrain Type mask</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -351,9 +360,6 @@
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
<item row="3" column="0">
|
||||||
<widget class="QLabel" name="label_BehaviorMask">
|
<widget class="QLabel" name="label_BehaviorMask">
|
||||||
<property name="toolTip">
|
|
||||||
<string>The mask used to read/write Metatile Behavior from the metatile's attributes data. If 0, this attribute is disabled.</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Behavior mask</string>
|
<string>Behavior mask</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -361,6 +367,9 @@
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="1">
|
<item row="3" column="1">
|
||||||
<widget class="QSpinBox" name="spinBox_BehaviorMask">
|
<widget class="QSpinBox" name="spinBox_BehaviorMask">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>The mask used to read/write Metatile Behavior from the metatile's attributes data. If 0, this attribute is disabled.</string>
|
||||||
|
</property>
|
||||||
<property name="prefix">
|
<property name="prefix">
|
||||||
<string>0x</string>
|
<string>0x</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -391,6 +400,9 @@
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="1">
|
<item row="5" column="1">
|
||||||
<widget class="QSpinBox" name="spinBox_EncounterTypeMask">
|
<widget class="QSpinBox" name="spinBox_EncounterTypeMask">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>The mask used to read/write Encounter Type from the metatile's attributes data. If 0, this attribute is disabled.</string>
|
||||||
|
</property>
|
||||||
<property name="prefix">
|
<property name="prefix">
|
||||||
<string>0x</string>
|
<string>0x</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -401,9 +413,6 @@
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="0">
|
<item row="5" column="0">
|
||||||
<widget class="QLabel" name="label_EncounterTypeMask">
|
<widget class="QLabel" name="label_EncounterTypeMask">
|
||||||
<property name="toolTip">
|
|
||||||
<string>The mask used to read/write Encounter Type from the metatile's attributes data. If 0, this attribute is disabled.</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Encounter Type mask</string>
|
<string>Encounter Type mask</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -411,9 +420,6 @@
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="0">
|
<item row="4" column="0">
|
||||||
<widget class="QLabel" name="label_LayerTypeMask">
|
<widget class="QLabel" name="label_LayerTypeMask">
|
||||||
<property name="toolTip">
|
|
||||||
<string>The mask used to read/write Layer Type from the metatile's attributes data. If 0, this attribute is disabled.</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Layer Type mask</string>
|
<string>Layer Type mask</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -421,6 +427,9 @@
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="1">
|
<item row="4" column="1">
|
||||||
<widget class="QSpinBox" name="spinBox_LayerTypeMask">
|
<widget class="QSpinBox" name="spinBox_LayerTypeMask">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>The mask used to read/write Layer Type from the metatile's attributes data. If 0, this attribute is disabled.</string>
|
||||||
|
</property>
|
||||||
<property name="prefix">
|
<property name="prefix">
|
||||||
<string>0x</string>
|
<string>0x</string>
|
||||||
</property>
|
</property>
|
||||||
|
|
|
@ -74,6 +74,7 @@ public:
|
||||||
void setPaletteEditorGeometry(QByteArray, QByteArray);
|
void setPaletteEditorGeometry(QByteArray, QByteArray);
|
||||||
void setRegionMapEditorGeometry(QByteArray, QByteArray);
|
void setRegionMapEditorGeometry(QByteArray, QByteArray);
|
||||||
void setProjectSettingsEditorGeometry(QByteArray, QByteArray);
|
void setProjectSettingsEditorGeometry(QByteArray, QByteArray);
|
||||||
|
void setCustomScriptsEditorGeometry(QByteArray, QByteArray);
|
||||||
void setCollisionOpacity(int opacity);
|
void setCollisionOpacity(int opacity);
|
||||||
void setMetatilesZoom(int zoom);
|
void setMetatilesZoom(int zoom);
|
||||||
void setShowPlayerView(bool enabled);
|
void setShowPlayerView(bool enabled);
|
||||||
|
@ -95,6 +96,7 @@ public:
|
||||||
QMap<QString, QByteArray> getPaletteEditorGeometry();
|
QMap<QString, QByteArray> getPaletteEditorGeometry();
|
||||||
QMap<QString, QByteArray> getRegionMapEditorGeometry();
|
QMap<QString, QByteArray> getRegionMapEditorGeometry();
|
||||||
QMap<QString, QByteArray> getProjectSettingsEditorGeometry();
|
QMap<QString, QByteArray> getProjectSettingsEditorGeometry();
|
||||||
|
QMap<QString, QByteArray> getCustomScriptsEditorGeometry();
|
||||||
int getCollisionOpacity();
|
int getCollisionOpacity();
|
||||||
int getMetatilesZoom();
|
int getMetatilesZoom();
|
||||||
bool getShowPlayerView();
|
bool getShowPlayerView();
|
||||||
|
@ -133,6 +135,8 @@ private:
|
||||||
QByteArray regionMapEditorState;
|
QByteArray regionMapEditorState;
|
||||||
QByteArray projectSettingsEditorGeometry;
|
QByteArray projectSettingsEditorGeometry;
|
||||||
QByteArray projectSettingsEditorState;
|
QByteArray projectSettingsEditorState;
|
||||||
|
QByteArray customScriptsEditorGeometry;
|
||||||
|
QByteArray customScriptsEditorState;
|
||||||
int collisionOpacity;
|
int collisionOpacity;
|
||||||
int metatilesZoom;
|
int metatilesZoom;
|
||||||
bool showPlayerView;
|
bool showPlayerView;
|
||||||
|
|
|
@ -33,19 +33,17 @@ private:
|
||||||
|
|
||||||
void displayScript(const QString &filepath, bool enabled);
|
void displayScript(const QString &filepath, bool enabled);
|
||||||
QString chooseScript(QString dir);
|
QString chooseScript(QString dir);
|
||||||
|
|
||||||
void removeScript(QListWidgetItem * item);
|
void removeScript(QListWidgetItem * item);
|
||||||
void replaceScript(QListWidgetItem * item);
|
void replaceScript(QListWidgetItem * item);
|
||||||
void openScript(QListWidgetItem * item);
|
void openScript(QListWidgetItem * item);
|
||||||
QString getScriptFilepath(QListWidgetItem * item, bool absolutePath = true) const;
|
QString getScriptFilepath(QListWidgetItem * item, bool absolutePath = true) const;
|
||||||
void setScriptFilepath(QListWidgetItem * item, QString filepath) const;
|
void setScriptFilepath(QListWidgetItem * item, QString filepath) const;
|
||||||
bool getScriptEnabled(QListWidgetItem * item) const;
|
bool getScriptEnabled(QListWidgetItem * item) const;
|
||||||
|
|
||||||
void markEdited();
|
void markEdited();
|
||||||
int prompt(const QString &text, QMessageBox::StandardButton defaultButton);
|
int prompt(const QString &text, QMessageBox::StandardButton defaultButton);
|
||||||
void save();
|
void save();
|
||||||
void closeEvent(QCloseEvent*);
|
void closeEvent(QCloseEvent*);
|
||||||
|
void restoreWindowState();
|
||||||
void initShortcuts();
|
void initShortcuts();
|
||||||
QObjectList shortcutableObjects() const;
|
QObjectList shortcutableObjects() const;
|
||||||
void applyUserShortcuts();
|
void applyUserShortcuts();
|
||||||
|
|
|
@ -238,6 +238,10 @@ void PorymapConfig::parseConfigKeyValue(QString key, QString value) {
|
||||||
this->projectSettingsEditorGeometry = bytesFromString(value);
|
this->projectSettingsEditorGeometry = bytesFromString(value);
|
||||||
} else if (key == "project_settings_editor_state") {
|
} else if (key == "project_settings_editor_state") {
|
||||||
this->projectSettingsEditorState = bytesFromString(value);
|
this->projectSettingsEditorState = bytesFromString(value);
|
||||||
|
} else if (key == "custom_scripts_editor_geometry") {
|
||||||
|
this->customScriptsEditorGeometry = bytesFromString(value);
|
||||||
|
} else if (key == "custom_scripts_editor_state") {
|
||||||
|
this->customScriptsEditorState = bytesFromString(value);
|
||||||
} else if (key == "metatiles_zoom") {
|
} else if (key == "metatiles_zoom") {
|
||||||
this->metatilesZoom = getConfigInteger(key, value, 10, 100, 30);
|
this->metatilesZoom = getConfigInteger(key, value, 10, 100, 30);
|
||||||
} else if (key == "show_player_view") {
|
} else if (key == "show_player_view") {
|
||||||
|
@ -286,6 +290,8 @@ QMap<QString, QString> PorymapConfig::getKeyValueMap() {
|
||||||
map.insert("region_map_editor_state", stringFromByteArray(this->regionMapEditorState));
|
map.insert("region_map_editor_state", stringFromByteArray(this->regionMapEditorState));
|
||||||
map.insert("project_settings_editor_geometry", stringFromByteArray(this->projectSettingsEditorGeometry));
|
map.insert("project_settings_editor_geometry", stringFromByteArray(this->projectSettingsEditorGeometry));
|
||||||
map.insert("project_settings_editor_state", stringFromByteArray(this->projectSettingsEditorState));
|
map.insert("project_settings_editor_state", stringFromByteArray(this->projectSettingsEditorState));
|
||||||
|
map.insert("custom_scripts_editor_geometry", stringFromByteArray(this->customScriptsEditorGeometry));
|
||||||
|
map.insert("custom_scripts_editor_state", stringFromByteArray(this->customScriptsEditorState));
|
||||||
map.insert("collision_opacity", QString("%1").arg(this->collisionOpacity));
|
map.insert("collision_opacity", QString("%1").arg(this->collisionOpacity));
|
||||||
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");
|
||||||
|
@ -382,6 +388,12 @@ void PorymapConfig::setProjectSettingsEditorGeometry(QByteArray projectSettingsE
|
||||||
this->save();
|
this->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PorymapConfig::setCustomScriptsEditorGeometry(QByteArray customScriptsEditorGeometry_, QByteArray customScriptsEditorState_) {
|
||||||
|
this->customScriptsEditorGeometry = customScriptsEditorGeometry_;
|
||||||
|
this->customScriptsEditorState = customScriptsEditorState_;
|
||||||
|
this->save();
|
||||||
|
}
|
||||||
|
|
||||||
void PorymapConfig::setCollisionOpacity(int opacity) {
|
void PorymapConfig::setCollisionOpacity(int opacity) {
|
||||||
this->collisionOpacity = opacity;
|
this->collisionOpacity = opacity;
|
||||||
// don't auto-save here because this can be called very frequently.
|
// don't auto-save here because this can be called very frequently.
|
||||||
|
@ -494,6 +506,15 @@ QMap<QString, QByteArray> PorymapConfig::getProjectSettingsEditorGeometry() {
|
||||||
return geometry;
|
return geometry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QMap<QString, QByteArray> PorymapConfig::getCustomScriptsEditorGeometry() {
|
||||||
|
QMap<QString, QByteArray> geometry;
|
||||||
|
|
||||||
|
geometry.insert("custom_scripts_editor_geometry", this->customScriptsEditorGeometry);
|
||||||
|
geometry.insert("custom_scripts_editor_state", this->customScriptsEditorState);
|
||||||
|
|
||||||
|
return geometry;
|
||||||
|
}
|
||||||
|
|
||||||
int PorymapConfig::getCollisionOpacity() {
|
int PorymapConfig::getCollisionOpacity() {
|
||||||
return this->collisionOpacity;
|
return this->collisionOpacity;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,9 +8,6 @@
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
|
|
||||||
// TODO: Better URL colors on dark themes
|
|
||||||
// TODO: Save window state
|
|
||||||
|
|
||||||
CustomScriptsEditor::CustomScriptsEditor(QWidget *parent) :
|
CustomScriptsEditor::CustomScriptsEditor(QWidget *parent) :
|
||||||
QMainWindow(parent),
|
QMainWindow(parent),
|
||||||
ui(new Ui::CustomScriptsEditor),
|
ui(new Ui::CustomScriptsEditor),
|
||||||
|
@ -33,6 +30,7 @@ CustomScriptsEditor::CustomScriptsEditor(QWidget *parent) :
|
||||||
connect(ui->buttonBox, &QDialogButtonBox::clicked, this, &CustomScriptsEditor::dialogButtonClicked);
|
connect(ui->buttonBox, &QDialogButtonBox::clicked, this, &CustomScriptsEditor::dialogButtonClicked);
|
||||||
|
|
||||||
this->initShortcuts();
|
this->initShortcuts();
|
||||||
|
this->restoreWindowState();
|
||||||
}
|
}
|
||||||
|
|
||||||
CustomScriptsEditor::~CustomScriptsEditor()
|
CustomScriptsEditor::~CustomScriptsEditor()
|
||||||
|
@ -90,6 +88,13 @@ void CustomScriptsEditor::applyUserShortcuts() {
|
||||||
shortcut->setKeys(shortcutsConfig.userShortcuts(shortcut));
|
shortcut->setKeys(shortcutsConfig.userShortcuts(shortcut));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CustomScriptsEditor::restoreWindowState() {
|
||||||
|
logInfo("Restoring custom scripts editor geometry from previous session.");
|
||||||
|
const QMap<QString, QByteArray> geometry = porymapConfig.getCustomScriptsEditorGeometry();
|
||||||
|
this->restoreGeometry(geometry.value("custom_scripts_editor_geometry"));
|
||||||
|
this->restoreState(geometry.value("custom_scripts_editor_state"));
|
||||||
|
}
|
||||||
|
|
||||||
void CustomScriptsEditor::displayScript(const QString &filepath, bool enabled) {
|
void CustomScriptsEditor::displayScript(const QString &filepath, bool enabled) {
|
||||||
auto item = new QListWidgetItem();
|
auto item = new QListWidgetItem();
|
||||||
auto widget = new CustomScriptsListItem();
|
auto widget = new CustomScriptsListItem();
|
||||||
|
@ -243,11 +248,9 @@ void CustomScriptsEditor::closeEvent(QCloseEvent* event) {
|
||||||
if (result == QMessageBox::Yes)
|
if (result == QMessageBox::Yes)
|
||||||
this->save();
|
this->save();
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
// TODO
|
porymapConfig.setCustomScriptsEditorGeometry(
|
||||||
porymapConfig.setProjectSettingsEditorGeometry(
|
|
||||||
this->saveGeometry(),
|
this->saveGeometry(),
|
||||||
this->saveState()
|
this->saveState()
|
||||||
);
|
);
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,8 +29,6 @@ ProjectSettingsEditor::~ProjectSettingsEditor()
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Move tool tips to editable areas
|
|
||||||
|
|
||||||
void ProjectSettingsEditor::connectSignals() {
|
void ProjectSettingsEditor::connectSignals() {
|
||||||
connect(ui->buttonBox, &QDialogButtonBox::clicked, this, &ProjectSettingsEditor::dialogButtonClicked);
|
connect(ui->buttonBox, &QDialogButtonBox::clicked, this, &ProjectSettingsEditor::dialogButtonClicked);
|
||||||
connect(ui->button_ChoosePrefabs, &QAbstractButton::clicked, this, &ProjectSettingsEditor::choosePrefabsFileClicked);
|
connect(ui->button_ChoosePrefabs, &QAbstractButton::clicked, this, &ProjectSettingsEditor::choosePrefabsFileClicked);
|
||||||
|
@ -178,7 +176,7 @@ void ProjectSettingsEditor::save() {
|
||||||
this->projectNeedsReload = true;
|
this->projectNeedsReload = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: If the selected file is in the project directory use a relative path
|
// Pick a file to use as the new prefabs file path
|
||||||
void ProjectSettingsEditor::choosePrefabsFileClicked(bool) {
|
void ProjectSettingsEditor::choosePrefabsFileClicked(bool) {
|
||||||
QString startPath = this->project->importExportPath;
|
QString startPath = this->project->importExportPath;
|
||||||
QFileInfo fileInfo(ui->lineEdit_PrefabsPath->text());
|
QFileInfo fileInfo(ui->lineEdit_PrefabsPath->text());
|
||||||
|
@ -190,6 +188,11 @@ void ProjectSettingsEditor::choosePrefabsFileClicked(bool) {
|
||||||
if (filepath.isEmpty())
|
if (filepath.isEmpty())
|
||||||
return;
|
return;
|
||||||
this->project->setImportExportPath(filepath);
|
this->project->setImportExportPath(filepath);
|
||||||
|
|
||||||
|
// Display relative path if this file is in the project folder
|
||||||
|
const QString projectDir = projectConfig.getProjectDir() + QDir::separator();
|
||||||
|
if (filepath.startsWith(projectDir))
|
||||||
|
filepath.remove(0, projectDir.length());
|
||||||
ui->lineEdit_PrefabsPath->setText(filepath);
|
ui->lineEdit_PrefabsPath->setText(filepath);
|
||||||
this->hasUnsavedChanges = true;
|
this->hasUnsavedChanges = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue