Changed default directory for open and save as dialogs.

--HG--
branch : develop
This commit is contained in:
dismine 2014-02-10 19:40:41 +02:00
parent 33b0ac8b21
commit 396c9c1a8c

View File

@ -919,7 +919,7 @@ void MainWindow::ActionDetails(bool checked)
bool MainWindow::SaveAs()
{
QString filters(tr("Pattern files (*.val)"));
QString dir = QDir::homePath() + tr("/pattern.val");
QString dir = QFileInfo(curFile).absolutePath() + tr("/pattern.val");
QString fileName = QFileDialog::getSaveFileName(this, tr("Save as"), dir, filters);
if (fileName.isEmpty())
@ -951,7 +951,16 @@ void MainWindow::Open()
if (MaybeSave())
{
QString filter(tr("Pattern files (*.val)"));
QString fileName = QFileDialog::getOpenFileName(this, tr("Open file"), QDir::homePath(), filter);
QString dir;
if (curFile.isEmpty())
{
dir = QDir::homePath();
}
else
{
dir = QFileInfo(curFile).absolutePath();
}
QString fileName = QFileDialog::getOpenFileName(this, tr("Open file"), dir, filter);
if (fileName.isEmpty() == false)
{
LoadPattern(fileName);