Save and load the tilebank texture path.

This commit is contained in:
dfighter1985 2014-07-30 11:10:15 +02:00
parent 3668784e7a
commit bb36cb5724
4 changed files with 16 additions and 0 deletions

View file

@ -584,6 +584,7 @@ void TileEditorMainWindow::onChooseTexturePath()
m_texturePath = path;
m_ui->tileBankTexturePathPB->setText( path );
m_tileModel->setTexturePath( path );
}
void TileEditorMainWindow::onOrientedStateChanged( int state )
@ -742,6 +743,12 @@ void TileEditorMainWindow::onTileBankLoaded()
m_ui->listView128->reset();
m_ui->listView256->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()

View file

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

View file

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

View file

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