//+--------------------------------------------------------------------------+
//|				From PFOperatorMaterialStaticState::IPFActionState				 |
//+--------------------------------------------------------------------------+
IOResult PFOperatorMaterialStaticState::Save(ISave* isave) const
{
	ULONG nb;
	IOResult res;

	isave->BeginChunk(IPFActionState::kChunkActionHandle);
	ULONG handle = actionHandle();
	if ((res = isave->Write(&handle, sizeof(ULONG), &nb)) != IO_OK) return res;
	isave->EndChunk();

	isave->BeginChunk(IPFActionState::kChunkRandGen);
	if ((res = isave->Write(randGen(), sizeof(RandGenerator), &nb)) != IO_OK) return res;
	isave->EndChunk();

	isave->BeginChunk(IPFActionState::kChunkData);
	float offset = cycleOffset();
	if ((res = isave->Write(&offset, sizeof(float), &nb)) != IO_OK) return res;
	isave->EndChunk();

	isave->BeginChunk(IPFActionState::kChunkData2);
	TimeValue time = offsetTime();
	if ((res = isave->Write(&time, sizeof(TimeValue), &nb)) != IO_OK) return res;
	isave->EndChunk();

	return IO_OK;
}
Esempio n. 2
0
void GNSSView::createActions()
{
	toggleFullScreenAction = new QAction(QIcon(), tr("Full screen"), this);
	toggleFullScreenAction->setStatusTip(tr("Show full screen"));
	addAction(toggleFullScreenAction);
	connect(toggleFullScreenAction, SIGNAL(triggered()), this, SLOT(toggleFullScreen()));
	toggleFullScreenAction->setCheckable(true);
	
	powerManAction = new QAction(QIcon(), tr("Power management"), this);
	powerManAction->setStatusTip(tr("Power management"));
	addAction(powerManAction);
	connect(powerManAction, SIGNAL(triggered()), this, SLOT(togglePowerManagement()));
	powerManAction->setCheckable(true);
	powerManAction->setChecked(powerManager->isEnabled());
	
	toggleForegroundAction = new QAction(QIcon(), tr("Foreground"), this);
	toggleForegroundAction->setStatusTip(tr("Show the foreground"));
	addAction(toggleForegroundAction);
	connect(toggleForegroundAction, SIGNAL(triggered()), view, SLOT(toggleForeground()));
	toggleForegroundAction->setCheckable(true);
	toggleForegroundAction->setChecked(true);
	
	offsetTimeAction = new QAction(QIcon(), tr("Offset time"), this);
	offsetTimeAction->setStatusTip(tr("Offset the time by n hours"));
	addAction(offsetTimeAction);
	connect(offsetTimeAction, SIGNAL(triggered()), this, SLOT(offsetTime()));
	
	quitAction = new QAction(QIcon(), tr("Quit"), this);
	quitAction->setStatusTip(tr("Quit"));
	addAction(quitAction);
	connect(quitAction, SIGNAL(triggered()), this, SLOT(quit()));
	
}
Esempio n. 3
0
void SyncObjTest::_doTests()
{
	SyncObj so;

	bool passed = true;
	so.lock();
	so.unlock();
	reportResult("Simple lock/unlock", passed);

	uint64_t now = offsetTime();
	unsigned long wait_in_us = 5000;
	so.lock();
	int rv = so.waitOnSignal(wait_in_us);
	so.unlock();
	uint64_t after = offsetTime();
	uint64_t delta_usec = after - now;

	if (rv != ETIMEDOUT) {
		DF_LOG_ERR("waitSignal() did not return ETIMEDOUT");
		passed = false;
	}

#ifdef __APPLE__
	const float error_factor = 2.0f;
#else
	const float error_factor = 1.2f;
#endif

	bool dtime_ok = (delta_usec > wait_in_us) && (delta_usec < wait_in_us * error_factor);

	if (!dtime_ok) {
		DF_LOG_ERR("waitSignal() timeout of %luus was %" PRIu64 "us", wait_in_us, delta_usec);
		passed = false;
	}

	reportResult("waitSignal() timeout", passed && dtime_ok);
}