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 "rqt_multiplot/PlotAxisConfig.h"
00020
00021 namespace rqt_multiplot {
00022
00023
00024
00025
00026
00027 PlotAxisConfig::PlotAxisConfig(QObject* parent, TitleType titleType, const
00028 QString& customTitle, bool titleVisible) :
00029 Config(parent),
00030 titleType_(titleType),
00031 customTitle_(customTitle),
00032 titleVisible_(titleVisible) {
00033 }
00034
00035 PlotAxisConfig::~PlotAxisConfig() {
00036 }
00037
00038
00039
00040
00041
00042 void PlotAxisConfig::setTitleType(TitleType type) {
00043 if (type != titleType_) {
00044 titleType_ = type;
00045
00046 emit titleTypeChanged(type);
00047 emit changed();
00048 }
00049 }
00050
00051 PlotAxisConfig::TitleType PlotAxisConfig::getTitleType() const {
00052 return titleType_;
00053 }
00054
00055 void PlotAxisConfig::setCustomTitle(const QString& title) {
00056 if (title != customTitle_) {
00057 customTitle_ = title;
00058
00059 emit customTitleChanged(title);
00060 emit changed();
00061 }
00062 }
00063
00064 const QString& PlotAxisConfig::getCustomTitle() const {
00065 return customTitle_;
00066 }
00067
00068 void PlotAxisConfig::setTitleVisible(bool visible) {
00069 if (visible != titleVisible_) {
00070 titleVisible_ = visible;
00071
00072 emit titleVisibleChanged(visible);
00073 emit changed();
00074 }
00075 }
00076
00077 bool PlotAxisConfig::isTitleVisible() const {
00078 return titleVisible_;
00079 }
00080
00081
00082
00083
00084
00085 void PlotAxisConfig::save(QSettings& settings) const {
00086 settings.setValue("title_type", titleType_);
00087 settings.setValue("custom_title", customTitle_);
00088 settings.setValue("title_visible", titleVisible_);
00089 }
00090
00091 void PlotAxisConfig::load(QSettings& settings) {
00092 setTitleType(static_cast<TitleType>(settings.value("title_type",
00093 AutoTitle).toInt()));
00094 setCustomTitle(settings.value("custom_title", "Untitled Axis").toString());
00095 setTitleVisible(settings.value("title_visible", true).toBool());
00096 }
00097
00098 void PlotAxisConfig::reset() {
00099 setTitleType(AutoTitle);
00100 setCustomTitle("Untitled Axis");
00101 setTitleVisible(true);
00102 }
00103
00104 void PlotAxisConfig::write(QDataStream& stream) const {
00105 stream << (int)titleType_;
00106 stream << customTitle_;
00107 stream << titleVisible_;
00108 }
00109
00110 void PlotAxisConfig::read(QDataStream& stream) {
00111 int titleType;
00112 QString customTitle;
00113 bool titleVisible;
00114
00115 stream >> titleType;
00116 setTitleType(static_cast<TitleType>(titleType));
00117 stream >> customTitle;
00118 setCustomTitle(customTitle);
00119 stream >> titleVisible;
00120 setTitleVisible(titleVisible);
00121 }
00122
00123
00124
00125
00126
00127 PlotAxisConfig& PlotAxisConfig::operator=(const PlotAxisConfig& src) {
00128 setTitleType(src.titleType_);
00129 setCustomTitle(src.customTitle_);
00130 setTitleVisible(src.titleVisible_);
00131
00132 return *this;
00133 }
00134
00135 }