It's not a terrible idea to remember the last used directory in the file open dialogs.

--HG--
branch : gsoc2013-dfighter
hg/feature/gsoc2013-dfighter
dfighter1985 12 years ago
parent 04dcad32e7
commit c2296a2a93

@ -32,6 +32,7 @@
#include <QSplitter>
#include <QDockWidget>
#include <QFileDialog>
#include <QFileInfo>
#include <QMessageBox>
#include <QTimer>
@ -77,16 +78,23 @@ namespace MaterialEditor
void MaterialEditorWindow::onOpenClicked()
{
if( lastShapeDir.isEmpty() )
lastShapeDir = "/";
QString fn = QFileDialog::getOpenFileName(
this,
tr( "Open model" ),
"/",
lastShapeDir,
tr( "Shape files ( *.shape )" )
);
if( fn.isEmpty() )
return;
QFileInfo info;
info.setFile( fn );
lastShapeDir = info.absolutePath();
std::string fname = fn.toUtf8().data();
bool ok = nl3dIface->loadShape( fname );
if( !ok )
@ -110,16 +118,23 @@ namespace MaterialEditor
void MaterialEditorWindow::onOpenMaterialClicked()
{
if( lastMatDir.isEmpty() )
lastMatDir = "/";
QString fn = QFileDialog::getOpenFileName(
this,
tr( "Open material" ),
"/",
lastMatDir,
tr( "Material files ( *.nelmat )" )
);
if( fn.isEmpty() )
return;
QFileInfo info;
info.setFile( fn );
lastMatDir = info.absolutePath();
bool ok = nl3dIface->loadMaterial( fn.toUtf8().data() );
if( !ok )
{

@ -65,6 +65,9 @@ private:
ViewPortWidget *viewPort;
Ui::MaterialEditorWindow m_ui;
QString lastShapeDir;
QString lastMatDir;
};
}

Loading…
Cancel
Save