COPASI API  4.16.103
ObjectBrowserDialog.cpp
Go to the documentation of this file.
1 // Copyright (C) 2010 - 2013 by Pedro Mendes, Virginia Tech Intellectual
2 // Properties, Inc., University of Heidelberg, and The University
3 // of Manchester.
4 // All rights reserved.
5 
6 // Copyright (C) 2008 - 2009 by Pedro Mendes, Virginia Tech Intellectual
7 // Properties, Inc., EML Research, gGmbH, University of Heidelberg,
8 // and The University of Manchester.
9 // All rights reserved.
10 
11 // Copyright (C) 2004 - 2007 by Pedro Mendes, Virginia Tech Intellectual
12 // Properties, Inc. and EML Research, gGmbH.
13 // All rights reserved.
14 
15 #include "ObjectBrowserDialog.h"
16 #include <QtGui/QPushButton>
17 #include <QtGui/QLayout>
18 #include <QtGui/QGridLayout>
19 #include <QtGui/QCloseEvent>
20 
21 #include "copasi.h"
22 
23 #include "copasiui3window.h"
24 #include "report/CCopasiObject.h"
25 #include "ObjectBrowserWidget.h"
26 //#include "qtUtilities.h"
27 
28 /*
29  * Constructs a ObjectBrowserDialog which is a child of 'parent', with the
30  * name 'name' and widget flags set to 'f'.
31  */
32 ObjectBrowserDialog::ObjectBrowserDialog(QWidget* parent, const char* name, bool modal, int state)
33  : QDialog(parent),
34  clearButton(NULL),
35  toggleViewButton(NULL),
36  cancelButton(NULL),
37  okButton(NULL),
38  Line1(NULL),
39  spacer(NULL),
40  objectBrowserWidget(NULL),
41  ObjectBrowserDialogLayout(NULL)
42 {
43  setObjectName(QString::fromUtf8(name));
44  setModal(modal);
45  setAttribute(Qt::WA_DeleteOnClose);
46  ObjectBrowserDialogLayout = new QGridLayout(this);
47  ObjectBrowserDialogLayout->setMargin(11);
48  ObjectBrowserDialogLayout->setSpacing(6);
49  ObjectBrowserDialogLayout->setObjectName(QString::fromUtf8("ObjectBrowserDialogLayout"));
50 
52  ObjectBrowserDialogLayout->addWidget(objectBrowserWidget, 0, 0, 1, 2);
53 
54  Line1 = new QFrame(this);
55  Line1->setObjectName("Line1");
56  Line1->setFrameShape(QFrame::HLine);
57  Line1->setFrameShadow(QFrame::Sunken);
58  Line1->setFrameShape(QFrame::HLine);
59  ObjectBrowserDialogLayout->addWidget(Line1, 1, 0, 1, 2);
60 
61  if (state == 0)
62  {
63  clearButton = new QPushButton(this);
64  clearButton->setObjectName("clearButton");
65  clearButton->setText("Clear");
66 
67  toggleViewButton = new QPushButton(this);
68  toggleViewButton->setObjectName("toggleViewButton");
69  toggleViewButton->setText("Selected Items");
70 
71  cancelButton = new QPushButton(this);
72  cancelButton->setObjectName("cancelButton");
73  cancelButton->setText("Cancel");
74 
75  okButton = new QPushButton(this);
76  okButton->setObjectName("okButton");
77  okButton->setText("OK");
78  okButton->setDefault(true);
79  okButton->setAutoDefault(true);
80 
81  connect(clearButton, SIGNAL(clicked()), objectBrowserWidget, SLOT(clearClicked()));
82  connect(toggleViewButton, SIGNAL(clicked()), this, SLOT(toggleViewClicked()));
83  connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancelClicked()));
84  connect(okButton, SIGNAL(clicked()), this, SLOT(okClicked()));
85 
86  ObjectBrowserDialogLayout->addWidget(clearButton, 2, 0);
88  ObjectBrowserDialogLayout->addWidget(cancelButton, 2, 2);
89  ObjectBrowserDialogLayout->addWidget(okButton, 2, 3);
90 
91  setTabOrder(okButton, clearButton);
92  setTabOrder(clearButton, toggleViewButton);
93  setTabOrder(toggleViewButton, cancelButton);
94  setTabOrder(cancelButton, objectBrowserWidget);
95  }
96  else
97  {
98  okButton = new QPushButton(this);
99  okButton->setObjectName("okButton");
100  okButton->setText("Close");
101  okButton->setDefault(true);
102  okButton->setAutoDefault(true);
103  ObjectBrowserDialogLayout->addWidget(okButton, 2, 1, 1, 1);
104 
105  connect(okButton, SIGNAL(clicked()), this, SLOT(okClicked()));
106 
107  setTabOrder(okButton, objectBrowserWidget);
108  }
109 
110  if (!name)
111  setObjectName("ObjectBrowser");
112 
113  resize(420, 460);
114  setWindowTitle(trUtf8("Object Browser"));
115 }
116 
118 {}
119 
120 void ObjectBrowserDialog::setOutputVector(std::vector< const CCopasiObject * > * pObjectVector)
121 {
123 }
124 
126 {
127  close();
128 }
129 
131 {
133  done(QDialog::Accepted);
134 }
135 
137 {
138  if (toggleViewButton->text() == "Selected Items")
139  toggleViewButton->setText("Tree View");
140  else
141  toggleViewButton->setText("Selected Items");
142 
144 }
145 
146 void ObjectBrowserDialog::selectObjects(std::vector< const CCopasiObject * > * pObjectVector)
147 {
149 }
QGridLayout * ObjectBrowserDialogLayout
ObjectBrowserWidget * objectBrowserWidget
void setOutputVector(std::vector< const CCopasiObject * > *pObjectVector)
virtual void toggleViewClicked()
void setOutputVector(std::vector< const CCopasiObject * > *pObjectVector)
void selectObjects(std::vector< const CCopasiObject * > *pObjectVector)
ObjectBrowserDialog(QWidget *parent=0, const char *name=0, bool modal=true, int state=0)
QPushButton * cancelButton
void selectObjects(std::vector< const CCopasiObject * > *pObjectVector)
QPushButton * toggleViewButton