Add metatile label copy button

This commit is contained in:
GriffinR 2022-02-10 09:53:04 -05:00
parent 9963e4c8aa
commit d1883720c9
3 changed files with 75 additions and 42 deletions

View file

@ -198,19 +198,8 @@
<bool>false</bool>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="13" column="0" colspan="3">
<widget class="QLabel" name="label_metatileLabel">
<property name="text">
<string>Metatile Label (Optional)</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_layerType">
<property name="text">
<string>Layer Type</string>
</property>
</widget>
<item row="1" column="2">
<widget class="QComboBox" name="comboBox_layerType"/>
</item>
<item row="9" column="0">
<widget class="QLabel" name="label_encounterType">
@ -219,12 +208,24 @@
</property>
</widget>
</item>
<item row="11" column="0">
<widget class="QLabel" name="label_terrainType">
<property name="text">
<string>Terrain Type</string>
<item row="10" column="0">
<widget class="QComboBox" name="comboBox_encounterType"/>
</item>
<item row="2" column="0">
<spacer name="verticalSpacer_5">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="12" column="0">
<widget class="QComboBox" name="comboBox_terrainType"/>
</item>
<item row="1" column="0">
<widget class="QGraphicsView" name="graphicsView_metatileLayers">
@ -248,6 +249,13 @@
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_layerType">
<property name="text">
<string>Layer Type</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_BottomTop">
<property name="text">
@ -255,8 +263,22 @@
</property>
</widget>
</item>
<item row="10" column="0">
<widget class="QComboBox" name="comboBox_encounterType"/>
<item row="13" column="0" colspan="3">
<widget class="QLabel" name="label_metatileLabel">
<property name="text">
<string>Metatile Label (Optional)</string>
</property>
</widget>
</item>
<item row="8" column="0" colspan="3">
<widget class="NoScrollComboBox" name="comboBox_metatileBehaviors" native="true"/>
</item>
<item row="11" column="0">
<widget class="QLabel" name="label_terrainType">
<property name="text">
<string>Terrain Type</string>
</property>
</widget>
</item>
<item row="1" column="1">
<spacer name="horizontalSpacer_5">
@ -271,19 +293,6 @@
</property>
</spacer>
</item>
<item row="14" column="0" colspan="3">
<widget class="QLineEdit" name="lineEdit_metatileLabel">
<property name="clearButtonEnabled">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QComboBox" name="comboBox_layerType"/>
</item>
<item row="8" column="0" colspan="3">
<widget class="NoScrollComboBox" name="comboBox_metatileBehaviors" native="true"/>
</item>
<item row="3" column="0" colspan="3">
<widget class="QLabel" name="label_metatileBehavior">
<property name="text">
@ -291,22 +300,33 @@
</property>
</widget>
</item>
<item row="12" column="0">
<widget class="QComboBox" name="comboBox_terrainType"/>
</item>
<item row="2" column="0">
<spacer name="verticalSpacer_5">
<item row="1" column="3">
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="14" column="3">
<widget class="QToolButton" name="copyButton_metatileLabel">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item row="14" column="0" colspan="3">
<widget class="QLineEdit" name="lineEdit_metatileLabel">
<property name="clearButtonEnabled">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@ -415,7 +435,7 @@
<x>0</x>
<y>0</y>
<width>384</width>
<height>265</height>
<height>262</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_2">

View file

@ -103,6 +103,8 @@ private slots:
void on_actionImport_Secondary_Metatiles_triggered();
void on_copyButton_metatileLabel_clicked();
private:
void initUi();
void setMetatileBehaviors();

View file

@ -1046,3 +1046,14 @@ void TilesetEditor::countTileUsage() {
}
}
}
void TilesetEditor::on_copyButton_metatileLabel_clicked() {
QClipboard * clipboard = QGuiApplication::clipboard();
QString label = this->ui->lineEdit_metatileLabel->text();
if (!label.isEmpty()) {
Tileset * tileset = Tileset::getMetatileTileset(this->getSelectedMetatile(), this->primaryTileset, this->secondaryTileset);
if (tileset)
label.prepend("METATILE_" + QString(tileset->name).replace("gTileset_", "") + "_");
}
clipboard->setText(label);
}