Implemented land adding.

--HG--
branch : gsoc2014-dfighter
This commit is contained in:
dfighter1985 2014-07-24 16:18:01 +02:00
parent e9e42701b9
commit 02ccd3b1c1
2 changed files with 30 additions and 0 deletions

View file

@ -94,6 +94,8 @@ TileEditorMainWindow::TileEditorMainWindow(QWidget *parent)
connect(m_ui->tileSetUpTB, SIGNAL(clicked()), this, SLOT(onTileSetUp()));
connect(m_ui->tileSetDownTB, SIGNAL(clicked()), this, SLOT(onTileSetDown()));
connect(m_ui->landAddTB, SIGNAL(clicked()), this, SLOT(onLandAdd()));
connect(m_ui->tileSetLV->selectionModel(),
SIGNAL(currentChanged(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 ) );
}
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)
{
QFileDialog::Options options;

View file

@ -47,11 +47,15 @@ public Q_SLOTS:
void onActionDeleteTile(bool triggered);
void onActionReplaceImage(bool triggered);
void onActionDeleteImage(bool triggered);
void onTileSetAdd();
void onTileSetDelete();
void onTileSetEdit();
void onTileSetUp();
void onTileSetDown();
void onLandAdd();
void changeActiveTileSet(const QModelIndex &newIndex, const QModelIndex &oldIndex);
void onZoomFactor(int level);