As it turns out, tilesets can be assigned to multiple lands...
--HG-- branch : gsoc2014-dfighterhg/feature/cdb-packed
parent
8a704b7f5f
commit
89c6180144
@ -0,0 +1,77 @@
|
||||
#include "land_edit_dialog.h"
|
||||
|
||||
LandEditDialog::LandEditDialog( QWidget *parent ) :
|
||||
QDialog( parent )
|
||||
{
|
||||
setupUi( this );
|
||||
setupConnections();
|
||||
}
|
||||
|
||||
LandEditDialog::~LandEditDialog()
|
||||
{
|
||||
}
|
||||
|
||||
void LandEditDialog::getSelectedTileSets( QStringList &l ) const
|
||||
{
|
||||
int c = tilesetLV->count();
|
||||
for( int i = 0; i < c; i++ )
|
||||
{
|
||||
l.push_back( tilesetLV->item( i )->text() );
|
||||
}
|
||||
}
|
||||
|
||||
void LandEditDialog::setTileSets( const QStringList &l )
|
||||
{
|
||||
tilesetCB->clear();
|
||||
|
||||
QStringListIterator itr( l );
|
||||
while( itr.hasNext() )
|
||||
{
|
||||
tilesetCB->addItem( itr.next() );
|
||||
}
|
||||
}
|
||||
|
||||
void LandEditDialog::setupConnections()
|
||||
{
|
||||
connect( okButton, SIGNAL( clicked( bool ) ), this, SLOT( onOkClicked() ) );
|
||||
connect( cancelButton, SIGNAL( clicked( bool ) ), this, SLOT( onCancelClicked() ) );
|
||||
connect( addButton, SIGNAL( clicked( bool ) ), this, SLOT( onAddClicked() ) );
|
||||
connect( removeButton, SIGNAL( clicked( bool ) ), this, SLOT( onRemoveClicked() ) );
|
||||
}
|
||||
|
||||
void LandEditDialog::onOkClicked()
|
||||
{
|
||||
accept();
|
||||
}
|
||||
|
||||
void LandEditDialog::onCancelClicked()
|
||||
{
|
||||
reject();
|
||||
}
|
||||
|
||||
void LandEditDialog::onAddClicked()
|
||||
{
|
||||
if( tilesetCB->currentIndex() < 0 )
|
||||
return;
|
||||
|
||||
QString text = tilesetCB->currentText();
|
||||
|
||||
int c = tilesetLV->count();
|
||||
for( int i = 0; i < c; i++ )
|
||||
{
|
||||
if( text == tilesetLV->item( i )->text() )
|
||||
return;
|
||||
}
|
||||
|
||||
tilesetLV->addItem( text );
|
||||
}
|
||||
|
||||
void LandEditDialog::onRemoveClicked()
|
||||
{
|
||||
if( tilesetLV->currentItem() == NULL )
|
||||
return;
|
||||
|
||||
QListWidgetItem *item = tilesetLV->currentItem();
|
||||
delete item;
|
||||
}
|
||||
|
@ -0,0 +1,32 @@
|
||||
#ifndef LAND_EDIT_DLG_H
|
||||
#define LAND_EDIT_DLG_H
|
||||
|
||||
|
||||
#include "ui_land_edit_dialog.h"
|
||||
#include <QStringList>
|
||||
|
||||
class LandEditDialog : public QDialog, public Ui::LandEditDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
LandEditDialog( QWidget *parent = NULL );
|
||||
~LandEditDialog();
|
||||
|
||||
void getSelectedTileSets( QStringList &l ) const;
|
||||
void setTileSets( const QStringList &l );
|
||||
|
||||
private:
|
||||
void setupConnections();
|
||||
|
||||
|
||||
private Q_SLOTS:
|
||||
void onOkClicked();
|
||||
void onCancelClicked();
|
||||
void onAddClicked();
|
||||
void onRemoveClicked();
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,99 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>LandEditDialog</class>
|
||||
<widget class="QDialog" name="LandEditDialog">
|
||||
<property name="windowModality">
|
||||
<enum>Qt::WindowModal</enum>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>402</width>
|
||||
<height>311</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Editing land</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QListWidget" name="tilesetLV"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QComboBox" name="tilesetCB"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="addButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Add</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="removeButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Remove</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="okButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>OK</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="cancelButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Cancel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
Loading…
Reference in New Issue