LCOV - code coverage report
Current view: top level - gui/source - persistentfiledialog.cpp (source / functions) Hit Total Coverage
Test: mcrl2_coverage.info.cleaned Lines: 0 29 0.0 %
Date: 2020-02-28 00:44:21 Functions: 0 5 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : // Author(s): Rimco Boudewijns
       2             : // Copyright: see the accompanying file COPYING or copy at
       3             : // https://github.com/mCRL2org/mCRL2/blob/master/COPYING
       4             : //
       5             : // Distributed under the Boost Software License, Version 1.0.
       6             : // (See accompanying file LICENSE_1_0.txt or copy at
       7             : // http://www.boost.org/LICENSE_1_0.txt)
       8             : //
       9             : 
      10             : #include "mcrl2/gui/persistentfiledialog.h"
      11             : 
      12             : using namespace mcrl2::gui::qt;
      13             : 
      14           0 : PersistentFileDialog::PersistentFileDialog(QString directory, QWidget *parent)
      15             :   : QObject(parent),
      16             :     m_parent(parent),
      17           0 :     m_directory(directory)
      18             : {
      19           0 :   if (m_directory.isEmpty())
      20           0 :     m_directory = QDir::currentPath();
      21           0 : }
      22             : 
      23           0 : QString PersistentFileDialog::getExistingDirectory(const QString &caption, QFileDialog::Options options)
      24             : {
      25           0 :   QString result = QFileDialog::getExistingDirectory(m_parent, caption, m_directory, options);
      26           0 :   if (!result.isNull())
      27             :   {
      28           0 :     QFileInfo info(result);
      29           0 :     m_directory = info.absolutePath();
      30             :   }
      31           0 :   return result;
      32             : }
      33             : 
      34           0 : QString PersistentFileDialog::getOpenFileName(const QString &caption, const QString &filter, QString *selectedFilter, QFileDialog::Options options)
      35             : {
      36           0 :   QString result = QFileDialog::getOpenFileName(m_parent, caption, m_directory, filter, selectedFilter, options);
      37           0 :   if (!result.isNull())
      38             :   {
      39           0 :     QFileInfo info(result);
      40           0 :     m_directory = info.absolutePath();
      41             :   }
      42           0 :   return result;
      43             : }
      44             : 
      45           0 : QStringList PersistentFileDialog::getOpenFileNames(const QString &caption, const QString &filter, QString *selectedFilter, QFileDialog::Options options)
      46             : {
      47           0 :   QStringList result = QFileDialog::getOpenFileNames(m_parent, caption, m_directory, filter, selectedFilter, options);
      48           0 :   if (!result.isEmpty())
      49             :   {
      50           0 :     QFileInfo info(result[0]);
      51           0 :     m_directory = info.absolutePath();
      52             :   }
      53           0 :   return result;
      54             : }
      55             : 
      56           0 : QString PersistentFileDialog::getSaveFileName(const QString &caption, const QString &filter, QString *selectedFilter, QFileDialog::Options options)
      57             : {
      58           0 :   QString result = QFileDialog::getSaveFileName(m_parent, caption, m_directory, filter, selectedFilter, options);
      59           0 :   if (!result.isNull())
      60             :   {
      61           0 :     QFileInfo info(result);
      62           0 :     m_directory = info.absolutePath();
      63             :   }
      64           0 :   return result;
      65             : }
      66             : 

Generated by: LCOV version 1.13