feat: add fast open last opened dir logic
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QMenu>
|
||||
#include <QSettings>
|
||||
|
||||
#include "IO/DICOM/DicomLoader.h"
|
||||
#include "DICOMPropertiesStore.h"
|
||||
@@ -19,10 +20,21 @@ OpenDirAction::~OpenDirAction()
|
||||
|
||||
void OpenDirAction::executeAction()
|
||||
{
|
||||
QString cachePath = QDir::currentPath()+"/.cache";
|
||||
if (!QFile::exists(cachePath))
|
||||
{
|
||||
QFile cache(cachePath);
|
||||
cache.open(QFile::NewOnly);
|
||||
cache.close();
|
||||
}
|
||||
QSettings setting(cachePath,QSettings::IniFormat);
|
||||
|
||||
QString path = QFileDialog::getExistingDirectory(menu(),
|
||||
tr("Open Directory"), QDir::currentPath(),
|
||||
tr("Open Directory"), setting.contains("LastDir")?setting.value("LastDir").toString():QDir::currentPath(),
|
||||
QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
|
||||
|
||||
DicomLoader::InitCodecs();
|
||||
setting.setValue("LastDir",path);
|
||||
std::string dir = path.toStdString();
|
||||
std::vector<ExtendMedicalImageProperties*> vector;
|
||||
int count = 0;
|
||||
|
||||
Reference in New Issue
Block a user