Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include <ros/package.h>
00020
00021 #include <ui_MultiplotWidget.h>
00022
00023 #include "rqt_multiplot/MultiplotWidget.h"
00024
00025 namespace rqt_multiplot {
00026
00027
00028
00029
00030
00031 MultiplotWidget::MultiplotWidget(QWidget* parent) :
00032 QWidget(parent),
00033 ui_(new Ui::MultiplotWidget()),
00034 config_(new MultiplotConfig(this)),
00035 messageTypeRegistry_(new MessageTypeRegistry(this)),
00036 packageRegistry_(new PackageRegistry(this)) {
00037 ui_->setupUi(this);
00038
00039 ui_->configWidget->setConfig(config_);
00040 ui_->plotTableConfigWidget->setConfig(config_->getTableConfig());
00041 ui_->plotTableConfigWidget->setPlotTable(ui_->plotTableWidget);
00042 ui_->plotTableWidget->setConfig(config_->getTableConfig());
00043
00044 connect(ui_->configWidget, SIGNAL(currentConfigModifiedChanged(bool)),
00045 this, SLOT(configWidgetCurrentConfigModifiedChanged(bool)));
00046 connect(ui_->configWidget, SIGNAL(currentConfigUrlChanged(const QString&)),
00047 this, SLOT(configWidgetCurrentConfigUrlChanged(const QString&)));
00048
00049 configWidgetCurrentConfigUrlChanged(QString());
00050
00051 messageTypeRegistry_->update();
00052 packageRegistry_->update();
00053 }
00054
00055 MultiplotWidget::~MultiplotWidget() {
00056 confirmClose();
00057
00058 delete ui_;
00059 }
00060
00061
00062
00063
00064
00065 MultiplotConfig* MultiplotWidget::getConfig() const {
00066 return config_;
00067 }
00068
00069 QDockWidget* MultiplotWidget::getDockWidget() const {
00070 QDockWidget* dockWidget = 0;
00071 QObject* currentParent = parent();
00072
00073 while (currentParent) {
00074 dockWidget = qobject_cast<QDockWidget*>(currentParent);
00075
00076 if (dockWidget)
00077 break;
00078
00079 currentParent = currentParent->parent();
00080 }
00081
00082 return dockWidget;
00083 }
00084
00085 void MultiplotWidget::setMaxConfigHistoryLength(size_t length) {
00086 ui_->configWidget->setMaxConfigUrlHistoryLength(length);
00087 }
00088
00089 size_t MultiplotWidget::getMaxConfigHistoryLength() const {
00090 return ui_->configWidget->getMaxConfigUrlHistoryLength();
00091 }
00092
00093 void MultiplotWidget::setConfigHistory(const QStringList& history) {
00094 ui_->configWidget->setConfigUrlHistory(history);
00095 }
00096
00097 QStringList MultiplotWidget::getConfigHistory() const {
00098 return ui_->configWidget->getConfigUrlHistory();
00099 }
00100
00101 void MultiplotWidget::runPlots() {
00102 ui_->plotTableConfigWidget->runPlots();
00103 }
00104
00105
00106
00107
00108
00109 void MultiplotWidget::loadConfig(const QString& url) {
00110 ui_->configWidget->loadConfig(url);
00111 }
00112
00113
00114 void MultiplotWidget::readBag(const QString& url) {
00115
00116 }
00117
00118 bool MultiplotWidget::confirmClose() {
00119 return ui_->configWidget->confirmSave(false);
00120 }
00121
00122
00123
00124
00125
00126 void MultiplotWidget::configWidgetCurrentConfigModifiedChanged(bool
00127 modified) {
00128 configWidgetCurrentConfigUrlChanged(ui_->configWidget->
00129 getCurrentConfigUrl());
00130 }
00131
00132 void MultiplotWidget::configWidgetCurrentConfigUrlChanged(const QString&
00133 url) {
00134 QString windowTitle = "Multiplot";
00135
00136 if (!url.isEmpty())
00137 windowTitle += " - ["+url+"]";
00138 else
00139 windowTitle += " - [untitled]";
00140
00141 if (ui_->configWidget->isCurrentConfigModified())
00142 windowTitle += "*";
00143
00144 setWindowTitle(windowTitle);
00145 }
00146
00147 }