示例#1
0
void updateQuantity()
{
	int i;

	do
	{
		printf("----------------------------------------------------\n");
		printf("Push 1 to add stock to book.\n");
		printf("Push 2 to subtract stock from book.\n");
		printf("Push 3 or higher to go back to main.\n");
		printf("?: ");
		scanf("%d", &i);

		switch(i)
		{
		case 1:
			printf("\n----------------------------------------------------\n");
			addQuantity(sFile1);
			printf("----------------------------------------------------\n\n");
			break;

		case 2:
			printf("\n----------------------------------------------------\n");
			subQuantity(sFile1);
			printf("----------------------------------------------------\n\n");
			break;
		}
	}
	while(i<3);
}
//OFFLINE
HardwareSensorMtiRos::HardwareSensorMtiRos(kernel::VariableCondition<int> *condition,
										   double trigger_mode, double trigger_freq, double trigger_shutter, int bufferSize_,
										   Mode mode, std::string dump_path, kernel::LoggerTask *loggerTask):
	HardwareSensorProprioAbstract(condition, mode, bufferSize_, ctNone),
	/*tightly_synchronized(false), */ dump_path(dump_path), loggerTask(loggerTask)
{
	if (mode == mOnlineDump && !loggerTask) JFR_ERROR(RtslamException, rtslam::RtslamException::GENERIC_ERROR, "HardwareSensorMtiRos: you must provide a loggerTask if you want to dump data.");
	addQuantity(qAcc);
	addQuantity(qAngVel);
	addQuantity(qMag);
	initData();

//	if (mode == mOnline || mode == mOnlineDump)
//	{
//		JFR_ERROR(RtslamException, rtslam::RtslamException::GENERIC_ERROR, "HardwareSensorMtiRos: Online and OnlineDump modes are not implemented yet.");
//	} else
//	{
		realFreq = trigger_freq;
//	}

	nh.setCallbackQueue(&imu_callback_queue);
	initialized_ = false; // Needed to wait for the topics to be published.
}
示例#3
0
void IngredientUI::addDefaultComboBoxValues() {
    quantityNo = 0;

    if (!ingredient->getQuantities().length()) {
        ingredient->addQuantity(new Quantity());
    }

    QList<Quantity*> ingredientQuantities = ingredient->getQuantities();
    for (QList<Quantity* >::iterator quantityIt = ingredientQuantities.begin(); quantityIt != ingredientQuantities.end(); quantityIt++) {
        if (this->findChildren<QComboBox*>(QString::fromUtf8("quantityComboBox_%1").arg(quantityNo+1)).length() == 0)
            addQuantity();
        else
            quantityNo++;

        int idx = itemIds.indexOf((*quantityIt)->getId());
        if (idx == -1) idx = 0;
        
        this->findChild<QComboBox*>(QString::fromUtf8("quantityComboBox_%1").arg(quantityNo))->setCurrentIndex(idx);
    }

    removePreviousQuantities();
}
示例#4
0
void IngredientUI::addQuantity() {
    quantityNo++;

    QPushButton* removeQuantityButton = new QPushButton("-", quantitiesGroupBox);
    removeQuantityButton->setObjectName(QString::fromUtf8("removeQuantityButton_%1").arg(quantityNo));
    removeQuantityButton->setMaximumSize(QSize(20, 15));

    gridLayout->addWidget(removeQuantityButton, quantityNo-1, 6, 1, 1);

    QPushButton* addQuantityButton = new QPushButton("+", quantitiesGroupBox);
    addQuantityButton->setObjectName(QString::fromUtf8("addQuantityButton_%1").arg(quantityNo));
    addQuantityButton->setMaximumSize(QSize(20, 15));

    gridLayout->addWidget(addQuantityButton, quantityNo-1, 7, 1, 1);

    QComboBox* quantityComboBox = new QComboBox(quantitiesGroupBox);
    quantityComboBox->setObjectName(QString::fromUtf8("quantityComboBox_%1").arg(quantityNo));
    quantityComboBox->setModel(model);

    gridLayout->addWidget(quantityComboBox, quantityNo-1, 3, 1, 3);

    connect(addQuantityButton, SIGNAL(clicked()), this, SLOT(addQuantity()));
    connect(removeQuantityButton, SIGNAL(clicked()), this, SLOT(removeQuantity()));
}