Save last used path to raw layout data.
This commit is contained in:
parent
bc6b9468b7
commit
3db18228c8
|
@ -3635,11 +3635,15 @@ void VPMainWindow::on_actionImportRawLayout_triggered()
|
|||
{
|
||||
const QString filter(tr("Raw Layout files") + QStringLiteral(" (*.rld)"));
|
||||
|
||||
const QString filePath = QFileDialog::getOpenFileName(this, tr("Open file"), QDir::homePath(), filter, nullptr,
|
||||
VAbstractApplication::VApp()->NativeFileDialog());
|
||||
auto *settings = VPApplication::VApp()->PuzzleSettings();
|
||||
|
||||
const QString filePath =
|
||||
QFileDialog::getOpenFileName(this, tr("Open file"), settings->GetPathRawLayoutData(), filter, nullptr,
|
||||
VAbstractApplication::VApp()->NativeFileDialog());
|
||||
|
||||
if (not filePath.isEmpty())
|
||||
{
|
||||
settings->SetPathRawLayoutData(QFileInfo(filePath).absolutePath());
|
||||
ImportRawLayouts({filePath});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "vpsettings.h"
|
||||
#include "../vmisc/compatibility.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QMarginsF>
|
||||
|
||||
using namespace Qt::Literals::StringLiterals;
|
||||
|
@ -71,6 +72,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutPieceGap, ("layout/pieceGa
|
|||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutExportFormat, ("layout/exportFormat"_L1)) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutLineWidth, ("layout/lineWidth"_L1)) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutShowGrainline, ("layout/showGrainline"_L1)) // NOLINT
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsRawLayoutData, ("paths/rawLatoutData"_L1)) // NOLINT
|
||||
|
||||
QT_WARNING_POP
|
||||
|
||||
|
@ -129,6 +131,18 @@ void VPSettings::SetDockWidgetPropertiesContentsActive(bool value)
|
|||
setValue(*settingDockPropertiesContentsActive, value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VPSettings::GetPathRawLayoutData() const -> QString
|
||||
{
|
||||
return value(*settingPathsRawLayoutData, QDir::homePath()).toString();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPSettings::SetPathRawLayoutData(const QString &value)
|
||||
{
|
||||
setValue(*settingPathsRawLayoutData, value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPSettings::SetLayoutUnit(Unit unit)
|
||||
{
|
||||
|
|
|
@ -50,6 +50,9 @@ public:
|
|||
static auto GetDefDockWidgetPropertiesContentsActive() -> bool;
|
||||
void SetDockWidgetPropertiesContentsActive(bool value);
|
||||
|
||||
auto GetPathRawLayoutData() const -> QString;
|
||||
void SetPathRawLayoutData(const QString &value);
|
||||
|
||||
void SetLayoutUnit(Unit unit);
|
||||
auto LayoutUnit() const -> Unit;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user