コード例 #1
0
void SearchManager::save(QDomElement& element) const
{
    // <url>
    QDomElement child_element = element.ownerDocument().createElement("url");
    child_element.appendChild(element.ownerDocument().createTextNode(root_.absoluteUrl().prettyURL()));
    element.appendChild(child_element);

    // <recursively>
    bool recursively = searchMode() == domain || depth_ > 0;
    child_element = element.ownerDocument().createElement("recursively");
    child_element.appendChild(element.ownerDocument().createTextNode(recursively ? "true" : "false"));
    element.appendChild(child_element);

    // <depth>
    child_element = element.ownerDocument().createElement("depth");
    child_element.appendChild(element.ownerDocument().
            createTextNode(searchMode() == domain ? QString("Unlimited") : QString::number(depth_)));
    element.appendChild(child_element);

    // <check_parent_folders>
    child_element = element.ownerDocument().createElement("check_parent_folders");
    child_element.appendChild(element.ownerDocument().
            createTextNode(checkParentDirs() ? "true" : "false"));
    element.appendChild(child_element);

    // <check_external_links>
    child_element = element.ownerDocument().createElement("check_external_links");
    child_element.appendChild(element.ownerDocument().
            createTextNode(checkExternalLinks() ? "true" : "false"));
    element.appendChild(child_element);

    // <check_regular_expression>
    child_element = element.ownerDocument().createElement("check_regular_expression");
    child_element.setAttribute("check", checkRegularExpressions() ? "true" : "false");
    if(checkRegularExpressions())
        child_element.appendChild(element.ownerDocument().
                createTextNode(reg_exp_.pattern()));
    element.appendChild(child_element);
    
    child_element = element.ownerDocument().createElement("link_list");
    element.appendChild(child_element);
    
    for(uint i = 0; i != search_results_.size(); ++i)
    {
        for(uint j = 0; j != search_results_[i].size() ; ++j)
        {
            for(uint l = 0; l != (search_results_[i])[j].size(); ++l)
            {
                LinkStatus* ls = ((search_results_[i])[j])[l];
                if(ls->checked())
                    ls->save(child_element);
            }
        }
    } 
}
コード例 #2
0
ファイル: Logic.c プロジェクト: moeabbas/lfr
// Run the IHK line
void runLine(){

	LCDClear();

	static const uint8_t forwardDirection = 0;
	
	// Start speed, current speed.
	uint8_t currentSpeed = SPEED_CREEP;

	setDirectionMotorL(forwardDirection);
	setDirectionMotorR(forwardDirection);

	// Run until end of track.
	while(stopFlag == FLAG_NOT_SET)
	{
		if(getSensorUpdateFlag())
		{
			// When a line is lost after driving straight, go in search mode
			if(lostLineFlag == FLAG_SET)
			{
				searchMode();
				lostLineFlag = FLAG_NOT_SET;
			}

			// When line is found, make a Right turn
			// Increase speed and follow the line.
			if(foundLineFlag == FLAG_SET)
			{
				go(150,DIRECTION_RIGHT,SPEED_CREEP);
				setDirectionMotorL(forwardDirection);
				setDirectionMotorR(forwardDirection);
				currentSpeed = SPEED_CREEP;
				foundLineFlag = FLAG_USED;
			}
		
			// When following the line,
			// if front sensor detects obstacle,
			// exit line following loop
			if (foundLineFlag == FLAG_USED)
			{
				uint16_t distance = AdcConvert(1);
				
				if (distance > (uint16_t)500)
				{
					setStopFlag(FLAG_SET);
				}
			}

			// Calculate and set new duty cycle.
			calcDuty(currentSpeed, calcFloorErrorAndFlagControl());

			clearSensorUpdateFlag();
		}
	}

	// Stop the robot at end mark.
	setDutyCycleMotorL(0);
	setDutyCycleMotorR(0);
}
コード例 #3
0
ファイル: people.cpp プロジェクト: namjae/xivo-client-qt
People::People(QWidget *parent)
    : XLet(parent, tr("People"), ":/images/tab-people.svg"),
      m_proxy_model(NULL),
      m_model(NULL),
      m_waiting_status(NULL)
{
    this->ui.setupUi(this);

    m_waiting_status = new QMovie(":/images/waiting-status.gif", QByteArray(), this);

    m_proxy_model = new PeopleEntrySortFilterProxyModel(this);
    m_model = new PeopleEntryModel(this);
    m_proxy_model->setSourceModel(m_model);
    ui.entry_table->setModel(m_proxy_model);

    QAction *search_action = ui.menu->addAction(tr("all"));
    QAction *favorite_action = ui.menu->addAction(tr("favorites"));
    QAction *my_contacts_action = ui.menu->addAction(tr("my contacts"));

    connect(search_action, SIGNAL(triggered()),
            this, SLOT(searchMode()));
    connect(favorite_action, SIGNAL(triggered()),
            this, SLOT(favoriteMode()));
    connect(my_contacts_action, SIGNAL(triggered()),
            this, SLOT(personalContactsMode()));

    this->ui.menu->setSelectedAction(1);

    connect(m_proxy_model, SIGNAL(columnsInserted(const QModelIndex &, int, int)),
            ui.entry_table, SLOT(updateColumnsDelegates(const QModelIndex &, int, int)));
    connect(m_proxy_model, SIGNAL(columnsInserted(const QModelIndex &, int, int)),
            ui.entry_table, SLOT(updateColumnsVisibility(const QModelIndex &, int, int)));
    connect(m_model, SIGNAL(columnsInserted(const QModelIndex &, int, int)),
            this, SLOT(defaultColumnSort(const QModelIndex &, int, int)));

    connect(this->ui.entry_table, SIGNAL(favoriteToggled(const QVariantMap &)),
            this, SLOT(setFavoriteStatus(const QVariantMap &)));
    connect(this->ui.entry_table, SIGNAL(deletePersonalContactClicked(const QVariantMap &)),
            this, SLOT(deletePersonalContact(const QVariantMap &)));
    connect(this->ui.entry_table, SIGNAL(editPersonalContactClicked(const QVariantMap &)),
            this, SLOT(requestEditPersonalContact(const QVariantMap &)));

    connect(this->ui.entry_filter, SIGNAL(textChanged(const QString &)),
            this, SLOT(schedulePeopleLookup(const QString &)));
    connect(this->ui.entry_filter, SIGNAL(returnPressed()),
            this, SLOT(searchPeople()));

    connect(this->ui.new_contact_button, SIGNAL(clicked()),
            this, SLOT(openNewContactDialog()));
    connect(this->ui.import_button, SIGNAL(clicked()),
            this, SLOT(openImportDialog()));
    connect(this->ui.export_button, SIGNAL(clicked()),
            this, SLOT(requestExportPersonalContacts()));
    connect(this->ui.purge_contacts_button, SIGNAL(clicked()),
            this, SLOT(purgePersonalContacts()));

    connect(signal_relayer, SIGNAL(numberSelectionRequested()),
            this, SLOT(numberSelectionRequested()));
    connect(this->ui.entry_filter, SIGNAL(returnPressed()),
            this, SLOT(focusEntryTable()));

    connect(&m_lookup_timer, SIGNAL(timeout()),
            this, SLOT(searchPeople()));
    m_lookup_timer.setSingleShot(true);
    m_lookup_timer.setInterval(delay_before_lookup);

    connect(&m_failure_timer, SIGNAL(timeout()),
            this, SLOT(setFailureStatus()));
    m_failure_timer.setSingleShot(true);
    m_failure_timer.setInterval(delay_before_failure);

    connect(&m_before_waiting_timer, SIGNAL(timeout()),
            this, SLOT(setWaitingStatus()));
    m_before_waiting_timer.setSingleShot(true);
    m_before_waiting_timer.setInterval(delay_before_waiting);

    b_engine->sendJsonCommand(MessageFactory::getPeopleHeaders());
    b_engine->sendJsonCommand(MessageFactory::getRelations());

    this->registerListener("people_headers_result");

    this->registerListener("people_search_result");

    this->registerListener("relations");
    this->registerListener("agent_status_update");
    this->registerListener("endpoint_status_update");
    this->registerListener("user_status_update");

    this->registerListener("people_favorite_update");
    this->registerListener("people_favorites_result");

    this->registerListener("people_export_personal_contacts_csv_result");
    this->registerListener("people_import_personal_contacts_csv_result");
    this->registerListener("people_personal_contact_created");
    this->registerListener("people_personal_contact_deleted");
    this->registerListener("people_personal_contact_raw_result");
    this->registerListener("people_personal_contact_raw_update");
    this->registerListener("people_personal_contacts_purged");
    this->registerListener("people_personal_contacts_result");

    if (PeoplePersonalMigration::needMigration()) {
        PeoplePersonalMigration::noticeAndMigratePersonalContacts(this);
    }
}