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_CURVE_COLOR_CONFIG_H 00020 #define RQT_MULTIPLOT_CURVE_COLOR_CONFIG_H 00021 00022 #include <QColor> 00023 00024 #include <rqt_multiplot/Config.h> 00025 00026 namespace rqt_multiplot { 00027 class CurveColorConfig : 00028 public Config { 00029 Q_OBJECT 00030 public: 00031 enum Type { 00032 Auto, 00033 Custom 00034 }; 00035 00036 CurveColorConfig(QObject* parent = 0, Type type = Auto, unsigned char 00037 autoColorIndex = 0, const QColor& customColor = Qt::black); 00038 ~CurveColorConfig(); 00039 00040 void setType(Type type); 00041 Type getType() const; 00042 void setAutoColorIndex(unsigned char index); 00043 unsigned char getAutoColorIndex() const; 00044 void setCustomColor(const QColor& color); 00045 const QColor& getCustomColor() const; 00046 QColor getCurrentColor() const; 00047 00048 void save(QSettings& settings) const; 00049 void load(QSettings& settings); 00050 void reset(); 00051 00052 void write(QDataStream& stream) const; 00053 void read(QDataStream& stream); 00054 00055 CurveColorConfig& operator=(const CurveColorConfig& src); 00056 00057 signals: 00058 void typeChanged(int type); 00059 void autoColorIndexChanged(unsigned char index); 00060 void customColorChanged(const QColor& color); 00061 void currentColorChanged(const QColor& color); 00062 00063 private: 00064 Type type_; 00065 unsigned char autoColorIndex_; 00066 QColor customColor_; 00067 }; 00068 }; 00069 00070 #endif