Implemented land adding.
This commit is contained in:
parent
b0a1149399
commit
b2a094cf4f
2 changed files with 30 additions and 0 deletions
|
@ -94,6 +94,8 @@ TileEditorMainWindow::TileEditorMainWindow(QWidget *parent)
|
||||||
connect(m_ui->tileSetUpTB, SIGNAL(clicked()), this, SLOT(onTileSetUp()));
|
connect(m_ui->tileSetUpTB, SIGNAL(clicked()), this, SLOT(onTileSetUp()));
|
||||||
connect(m_ui->tileSetDownTB, SIGNAL(clicked()), this, SLOT(onTileSetDown()));
|
connect(m_ui->tileSetDownTB, SIGNAL(clicked()), this, SLOT(onTileSetDown()));
|
||||||
|
|
||||||
|
connect(m_ui->landAddTB, SIGNAL(clicked()), this, SLOT(onLandAdd()));
|
||||||
|
|
||||||
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 &)));
|
||||||
|
@ -333,6 +335,30 @@ void TileEditorMainWindow::onTileSetDown()
|
||||||
m_ui->tileSetLV->setCurrentIndex( model->index( r + 1, 0 ) );
|
m_ui->tileSetLV->setCurrentIndex( model->index( r + 1, 0 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TileEditorMainWindow::onLandAdd()
|
||||||
|
{
|
||||||
|
QString name = QInputDialog::getText( this,
|
||||||
|
tr("Adding new land"),
|
||||||
|
tr("Please specify the new land's name") );
|
||||||
|
|
||||||
|
if( name.isEmpty() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
for( int i = 0; i < m_ui->landLW->count(); i++ )
|
||||||
|
{
|
||||||
|
QListWidgetItem *item = m_ui->landLW->item( i );
|
||||||
|
if( item->text() == name )
|
||||||
|
{
|
||||||
|
QMessageBox::information( this,
|
||||||
|
tr( "Error adding new land" ),
|
||||||
|
tr( "A land with that name already exists." ) );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_ui->landLW->addItem( name );
|
||||||
|
}
|
||||||
|
|
||||||
void TileEditorMainWindow::onActionAddTile(int tabId)
|
void TileEditorMainWindow::onActionAddTile(int tabId)
|
||||||
{
|
{
|
||||||
QFileDialog::Options options;
|
QFileDialog::Options options;
|
||||||
|
|
|
@ -47,11 +47,15 @@ public Q_SLOTS:
|
||||||
void onActionDeleteTile(bool triggered);
|
void onActionDeleteTile(bool triggered);
|
||||||
void onActionReplaceImage(bool triggered);
|
void onActionReplaceImage(bool triggered);
|
||||||
void onActionDeleteImage(bool triggered);
|
void onActionDeleteImage(bool triggered);
|
||||||
|
|
||||||
void onTileSetAdd();
|
void onTileSetAdd();
|
||||||
void onTileSetDelete();
|
void onTileSetDelete();
|
||||||
void onTileSetEdit();
|
void onTileSetEdit();
|
||||||
void onTileSetUp();
|
void onTileSetUp();
|
||||||
void onTileSetDown();
|
void onTileSetDown();
|
||||||
|
|
||||||
|
void onLandAdd();
|
||||||
|
|
||||||
void changeActiveTileSet(const QModelIndex &newIndex, const QModelIndex &oldIndex);
|
void changeActiveTileSet(const QModelIndex &newIndex, const QModelIndex &oldIndex);
|
||||||
void onZoomFactor(int level);
|
void onZoomFactor(int level);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue