Skip to content
Snippets Groups Projects
Commit fdef678d authored by Gatien Ferret's avatar Gatien Ferret
Browse files

Merge branch 'feat/RememberLidarStateLocation' into 'master'

[feat] Remember paths in Load and Save Lidar State dialogs

See merge request !351
parents 1ae55b74 1e7bfe34
No related branches found
No related tags found
1 merge request!351[feat] Remember paths in Load and Save Lidar State dialogs
Pipeline #294904 canceled
Pipeline: LidarView

#294905

    ......@@ -7,6 +7,7 @@
    #include <QMessageBox>
    #include <pqApplicationCore.h>
    #include <pqSettings.h>
    #include <vtkSMBooleanDomain.h>
    #include <vtkSmartPointer.h>
    ......@@ -59,6 +60,13 @@ void lqLoadLidarStateReaction::LoadLidarState(vtkSMProxy * lidarCurrentProxy)
    {
    return;
    }
    // Set LidarState file directory to get back here whenever we load / save it
    if (!LidarStateFile.isNull() && !LidarStateFile.isEmpty())
    {
    pqSettings* settings = pqApplicationCore::instance()->settings();
    QFileInfo fileInfo(LidarStateFile);
    settings->setValue("LidarPlugin/OpenData/DefaultDirState", fileInfo.absolutePath());
    }
    // Read and get information of the JSON file
    Json::Value contents;
    ......
    ......@@ -10,6 +10,7 @@
    #include <pqPipelineSource.h>
    #include <pqServer.h>
    #include <pqServerManagerModel.h>
    #include <pqSettings.h>
    #include <vtkSMProxy.h>
    #include <vtkSMProperty.h>
    ......@@ -63,11 +64,23 @@ void lqSaveLidarStateReaction::onTriggered()
    //-----------------------------------------------------------------------------
    void lqSaveLidarStateReaction::SaveLidarState(vtkSMProxy * lidarProxy)
    {
    // Save Lidar Save information file
    QString defaultFileName = QString("SaveLidarInformation.json");
    // Save Lidar information file and save the folder in which it was saved to find it again later
    QString defaultFileName = QString("/SaveLidarInformation.json");
    pqSettings* settings = pqApplicationCore::instance()->settings();
    QString defaultDir =
    settings->value("LidarPlugin/OpenData/DefaultDirState", QDir::homePath()).toString();
    defaultDir = defaultDir + defaultFileName;
    QString StateFile = QFileDialog::getSaveFileName(nullptr,
    QString("File to save the first lidar information:"),
    defaultFileName, QString("json (*.json)"));
    QString("File to save the first lidar information:"), defaultDir, QString("json (*.json)"));
    if (!StateFile.isNull() && !StateFile.isEmpty())
    {
    QFileInfo fileInfo(StateFile);
    settings->setValue("LidarPlugin/OpenData/DefaultDirState", fileInfo.absolutePath());
    }
    if(StateFile.isEmpty())
    {
    ......
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Finish editing this message first!
    Please register or to comment