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;
|
QFileDialog::Options options;
|
||||||
QString selectedFilter;
|
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 );
|
TileConstants::TNodeTileType type = tabToType( tabId );
|
||||||
|
|
||||||
|
@ -719,6 +721,10 @@ void TileEditorMainWindow::onActionAddTile(int tabId)
|
||||||
lv->reset();
|
lv->reset();
|
||||||
lv->setRootIndex( rootIdx );
|
lv->setRootIndex( rootIdx );
|
||||||
lv->setCurrentIndex( lv->model()->index( 0, 0, 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 )
|
void TileEditorMainWindow::onActionDeleteTile( int tabId )
|
||||||
|
@ -787,7 +793,7 @@ void TileEditorMainWindow::onActionReplaceImage( int tabId )
|
||||||
|
|
||||||
QString fileName = QFileDialog::getOpenFileName( this,
|
QString fileName = QFileDialog::getOpenFileName( this,
|
||||||
tr( "Select tile image" ),
|
tr( "Select tile image" ),
|
||||||
"",
|
m_lastTileDir,
|
||||||
tr( "PNG files (*.png)" ) );
|
tr( "PNG files (*.png)" ) );
|
||||||
if( fileName.isEmpty() )
|
if( fileName.isEmpty() )
|
||||||
return;
|
return;
|
||||||
|
@ -803,6 +809,10 @@ void TileEditorMainWindow::onActionReplaceImage( int tabId )
|
||||||
tr( "Error replacing tile image" ),
|
tr( "Error replacing tile image" ),
|
||||||
error );
|
error );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString fn = fileName.replace( '\\', '/' );
|
||||||
|
int slashIdx = fn.lastIndexOf( '/' );
|
||||||
|
m_lastTileDir = fn.left( slashIdx );
|
||||||
}
|
}
|
||||||
|
|
||||||
void TileEditorMainWindow::onTileBankLoaded()
|
void TileEditorMainWindow::onTileBankLoaded()
|
||||||
|
|
|
@ -123,6 +123,7 @@ private:
|
||||||
|
|
||||||
QString m_fileName;
|
QString m_fileName;
|
||||||
QString m_lastOpenDir;
|
QString m_lastOpenDir;
|
||||||
|
QString m_lastTileDir;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TILE_EDITOR_MAIN_WINDOW_H
|
#endif // TILE_EDITOR_MAIN_WINDOW_H
|
||||||
|
|
Loading…
Reference in a new issue