mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-12-24 01:38:45 +00:00
Save the last directory where we loaded a tile image from.
This commit is contained in:
parent
f23a557e77
commit
53f771690c
2 changed files with 13 additions and 2 deletions
|
@ -684,7 +684,9 @@ void TileEditorMainWindow::onActionAddTile(int tabId)
|
|||
|
||||
QFileDialog::Options options;
|
||||
QString selectedFilter;
|
||||
QStringList fileNames = QFileDialog::getOpenFileNames(this, "Choose Tile Texture", "." , "Images (*.png);;All Files (*.*)", &selectedFilter, options);
|
||||
QStringList fileNames = QFileDialog::getOpenFileNames(this, "Choose Tile Texture", m_lastTileDir , "Images (*.png);;All Files (*.*)", &selectedFilter, options);
|
||||
if( fileNames.empty() )
|
||||
return;
|
||||
|
||||
TileConstants::TNodeTileType type = tabToType( tabId );
|
||||
|
||||
|
@ -719,6 +721,10 @@ void TileEditorMainWindow::onActionAddTile(int tabId)
|
|||
lv->reset();
|
||||
lv->setRootIndex( rootIdx );
|
||||
lv->setCurrentIndex( lv->model()->index( 0, 0, rootIdx ) );
|
||||
|
||||
QString fn = fileNames[ 0 ].replace( '\\', '/' );
|
||||
int slashIdx = fn.lastIndexOf( '/' );
|
||||
m_lastTileDir = fn.left( slashIdx );
|
||||
}
|
||||
|
||||
void TileEditorMainWindow::onActionDeleteTile( int tabId )
|
||||
|
@ -787,7 +793,7 @@ void TileEditorMainWindow::onActionReplaceImage( int tabId )
|
|||
|
||||
QString fileName = QFileDialog::getOpenFileName( this,
|
||||
tr( "Select tile image" ),
|
||||
"",
|
||||
m_lastTileDir,
|
||||
tr( "PNG files (*.png)" ) );
|
||||
if( fileName.isEmpty() )
|
||||
return;
|
||||
|
@ -803,6 +809,10 @@ void TileEditorMainWindow::onActionReplaceImage( int tabId )
|
|||
tr( "Error replacing tile image" ),
|
||||
error );
|
||||
}
|
||||
|
||||
QString fn = fileName.replace( '\\', '/' );
|
||||
int slashIdx = fn.lastIndexOf( '/' );
|
||||
m_lastTileDir = fn.left( slashIdx );
|
||||
}
|
||||
|
||||
void TileEditorMainWindow::onTileBankLoaded()
|
||||
|
|
|
@ -123,6 +123,7 @@ private:
|
|||
|
||||
QString m_fileName;
|
||||
QString m_lastOpenDir;
|
||||
QString m_lastTileDir;
|
||||
};
|
||||
|
||||
#endif // TILE_EDITOR_MAIN_WINDOW_H
|
||||
|
|
Loading…
Reference in a new issue