From 78f465406372cef8014dbe2df15017f73d7cfcbb Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Thu, 24 Jul 2014 23:41:42 +0200 Subject: [PATCH] Implemented tilebank texture path setting. --HG-- branch : gsoc2014-dfighter --- .../tile_editor/tile_editor_main_window.cpp | 23 +++++++++++++++ .../tile_editor/tile_editor_main_window.h | 4 +++ .../tile_editor/tile_editor_main_window.ui | 29 +++++++------------ 3 files changed, 38 insertions(+), 18 deletions(-) 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 40b3b8dfc..7b255ce2d 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 @@ -99,6 +99,8 @@ TileEditorMainWindow::TileEditorMainWindow(QWidget *parent) connect(m_ui->chooseVegetPushButton, SIGNAL(clicked()), this, SLOT(onChooseVegetation())); connect(m_ui->resetVegetPushButton, SIGNAL(clicked()), this, SLOT(onResetVegetation())); + connect(m_ui->tileBankTexturePathPB, SIGNAL(clicked()), this, SLOT(onChooseTexturePath())); + // 128x128 List View //m_ui->listView128->setItemDelegate(m_tileItemDelegate); m_ui->listView128->addAction(m_ui->actionAddTile); @@ -502,6 +504,27 @@ void TileEditorMainWindow::onResetVegetation() node->setVegetSet( "" ); } +void TileEditorMainWindow::onChooseTexturePath() +{ + QString path = QFileDialog::getExistingDirectory( this, + tr("Choose tilebank absolute texture path "), + "" ); + + if( path.isEmpty() ) + return; + + int reply = QMessageBox::question( this, + tr("tilebank texture path"), + tr("Are you sure you want to make '%1' the tilebank absolute texture path?").arg( path ), + QMessageBox::Yes | QMessageBox::Cancel ); + + if( reply != QMessageBox::Yes ) + return; + + m_texturePath = path; + m_ui->tileBankTexturePathPB->setText( path ); +} + void TileEditorMainWindow::onActionAddTile(int tabId) { QFileDialog::Options options; 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 de7f1d0d0..a66d6d993 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 @@ -62,6 +62,8 @@ public Q_SLOTS: void onResetVegetation(); void onChooseVegetation(); + void onChooseTexturePath(); + void changeActiveTileSet(const QModelIndex &newIndex, const QModelIndex &oldIndex); void onZoomFactor(int level); @@ -84,6 +86,8 @@ private: TileItemDelegate *m_tileItemDelegate; QList< TileModel* > m_tileModels; + + QString m_texturePath; }; #endif // TILE_EDITOR_MAIN_WINDOW_H diff --git a/code/studio/src/plugins/tile_editor/tile_editor_main_window.ui b/code/studio/src/plugins/tile_editor/tile_editor_main_window.ui index 387d0f23e..4297b4848 100644 --- a/code/studio/src/plugins/tile_editor/tile_editor_main_window.ui +++ b/code/studio/src/plugins/tile_editor/tile_editor_main_window.ui @@ -541,24 +541,6 @@ - - - - - - ... - - - - - - - ... - - - - - @@ -569,6 +551,17 @@ + + + + + + ... + + + + +