Changeset 63 in flair-src for branches/mavlink/lib/FlairCore/src


Ignore:
Timestamp:
08/23/16 12:10:01 (8 years ago)
Author:
Thomas Fuhrmann
Message:

Save config on target and save all locally are now working

Location:
branches/mavlink/lib/FlairCore/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/mavlink/lib/FlairCore/src/ListWidget.cpp

    r59 r63  
    5959void ListWidget::RemoveItem(void) {
    6060  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
    6167    selectedItemChanged = false;
    6268    items.erase(items.cbegin() + selectedItemRow);
  • branches/mavlink/lib/FlairCore/src/ListWidget.h

    r59 r63  
    6262  *
    6363  * 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.
    6466  */
    6567  void RemoveItem(void);
  • branches/mavlink/lib/FlairCore/src/Widget.cpp

    r59 r63  
    2020
    2121using std::string;
     22
     23//remove, for tests
     24#include <iostream>
    2225
    2326namespace flair {
     
    221224}
    222225
     226template <> void Widget::SetPersistentXmlProp(std::string prop, std::string value) {
     227  SetVolatileXmlProp(prop, value);
     228  SetVolatileXmlProp(prop, value, pimpl_->file_node);
     229}
     230
     231void 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
    223248void Widget::SendXml(void) { pimpl_->SendXml(); }
    224249
  • branches/mavlink/lib/FlairCore/src/Widget.h

    r15 r63  
    143143  virtual void XmlEvent(void){};
    144144
     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
    145154private:
    146155  class Widget_impl *pimpl_;
Note: See TracChangeset for help on using the changeset viewer.