mirror of https://github.com/CGAL/cgal
Let the application remember in which directory lies the last open file.
That directory is used to load new files.
This commit is contained in:
parent
9e64a530f6
commit
acf4ea73d5
|
|
@ -151,14 +151,18 @@ void MainWindow::updateViewerBBox()
|
||||||
|
|
||||||
void MainWindow::open(QString filename)
|
void MainWindow::open(QString filename)
|
||||||
{
|
{
|
||||||
|
QFileInfo fileinfo(filename);
|
||||||
|
if(fileinfo.isFile() && fileinfo.isReadable()) {
|
||||||
int index = scene->open(filename);
|
int index = scene->open(filename);
|
||||||
if(index >= 0) {
|
if(index >= 0) {
|
||||||
|
QSettings settings;
|
||||||
|
settings.setValue("OFF open directory",
|
||||||
|
fileinfo.absoluteDir().absolutePath());
|
||||||
setCurrentFile(filename);
|
setCurrentFile(filename);
|
||||||
selectPolyhedron(index);
|
selectPolyhedron(index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainWindow::selectPolyhedron(int i)
|
void MainWindow::selectPolyhedron(int i)
|
||||||
{
|
{
|
||||||
|
|
@ -286,10 +290,13 @@ void MainWindow::closeEvent(QCloseEvent *event)
|
||||||
|
|
||||||
void MainWindow::on_actionLoadPolyhedron_triggered()
|
void MainWindow::on_actionLoadPolyhedron_triggered()
|
||||||
{
|
{
|
||||||
|
QSettings settings;
|
||||||
|
QString directory = settings.value("OFF open directory",
|
||||||
|
QDir::current().dirName()).toString();
|
||||||
QStringList filenames =
|
QStringList filenames =
|
||||||
QFileDialog::getOpenFileNames(this,
|
QFileDialog::getOpenFileNames(this,
|
||||||
tr("Load polyhedron..."),
|
tr("Load polyhedron..."),
|
||||||
QString(),
|
directory,
|
||||||
tr("OFF files (*.off)\n"
|
tr("OFF files (*.off)\n"
|
||||||
"All files (*)"));
|
"All files (*)"));
|
||||||
if(!filenames.isEmpty()) {
|
if(!filenames.isEmpty()) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue