- Timestamp:
- Aug 23, 2016, 12:10:01 PM (8 years ago)
- Location:
- branches/mavlink/lib/FlairCore/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/mavlink/lib/FlairCore/src/ListWidget.cpp
r59 r63 59 59 void ListWidget::RemoveItem(void) { 60 60 if (selectedItemChanged) { 61 // Delete the the last item, the xml file will automatically be updated by the GUI 62 // TODO diff when the apply all xml file is received to avoid clear here 63 std::ostringstream item_prop; 64 item_prop << "item" << (items.size() - 1); 65 UnsetPersistentXmlProp(item_prop.str()); 66 // Delete the item from the internal list and ask the GUI to delete it 61 67 selectedItemChanged = false; 62 68 items.erase(items.cbegin() + selectedItemRow); -
branches/mavlink/lib/FlairCore/src/ListWidget.h
r59 r63 62 62 * 63 63 * Remove the currently selected item. 64 * The item is not removed from the internal xml file, 65 * because the xml is override by the GUI. 64 66 */ 65 67 void RemoveItem(void); -
branches/mavlink/lib/FlairCore/src/Widget.cpp
r59 r63 20 20 21 21 using std::string; 22 23 //remove, for tests 24 #include <iostream> 22 25 23 26 namespace flair { … … 221 224 } 222 225 226 template <> void Widget::SetPersistentXmlProp(std::string prop, std::string value) { 227 SetVolatileXmlProp(prop, value); 228 SetVolatileXmlProp(prop, value, pimpl_->file_node); 229 } 230 231 void Widget::UnsetPersistentXmlProp(std::string prop) { 232 xmlNodePtr Node = pimpl_->file_node; 233 234 for(xmlAttrPtr attr = Node->properties; NULL != attr; attr = attr->next) 235 { 236 std::cout << attr->name << std::endl; 237 } 238 239 int ret = xmlUnsetProp(pimpl_->file_node, (xmlChar *)prop.c_str()); 240 std::cout << "UnsetPersistentXmlProp, item= " << prop << "result = " << ret << std::endl; 241 242 for(xmlAttrPtr attr = Node->properties; NULL != attr; attr = attr->next) 243 { 244 std::cout << attr->name << std::endl; 245 } 246 } 247 223 248 void Widget::SendXml(void) { pimpl_->SendXml(); } 224 249 -
branches/mavlink/lib/FlairCore/src/Widget.h
r15 r63 143 143 virtual void XmlEvent(void){}; 144 144 145 /*! 146 * \brief Unset a persistent xml property 147 * 148 * Unset an existent property, so it won't be saved. 149 * 150 * \param prop property to set 151 */ 152 void UnsetPersistentXmlProp(std::string prop); 153 145 154 private: 146 155 class Widget_impl *pimpl_;
Note:
See TracChangeset
for help on using the changeset viewer.