mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-14 03:09:08 +00:00
Implemented tileset rename.
--HG-- branch : gsoc2014-dfighter
This commit is contained in:
parent
71fc4a098b
commit
9d1fec6ce1
4 changed files with 39 additions and 1 deletions
|
@ -89,6 +89,7 @@ TileEditorMainWindow::TileEditorMainWindow(QWidget *parent)
|
||||||
//m_ui->tileSetLV->setRootIndex(m_model->index(0,0));
|
//m_ui->tileSetLV->setRootIndex(m_model->index(0,0));
|
||||||
connect(m_ui->tileSetAddTB, SIGNAL(clicked()), this, SLOT(onTileSetAdd()));
|
connect(m_ui->tileSetAddTB, SIGNAL(clicked()), this, SLOT(onTileSetAdd()));
|
||||||
connect(m_ui->tileSetDeleteTB, SIGNAL(clicked()), this, SLOT(onTileSetDelete()));
|
connect(m_ui->tileSetDeleteTB, SIGNAL(clicked()), this, SLOT(onTileSetDelete()));
|
||||||
|
connect(m_ui->tileSetEditTB, SIGNAL(clicked()), this, SLOT(onTileSetEdit()));
|
||||||
connect(m_ui->tileSetLV->selectionModel(),
|
connect(m_ui->tileSetLV->selectionModel(),
|
||||||
SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)),
|
SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)),
|
||||||
this, SLOT(changeActiveTileSet(const QModelIndex &, const QModelIndex &)));
|
this, SLOT(changeActiveTileSet(const QModelIndex &, const QModelIndex &)));
|
||||||
|
@ -274,6 +275,40 @@ void TileEditorMainWindow::onTileSetDelete()
|
||||||
//m_ui->tileSetLV->reset();
|
//m_ui->tileSetLV->reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TileEditorMainWindow::onTileSetEdit()
|
||||||
|
{
|
||||||
|
QModelIndex idx = m_ui->tileSetLV->currentIndex();
|
||||||
|
if( !idx.isValid() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
TileSetNode *node = reinterpret_cast< TileSetNode* >( idx.internalPointer() );
|
||||||
|
QString name = node->getTileSetName();
|
||||||
|
|
||||||
|
bool ok = false;
|
||||||
|
|
||||||
|
QString newName = QInputDialog::getText( this,
|
||||||
|
tr( "Edit tileset" ),
|
||||||
|
tr( "Enter tileset name" ),
|
||||||
|
QLineEdit::Normal,
|
||||||
|
name,
|
||||||
|
&ok );
|
||||||
|
|
||||||
|
if( !ok )
|
||||||
|
return;
|
||||||
|
|
||||||
|
TileModel *model = static_cast<TileModel*>(m_ui->tileSetLV->model());
|
||||||
|
if( model->hasTileSet( newName ) )
|
||||||
|
{
|
||||||
|
QMessageBox::information( this,
|
||||||
|
tr("Tileset already exists"),
|
||||||
|
tr("A tileset with that name already exists!") );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
node->setTileSetName( newName );
|
||||||
|
m_ui->tileSetLV->reset();
|
||||||
|
}
|
||||||
|
|
||||||
void TileEditorMainWindow::onActionAddTile(int tabId)
|
void TileEditorMainWindow::onActionAddTile(int tabId)
|
||||||
{
|
{
|
||||||
QFileDialog::Options options;
|
QFileDialog::Options options;
|
||||||
|
|
|
@ -49,6 +49,7 @@ public Q_SLOTS:
|
||||||
void onActionDeleteImage(bool triggered);
|
void onActionDeleteImage(bool triggered);
|
||||||
void onTileSetAdd();
|
void onTileSetAdd();
|
||||||
void onTileSetDelete();
|
void onTileSetDelete();
|
||||||
|
void onTileSetEdit();
|
||||||
void changeActiveTileSet(const QModelIndex &newIndex, const QModelIndex &oldIndex);
|
void changeActiveTileSet(const QModelIndex &newIndex, const QModelIndex &oldIndex);
|
||||||
void onZoomFactor(int level);
|
void onZoomFactor(int level);
|
||||||
|
|
||||||
|
|
|
@ -516,7 +516,7 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QToolButton" name="toolButton_6">
|
<widget class="QToolButton" name="tileSetEditTB">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>...</string>
|
<string>...</string>
|
||||||
</property>
|
</property>
|
||||||
|
|
|
@ -68,6 +68,8 @@ public:
|
||||||
int columnCount() const;
|
int columnCount() const;
|
||||||
|
|
||||||
const QString &getTileSetName(){ return m_tileSetName; }
|
const QString &getTileSetName(){ return m_tileSetName; }
|
||||||
|
void setTileSetName( const QString &name ){ m_tileSetName = name; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_tileSetName;
|
QString m_tileSetName;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue