Merge pull request #413 from GriffinRichards/label-copy

Add metatile label copy button
This commit is contained in:
Marcus Huderle 2022-07-03 10:46:50 -05:00 committed by GitHub
commit ed30115d2e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 143 additions and 99 deletions

View file

@ -14,6 +14,7 @@ The **"Breaking Changes"** listed below are changes that have been made in the d
- Add Copy/Paste for metatiles in the Tileset Editor.
- Add ability to set the opacity of the scripting overlay.
- Add ability to get/set map header properties and read tile pixel data via the API.
- Add button to copy the full metatile label to the clipboard in the Tileset Editor.
### Changed
- If an object event is inanimate, it will always render using its first frame.

View file

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>700</width>
<width>727</width>
<height>700</height>
</rect>
</property>
@ -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"/>
</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,40 @@
</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="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Copies the full metatile label to the clipboard.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../resources/images.qrc">
<normaloff>:/icons/clipboard.ico</normaloff>:/icons/clipboard.ico</iconset>
</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>
@ -414,8 +441,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>384</width>
<height>265</height>
<width>411</width>
<height>247</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_2">
@ -507,7 +534,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>700</width>
<width>727</width>
<height>22</height>
</rect>
</property>
@ -658,10 +685,12 @@
<customwidgets>
<customwidget>
<class>NoScrollComboBox</class>
<extends>QWidget</extends>
<extends>QComboBox</extends>
<header>noscrollcombobox.h</header>
</customwidget>
</customwidgets>
<resources/>
<resources>
<include location="../resources/images.qrc"/>
</resources>
<connections/>
</ui>

View file

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

BIN
resources/icons/clipboard.ico Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View file

@ -1,54 +1,55 @@
<RCC>
<qresource prefix="/">
<file>icons/add.ico</file>
<file>icons/collapse_all.ico</file>
<file>icons/cursor.ico</file>
<file>icons/delete.ico</file>
<file>icons/expand_all.ico</file>
<file>icons/fill_color_cursor.ico</file>
<file>icons/fill_color.ico</file>
<file>icons/folder_closed_map.ico</file>
<file>icons/folder_closed.ico</file>
<file>icons/folder_map_edited.ico</file>
<file>icons/folder_map_opened.ico</file>
<file>icons/folder_map.ico</file>
<file>icons/folder.ico</file>
<file>icons/map_edited.ico</file>
<file>icons/map_opened.ico</file>
<file>icons/map.ico</file>
<file>icons/move.ico</file>
<file>icons/pencil_cursor.ico</file>
<file>icons/pencil.ico</file>
<file>icons/pipette_cursor.ico</file>
<file>icons/pipette.ico</file>
<file>icons/porymap-icon-1.ico</file>
<file>icons/porymap-icon-2.ico</file>
<file>icons/porymap.icns</file>
<file>icons/shift_cursor.ico</file>
<file>icons/shift.ico</file>
<file>icons/sort_alphabet.ico</file>
<file>icons/sort_map.ico</file>
<file>icons/sort_number.ico</file>
<file>icons/tall_grass.ico</file>
<file>icons/viewsprites.ico</file>
<file>icons/ui/dark_checkbox_checked_disabled.png</file>
<file>icons/ui/dark_checkbox_checked_disabled@2x.png</file>
<file>icons/ui/dark_checkbox_checked.png</file>
<file>icons/ui/dark_checkbox_checked@2x.png</file>
<file>icons/ui/dark_checkbox_unchecked_disabled.png</file>
<file>icons/ui/dark_checkbox_unchecked_disabled@2x.png</file>
<file>icons/ui/dark_checkbox_unchecked.png</file>
<file>icons/ui/dark_checkbox_unchecked@2x.png</file>
<file>icons/ui/midnight_checkbox_checked_disabled.png</file>
<file>icons/ui/midnight_checkbox_checked_disabled@2x.png</file>
<file>icons/ui/midnight_checkbox_checked.png</file>
<file>icons/ui/midnight_checkbox_checked@2x.png</file>
<file>icons/ui/midnight_checkbox_unchecked_disabled.png</file>
<file>icons/ui/midnight_checkbox_unchecked_disabled@2x.png</file>
<file>icons/ui/midnight_checkbox_unchecked.png</file>
<file>icons/ui/midnight_checkbox_unchecked@2x.png</file>
<file>images/blank_tileset.png</file>
<file>images/collisions.png</file>
<file>images/Entities_16x16.png</file>
</qresource>
<qresource prefix="/">
<file>icons/add.ico</file>
<file>icons/collapse_all.ico</file>
<file>icons/cursor.ico</file>
<file>icons/delete.ico</file>
<file>icons/expand_all.ico</file>
<file>icons/fill_color_cursor.ico</file>
<file>icons/fill_color.ico</file>
<file>icons/folder_closed_map.ico</file>
<file>icons/folder_closed.ico</file>
<file>icons/folder_map_edited.ico</file>
<file>icons/folder_map_opened.ico</file>
<file>icons/folder_map.ico</file>
<file>icons/folder.ico</file>
<file>icons/map_edited.ico</file>
<file>icons/map_opened.ico</file>
<file>icons/map.ico</file>
<file>icons/move.ico</file>
<file>icons/pencil_cursor.ico</file>
<file>icons/pencil.ico</file>
<file>icons/pipette_cursor.ico</file>
<file>icons/pipette.ico</file>
<file>icons/porymap-icon-1.ico</file>
<file>icons/porymap-icon-2.ico</file>
<file>icons/porymap.icns</file>
<file>icons/shift_cursor.ico</file>
<file>icons/shift.ico</file>
<file>icons/sort_alphabet.ico</file>
<file>icons/sort_map.ico</file>
<file>icons/sort_number.ico</file>
<file>icons/tall_grass.ico</file>
<file>icons/viewsprites.ico</file>
<file>icons/ui/dark_checkbox_checked_disabled.png</file>
<file>icons/ui/dark_checkbox_checked_disabled@2x.png</file>
<file>icons/ui/dark_checkbox_checked.png</file>
<file>icons/ui/dark_checkbox_checked@2x.png</file>
<file>icons/ui/dark_checkbox_unchecked_disabled.png</file>
<file>icons/ui/dark_checkbox_unchecked_disabled@2x.png</file>
<file>icons/ui/dark_checkbox_unchecked.png</file>
<file>icons/ui/dark_checkbox_unchecked@2x.png</file>
<file>icons/ui/midnight_checkbox_checked_disabled.png</file>
<file>icons/ui/midnight_checkbox_checked_disabled@2x.png</file>
<file>icons/ui/midnight_checkbox_checked.png</file>
<file>icons/ui/midnight_checkbox_checked@2x.png</file>
<file>icons/ui/midnight_checkbox_unchecked_disabled.png</file>
<file>icons/ui/midnight_checkbox_unchecked_disabled@2x.png</file>
<file>icons/ui/midnight_checkbox_unchecked.png</file>
<file>icons/ui/midnight_checkbox_unchecked@2x.png</file>
<file>images/blank_tileset.png</file>
<file>images/collisions.png</file>
<file>images/Entities_16x16.png</file>
<file>icons/clipboard.ico</file>
</qresource>
</RCC>

View file

@ -1067,3 +1067,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->getSelectedMetatileId(), this->primaryTileset, this->secondaryTileset);
if (tileset)
label.prepend("METATILE_" + QString(tileset->name).replace("gTileset_", "") + "_");
}
clipboard->setText(label);
}