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

#include <CQSBMLFileDialog.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 sbmlLevel=2, unsigned int sbmlVersion=4)
 

Detailed Description

Definition at line 28 of file CQSBMLFileDialog.h.

Member Function Documentation

std::pair< QString, std::pair< unsigned C_INT32, unsigned C_INT32 > > CQSBMLFileDialog::getSaveFileName ( QWidget *  parent,
const char *  name,
const QString &  startWith,
const QString &  caption,
unsigned int  sbmlLevel = 2,
unsigned int  sbmlVersion = 4 
)
static

Definition at line 23 of file CQSBMLFileDialog.cpp.

References CopasiFileDialog::getSaveFileName().

Referenced by CopasiUI3Window::slotExportSBML().

29 {
30  std::pair< QString, std::pair< unsigned C_INT32, unsigned C_INT32 > > NameAndVersion;
31 
32  QString Filter = "Level 1 Version 1 (*.xml);;"
33  "Level 1 Version 2 (*.xml);;"
34  "Level 2 Version 1 (*.xml);;"
35  "Level 2 Version 2 (*.xml);;"
36  "Level 2 Version 3 (*.xml);;"
37  "Level 2 Version 4 (*.xml);;"
38  "Level 2 Version 5 (*.xml);;"
39  "Level 3 Version 1 (*.xml)";
40 
41  QString SelectedFilter =
42  QString("Level %1 Version %2 (*.xml)").arg(QString::number(sbmlLevel)).arg(QString::number(sbmlVersion));;
43 
44  // The default export is L2V4
45  if (Filter.indexOf(SelectedFilter) == -1)
46  {
47  SelectedFilter = "Level 2 Version 4 (*.xml)";
48  }
49 
50  // We need to avoid the KDE dialog at least under Qt 4.7 and KDE 4.5
51  // See: Bug 1651
52  QFileDialog::Options DontUseNativeDialog = 0;
53 
54 #ifdef Linux
55  DontUseNativeDialog = QFileDialog::DontUseNativeDialog;
56 #endif // Linux
57 
58  NameAndVersion.first =
59  CopasiFileDialog::getSaveFileName(parent, name, startWith, Filter, caption, &SelectedFilter, DontUseNativeDialog);
60 
61  QRegExp Pattern("Level (\\d) Version (\\d) \\(\\*\\.xml\\)");
62 
63  if (Pattern.exactMatch(SelectedFilter))
64  {
65  NameAndVersion.second.first = Pattern.cap(1).toInt();
66  NameAndVersion.second.second = Pattern.cap(2).toInt();
67  }
68  else
69  {
70  NameAndVersion.second.first = 2;
71  NameAndVersion.second.second = 4;
72  }
73 
74  return NameAndVersion;
75 }
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: