00001 /****************************************************************************** 00002 * Copyright (C) 2015 by Ralf Kaestner * 00003 * ralf.kaestner@gmail.com * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the Lesser GNU General Public License as published by* 00007 * the Free Software Foundation; either version 3 of the License, or * 00008 * (at your option) any later version. * 00009 * * 00010 * This program is distributed in the hope that it will be useful, * 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00013 * Lesser GNU General Public License for more details. * 00014 * * 00015 * You should have received a copy of the Lesser GNU General Public License * 00016 * along with this program. If not, see <http://www.gnu.org/licenses/>. * 00017 ******************************************************************************/ 00018 00019 #ifndef RQT_MULTIPLOT_MULTIPLOT_CONFIG_WIDGET_H 00020 #define RQT_MULTIPLOT_MULTIPLOT_CONFIG_WIDGET_H 00021 00022 #include <QStringList> 00023 #include <QWidget> 00024 00025 #include <rqt_multiplot/MultiplotConfig.h> 00026 00027 namespace Ui { 00028 class MultiplotConfigWidget; 00029 }; 00030 00031 namespace rqt_multiplot { 00032 class MultiplotConfigWidget : 00033 public QWidget { 00034 Q_OBJECT 00035 public: 00036 MultiplotConfigWidget(QWidget* parent = 0, size_t maxHistoryLength = 10); 00037 virtual ~MultiplotConfigWidget(); 00038 00039 void setConfig(MultiplotConfig* config); 00040 MultiplotConfig* getConfig() const; 00041 void setCurrentConfigUrl(const QString& url, bool updateHistory = true); 00042 QString getCurrentConfigUrl() const; 00043 bool setCurrentConfigModified(bool modified); 00044 bool isCurrentConfigModified() const; 00045 void setMaxConfigUrlHistoryLength(size_t length); 00046 size_t getMaxConfigUrlHistoryLength() const; 00047 void setConfigUrlHistory(const QStringList& history); 00048 QStringList getConfigUrlHistory() const; 00049 bool isFile(const QString& url) const; 00050 00051 bool loadConfig(const QString& url); 00052 bool saveCurrentConfig(); 00053 bool saveConfig(const QString& url); 00054 void resetConfig(); 00055 00056 bool confirmSave(bool canCancel = true); 00057 00058 void addConfigUrlToHistory(const QString& url); 00059 void clearConfigUrlHistory(); 00060 00061 signals: 00062 void currentConfigModifiedChanged(bool modified); 00063 void currentConfigUrlChanged(const QString& url); 00064 00065 private: 00066 Ui::MultiplotConfigWidget* ui_; 00067 00068 MultiplotConfig* config_; 00069 00070 QString currentConfigUrl_; 00071 bool currentConfigModified_; 00072 size_t maxHistoryLength_; 00073 00074 private slots: 00075 void configChanged(); 00076 00077 void configComboBoxEditTextChanged(const QString& text); 00078 void configComboBoxCurrentUrlChanged(const QString& url); 00079 00080 void pushButtonClearHistoryClicked(); 00081 void pushButtonNewClicked(); 00082 void pushButtonOpenClicked(); 00083 void pushButtonSaveClicked(); 00084 void pushButtonSaveAsClicked(); 00085 }; 00086 }; 00087 00088 #endif