From 0582dd4e4fcb111e253899348d5777c3e2ad027e Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Wed, 30 Jul 2014 01:50:01 +0200 Subject: [PATCH] Connected the oriented combobox and now saving it's value to the tilebank. --- .../tile_editor/tile_editor_main_window.cpp | 16 ++++++++++++++++ .../tile_editor/tile_editor_main_window.h | 2 ++ .../studio/src/plugins/tile_editor/tile_item.cpp | 1 + code/studio/src/plugins/tile_editor/tile_item.h | 4 ++++ .../src/plugins/tile_editor/tilebank_saver.cpp | 2 ++ 5 files changed, 25 insertions(+) diff --git a/code/studio/src/plugins/tile_editor/tile_editor_main_window.cpp b/code/studio/src/plugins/tile_editor/tile_editor_main_window.cpp index 91d81ea50..a8219f6eb 100644 --- a/code/studio/src/plugins/tile_editor/tile_editor_main_window.cpp +++ b/code/studio/src/plugins/tile_editor/tile_editor_main_window.cpp @@ -162,6 +162,8 @@ TileEditorMainWindow::TileEditorMainWindow(QWidget *parent) connect( m_ui->actionSaveTileBank, SIGNAL( triggered() ), this, SLOT( save() ) ); connect( m_ui->actionSaveTileBankAs, SIGNAL( triggered() ), this, SLOT( saveAs() ) ); + + connect( m_ui->orientedCheckBox, SIGNAL( stateChanged( int ) ), this, SLOT( onOrientedStateChanged( int ) ) ); } TileEditorMainWindow::~TileEditorMainWindow() @@ -556,6 +558,20 @@ void TileEditorMainWindow::onChooseTexturePath() m_ui->tileBankTexturePathPB->setText( path ); } +void TileEditorMainWindow::onOrientedStateChanged( int state ) +{ + QModelIndex idx = m_ui->tileSetLV->currentIndex(); + if( !idx.isValid() ) + return; + + TileSetNode *node = reinterpret_cast< TileSetNode* >( idx.internalPointer() ); + + if( state == Qt::Checked ) + node->setOriented( true ); + else + node->setOriented( false ); +} + void TileEditorMainWindow::onActionAddTile(int tabId) { QModelIndex idx = m_ui->tileSetLV->currentIndex(); diff --git a/code/studio/src/plugins/tile_editor/tile_editor_main_window.h b/code/studio/src/plugins/tile_editor/tile_editor_main_window.h index a491fc5f2..2d1a9e154 100644 --- a/code/studio/src/plugins/tile_editor/tile_editor_main_window.h +++ b/code/studio/src/plugins/tile_editor/tile_editor_main_window.h @@ -69,6 +69,8 @@ private Q_SLOTS: void onChooseTexturePath(); + void onOrientedStateChanged( int state ); + void changeActiveTileSet(const QModelIndex &newIndex, const QModelIndex &oldIndex); void onZoomFactor(int level); diff --git a/code/studio/src/plugins/tile_editor/tile_item.cpp b/code/studio/src/plugins/tile_editor/tile_item.cpp index b6bb30ea2..78c3afae2 100644 --- a/code/studio/src/plugins/tile_editor/tile_item.cpp +++ b/code/studio/src/plugins/tile_editor/tile_item.cpp @@ -167,6 +167,7 @@ void Node::swapRows( int a, int b ) TileSetNode::TileSetNode(QString tileSetName, Node *parent) : m_tileSetName(tileSetName) { m_parentItem = parent; + m_oriented = false; } TileSetNode::~TileSetNode() diff --git a/code/studio/src/plugins/tile_editor/tile_item.h b/code/studio/src/plugins/tile_editor/tile_item.h index b66a2b6f3..9538afa3b 100644 --- a/code/studio/src/plugins/tile_editor/tile_item.h +++ b/code/studio/src/plugins/tile_editor/tile_item.h @@ -75,9 +75,13 @@ public: void setVegetSet( const QString &s ){ m_vegetSet = s; } QString vegetSet() const{ return m_vegetSet; } + bool isOriented() const{ return m_oriented; } + void setOriented( bool b ){ m_oriented = b; } + private: QString m_tileSetName; QString m_vegetSet; + bool m_oriented; }; class TileTypeNode : public Node diff --git a/code/studio/src/plugins/tile_editor/tilebank_saver.cpp b/code/studio/src/plugins/tile_editor/tilebank_saver.cpp index 6bf13fdfe..c41673243 100644 --- a/code/studio/src/plugins/tile_editor/tilebank_saver.cpp +++ b/code/studio/src/plugins/tile_editor/tilebank_saver.cpp @@ -187,6 +187,8 @@ public: addTilesToSet( set, n ); setupTransitionTiles( set, n ); setupDisplacementTiles( set, n ); + + set->setOriented( n->isOriented() ); } // Add tilesets to lands