CurveConfigWidget.cpp
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright (C) 2015 by Ralf Kaestner *
3  * ralf.kaestner@gmail.com *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the Lesser GNU General Public License as published by*
7  * the Free Software Foundation; either version 3 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * Lesser GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the Lesser GNU General Public License *
16  * along with this program. If not, see <http://www.gnu.org/licenses/>. *
17  ******************************************************************************/
18 
19 #include <ros/package.h>
20 
21 #include <ui_CurveConfigWidget.h>
22 
24 
25 namespace rqt_multiplot {
26 
27 /*****************************************************************************/
28 /* Constructors and Destructor */
29 /*****************************************************************************/
30 
32  QWidget(parent),
33  ui_(new Ui::CurveConfigWidget()),
34  config_(new CurveConfig(this)),
35  messageTopicRegistry_(new MessageTopicRegistry(this)) {
36  ui_->setupUi(this);
37 
38  ui_->pushButtonCopyRight->setIcon(
39  QIcon(QString::fromStdString(ros::package::getPath("rqt_multiplot").
40  append("/resource/22x22/arrow_right.png"))));
41  ui_->pushButtonCopyLeft->setIcon(
42  QIcon(QString::fromStdString(ros::package::getPath("rqt_multiplot").
43  append("/resource/22x22/arrow_left.png"))));
44  ui_->pushButtonSwap->setIcon(
45  QIcon(QString::fromStdString(ros::package::getPath("rqt_multiplot").
46  append("/resource/22x22/arrows_right_left.png"))));
47 
48  ui_->curveAxisConfigWidgetX->setConfig(config_->getAxisConfig(
50  ui_->curveAxisConfigWidgetY->setConfig(config_->getAxisConfig(
52  ui_->curveColorConfigWidget->setConfig(config_->getColorConfig());
53  ui_->curveStyleConfigWidget->setConfig(config_->getStyleConfig());
54  ui_->curveDataConfigWidget->setConfig(config_->getDataConfig());
55 
56  connect(config_, SIGNAL(titleChanged(const QString&)), this,
57  SLOT(configTitleChanged(const QString&)));
58  connect(config_, SIGNAL(subscriberQueueSizeChanged(size_t)), this,
59  SLOT(configSubscriberQueueSizeChanged(size_t)));
60 
62  SIGNAL(topicChanged(const QString&)), this,
63  SLOT(configAxisConfigTopicChanged(const QString&)));
65  SIGNAL(topicChanged(const QString&)), this,
66  SLOT(configAxisConfigTopicChanged(const QString&)));
67 
69  SIGNAL(typeChanged(const QString&)), this,
70  SLOT(configAxisConfigTypeChanged(const QString&)));
72  SIGNAL(typeChanged(const QString&)), this,
73  SLOT(configAxisConfigTypeChanged(const QString&)));
74 
75  connect(ui_->lineEditTitle, SIGNAL(editingFinished()), this,
77  connect(ui_->pushButtonCopyRight, SIGNAL(clicked()), this,
79  connect(ui_->pushButtonCopyLeft, SIGNAL(clicked()), this,
81  connect(ui_->pushButtonSwap, SIGNAL(clicked()), this,
82  SLOT(pushButtonSwapClicked()));
83  connect(ui_->spinBoxSubscriberQueueSize, SIGNAL(valueChanged(int)),
85 
87 
90 }
91 
93  delete ui_;
94 }
95 
96 /*****************************************************************************/
97 /* Accessors */
98 /*****************************************************************************/
99 
101  *config_ = config;
102 }
103 
105  return *config_;
106 }
107 
109  return *config_;
110 }
111 
112 /*****************************************************************************/
113 /* Slots */
114 /*****************************************************************************/
115 
116 void CurveConfigWidget::configTitleChanged(const QString& title) {
117  ui_->lineEditTitle->setText(title);
118 }
119 
121  ui_->spinBoxSubscriberQueueSize->setValue(queueSize);
122 }
123 
125  CurveAxisConfig* source = static_cast<CurveAxisConfig*>(sender());
126  CurveAxisConfig* destination = 0;
127 
128  if (source == config_->getAxisConfig(CurveConfig::X))
129  destination = config_->getAxisConfig(CurveConfig::Y);
130  else
131  destination = config_->getAxisConfig(CurveConfig::X);
132 
133  if (destination->getTopic().isEmpty())
134  destination->setTopic(topic);
135 }
136 
138  CurveAxisConfig* source = static_cast<CurveAxisConfig*>(sender());
139  CurveAxisConfig* destination = 0;
140 
141  if (source == config_->getAxisConfig(CurveConfig::X))
142  destination = config_->getAxisConfig(CurveConfig::Y);
143  else
144  destination = config_->getAxisConfig(CurveConfig::X);
145 
146  if (destination->getType().isEmpty())
147  destination->setType(type);
148 }
149 
151  config_->setTitle(ui_->lineEditTitle->text());
152 }
153 
157 }
158 
162 }
163 
165  CurveAxisConfig xAxisConfig;
166 
167  xAxisConfig = *config_->getAxisConfig(CurveConfig::X);
170  *config_->getAxisConfig(CurveConfig::Y) = xAxisConfig;
171 }
172 
175 }
176 
177 }
void configAxisConfigTypeChanged(const QString &type)
const QString & getTopic() const
void setConfig(const CurveConfig &config)
void configSubscriberQueueSizeChanged(size_t queueSize)
void configAxisConfigTopicChanged(const QString &topic)
void spinBoxSubscriberQueueSizeValueChanged(int value)
CurveDataConfig * getDataConfig() const
Definition: CurveConfig.cpp:90
size_t getSubscriberQueueSize() const
CurveAxisConfig * getAxisConfig(Axis axis) const
Definition: CurveConfig.cpp:73
const QString & getType() const
void setTopic(const QString &topic)
void setType(const QString &type)
ROSLIB_DECL std::string getPath(const std::string &package_name)
void setSubscriberQueueSize(size_t queueSize)
Definition: CurveConfig.cpp:94
const QString & getTitle() const
Definition: CurveConfig.cpp:69
ROSCPP_DECL std::string append(const std::string &left, const std::string &right)
void setTitle(const QString &title)
Definition: CurveConfig.cpp:60
CurveStyleConfig * getStyleConfig() const
Definition: CurveConfig.cpp:86
MessageTopicRegistry * messageTopicRegistry_
CurveColorConfig * getColorConfig() const
Definition: CurveConfig.cpp:82
void configTitleChanged(const QString &title)


rqt_multiplot
Author(s): Ralf Kaestner
autogenerated on Wed Jul 10 2019 03:49:44