forked from OpenDDS/OpenDDS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
GvOptions.cpp
127 lines (101 loc) · 4.01 KB
/
GvOptions.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/*
*
*
* Distributed under the OpenDDS License.
* See: http://www.opendds.org/license.html
*/
// Tell GCC to ignore implicitly declared copy methods as long as
// Qt is not compliant.
#ifdef __GNUC__
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wdeprecated-copy"
#endif
#include <QtGui/QtGui>
#include <QtCore/QDir>
#ifdef __GNUC__
# pragma GCC diagnostic pop
#endif
#include "GvOptions.h"
// Note calls to QObject::toStdString() have been replaced with QObject::toLocal8Bit().constData()
// to avoid QString-related aborts under windows.
namespace Monitor {
GvOptionsDialog::GvOptionsDialog( QWidget* parent)
: QDialog( parent)
{
ui.setupUi( this);
// tmp dirs are platform specific.
ui.dotLocEdit->setText(QDir::tempPath() + QDir::separator() + "monitor.dot");
ui.pngLocEdit->setText(QDir::tempPath() + QDir::separator() + "monitor.png");
}
void
GvOptionsDialog::dialogAction(QWidget *parent, GvOptionsData &gvOpt, bool* status)
{
GvOptionsDialog dialog( parent);
// set current gvOptions
dialog.ui.dotLocEdit->setText(gvOpt.dotFile_.c_str());
dialog.ui.pngLocEdit->setText(gvOpt.pngFile_.c_str());
dialog.ui.gvLocEdit->setText(gvOpt.graphvizBin_.c_str());
dialog.ui.lrLayout->setChecked(gvOpt.lrLayout_);
dialog.ui.abbrGUIDs->setChecked(gvOpt.abbrGUIDs_);
dialog.ui.ignoreBuiltinTopics->setChecked(gvOpt.ignoreBuiltinTopics_);
dialog.ui.hideTopics->setChecked(gvOpt.hideTopics_);
dialog.ui.ignoreHosts->setChecked(gvOpt.ignoreHosts_);
dialog.ui.ignoreProcs->setChecked(gvOpt.ignoreProcs_);
dialog.ui.ignorePubs->setChecked(gvOpt.ignorePubs_);
dialog.ui.ignoreSubs->setChecked(gvOpt.ignoreSubs_);
dialog.ui.ignoreTransports->setChecked(gvOpt.ignoreTransports_);
dialog.ui.ignoreQos->setChecked(gvOpt.ignoreQos_);
switch( dialog.exec()) {
case Accepted:
gvOpt.dotFile_ = dialog.ui.dotLocEdit->displayText().toLocal8Bit().constData();
gvOpt.pngFile_ = dialog.ui.pngLocEdit->displayText().toLocal8Bit().constData();
gvOpt.graphvizBin_ = dialog.ui.gvLocEdit->displayText().toLocal8Bit().constData();
gvOpt.lrLayout_ = dialog.ui.lrLayout->isChecked();
gvOpt.abbrGUIDs_ = dialog.ui.abbrGUIDs->isChecked();
gvOpt.ignoreBuiltinTopics_ = dialog.ui.ignoreBuiltinTopics->isChecked();
gvOpt.hideTopics_ = dialog.ui.hideTopics->isChecked();
gvOpt.ignoreHosts_ = dialog.ui.ignoreHosts->isChecked();
gvOpt.ignoreProcs_ = dialog.ui.ignoreProcs->isChecked();
gvOpt.ignorePubs_ = dialog.ui.ignorePubs->isChecked();
gvOpt.ignoreSubs_ = dialog.ui.ignoreSubs->isChecked();
gvOpt.ignoreTransports_ = dialog.ui.ignoreTransports->isChecked();
gvOpt.ignoreQos_ = dialog.ui.ignoreQos->isChecked();
*status = true;
break;
case Rejected:
default:
*status = false;
break;
}
}
void
GvOptionsDialog::getGvData(QWidget *parent, GvOptionsData &gvOpt)
{
GvOptionsDialog dialog( parent);
gvOpt.dotFile_ = dialog.ui.dotLocEdit->displayText().toLocal8Bit().constData();
gvOpt.pngFile_ = dialog.ui.pngLocEdit->displayText().toLocal8Bit().constData();
gvOpt.graphvizBin_ = dialog.ui.gvLocEdit->displayText().toLocal8Bit().constData();
gvOpt.lrLayout_ = dialog.ui.lrLayout->isChecked();
gvOpt.abbrGUIDs_ = dialog.ui.abbrGUIDs->isChecked();
gvOpt.ignoreBuiltinTopics_ = dialog.ui.ignoreBuiltinTopics->isChecked();
gvOpt.hideTopics_ = dialog.ui.hideTopics->isChecked();
gvOpt.ignoreHosts_ = dialog.ui.ignoreHosts->isChecked();
gvOpt.ignoreProcs_ = dialog.ui.ignoreProcs->isChecked();
gvOpt.ignorePubs_ = dialog.ui.ignorePubs->isChecked();
gvOpt.ignoreSubs_ = dialog.ui.ignoreSubs->isChecked();
gvOpt.ignoreTransports_ = dialog.ui.ignoreTransports->isChecked();
gvOpt.ignoreQos_ = dialog.ui.ignoreQos->isChecked();
}
GvOptionsData::GvOptionsData() : lrLayout_(false)
, abbrGUIDs_(false)
, ignoreBuiltinTopics_(false)
, hideTopics_(false)
, ignoreHosts_(false)
, ignoreProcs_(false)
, ignorePubs_(false)
, ignoreSubs_(false)
, ignoreTransports_(false)
, ignoreQos_(false)
{
}
} // End of namespace Monitor