Changed: #1409 Made the tile set and tile type tabs connect. Added the context menu to each tab.
This commit is contained in:
parent
dfc71de786
commit
ceb8f7997d
3 changed files with 61 additions and 21 deletions
|
@ -88,6 +88,27 @@ TileEditorMainWindow::TileEditorMainWindow(QWidget *parent)
|
||||||
m_ui->listView128->addAction(m_ui->actionReplaceImage);
|
m_ui->listView128->addAction(m_ui->actionReplaceImage);
|
||||||
m_ui->listView128->addAction(m_ui->actionDeleteImage);
|
m_ui->listView128->addAction(m_ui->actionDeleteImage);
|
||||||
|
|
||||||
|
// 256x256 List View
|
||||||
|
m_ui->listView256->setModel(m_model);
|
||||||
|
m_ui->listView256->addAction(m_ui->actionAddTile);
|
||||||
|
m_ui->listView256->addAction(m_ui->actionDeleteTile);
|
||||||
|
m_ui->listView256->addAction(m_ui->actionReplaceImage);
|
||||||
|
m_ui->listView256->addAction(m_ui->actionDeleteImage);
|
||||||
|
|
||||||
|
// Transition List View
|
||||||
|
m_ui->listViewTransition->setModel(m_model);
|
||||||
|
//m_ui->listViewTransition->addAction(m_ui->actionAddTile);
|
||||||
|
//m_ui->listViewTransition->addAction(m_ui->actionDeleteTile);
|
||||||
|
m_ui->listViewTransition->addAction(m_ui->actionReplaceImage);
|
||||||
|
m_ui->listViewTransition->addAction(m_ui->actionDeleteImage);
|
||||||
|
|
||||||
|
// Displacement List View
|
||||||
|
m_ui->listViewDisplacement->setModel(m_model);
|
||||||
|
//m_ui->listViewDisplacement->addAction(m_ui->actionAddTile);
|
||||||
|
//m_ui->listViewDisplacement->addAction(m_ui->actionDeleteTile);
|
||||||
|
m_ui->listViewDisplacement->addAction(m_ui->actionReplaceImage);
|
||||||
|
m_ui->listViewDisplacement->addAction(m_ui->actionDeleteImage);
|
||||||
|
|
||||||
// Connect context menu actions up.
|
// Connect context menu actions up.
|
||||||
connect(m_ui->actionAddTile, SIGNAL(triggered(bool)), this, SLOT(onActionAddTile(bool)));
|
connect(m_ui->actionAddTile, SIGNAL(triggered(bool)), this, SLOT(onActionAddTile(bool)));
|
||||||
connect(m_ui->actionDeleteTile, SIGNAL(triggered(bool)), this, SLOT(onActionDeleteTile(bool)));
|
connect(m_ui->actionDeleteTile, SIGNAL(triggered(bool)), this, SLOT(onActionDeleteTile(bool)));
|
||||||
|
@ -174,7 +195,7 @@ void TileEditorMainWindow::onTileSetAdd()
|
||||||
|
|
||||||
// Add the default transition tiles.
|
// Add the default transition tiles.
|
||||||
// TODO tie this to CTileSet::count from NeL
|
// TODO tie this to CTileSet::count from NeL
|
||||||
for(int transPos=0; transPos < 48; transPos++)
|
for(int transPos=0; transPos<48; transPos++)
|
||||||
{
|
{
|
||||||
QVector<QVariant> tileInfo;
|
QVector<QVariant> tileInfo;
|
||||||
tileInfo.push_back(QString("filename").append(QString::number(transPos+1)));
|
tileInfo.push_back(QString("filename").append(QString::number(transPos+1)));
|
||||||
|
@ -187,6 +208,16 @@ void TileEditorMainWindow::onTileSetAdd()
|
||||||
tilesDisp.push_back(QString("Displacement"));
|
tilesDisp.push_back(QString("Displacement"));
|
||||||
TileTypeTileItem *tileDisp= new TileTypeTileItem(tilesDisp);
|
TileTypeTileItem *tileDisp= new TileTypeTileItem(tilesDisp);
|
||||||
|
|
||||||
|
// Add the default displacement tiles.
|
||||||
|
// TODO tie this to CTileSet::CountDisplace from NeL
|
||||||
|
for(int dispPos=0; dispPos<16; dispPos++)
|
||||||
|
{
|
||||||
|
QVector<QVariant> tileInfo;
|
||||||
|
tileInfo.push_back(QString("filename").append(QString::number(dispPos+1)));
|
||||||
|
TileItem *dispTile= new TileItem(tileInfo);
|
||||||
|
tileDisp->appendRow(dispTile);
|
||||||
|
}
|
||||||
|
|
||||||
// Append them in the correct order to the tile set.
|
// Append them in the correct order to the tile set.
|
||||||
tileSet->appendRow(tile128);
|
tileSet->appendRow(tile128);
|
||||||
tileSet->appendRow(tile256);
|
tileSet->appendRow(tile256);
|
||||||
|
@ -216,16 +247,13 @@ void TileEditorMainWindow::onActionAddTile(int tabId)
|
||||||
|
|
||||||
void TileEditorMainWindow::changeActiveTileSet(const QModelIndex &newIndex, const QModelIndex &oldIndex)
|
void TileEditorMainWindow::changeActiveTileSet(const QModelIndex &newIndex, const QModelIndex &oldIndex)
|
||||||
{
|
{
|
||||||
|
QModelIndex &tile128Idx = newIndex.child(0,0);
|
||||||
|
QModelIndex &tile256Idx = newIndex.child(1,0);
|
||||||
|
QModelIndex &tileTransIdx = newIndex.child(2,0);
|
||||||
|
QModelIndex &tileDispIdx = newIndex.child(3,0);
|
||||||
|
|
||||||
QModelIndex tile128Idx = newIndex.child(0,0);
|
m_ui->listView128->setRootIndex(tile128Idx);
|
||||||
QModelIndex tile256Idx = newIndex.child(1,0);
|
|
||||||
QModelIndex tileTransIdx = newIndex.child(2,0);
|
|
||||||
QModelIndex tileDispIdx = newIndex.child(3,0);
|
|
||||||
|
|
||||||
|
|
||||||
m_ui->listView128->setRootIndex(newIndex);
|
|
||||||
m_ui->listView256->setRootIndex(tile256Idx);
|
m_ui->listView256->setRootIndex(tile256Idx);
|
||||||
m_ui->listViewTransition->setRootIndex(tileTransIdx);
|
m_ui->listViewTransition->setRootIndex(tileTransIdx);
|
||||||
m_ui->listViewDisplacement->setRootIndex(tileDispIdx);
|
m_ui->listViewDisplacement->setRootIndex(tileDispIdx);
|
||||||
// m_ui->listView128->setModelColumn
|
|
||||||
}
|
}
|
|
@ -18,7 +18,7 @@
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QTabWidget" name="tileViewTabWidget">
|
<widget class="QTabWidget" name="tileViewTabWidget">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>0</number>
|
<number>2</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="tab128">
|
<widget class="QWidget" name="tab128">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
|
@ -66,7 +66,11 @@
|
||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QGridLayout" name="gridLayout_11">
|
<layout class="QGridLayout" name="gridLayout_11">
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QListView" name="listView256"/>
|
<widget class="QListView" name="listView256">
|
||||||
|
<property name="contextMenuPolicy">
|
||||||
|
<enum>Qt::ActionsContextMenu</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QGroupBox" name="editChannel256GB">
|
<widget class="QGroupBox" name="editChannel256GB">
|
||||||
|
@ -105,7 +109,17 @@
|
||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QGridLayout" name="gridLayout_12">
|
<layout class="QGridLayout" name="gridLayout_12">
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QListView" name="listViewTransition"/>
|
<widget class="QListView" name="listViewTransition">
|
||||||
|
<property name="contextMenuPolicy">
|
||||||
|
<enum>Qt::ActionsContextMenu</enum>
|
||||||
|
</property>
|
||||||
|
<property name="flow">
|
||||||
|
<enum>QListView::LeftToRight</enum>
|
||||||
|
</property>
|
||||||
|
<property name="layoutMode">
|
||||||
|
<enum>QListView::Batched</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QGroupBox" name="editChannelTransitionGB">
|
<widget class="QGroupBox" name="editChannelTransitionGB">
|
||||||
|
@ -148,7 +162,11 @@
|
||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QGridLayout" name="gridLayout_13">
|
<layout class="QGridLayout" name="gridLayout_13">
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QListView" name="listViewDisplacement"/>
|
<widget class="QListView" name="listViewDisplacement">
|
||||||
|
<property name="contextMenuPolicy">
|
||||||
|
<enum>Qt::ActionsContextMenu</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -468,7 +486,7 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QTreeView" name="tileSetLV"/>
|
<widget class="QListView" name="tileSetLV"/>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
|
@ -36,6 +36,7 @@ void TileItem::appendChild(TileItem *item)
|
||||||
|
|
||||||
TileItem *TileItem::child(int row)
|
TileItem *TileItem::child(int row)
|
||||||
{
|
{
|
||||||
|
//nlinfo("row %d and size %d", row, childItems.size());
|
||||||
return childItems.value(row);
|
return childItems.value(row);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,16 +137,9 @@ void TileItem::appendRow(const QList<TileItem*> &items)
|
||||||
|
|
||||||
void TileItem::appendRow(TileItem *item)
|
void TileItem::appendRow(TileItem *item)
|
||||||
{
|
{
|
||||||
nlinfo("number of children: %d", childItems.size());
|
|
||||||
item->setParent(this);
|
item->setParent(this);
|
||||||
childItems.append(item);
|
childItems.append(item);
|
||||||
nlinfo("number of children: %d", childItems.size());
|
|
||||||
}
|
}
|
||||||
//QImage *TileItem::getTileImageFromChannel(int channel)
|
|
||||||
//{
|
|
||||||
// return m_tileChannels[channel];
|
|
||||||
//}
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////
|
///////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue