Exemplo n.º 1
0
 // ---------------------------------------------------------------------------------
 void ReportManager::store ( ReportType const& p )
 {
   if ( persistence().persist ( p ).was_successful() )
   {
     emit stored ( p );
   }
 }
Exemplo n.º 2
0
v4l2device::device_info V4LSelectDeviceDialog::pickDevice(QWidget* owner, bool prefferStored)
{
    auto devices = v4l2device::list_attached_devices();
    GlobSaveableTempl<QString, false> stored("LastUsedDeviceName");

    if (prefferStored)
    {
        const std::string dev = stored.getCachedValue().toStdString();
        for (const auto& d : devices)
        {
            if (dev == d.devname)
                return d;
        }
    }

    v4l2device::device_info res;
    if (devices.size() || !prefferStored) //if prefferedStored but no devices connected - do not popup
    {
        V4LSelectDeviceDialog dialog(owner);
        dialog.updateList(devices);
        if (QDialog::Accepted == dialog.exec())
        {
            res = dialog.getSelected();

            if (!res.devname.empty()) //if empty selected - do not cache it
                stored.setCachedValue(res.devname.c_str());
        }
    }
    return res;
}
Exemplo n.º 3
0
 // ---------------------------------------------------------------------------------
 void TaskManager::store ( Task const& t )
 {
   if(persistence().persist(t).was_successful())
      {
       emit stored(t);
      }
 }
Exemplo n.º 4
0
 // ---------------------------------------------------------------------------------
 void ProjectManager::store ( Project const& p )
 {
   if(persistence().persist(p).was_successful())
      {
       emit stored(p);
      }
 }
void
MeeGo::Sync::FrameworkClient::doInitialSync()
{
  qDebug() << "INFO: Performing 'initial sync' procedure for profile:"
	   << m_name;

  StoreCredentialsProcessor * const processor =
    new StoreCredentialsProcessor(m_username, m_password);
  m_processor.reset(processor);

  // Capture completion of credentials storage for subsequent sync
  // profile processing.
  connect(processor,
	  SIGNAL(stored(quint32)),
	  this,
	  SLOT(credentialsStored(quint32)));

  // Capture errors that occurred during credentials storage.
  connect(processor,
	  SIGNAL(error(const SignOn::Error &)),
	  this,
	  SLOT(credentialsError(const SignOn::Error &)));

  if (m_cred.isNull()) {
    m_cred.reset(new SharedCredentials);
  }

  // Process credentials storage asynchronously.
  m_cred->processCredentials(processor, m_provider);

  // Profile will be updated with new username/password once
  // credentials storage completes.
}
Exemplo n.º 6
0
 // ---------------------------------------------------------------------------------
 void ActionTemplateManager::store ( ActionTemplate const& p )
 {
   if(persistence().persist(p).was_successful())
      {
       emit stored(p);
      }
 }
Exemplo n.º 7
0
void ExtArgSelector::onReloadTriggered()
{
    int counter = 0;
    int selected = -1;

    QString call = boxSelection->currentData().toString();
    const char *prefval = _argument->pref_valptr ? *_argument->pref_valptr : NULL;
    QString stored(prefval ? prefval : "");
    if ( call != stored )
        stored = call;

    if ( reloadValues() && values.length() > 0 )
    {
        boxSelection->clear();

        ExtcapValueList::const_iterator iter = values.constBegin();

        while ( iter != values.constEnd() )
        {
            boxSelection->addItem((*iter).value(), (*iter).call());

            if ( stored.compare((*iter).call()) == 0 )
                selected = counter;
            else if ( (*iter).isDefault() && selected == -1 )
                selected = counter;

            counter++;
            ++iter;
        }

        if ( selected > -1 && selected < boxSelection->count() )
            boxSelection->setCurrentIndex(selected);
    }
}
void main()                                  // Main function
{
  badge_setup();                             // Call badge setup
  text_size(SMALL);    
  oledprint("Use SimpleIDE\nTerminal.");
  
  if(!stored(wilma))                         // Check first, if repeat skip
    store(wilma);
  if(!stored(betty)) 
    store(betty);
  if(!stored(fred))                          // ...but if not repeat, store
    store(fred);
  if(!stored(barney)) 
    store(barney);
    
  contacts_displayAll();                       // Display contacts
}  
Exemplo n.º 9
0
int SmartState::getState(const PetriNet& net, MarkVal* marking, VarVal* valuation) const{
	if(stored()){
		memcpy(marking, _marking, sizeof(MarkVal) * net.numberOfPlaces());
		memcpy(valuation, _valuation, sizeof(VarVal) * net.numberOfVariables());
		return 0;
	}
	int depth = parent()->getState(net, marking, valuation);
	net.fireWithoutCheck(transition(), marking, valuation, marking, valuation, multiplicity());
	return depth + 1;
}
Exemplo n.º 10
0
std::string
SnapshotToolCut::str() const
{
    std::stringstream ss;

    ss << "name: " << name() << std::endl
       << "backendSize: " << stored() << std::endl
       << "uuid: " << getUUID() << std::endl
       << "date: " << getDate();
    return ss.str();
}
Exemplo n.º 11
0
QWidget * ExtArgSelector::createEditor(QWidget * parent)
{
    int counter = 0;
    int selected = -1;
    const char *prefval = _argument->pref_valptr ? *_argument->pref_valptr : NULL;
    QString stored(prefval ? prefval : "");

    QWidget * editor = new QWidget(parent);
    QHBoxLayout * layout = new QHBoxLayout();

    boxSelection = new QComboBox(parent);
    layout->addWidget(boxSelection);

    if ( values.length() > 0 )
    {
        ExtcapValueList::const_iterator iter = values.constBegin();

        while ( iter != values.constEnd() )
        {
            boxSelection->addItem((*iter).value(), (*iter).call());

            if ( !prefval && (*iter).isDefault() )
                selected = counter;
            else if ( prefval && stored.compare((*iter).call()) == 0 )
                selected = counter;

            counter++;
            ++iter;
        }

        if ( selected > -1 && selected < boxSelection->count() )
            boxSelection->setCurrentIndex(selected);
    }

    if ( reload() )
    {
        QString btnText(tr("Reload data"));
        if ( _argument->placeholder )
            btnText = QString(_argument->placeholder);

        QPushButton * reloadButton = new QPushButton(btnText, editor);
        layout->addWidget(reloadButton);
        reloadButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
        boxSelection->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);

        connect(reloadButton, SIGNAL(clicked()), this, SLOT(onReloadTriggered()));
    }

    connect ( boxSelection, SIGNAL(currentIndexChanged(int)), SLOT(onIntChanged(int)) );

    editor->setLayout(layout);

    return editor;
}
Exemplo n.º 12
0
NT2_TEST_CASE_TPL(pack_store, BOOST_SIMD_SIMD_TYPES )
{
  typedef typename boost::simd::pack<T> p_t;
  static const std::size_t card = boost::simd::meta::cardinal_of<p_t>::value;
  std::vector<T, boost::simd::allocator<T> > data(card);
  std::vector<T, boost::simd::allocator<T> > stored(card);

  for(size_t i=0; i<card; ++i) data[i] = T(i);
  p_t p(data.begin(),data.end());
  boost::simd::aligned_store(p,&stored[0],0);

  NT2_TEST_EQUAL( *(stored.begin()), *(data.begin()));
  NT2_TEST_EQUAL( *(stored.end()-1), *(data.end()-1));

}
Exemplo n.º 13
0
    /**
     * Find and parse all geometry elements on the appropriate field path from the document.
     */
    static void extractGeometries(const BSONObj& doc,
                                  const string& path,
                                  vector<StoredGeometry*>* geometries) {

        BSONElementSet geomElements;
        // NOTE: Annoyingly, we cannot just expand arrays b/c single 2d points are arrays, we need
        // to manually expand all results to check if they are geometries
        doc.getFieldsDotted(path, geomElements, false /* expand arrays */);

        for (BSONElementSet::iterator it = geomElements.begin(); it != geomElements.end(); ++it) {

            const BSONElement& el = *it;
            auto_ptr<StoredGeometry> stored(StoredGeometry::parseFrom(el));

            if (stored.get()) {
                // Valid geometry element
                geometries->push_back(stored.release());
            }
            else if (el.type() == Array) {

                // Many geometries may be in an array
                BSONObjIterator arrIt(el.Obj());
                while (arrIt.more()) {

                    const BSONElement nextEl = arrIt.next();
                    stored.reset(StoredGeometry::parseFrom(nextEl));

                    if (stored.get()) {
                        // Valid geometry element
                        geometries->push_back(stored.release());
                    }
                    else {
                        warning() << "geoNear stage read non-geometry element " << nextEl.toString()
                                  << " in array " << el.toString();
                    }
                }
            }
            else {
                warning() << "geoNear stage read non-geometry element " << el.toString();
            }
        }
    }
