COPASI API  4.16.103
Static Public Member Functions | List of all members
CQSEDMLFileDialog Class Reference

#include <CQSEDMLFileDialog.h>

Static Public Member Functions

static std::pair< QString,
std::pair< unsigned C_INT32,
unsigned C_INT32 > > 
getSaveFileName (QWidget *parent, const char *name, const QString &startWith, const QString &caption, unsigned int sedmlLevel=1, unsigned int sedmlVersion=2)
 

Detailed Description

Definition at line 26 of file CQSEDMLFileDialog.h.

Member Function Documentation

std::pair< QString, std::pair< unsigned C_INT32, unsigned C_INT32 > > CQSEDMLFileDialog::getSaveFileName ( QWidget *  parent,
const char *  name,
const QString &  startWith,
const QString &  caption,
unsigned int  sedmlLevel = 1,
unsigned int  sedmlVersion = 2 
)
static

Definition at line 21 of file CQSEDMLFileDialog.cpp.

References CopasiFileDialog::getSaveFileName().

27 {
28  std::pair< QString, std::pair< unsigned C_INT32, unsigned C_INT32 > > NameAndVersion;
29 
30  QString Filter = "Level 1 Version 2 (*.sedml);;"
31  "Level 1 Version 1 (*.sedml)";
32 
33  QString SelectedFilter =
34  QString("Level %1 Version %2 (*.sedml)").arg(QString::number(sedmlLevel)).arg(QString::number(sedmlVersion));;
35 
36  // The default export is L1V2
37  if (Filter.indexOf(SelectedFilter) == -1)
38  {
39  SelectedFilter = "Level 1 Version 2 (*.sedml)";
40  }
41 
42  // We need to avoid the KDE dialog at least under Qt 4.7 and KDE 4.5
43  // See: Bug 1651
44  QFileDialog::Options DontUseNativeDialog = 0;
45 
46 #ifdef Linux
47  DontUseNativeDialog = QFileDialog::DontUseNativeDialog;
48 #endif // Linux
49 
50  NameAndVersion.first =
51  CopasiFileDialog::getSaveFileName(parent, name, startWith, Filter, caption, &SelectedFilter, DontUseNativeDialog);
52 
53  QRegExp Pattern("Level (\\d) Version (\\d) \\(\\*\\.sedml\\)");
54 
55  if (Pattern.exactMatch(SelectedFilter))
56  {
57  NameAndVersion.second.first = Pattern.cap(1).toInt();
58  NameAndVersion.second.second = Pattern.cap(2).toInt();
59  }
60  else
61  {
62  NameAndVersion.second.first = 1;
63  NameAndVersion.second.second = 2;
64  }
65 
66  return NameAndVersion;
67 }
static QString getSaveFileName(QWidget *parent=0, const char *name=0, const QString &startWith=QString::null, const QString &filter=QString::null, const QString &caption=QString::null, QString *pSelectedFilter=NULL, QFileDialog::Options options=0)

The documentation for this class was generated from the following files: