Save and load the tilebank texture path.

This commit is contained in:
dfighter1985 2014-07-30 11:10:15 +02:00
parent 447caab681
commit 99683c6569
4 changed files with 16 additions and 0 deletions

View file

@ -584,6 +584,7 @@ void TileEditorMainWindow::onChooseTexturePath()
m_texturePath = path; m_texturePath = path;
m_ui->tileBankTexturePathPB->setText( path ); m_ui->tileBankTexturePathPB->setText( path );
m_tileModel->setTexturePath( path );
} }
void TileEditorMainWindow::onOrientedStateChanged( int state ) void TileEditorMainWindow::onOrientedStateChanged( int state )
@ -742,6 +743,12 @@ void TileEditorMainWindow::onTileBankLoaded()
m_ui->listView128->reset(); m_ui->listView128->reset();
m_ui->listView256->reset(); m_ui->listView256->reset();
m_ui->listViewTransition->reset(); m_ui->listViewTransition->reset();
QString path = m_tileModel->texturePath();
if( path.isEmpty() )
m_ui->tileBankTexturePathPB->setText( "..." );
else
m_ui->tileBankTexturePathPB->setText( path );
} }
TileModel* TileEditorMainWindow::createTileModel() TileModel* TileEditorMainWindow::createTileModel()

View file

@ -95,6 +95,9 @@ public:
void clear(); void clear();
void setTexturePath( const QString &path ){ m_texturePath = path; }
QString texturePath() const{ return m_texturePath; }
public Q_SLOTS: public Q_SLOTS:
void selectFilenameDisplay(bool selected); void selectFilenameDisplay(bool selected);
void selectIndexDisplay(bool selected); void selectIndexDisplay(bool selected);
@ -109,6 +112,8 @@ private:
//QList<TileItem*> m_tiles; //QList<TileItem*> m_tiles;
//int m_activeEditChannel; //int m_activeEditChannel;
Node *rootItem; Node *rootItem;
QString m_texturePath;
}; };
#endif // TILE_MODEL_H #endif // TILE_MODEL_H

View file

@ -166,5 +166,7 @@ bool TileBankLoader::load( const char *filename, TileModel *model, QList< Land >
p->loadLands( lands ); p->loadLands( lands );
p->loadTileSets( model ); p->loadTileSets( model );
model->setTexturePath( p->bank.getAbsPath().c_str() );
return false; return false;
} }

View file

@ -223,6 +223,8 @@ bool TileBankSaver::save( const char *fileName, const TileModel* model, const QL
p->addLands( lands ); p->addLands( lands );
p->addTileSets( model, lands ); p->addTileSets( model, lands );
p->bank.setAbsPath( model->texturePath().toUtf8().constData() );
// Save to file // Save to file
NLMISC::COFile f; NLMISC::COFile f;
bool b = f.open( fileName, false, false, false ); bool b = f.open( fileName, false, false, false );