From 947782a2c57a5fc37e0f8d76344907685a16e07d Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Thu, 24 Jul 2014 16:25:28 +0200 Subject: [PATCH] Implemented land name changing. --HG-- branch : gsoc2014-dfighter --- .../tile_editor/tile_editor_main_window.cpp | 22 +++++++++++++++++++ .../tile_editor/tile_editor_main_window.h | 1 + 2 files changed, 23 insertions(+) diff --git a/code/studio/src/plugins/tile_editor/tile_editor_main_window.cpp b/code/studio/src/plugins/tile_editor/tile_editor_main_window.cpp index 26f92b6ae..11f5d79b0 100644 --- a/code/studio/src/plugins/tile_editor/tile_editor_main_window.cpp +++ b/code/studio/src/plugins/tile_editor/tile_editor_main_window.cpp @@ -96,6 +96,7 @@ TileEditorMainWindow::TileEditorMainWindow(QWidget *parent) connect(m_ui->landAddTB, SIGNAL(clicked()), this, SLOT(onLandAdd())); connect(m_ui->landRemoveTB, SIGNAL(clicked()), this, SLOT(onLandRemove())); + connect(m_ui->landEditTB, SIGNAL(clicked()), this, SLOT(onLandEdit())); connect(m_ui->tileSetLV->selectionModel(), SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)), @@ -369,6 +370,27 @@ void TileEditorMainWindow::onLandRemove() delete item; } +void TileEditorMainWindow::onLandEdit() +{ + QListWidgetItem *item = m_ui->landLW->currentItem(); + if( item == NULL ) + return; + + QString name = item->text(); + + QString newName = QInputDialog::getText( this, + tr( "Editing land" ), + tr( "Please specify the new name of the selected land" ), + QLineEdit::Normal, + name ); + + if( newName.isEmpty() ) + return; + if( newName == name ) + return; + item->setText( newName ); +} + void TileEditorMainWindow::onActionAddTile(int tabId) { QFileDialog::Options options; diff --git a/code/studio/src/plugins/tile_editor/tile_editor_main_window.h b/code/studio/src/plugins/tile_editor/tile_editor_main_window.h index cc7312b7d..31e65df27 100644 --- a/code/studio/src/plugins/tile_editor/tile_editor_main_window.h +++ b/code/studio/src/plugins/tile_editor/tile_editor_main_window.h @@ -56,6 +56,7 @@ public Q_SLOTS: void onLandAdd(); void onLandRemove(); + void onLandEdit(); void changeActiveTileSet(const QModelIndex &newIndex, const QModelIndex &oldIndex); void onZoomFactor(int level);