fix ability to select a temporary directory (for image files)
This commit is contained in:
@ -132,7 +132,13 @@ LammpsGui::LammpsGui(QWidget *parent, const char *filename) :
|
|||||||
#else
|
#else
|
||||||
if (!tmpdir) tmpdir = "/tmp";
|
if (!tmpdir) tmpdir = "/tmp";
|
||||||
#endif
|
#endif
|
||||||
settings.setValue("tempdir", QString(tmpdir));
|
|
||||||
|
QFileInfo newtmp(settings.value("tempdir", QString(tmpdir)).toString());
|
||||||
|
if (newtmp.isDir() && newtmp.isWritable()) {
|
||||||
|
settings.setValue("tempdir", newtmp.filePath());
|
||||||
|
} else {
|
||||||
|
settings.setValue("tempdir", QString(tmpdir));
|
||||||
|
}
|
||||||
|
|
||||||
lammps_args.clear();
|
lammps_args.clear();
|
||||||
lammps_args.push_back(mystrdup("LAMMPS-GUI"));
|
lammps_args.push_back(mystrdup("LAMMPS-GUI"));
|
||||||
|
|||||||
@ -98,6 +98,11 @@ void Preferences::accept()
|
|||||||
if (field)
|
if (field)
|
||||||
if (field->hasAcceptableInput()) settings->setValue("nthreads", field->text());
|
if (field->hasAcceptableInput()) settings->setValue("nthreads", field->text());
|
||||||
|
|
||||||
|
// store temp dir
|
||||||
|
field = tabWidget->findChild<QLineEdit *>("tmpedit");
|
||||||
|
if (field)
|
||||||
|
if (field->hasAcceptableInput()) settings->setValue("tempdir", field->text());
|
||||||
|
|
||||||
// store image width, height, and zoom
|
// store image width, height, and zoom
|
||||||
|
|
||||||
settings->beginGroup("snapshot");
|
settings->beginGroup("snapshot");
|
||||||
@ -248,7 +253,11 @@ void GeneralTab::newtmpfolder()
|
|||||||
QLineEdit *field = findChild<QLineEdit *>("tmpedit");
|
QLineEdit *field = findChild<QLineEdit *>("tmpedit");
|
||||||
QString tmpdir =
|
QString tmpdir =
|
||||||
QFileDialog::getExistingDirectory(this, "Find Folder for Temporary Files", field->text());
|
QFileDialog::getExistingDirectory(this, "Find Folder for Temporary Files", field->text());
|
||||||
if (!tmpdir.isEmpty()) field->setText(tmpdir);
|
|
||||||
|
if (!tmpdir.isEmpty()) {
|
||||||
|
QFileInfo newtmp(tmpdir);
|
||||||
|
if (newtmp.isDir() && newtmp.isWritable()) field->setText(tmpdir);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralTab::pluginpath()
|
void GeneralTab::pluginpath()
|
||||||
|
|||||||
Reference in New Issue
Block a user