void main()                                   // Main function
{
  badge_setup();                              // Call badge setup
  oledprint("Any BTN\nfor Menu");
  pause(1200);
  while(1)
  {
    clear();                                  // Display screen name
    text_size(LARGE);
    oledprint("%s", screenName);

    while(!buttons());                        // Wait for button press

    text_size(SMALL);                         // Menu
    clear();         
    oledprint("      MENU      ");
    oledprint("P17-Send        ");
    oledprint("     Receive-P27\n");
    oledprint("P15-Upload      ");
    oledprint("        Back-P25\n");
    oledprint("  Erase-OSH-All ");
    pause(250);
    
    while((states = buttons()) == 0);         // Wait for button press

    clear();                                  // Get ready to display operation
    text_size(LARGE);
    
    switch(states)                            // Handle button press
    {
      case 0b0100000:                         // P17 pressed, send IR
        clear;
        oledprint("Sending");
        rgbs(RED, RED);
        send(my); 
        rgbs(OFF, OFF);
        pause(50);
        continue;                             // Back to while(1)
      case 0b0000001:                         // P27 pressed
        break;                                // Skip to IR receive code
      case 0b0001000:
        clear();
        oledprint("Upload  ...");
        contacts_displayAll();
        oledprint("Done");
        pause(250);
        continue;                             // Back to while(1)
      case 0b1000000:                         // OSH pressed, erase EEPROM
        clear();
        oledprint("CONFIRM");
        pause(500);
        text_size(SMALL);
        cursor(0, 4);
        oledprint("Yes-OSH\n\n");
        oledprint("No-Any other btn");
        while(!(states = buttons()));         // Get confirmation
        if(states == 0b1000000)               // Yes, erase
        {
          text_size(LARGE);
          clear();
          oledprint("Wait 20s...");
          contacts_eraseAll();
          oledprint("Done!");
          pause(250);
        }          
        else                                   // No, don't erase
        {
          clear();
          pause(250);
        }   
        continue;                               // Back to while(1)  
      default:
        continue;                               // Back to while(1)
    }

    // P27 has to have been pressed to get to here
    clear();
    oledprint("IR Rcv");                      // Display ready for IR
    cursor(0, 7);
    text_size(SMALL);
    oledprint("        Back-P25");

    // Wait for IR message
    pause(250);
    irclear();                                // Clear the IR buffers
    while(1)
    {
      irlenb = receive(irbuf);
      if(irlenb > 0) break;
      states = buttons();
      if(states == 0b0000100)
      {
        led(0, OFF);
        break;
      }        
      led(0, ON);
      pause(150);
      led(0, OFF);
      pause(150);
    }
    if(states == 0b0000100) continue;
    clear();                                  // Menu, what to do with data
    oledprint(irbuf);
    cursor(0, 5);
    oledprint("       Store-P26");
    cursor(0, 6);
    oledprint("     Discard-P25");
    while((states = buttons()) == 0);         // Wait for button press
    text_size(LARGE);
    clear();
    if(states == 0b0000010)                   // If P26, store to EEPROM
    {
      if(!stored(irbuf)) store(irbuf);
      oledprint("Stored");
    }      
    if(states == 0b0000100)                   // if(P25), discard
    {
      oledprint("Discard");
    }  
    pause(500);    
  }
}