PluginDialog::PluginDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::PluginDialog)
{
    ui->setupUi(this);
    pluginManager = new PluginManager();
    busyOverlay = new BusyOverlay();
    QHBoxLayout *layout = new QHBoxLayout(ui->tree_plugins);
    layout->setAlignment(Qt::AlignCenter);
    layout->addWidget(busyOverlay);
    //connect(pluginManager, SIGNAL(pluginInstalled(QString)), this, SLOT(pluginInstalled(QString)));
    connect(this, SIGNAL(mirrorChanged(QString)), this, SLOT(setMirror(QString)));
    connect(&netManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(replyFinished(QNetworkReply*)));
    setMirror("https://raw.github.com/olav-st/screencloud-plugin-list/master/plugin-list.xml");
}
BioXASMirrorBendView::BioXASMirrorBendView(BioXASMirror *mirror, QWidget *parent) :
    QWidget(parent)
{
	// Initialize member variables.

	mirror_ = 0;

	// Create UI elements.

	bendEditor_ = new AMExtendedControlEditor(0);
	bendEditor_->setControlFormat('f', 2);
	bendEditor_->setTitle("Bend radius");

	upstreamEditor_ = new AMExtendedControlEditor(0);
	upstreamEditor_->setControlFormat('f', 2);
	upstreamEditor_->setTitle("Upstream bender");

	downstreamEditor_ = new AMExtendedControlEditor(0);
	downstreamEditor_->setControlFormat('f', 2);
	downstreamEditor_->setTitle("Downstream bender");

	// Create and set layouts.

	QVBoxLayout *layout = new QVBoxLayout();
	layout->setMargin(0);
	layout->addWidget(bendEditor_);
	layout->addWidget(upstreamEditor_);
	layout->addWidget(downstreamEditor_);

	setLayout(layout);

	// Current settings.

	setMirror(mirror);
}
Exemple #3
0
int QDeclarativeImageBase::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QDeclarativeImplicitSizeItem::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 9)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 9;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< Status*>(_v) = status(); break;
        case 1: *reinterpret_cast< QUrl*>(_v) = source(); break;
        case 2: *reinterpret_cast< qreal*>(_v) = progress(); break;
        case 3: *reinterpret_cast< bool*>(_v) = asynchronous(); break;
        case 4: *reinterpret_cast< bool*>(_v) = cache(); break;
        case 5: *reinterpret_cast< QSize*>(_v) = sourceSize(); break;
        case 6: *reinterpret_cast< bool*>(_v) = mirror(); break;
        }
        _id -= 7;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 1: setSource(*reinterpret_cast< QUrl*>(_v)); break;
        case 3: setAsynchronous(*reinterpret_cast< bool*>(_v)); break;
        case 4: setCache(*reinterpret_cast< bool*>(_v)); break;
        case 5: setSourceSize(*reinterpret_cast< QSize*>(_v)); break;
        case 6: setMirror(*reinterpret_cast< bool*>(_v)); break;
        }
        _id -= 7;
    } else if (_c == QMetaObject::ResetProperty) {
        switch (_id) {
        case 5: resetSourceSize(); break;
        }
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 7;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
Exemple #4
0
OVR_PUBLIC_FUNCTION(void) ovr_DestroyMirrorTexture(ovrSession session, ovrTexture* mirrorTexture) {
	ovrMirrorTexture1_3* mirror = getMirror();

	ovr_DestroyMirrorTexture1_3((ovrSession1_3)session, *mirror);

	setMirror(NULL);

	if (mirrorTexture->Header.API == ovrRenderAPI_D3D11) {
		union ovrD3D11Texture* ovrtext = (union ovrD3D11Texture*)mirrorTexture;

		ovrtext->D3D11.pTexture->Release();
	}
}
void ofxRPiCameraVideoGrabber::applyAllSettings()
{
    
    setExposurePreset(exposurePreset); 
    setMeteringType(meteringType);
    setAutoISO(autoISO);
    setISO(ISO);    
    setAutoShutter(autoShutter);
    setShutterSpeed(shutterSpeed);
    
    setSharpness(sharpness);
    setContrast(contrast);
    setBrightness(brightness);
    setSaturation(saturation);
    setFrameStabilization(frameStabilization);
    setWhiteBalance(whiteBalance);
    setImageFilter(imageFilter);
    setColorEnhancement(false);	 //TODO implement
    setDRE(dreLevel);
    setSensorCrop(cropRectangle);
    setDigitalZoom();
    setRotation(rotation);
    setMirror(mirror);
    
    setSoftwareSharpening(doDisableSoftwareSharpen);
    setSoftwareSaturation(doDisableSoftwareSaturation);
    applyExposure(__func__);
    
    //Requires gpio program provided via wiringPi
    //sudo apt-get install wiringpi
    ofFile gpioProgram("/usr/bin/gpio");
    hasGPIOProgram = gpioProgram.exists();
    
    if(hasGPIOProgram)
    {
        LED_PIN = getLEDPin();
        
        stringstream command;
        command << "gpio export ";
        command << LED_PIN;
        command << " out";
        
        if(system(command.str().c_str()) == 0)
        {
            //silence compiler warning 
        }
        LED = true;
        setLEDState(LED);
    } 
}
void ofxRPiCameraVideoGrabber::setup(CameraState cameraState)
{
    setup(cameraState.cameraSettings);
    map<string, string> keyValueMap = cameraState.keyValueMap;
    for(auto iterator  = keyValueMap.begin(); iterator != keyValueMap.end(); iterator++) 
    {
        string key = iterator->first;
        string value = iterator->second;
        //ofLogVerbose(__func__) << "key: " << key << " value: " << value;

        if(key == "sharpness")  setSharpness(ofToInt(value));
        if(key == "contrast")   setContrast(ofToInt(value));
        if(key == "brightness") setBrightness(ofToInt(value));
        if(key == "saturation") setSaturation(ofToInt(value));
        if(key == "ISO")        setISO(ofToInt(value));
        if(key == "AutoISO")    setAutoISO(ofToBool(value));
        if(key == "DRE")        setDRE(ofToInt(value));
        if(key == "cropRectangle") 
        {
            vector<string> rectValues = ofSplitString(value, ",");
            if(rectValues.size() == 4)             
            {
                setSensorCrop(ofToInt(rectValues[0]),
                                            ofToInt(rectValues[1]),
                                            ofToInt(rectValues[2]),
                                            ofToInt(rectValues[3])); 
            }
        }
        if(key == "zoomLevelNormalized")    setZoomLevelNormalized(ofToFloat(value));
        if(key == "mirror")                 setMirror(value);
        if(key == "rotation")               setRotation(ofToInt(value));
        if(key == "imageFilter")            setImageFilter(value);
        if(key == "exposurePreset")         setExposurePreset(value);
        if(key == "evCompensation")         setEvCompensation(ofToInt(value));
        if(key == "autoShutter")            setAutoShutter(ofToBool(value));
        if(key == "shutterSpeed")           setShutterSpeed(ofToInt(value));
        if(key == "meteringType")           setMeteringType(value);
        
        if(key == "SoftwareSaturationEnabled") setSoftwareSaturation(ofToBool(value));
        if(key == "SoftwareSharpeningEnabled") setSoftwareSharpening(ofToBool(value));
    }
}
BioXASM1MirrorView::BioXASM1MirrorView(BioXASM1Mirror *mirror, QWidget *parent) :
    QWidget(parent)
{
	// Initialize member variables.

	mirror_ = 0;

	// Create UI elements.

	mirrorEditor_ = new BioXASMirrorView(0);

	upperSlitEditor_ = new AMExtendedControlEditor(0);
	upperSlitEditor_->setTitle("Upper slit blade");

	bendView_ = new BioXASMirrorBendView(0);

	// Create and set layouts.

	QVBoxLayout *controlsLayout = new QVBoxLayout();
	controlsLayout->addWidget(mirrorEditor_);
	controlsLayout->addWidget(upperSlitEditor_);

	QVBoxLayout *bendLayout = new QVBoxLayout();
	bendLayout->addWidget(bendView_);
	bendLayout->addStretch();

	QHBoxLayout *layout = new QHBoxLayout();
	layout->addLayout(controlsLayout);
	layout->addLayout(bendLayout);

	setLayout(layout);

	// Current settings.

	setMirror(mirror);
}
BioXASMirrorView::BioXASMirrorView(BioXASMirror *mirror, QWidget *parent) :
    QWidget(parent)
{
	// Initialize member variables.

	mirror_ = 0;

	// Create basic controls view.

	pitchEditor_ = new CLSControlEditor(0);
	pitchEditor_->setTitle("Pitch");
        pitchEditor_->setFormat('f');
        pitchEditor_->setPrecision(3);

	rollEditor_ = new CLSControlEditor(0);
	rollEditor_->setTitle("Roll");
        rollEditor_->setFormat('f');
        rollEditor_->setPrecision(3);

	yawEditor_ = new CLSControlEditor(0);
	yawEditor_->setTitle("Yaw");
        yawEditor_->setFormat('f');
        yawEditor_->setPrecision(3);

	heightEditor_ = new CLSControlEditor(0);
	heightEditor_->setTitle("Height");
        heightEditor_->setFormat('f');
        heightEditor_->setPrecision(3);

	lateralEditor_ = new CLSControlEditor(0);
	lateralEditor_->setTitle("Lateral");
        lateralEditor_->setFormat('f');
        lateralEditor_->setPrecision(3);

	QVBoxLayout *controlsBoxLayout = new QVBoxLayout();
	controlsBoxLayout->addWidget(pitchEditor_);
	controlsBoxLayout->addWidget(rollEditor_);
	controlsBoxLayout->addWidget(yawEditor_);
	controlsBoxLayout->addWidget(heightEditor_);
	controlsBoxLayout->addWidget(lateralEditor_);

	QGroupBox *controlsBox = new QGroupBox();
	controlsBox->setTitle("Mirror");
	controlsBox->setLayout(controlsBoxLayout);
	controlsBox->setMinimumWidth(350);

	// Create bend view.

	bendView_ = new BioXASMirrorBendView(0);

	QVBoxLayout *bendBoxLayout = new QVBoxLayout();
	bendBoxLayout->addWidget(bendView_);
	bendBoxLayout->addStretch();

	QGroupBox *bendBox = new QGroupBox();
	bendBox->setTitle("Bend");
	bendBox->setLayout(bendBoxLayout);
	bendBox->setMinimumWidth(350);

	// Create and set layouts.

	QHBoxLayout *layout = new QHBoxLayout();
	layout->setMargin(0);
	layout->addWidget(controlsBox);
	layout->addWidget(bendBox);

	setLayout(layout);

	// Current settings.

	setMirror(mirror);

	refresh();
}
OVR_PUBLIC_FUNCTION(ovrResult) ovrHmd_CreateMirrorTextureD3D11(ovrHmd hmd,
	ID3D11Device* device,
	const D3D11_TEXTURE2D_DESC* desc,
	ovrTexture** outMirrorTexture) {
	BOOST_LOG_TRIVIAL(trace) << "ovrHmd_CreateMirrorTextureD3D11 format " << desc->Format << " samples " << desc->SampleDesc.Count << " bindflags " << desc->BindFlags << " miscflags " << desc->MiscFlags;

	ovrMirrorTextureDesc1_3 d;
	
	d.Format = getOVRFormat(desc->Format);

	d.Width = desc->Width;
	d.Height = desc->Height;

	d.MiscFlags = 0;

	switch (d.Format) {
	case OVR_FORMAT_R8G8B8A8_UNORM_SRGB:
	case OVR_FORMAT_B8G8R8A8_UNORM_SRGB:
	case OVR_FORMAT_B8G8R8X8_UNORM_SRGB:
		d.MiscFlags |= ovrTextureMisc_DX_Typeless;		
		break;
	}

	ovrMirrorTexture1_3* mirror = (ovrMirrorTexture1_3*)malloc(sizeof(ovrMirrorTexture1_3));

	ovrResult result = ovr_CreateMirrorTextureDX1_3((ovrSession1_3)hmd->Handle, (IUnknown*)device, &d, mirror);

	if (!OVR_SUCCESS(result)) {
		ovrErrorInfo1_3 info;
		ovr_GetLastErrorInfo1_3(&info);

		BOOST_LOG_TRIVIAL(error) << "ovrHmd_CreateMirrorTextureD3D11 could not allocate Mirrortexture:" << info.ErrorString;
		return result;
	}

	ovrD3D11Texture* ovrtext = (ovrD3D11Texture*)malloc(sizeof(ovrD3D11Texture));

	ID3D11Texture2D* texture = 0;	
	ovr_GetMirrorTextureBufferDX1_3((ovrSession1_3)hmd->Handle, *mirror, IID_ID3D11Texture2D, (void**)&texture);

	ovrtext->D3D11.pTexture = texture;

	if (desc->BindFlags & D3D11_BIND_SHADER_RESOURCE) {
		HRESULT rs;

		D3D11_SHADER_RESOURCE_VIEW_DESC depthSrv;
		ZeroMemory(&depthSrv, sizeof(D3D11_SHADER_RESOURCE_VIEW_DESC));
		depthSrv.Format = getShaderResourceFormat(desc->Format);
		depthSrv.ViewDimension = desc->SampleDesc.Count > 1 ? D3D11_SRV_DIMENSION_TEXTURE2DMS : D3D11_SRV_DIMENSION_TEXTURE2D;
		depthSrv.Texture2D.MostDetailedMip = 0;
		depthSrv.Texture2D.MipLevels = desc->MipLevels;

		rs = device->CreateShaderResourceView((ID3D11Resource*)ovrtext->D3D11.pTexture, &depthSrv, &(ovrtext->D3D11.pSRView));

		if (rs < 0) {
			BOOST_LOG_TRIVIAL(error) << "ovrHmd_CreateMirrorTextureD3D11 could not create ShaderResourceView";
			return ovrError_ServiceError;
		}
	}

	ovrtext->D3D11.Header.API = ovrRenderAPI_D3D11;
	ovrtext->D3D11.Header.TextureSize.w = d.Width;
	ovrtext->D3D11.Header.TextureSize.h = d.Height;

	*outMirrorTexture = (ovrTexture*)ovrtext;

	setMirror(mirror);

	return result;

}
OMX_ERRORTYPE ofxRPiCameraVideoGrabber::setMirror(string mirror_)
{
    return setMirror(GetMirror(mirror_));
}
// Allow us to mirror the image_gen/depth_gen
bool ofxOpenNIContext::toggleMirror() {
	return setMirror(!context.GetGlobalMirror());
}
Exemple #12
0
int main (int argc, char **argv)
{
    // Variables for recording the time. 
	time_t rawtime;
	struct tm * timeinfo;
    // Variables for describing the scan.
	float startvalue,endvalue,stepsize;
    // Variables for storing text
	char fileName[BUFSIZE],comments[BUFSIZE];
    // A file used to indicate that we are collecting data.
	char dataCollectionFileName[] = "/home/pi/.takingData"; 
    // Used to store error codes
    int err;

	FILE *dataCollectionFlagFile, *fp;
    
    /* Check to make sure that the proper arguments were supplied. */
	if (argc==5) {
		startvalue=atof(argv[1]);
		endvalue=atof(argv[2]);
		stepsize=atof(argv[3]);
		strcpy(comments,argv[4]);
	} else {
		printf("Usage:\n");
		printf("$ sudo ./RbAbsorbScan <begin> <end> <step>  <comments>\n");
		printf("                      (0.0 - 117.5)                   \n");
		return 0;
	}

	// Indicate that data is being collected.
	dataCollectionFlagFile=fopen(dataCollectionFileName,"w");
	if (!dataCollectionFlagFile) {
		printf("Unable to open file: %s\n",dataCollectionFileName);
		exit(1);
	}

	initializeBoard();
	initializeUSB1208();

	if (endvalue>117.5) endvalue=117.5;
	if (startvalue>117.5) endvalue=117.5;
	if (startvalue<0) startvalue=0;
	if (endvalue<0) endvalue=0;
	if (startvalue>endvalue) {
		printf("error: startvalue > endvalue.\nYeah, i could just swap them in code.. or you could just enter them in correctly. :-)\n");
		return 1;
	}

	// Get file name.  use format "RbAbs"+$DATE+$TIME+".dat"
	time(&rawtime);
	timeinfo=localtime(&rawtime);
	struct stat st = {0};
	strftime(fileName,BUFSIZE,"/home/pi/RbData/%F",timeinfo);
	if (stat(fileName, &st) == -1){ // Create the directory for the Day's data 
		mkdir(fileName,S_IRWXU | S_IRWXG | S_IRWXO );
	}
	strftime(fileName,BUFSIZE,"/home/pi/RbData/%F/RbAbs%F_%H%M%S.dat",timeinfo);

	printf("\n%s\n",fileName);

	writeFileHeader(fileName, comments);
	fp=fopen(fileName,"a");

	if (!fp) {
		printf("unable to open file: %s\n",fileName);
		exit(1);
	}

    err=setMirror(0);
    if(err>0) printf("Error Occured While setting Flip Mirror: %d\n",err);

	collectAndRecordData(fileName, startvalue, endvalue, stepsize);

	setVortexPiezo(45.0); // Return Piezo to 45.0 V

	closeUSB1208();

	graphData(fileName);

	fclose(dataCollectionFlagFile);
	remove(dataCollectionFileName);

	return 0;
}
bool AkVCam::PluginInterface::createDevice(const std::string &deviceId,
                                           const std::wstring &description,
                                           const std::vector<VideoFormat> &formats)
{
    AkLoggerLog("AkVCam::PluginInterface::createDevice");

    StreamPtr stream;

    // Create one device.
    auto pluginRef = reinterpret_cast<CMIOHardwarePlugInRef>(this->d);
    auto device = std::make_shared<Device>(pluginRef);
    device->setDeviceId(deviceId);
    device->connectAddListener(this, &PluginInterface::addListener);
    device->connectRemoveListener(this, &PluginInterface::removeListener);
    this->m_devices.push_back(device);

    // Define device properties.
    device->properties().setProperty(kCMIOObjectPropertyName,
                                     description.c_str());
    device->properties().setProperty(kCMIOObjectPropertyManufacturer,
                                     CMIO_PLUGIN_VENDOR);
    device->properties().setProperty(kCMIODevicePropertyModelUID,
                                     CMIO_PLUGIN_PRODUCT);
    device->properties().setProperty(kCMIODevicePropertyLinkedCoreAudioDeviceUID,
                                     "");
    device->properties().setProperty(kCMIODevicePropertyLinkedAndSyncedCoreAudioDeviceUID,
                                     "");
    device->properties().setProperty(kCMIODevicePropertySuspendedByUser,
                                     UInt32(0));
    device->properties().setProperty(kCMIODevicePropertyHogMode,
                                     pid_t(-1),
                                     false);
    device->properties().setProperty(kCMIODevicePropertyDeviceMaster,
                                     pid_t(-1));
    device->properties().setProperty(kCMIODevicePropertyExcludeNonDALAccess,
                                     UInt32(0));
    device->properties().setProperty(kCMIODevicePropertyDeviceIsAlive,
                                     UInt32(1));
    device->properties().setProperty(kCMIODevicePropertyDeviceUID,
                                     deviceId.c_str());
    device->properties().setProperty(kCMIODevicePropertyTransportType,
                                     UInt32(kIOAudioDeviceTransportTypePCI));
    device->properties().setProperty(kCMIODevicePropertyDeviceIsRunningSomewhere,
                                     UInt32(0));

    if (device->createObject() != kCMIOHardwareNoError)
        goto createDevice_failed;

    stream = device->addStream();

    // Register one stream for this device.
    if (!stream)
        goto createDevice_failed;

    stream->setFormats(formats);
    stream->properties().setProperty(kCMIOStreamPropertyDirection, UInt32(0));

    if (device->registerStreams() != kCMIOHardwareNoError) {
        device->registerStreams(false);

        goto createDevice_failed;
    }

    // Register the device.
    if (device->registerObject() != kCMIOHardwareNoError) {
        device->registerObject(false);
        device->registerStreams(false);

        goto createDevice_failed;
    }

    device->setBroadcasting(this->d->m_ipcBridge.broadcaster(deviceId));
    device->setMirror(this->d->m_ipcBridge.isHorizontalMirrored(deviceId),
                      this->d->m_ipcBridge.isVerticalMirrored(deviceId));
    device->setScaling(this->d->m_ipcBridge.scalingMode(deviceId));
    device->setAspectRatio(this->d->m_ipcBridge.aspectRatioMode(deviceId));
    device->setSwapRgb(this->d->m_ipcBridge.swapRgb(deviceId));

    return true;

createDevice_failed:
    this->m_devices.erase(std::prev(this->m_devices.end()));

    return false;
}