00001 #include "rqt_mrta/config/architecture/tasks.h" 00002 00003 namespace rqt_mrta 00004 { 00005 namespace config 00006 { 00007 namespace architecture 00008 { 00009 Tasks::Tasks(QObject* parent) 00010 : AbstractConfig(parent), incoming_tasks_(new IncomingTasks(this)) 00011 { 00012 connect(incoming_tasks_, SIGNAL(changed()), this, SIGNAL(changed())); 00013 } 00014 00015 Tasks::~Tasks() 00016 { 00017 if (incoming_tasks_) 00018 { 00019 delete incoming_tasks_; 00020 incoming_tasks_ = NULL; 00021 } 00022 } 00023 00024 QString Tasks::getType() const { return type_; } 00025 00026 IncomingTasks* Tasks::getIncomingTasks() const { return incoming_tasks_; } 00027 00028 void Tasks::setType(const QString& type) 00029 { 00030 if (type != type_) 00031 { 00032 type_ = type; 00033 emit typeChanged(type); 00034 emit changed(); 00035 } 00036 } 00037 00038 void Tasks::save(QSettings& settings) const 00039 { 00040 settings.beginGroup("tasks"); 00041 settings.setValue("type", type_); 00042 incoming_tasks_->save(settings); 00043 settings.endGroup(); 00044 } 00045 00046 void Tasks::load(QSettings& settings) 00047 { 00048 settings.beginGroup("tasks"); 00049 setType(settings.value("type").toString()); 00050 incoming_tasks_->load(settings); 00051 settings.endGroup(); 00052 } 00053 00054 void Tasks::reset() 00055 { 00056 setType(""); 00057 incoming_tasks_->reset(); 00058 } 00059 00060 void Tasks::write(QDataStream& stream) const 00061 { 00062 stream << type_; 00063 incoming_tasks_->write(stream); 00064 } 00065 00066 void Tasks::read(QDataStream& stream) 00067 { 00068 QString type; 00069 stream >> type; 00070 setType(type); 00071 incoming_tasks_->read(stream); 00072 } 00073 00074 Tasks& Tasks::operator=(const Tasks& config) 00075 { 00076 setType(config.type_); 00077 *incoming_tasks_ = *config.incoming_tasks_; 00078 return *this; 00079 } 00080 } 00081 } 00082 }