mirror of
https://github.com/cmclark00/retro-imager.git
synced 2025-05-18 16:05:21 +01:00
parent
7385dd0838
commit
eb11ba2707
1 changed files with 18 additions and 1 deletions
|
@ -421,8 +421,15 @@ void ImageWriter::onPreparationStatusUpdate(QString msg)
|
||||||
void ImageWriter::openFileDialog()
|
void ImageWriter::openFileDialog()
|
||||||
{
|
{
|
||||||
#ifndef QT_NO_WIDGETS
|
#ifndef QT_NO_WIDGETS
|
||||||
|
QSettings settings;
|
||||||
|
QString path = settings.value("General/lastpath").toString();
|
||||||
|
QFileInfo fi(path);
|
||||||
|
|
||||||
|
if (path.isEmpty() || !fi.exists() || !fi.isReadable() )
|
||||||
|
path = QStandardPaths::writableLocation(QStandardPaths::DownloadLocation);
|
||||||
|
|
||||||
QFileDialog *fd = new QFileDialog(nullptr, tr("Select image"),
|
QFileDialog *fd = new QFileDialog(nullptr, tr("Select image"),
|
||||||
QStandardPaths::writableLocation(QStandardPaths::DownloadLocation),
|
path,
|
||||||
"Image files (*.img *.zip *.gz *.xz);;All files (*.*)");
|
"Image files (*.img *.zip *.gz *.xz);;All files (*.*)");
|
||||||
connect(fd, SIGNAL(fileSelected(QString)), SLOT(onFileSelected(QString)));
|
connect(fd, SIGNAL(fileSelected(QString)), SLOT(onFileSelected(QString)));
|
||||||
|
|
||||||
|
@ -443,10 +450,19 @@ void ImageWriter::openFileDialog()
|
||||||
|
|
||||||
void ImageWriter::onFileSelected(QString filename)
|
void ImageWriter::onFileSelected(QString filename)
|
||||||
{
|
{
|
||||||
|
#ifndef QT_NO_WIDGETS
|
||||||
QFileInfo fi(filename);
|
QFileInfo fi(filename);
|
||||||
|
QSettings settings;
|
||||||
|
|
||||||
if (fi.isFile())
|
if (fi.isFile())
|
||||||
{
|
{
|
||||||
|
QString path = fi.path();
|
||||||
|
if (path != settings.value("General/lastpath"))
|
||||||
|
{
|
||||||
|
settings.setValue("General/lastpath", path);
|
||||||
|
settings.sync();
|
||||||
|
}
|
||||||
|
|
||||||
emit fileSelected(QUrl::fromLocalFile(filename));
|
emit fileSelected(QUrl::fromLocalFile(filename));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -455,6 +471,7 @@ void ImageWriter::onFileSelected(QString filename)
|
||||||
}
|
}
|
||||||
|
|
||||||
sender()->deleteLater();
|
sender()->deleteLater();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImageWriter::_parseCompressedFile()
|
void ImageWriter::_parseCompressedFile()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue