Skip to content
Snippets Groups Projects
Commit a195089b authored by MelanieCarriere's avatar MelanieCarriere
Browse files

Merge branch 'FixCrashAnalysisAndSaveLoadReaction' into 'master'

Fix crash analysis and save load reaction

See merge request !164
parents 536572d8 985eb865
No related branches found
No related tags found
1 merge request!164Fix crash analysis and save load reaction
Pipeline #205909 passed
Pipeline: LidarView

#205910

    ......@@ -7,10 +7,12 @@
    //-----------------------------------------------------------------------------
    lqLidarStateDialog::lqLidarStateDialog(QWidget *parent,
    std::vector<propertyInfo>& propertiesVector) :
    std::vector<propertyInfo>& propertiesVector,
    const std::string& instruction) :
    QDialog(parent)
    {
    this->properties = propertiesVector;
    this->instructions = QString(instruction.c_str());
    QVBoxLayout* vbox = new QVBoxLayout;
    ......@@ -26,6 +28,22 @@ lqLidarStateDialog::lqLidarStateDialog(QWidget *parent,
    //-----------------------------------------------------------------------------
    void lqLidarStateDialog::CreateDialog(QVBoxLayout *vbox)
    {
    // Display an information message if there is no property to display
    if(this->properties.empty())
    {
    QLabel * label = new QLabel(QString("No property available"));
    vbox->addWidget(label, 0, Qt::AlignCenter);
    return;
    }
    // Display a message to give a tip to the user :
    if(!this->instructions.isEmpty())
    {
    QLabel * label = new QLabel(this->instructions);
    label->setStyleSheet("font: italic;font-size: 12px ; color: grey");
    vbox->addWidget(label, 0, Qt::AlignLeft);
    }
    for(unsigned int i = 0; i < this->properties.size(); i++)
    {
    propertyInfo currentProperty = this->properties[i];
    ......
    ......@@ -63,13 +63,17 @@ class lqLidarStateDialog : public QDialog
    Q_OBJECT
    public:
    explicit lqLidarStateDialog(QWidget *parent, std::vector<propertyInfo>& propertiesVector);
    explicit lqLidarStateDialog(QWidget *parent,
    std::vector<propertyInfo>& propertiesVector,
    const std::string& instruction = "");
    ~lqLidarStateDialog(){}
    void CreateDialog(QVBoxLayout * vbox);
    std::vector<propertyInfo> properties;
    QString instructions;
    };
    #endif // LQLIDARSTATEDIALOG_H
    ......
    ......@@ -80,7 +80,7 @@ void lqLoadLidarStateReaction::onTriggered()
    return;
    }
    lqLidarStateDialog dialog(nullptr, propertyInfo);
    lqLidarStateDialog dialog(nullptr, propertyInfo, "Please select the parameters to load");
    if(dialog.exec())
    {
    for(const auto & currentProp : dialog.properties)
    ......
    ......@@ -70,7 +70,7 @@ void lqSaveLidarStateReaction::onTriggered()
    std::vector<propertyInfo> propertiesInfo;
    constructPropertiesInfo(lidarProxy, propertiesInfo);
    lqLidarStateDialog dialog(nullptr, propertiesInfo);
    lqLidarStateDialog dialog(nullptr, propertiesInfo, "Please select the parameters to save");
    if(dialog.exec())
    {
    Json::StyledStreamWriter writer;
    ......@@ -108,6 +108,10 @@ void lqSaveLidarStateReaction::onTriggered()
    }
    }
    }
    if(data.empty())
    {
    QMessageBox::information(nullptr, QObject::tr(""), QObject::tr("Saved json file is empty (no parameter selected)"));
    }
    writer.write(configFile, data);
    }
    ......@@ -144,6 +148,13 @@ void lqSaveLidarStateReaction::constructPropertiesInfo(vtkSMProxy * lidarProxy,
    continue;
    }
    if(strcmp(prop->GetClassName(), "vtkSMProperty") == 0)
    {
    // If the property is a simple "vtkSMProperty" (ex: "Start" for Stream proxy)
    // "GetAsProxy" function will generate a warning
    continue;
    }
    // If the property is a valid proxy, we print all the properties of the proxy at the end
    vtkSMProxy* propertyAsProxy = vtkSMPropertyHelper(prop).GetAsProxy();
    if(propertyAsProxy)
    ......
    ......@@ -64,6 +64,12 @@ vtkSMProxy* SearchProxyByName(vtkSMProxy * base_proxy, const std::string &proxyN
    for (propIter->Begin(); !propIter->IsAtEnd(); propIter->Next())
    {
    vtkSMProperty* prop = propIter->GetProperty();
    if(strcmp(prop->GetClassName(), "vtkSMProperty") == 0)
    {
    // If the property is a simple "vtkSMProperty" (ex: "Start" for Stream proxy)
    // "GetAsProxy" function will generate a warning
    continue;
    }
    // Search the proxy in the subProxy if its valid
    vtkSMProxy* propertyAsProxy = vtkSMPropertyHelper(prop).GetAsProxy();
    ......
    ......@@ -50,12 +50,19 @@ std::string GetCrashAnalysingFileName()
    appDir += "LastData";
    }
    // Checking if the application directory exists in the home directory and create it otherwise
    boost::filesystem::path appDirPath(appDir.c_str());
    try
    {
    // Checking if the application directory exists in the home directory and create it otherwise
    boost::filesystem::path appDirPath(appDir.c_str());
    if (!boost::filesystem::is_directory(appDirPath))
    if (!boost::filesystem::is_directory(appDirPath))
    {
    boost::filesystem::create_directories(appDirPath);
    }
    }
    catch (std::exception const& e)
    {
    boost::filesystem::create_directory(appDirPath);
    std::cout << "Failed to create directory for crash analysis : " << e.what() << std::endl;
    }
    return appDir;
    }
    ......
    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