MultiplotWidget.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_MultiplotWidget.h>
22 
24 
25 namespace rqt_multiplot {
26 
27 /*****************************************************************************/
28 /* Constructors and Destructor */
29 /*****************************************************************************/
30 
32  QWidget(parent),
33  ui_(new Ui::MultiplotWidget()),
34  config_(new MultiplotConfig(this)),
35  messageTypeRegistry_(new MessageTypeRegistry(this)),
36  packageRegistry_(new PackageRegistry(this)) {
37  ui_->setupUi(this);
38 
39  ui_->configWidget->setConfig(config_);
40  ui_->plotTableConfigWidget->setConfig(config_->getTableConfig());
41  ui_->plotTableConfigWidget->setPlotTable(ui_->plotTableWidget);
42  ui_->plotTableWidget->setConfig(config_->getTableConfig());
43 
44  connect(ui_->configWidget, SIGNAL(currentConfigModifiedChanged(bool)),
46  connect(ui_->configWidget, SIGNAL(currentConfigUrlChanged(const QString&)),
47  this, SLOT(configWidgetCurrentConfigUrlChanged(const QString&)));
48 
50 
53 }
54 
56  confirmClose();
57 
58  delete ui_;
59 }
60 
61 /*****************************************************************************/
62 /* Accessors */
63 /*****************************************************************************/
64 
66  return config_;
67 }
68 
69 QDockWidget* MultiplotWidget::getDockWidget() const {
70  QDockWidget* dockWidget = 0;
71  QObject* currentParent = parent();
72 
73  while (currentParent) {
74  dockWidget = qobject_cast<QDockWidget*>(currentParent);
75 
76  if (dockWidget)
77  break;
78 
79  currentParent = currentParent->parent();
80  }
81 
82  return dockWidget;
83 }
84 
86  ui_->configWidget->setMaxConfigUrlHistoryLength(length);
87 }
88 
90  return ui_->configWidget->getMaxConfigUrlHistoryLength();
91 }
92 
93 void MultiplotWidget::setConfigHistory(const QStringList& history) {
94  ui_->configWidget->setConfigUrlHistory(history);
95 }
96 
97 QStringList MultiplotWidget::getConfigHistory() const {
98  return ui_->configWidget->getConfigUrlHistory();
99 }
100 
102  ui_->plotTableConfigWidget->runPlots();
103 }
104 
105 /*****************************************************************************/
106 /* Methods */
107 /*****************************************************************************/
108 
109 void MultiplotWidget::loadConfig(const QString& url) {
110  ui_->configWidget->loadConfig(url);
111 }
112 
113 
114 void MultiplotWidget::readBag(const QString& url) {
115 // ui_->bagReaderWidget->readBag(url);
116 }
117 
119  return ui_->configWidget->confirmSave(false);
120 }
121 
122 /*****************************************************************************/
123 /* Slots */
124 /*****************************************************************************/
125 
127  modified) {
129  getCurrentConfigUrl());
130 }
131 
133  url) {
134  QString windowTitle = "Multiplot";
135 
136  if (!url.isEmpty())
137  windowTitle += " - ["+url+"]";
138  else
139  windowTitle += " - [untitled]";
140 
141  if (ui_->configWidget->isCurrentConfigModified())
142  windowTitle += "*";
143 
144  setWindowTitle(windowTitle);
145 }
146 
147 }
void setConfigHistory(const QStringList &history)
QStringList getConfigHistory() const
size_t getMaxConfigHistoryLength() const
QDockWidget * getDockWidget() const
void readBag(const QString &url)
void loadConfig(const QString &url)
void configWidgetCurrentConfigModifiedChanged(bool modified)
MultiplotWidget(QWidget *parent=0)
MessageTypeRegistry * messageTypeRegistry_
PackageRegistry * packageRegistry_
PlotTableConfig * getTableConfig() const
MultiplotConfig * getConfig() const
void configWidgetCurrentConfigUrlChanged(const QString &url)
Ui::MultiplotWidget * ui_
void setMaxConfigHistoryLength(size_t length)


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