Esempio n. 1
0
KalziumGLWidget::KalziumGLWidget(QWidget *parent) : Avogadro::GLWidget(parent),
  m_lastEngine1(0), m_lastEngine2(0)
{
    // work around a bug in OpenBabel: the chemical data files parsing
    // is dependent on the LC_NUMERIC locale.
    m_lc_numeric = QByteArray(setlocale(LC_NUMERIC, 0));
    setlocale(LC_NUMERIC, "C");

    // Prevent What's this from intercepting right mouse clicks
    setContextMenuPolicy(Qt::PreventContextMenu);
    // Load the tools and set navigate as the default
    // first set the Avogadro plugin directory,
    // avoiding overwriting an already set envvar
    static bool s_pluginDirSet = false;
    if (!s_pluginDirSet) {
        if (qgetenv("AVOGADRO_PLUGINS").isEmpty()) {
            qputenv("AVOGADRO_PLUGINS", AVOGADRO_PLUGIN_DIR);
        }
        s_pluginDirSet = true;
    }
    Avogadro::PluginManager *manager = Avogadro::PluginManager::instance();
    manager->loadFactories();
    Avogadro::ToolGroup* tools = new Avogadro::ToolGroup(this);
    tools->append(manager->tools(this));
    tools->setActiveTool("Navigate");
    setToolGroup(tools);
    // Set the default engine to be active
    loadDefaultEngines();

    // Set the default quality level to high
    setQuality(2);

    setMolecule(new Avogadro::Molecule(this));
    update();
}
Esempio n. 2
0
LRESULT JpegOptionsDialog::doHScroll(
	int scrollCode,
	int position,
	HWND hScrollBar)
{
	if (hScrollBar == hQualitySlider)
	{
		if (scrollCode != SB_ENDSCROLL)
		{
			switch (scrollCode)
			{
			case SB_PAGEUP:
				position = quality - 10;
				break;
			case SB_PAGEDOWN:
				position = quality + 10;
				break;
			}
			if (position < 1)
			{
				position = 1;
			}
			if (position > 100)
			{
				position = 100;
			}
			setQuality(position);
			return 0;
		}
	}
	return CUIDialog::doHScroll(scrollCode, position, hScrollBar);
}
void LightsaberCrystalComponentImplementation::updateCraftingValues(CraftingValues* values, bool firstUpdate) {

	int colorMax = values->getMaxValue("color");
	int color = values->getCurrentValue("color"); 

	setMaxCondition(values->getCurrentValue("hitpoints"));

	if (colorMax != 31) {
		int finalColor = MIN(color, 11);
		setColor(finalColor);
		updateCrystal(finalColor);
	} 
	else {
		setColor(31);
		updateCrystal(31);
	}

	if (color == 31){
		setQuality(values->getCurrentValue("quality"));
		setAttackSpeed(Math::getPrecision(values->getCurrentValue("attackspeed"), 2));
		setMinimumDamage(MIN(values->getCurrentValue("mindamage"), 50));
		setMaximumDamage(MIN(values->getCurrentValue("maxdamage"), 50));
		setWoundChance(values->getCurrentValue("woundchance"));

		// Following are incoming positive values in script (Due to loot modifier.)
		// Switch to negative number.
		setSacHealth(MIN(values->getCurrentValue("attackhealthcost"), 9) * -1);
		setSacAction(MIN(values->getCurrentValue("attackactioncost"), 9) * -1);
		setSacMind(MIN(values->getCurrentValue("attackmindcost"), 9) * -1);
		setForceCost(MIN(values->getCurrentValue("forcecost"), 9) * -1);
	}

	ComponentImplementation::updateCraftingValues(values, firstUpdate);
}
void S60AudioEncoderControl::setAudioSettings(const QAudioEncoderSettings &settings)
{
    QAudioFormat fmt = m_session->format();
    if (settings.encodingMode() == QtMultimediaKit::ConstantQualityEncoding) {
        fmt.setCodec(settings.codec());
        setQuality(settings.quality(), fmt);
        if (settings.sampleRate() > 0) {
            fmt.setFrequency(settings.sampleRate());
        }
        if (settings.channelCount() > 0)
            fmt.setChannels(settings.channelCount());
    }else {
        if (settings.sampleRate() == 8000) {
            fmt.setSampleType(QAudioFormat::UnSignedInt);
            fmt.setSampleSize(8);
        } else {
            fmt.setSampleType(QAudioFormat::SignedInt);
            fmt.setSampleSize(16);
        }
        fmt.setCodec(settings.codec());
        fmt.setFrequency(settings.sampleRate());
        fmt.setChannels(settings.channelCount());
    }
    m_session->setFormat(fmt);
    m_settings = settings;
}
Esempio n. 5
0
SoftwareRenderer::SoftwareRenderer(Scenery *scenery) : scenery(scenery) {
    render_camera = new CameraDefinition;

    scenery->getCamera()->copy(render_camera);

    atmosphere_renderer = new BaseAtmosphereRenderer(this);
    clouds_renderer = new CloudsRenderer(this);
    terrain_renderer = new TerrainRenderer(this);
    textures_renderer = new TexturesRenderer();
    vegetation_renderer = new VegetationRenderer(this);
    water_renderer = new WaterRenderer(this);

    nightsky_renderer = new NightSky(this);

    fluid_medium = new FluidMediumManager(this);
    lighting = new LightingManager();
    godrays = new GodRaysSampler();

    lighting->registerFilter(water_renderer);
    lighting->registerFilter(terrain_renderer);
    lighting->registerFilter(vegetation_renderer);
    lighting->registerFilter(clouds_renderer);
    lighting->registerSource(atmosphere_renderer);

    setQuality(0.5);
}
Esempio n. 6
0
void SMSClient::quality(unsigned quality)
{
    if (quality != getQuality()){
        setQuality(quality);
        Event e(EventClientChanged, this);
        e.process();
    }
}
void TurbulenceModule::read (utils::InStream &s)
{
	mPower = s.readDouble ();
	setRoughness (s.readInt());
	setSeed (s.readInt());
	setFrequency (s.readDouble());
	setQuality (s.readInt());
}
Esempio n. 8
0
bool Animate3D::init(Animation3D* animation)
{
    _animation = animation;
    animation->retain();
    setDuration(animation->getDuration());
    setOriginInterval(animation->getDuration());
    setQuality(Configuration::getInstance()->getAnimate3DQuality());
    return true;
}
ImageExport::ImageExport(QString dirName, QString type, double scale, double quality, double dpi, bool overwrite)
{
	setDir(dirName);
	setType(type);
	setScale(scale);
	setQuality(quality);
	setDPI(dpi);
	setOverWrite(overwrite);
}
Esempio n. 10
0
MovieWriter::Format::Format( const ICMCompressionSessionOptionsRef options, uint32_t codec, float quality, float frameRate, bool enableMultiPass )
	: mCodec( codec ), mEnableMultiPass( enableMultiPass )
{
	::ICMCompressionSessionOptionsCreateCopy( NULL, options, &mOptions );
	setQuality( quality );
	setTimeScale( (long)(frameRate * 100) );
	setDefaultDuration( 1.0f / frameRate );
	setGamma( PLATFORM_DEFAULT_GAMMA );
}
Esempio n. 11
0
LRESULT JpegOptionsDialog::doVScroll(
	int scrollCode,
	int position,
	HWND hScrollBar)
{
	if (scrollCode == SB_THUMBPOSITION && hScrollBar == hQualitySpin)
	{
		setQuality(position);
		return 0;
	}
	return CUIDialog::doVScroll(scrollCode, position, hScrollBar);
}
Esempio n. 12
0
void Atmosphere::init(RenderInterface* _graphics)
{
	
	waIndex = _graphics->getHandleIndex("cbWorldAttribute",ResourceType::ConstantBuffer);
	saIndex = _graphics->getHandleIndex("cbScatterAttributes",ResourceType::ConstantBuffer);

	setQuality(_graphics);
	setWorldAttributes(_graphics);
	//setScatterAttributes(_graphics, 0, 1, 0);

	printf("Atmosphere CBuffer Sanity Check\n");
	printf("QS = %i\nWA = %i\nSA = %i\n", sizeof(QualitySettings), sizeof(CBWorldAttributes), sizeof(CBScatterAttributes));
}
Esempio n. 13
0
Rasterizer::Rasterizer(SoftwareRenderer *renderer, RenderProgress *progress, unsigned short client_id,
                       const Color &color)
    : renderer(renderer), progress(progress), client_id(client_id) {
    this->color = new Color(color);

    interrupted = false;
    backface_culling = false;
    perspective_correction = true;
    triangle_count = 0;
    auto_cut_limit = 0.01;

    setQuality(0.5);
}
Esempio n. 14
0
GodRaysSampler::GodRaysSampler() {
    enabled = true;
    bounds = new SpaceSegment();
    definition = new GodRaysDefinition(NULL);
    camera_location = new Vector3(0, 0, 0);
    lighting = NULL;
    low_altitude = -1.0;
    high_altitude = 1.0;
    sampling_step = 1.0;
    max_length = 1.0;
    data = new double[1];
    setQuality(0.5);
}
Esempio n. 15
0
void MovieWriter::Format::initDefaults()
{
	OSStatus err = ::ICMCompressionSessionOptionsCreate( NULL, &mOptions );

	mTimeBase = 600;
	mDefaultTime = 1 / 30.0f;
	mGamma = PLATFORM_DEFAULT_GAMMA;
	mEnableMultiPass = false;

	enableTemporal( true );
	enableReordering( true );
	enableFrameTimeChanges( true );
	setQuality( 0.99f );
}
Esempio n. 16
0
bool Animate3D::init(Animation3D* animation, float fromTime, float duration)
{
    float fullDuration = animation->getDuration();
    if (duration > fullDuration - fromTime)
        duration = fullDuration - fromTime;
    
    _start = fromTime / fullDuration;
    _last = duration / fullDuration;
    setDuration(duration);
    setOriginInterval(duration);
    _animation = animation;
    animation->retain();
    setQuality(Configuration::getInstance()->getAnimate3DQuality());
    return true;
}
Esempio n. 17
0
Camera::Camera(RobotInterface *robotInterface) {
    _robotInterface = robotInterface;
    _pinkThresholded = NULL;
    _yellowThresholded = NULL;
    _pinkSquares = NULL;
    _yellowSquares = NULL;
    setQuality(CAMERA_QUALITY);
    setResolution(CAMERA_RESOLUTION);

    // create 3 windows that will be used to display
    // what is happening during processing of images
    cvNamedWindow("Thresholded", CV_WINDOW_AUTOSIZE);
    cvNamedWindow("Biggest Squares Distances", CV_WINDOW_AUTOSIZE);
    cvNamedWindow("Slopes", CV_WINDOW_AUTOSIZE);
}
Esempio n. 18
0
//-----------------------------------------------------------------------
void GshhsReader::selectBestQuality(Projection *proj)
{
	double gshhsRangsThreshold = 200;	// FIXME
	isUsingRangsReader = proj->getCoefremp()<gshhsRangsThreshold;
	
	int bestQuality = 0;
	if (proj->getCoefremp() > 50)
		bestQuality = 0;
	else if (proj->getCoefremp() > 5)
		bestQuality = 1;
	else if (proj->getCoefremp() > 0.2)
		bestQuality = 2;
	else if (proj->getCoefremp() > 0.005)
		bestQuality = 3;
	else
		bestQuality = 4;
	
	if (bestQuality > userPreferredQuality)
		setQuality(userPreferredQuality);
	else
		setQuality(bestQuality);

	//printf("coefremp=%.2f usingRangs=%d qual=%d\n", proj->getCoefremp(),(int)isUsingRangsReader,getQuality());
}
Esempio n. 19
0
Animate3D::Animate3D()
: _state(Animate3D::Animate3DState::Running)
, _animation(nullptr)
, _absSpeed(1.f)
, _weight(1.f)
, _start(0.f)
, _last(1.f)
, _playReverse(false)
, _accTransTime(0.0f)
, _lastTime(0.0f)
, _originInterval(0.0f)
, _frameRate(30.0f)
{
    setQuality(Animate3DQuality::QUALITY_HIGH);
}
Esempio n. 20
0
// called prior to using the allele in analysis
// called again when haplotype alleles are built, in which case the "currentBase" is set to the alternate sequence of the allele
void Allele::update(int haplotypeLength) {
    if (haplotypeLength == 1) {
        if (type == ALLELE_REFERENCE) {
            currentBase = string(1, *currentReferenceBase);
        } else {
            currentBase = base();
        }
    } else {
        currentBase = base();
    }
    // should be done after setting currentBase to haplotypeLength
    if (isReference()) setQuality();
    basesLeft = bpLeft();
    basesRight = bpRight();
}
Esempio n. 21
0
void CloudsRenderer::update() {
    for (auto renderer : layer_renderers) {
        delete renderer;
    }
    layer_renderers.clear();

    for (auto model : layer_models) {
        delete model;
    }
    layer_models.clear();

    CloudsDefinition *clouds = parent->getScenery()->getClouds();
    int n = clouds->getLayerCount();
    for (int i = 0; i < n; i++) {
        layer_renderers.push_back(new CloudBasicLayerRenderer(parent));

        CloudLayerDefinition *layer = clouds->getCloudLayer(i);
        BaseCloudsModel *model;
        switch (layer->type) {
        case CloudLayerDefinition::STRATOCUMULUS:
            model = new CloudModelStratoCumulus(layer);
            break;
        case CloudLayerDefinition::ALTOCUMULUS:
            model = new CloudModelAltoCumulus(layer);
            break;
        case CloudLayerDefinition::CIRRUS:
            model = new CloudModelCirrus(layer);
            break;
        case CloudLayerDefinition::CUMULONIMBUS:
            model = new CloudModelCumuloNimbus(layer);
            break;
        case CloudLayerDefinition::STRATUS:
        case CloudLayerDefinition::NIMBOSTRATUS:
        case CloudLayerDefinition::CUMULUS:
        case CloudLayerDefinition::ALTOSTRATUS:
        case CloudLayerDefinition::CIRROCUMULUS:
        case CloudLayerDefinition::CIRROSTRATUS:
        case CloudLayerDefinition::_COUNT:
            model = new BaseCloudsModel(layer);
            break;
        }

        layer_models.push_back(model);
        model->update();
    }

    setQuality(quality);
}
Esempio n. 22
0
void S60AudioEncoderControl::setEncodingOption(
        const QString &codec, const QString &name, const QVariant &value)
{
    TRACE("S60AudioEncoderControl::setEncodingOption" << qtThisPtr()
          << "codec" << codec << "name" << name << "value" << value);
    if (codec == "PCM") {
        QAudioFormat fmt = m_session->format();
        if(qstrcmp(name.toLocal8Bit().constData(), "quality") == 0)
            setQuality((QtMultimediaKit::EncodingQuality)value.toInt(), fmt);
        else if(qstrcmp(name.toLocal8Bit().constData(), "channels") == 0)
            fmt.setChannels(value.toInt());
        else if(qstrcmp(name.toLocal8Bit().constData(), "samplerate") == 0)
            fmt.setFrequency(value.toInt());
        m_session->setFormat(fmt);
    }
}
void S60AudioEncoderControl::setEncodingOption(
        const QString &codec, const QString &name, const QVariant &value)
{
    if (codec == "PCM") {        
        QAudioFormat fmt = m_session->format();

        if(qstrcmp(name.toLocal8Bit().constData(), "quality") == 0) {
            setQuality((QtMultimediaKit::EncodingQuality)value.toInt(), fmt);
        } else if(qstrcmp(name.toLocal8Bit().constData(), "channels") == 0) {
            fmt.setChannels(value.toInt());
        } else if(qstrcmp(name.toLocal8Bit().constData(), "samplerate") == 0) {
            fmt.setFrequency(value.toInt());
        }
        m_session->setFormat(fmt);
    }
}
Esempio n. 24
0
//==========================================================
//==========================================================
//==========================================================
// GshhsReader
//==========================================================
//==========================================================
//==========================================================
GshhsReader::GshhsReader (std::string fpath, int quality)
{
    this->fpath = fpath;
    gshhsRangsReader = new GshhsRangsReader(fpath);
    isUsingRangsReader = true;
    for (int qual=0; qual<5; qual++)
    {
        lsPoly_level1[qual] = new std::vector <GshhsPolygon*>;
        lsPoly_level2[qual] = new std::vector <GshhsPolygon*>;
        lsPoly_level3[qual] = new std::vector <GshhsPolygon*>;
        lsPoly_level4[qual] = new std::vector <GshhsPolygon*>;
        lsPoly_boundaries[qual] = new std::vector <GshhsPolygon*>;
        lsPoly_rivers[qual] = new std::vector <GshhsPolygon*>;
    }
    userPreferredQuality = quality;
    setQuality(quality);
}
Esempio n. 25
0
void ConfigureRecorder::processPopup()
{
    // Save the current quality settings, in case we have to cancel.
    QualitySetting savedQualities[MaxQualities];
    int savedQuality = quality;
    copyQualities( savedQualities, qualities, MaxQualities );

    // Update the configuration dialog's display with the current state.
    setQuality( quality );

    // Process the dialog.
    if ( QtopiaApplication::execDialog( this ) != QDialog::Accepted) {
        // Copy the saved configuration back.
        copyQualities( qualities, savedQualities, MaxQualities );
        quality = savedQuality;
    }
}
Esempio n. 26
0
//-------------------------------------------------------
// Recopie
GshhsReader::GshhsReader(const GshhsReader &model)
{
    fpath = model.fpath;
    gshhsRangsReader = new GshhsRangsReader(fpath);	
    isUsingRangsReader = model.isUsingRangsReader;
    // reuse lists of polygons
    for (int qual=0; qual<5; qual++)
    {
        lsPoly_level1[qual] = model.lsPoly_level1[qual];
        lsPoly_level2[qual] = model.lsPoly_level2[qual];
        lsPoly_level3[qual] = model.lsPoly_level3[qual];
        lsPoly_level4[qual] = model.lsPoly_level4[qual];
        lsPoly_boundaries[qual] = model.lsPoly_boundaries[qual];
        lsPoly_rivers[qual] = model.lsPoly_rivers[qual];
    }
    userPreferredQuality = model.userPreferredQuality;
    quality = model.quality;
    setQuality(quality);
}
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) {
    cWidget = new QWidget( this );
    vLayout = new QVBoxLayout( cWidget );
    h1Layout = new QHBoxLayout();
    h2Layout = new QHBoxLayout();
    leFilePath = new QLineEdit( this );
    bSelectFile = new QPushButton( this );
    bStart = new QPushButton( this );
    slider = new QSlider(Qt::Horizontal, this);
    lSlider = new QLabel( this );
    progressBar = new QProgressBar( this );

    leFilePath->setReadOnly(true);
    leFilePath->setText("");

    bSelectFile->setText("&Select file");
    bStart->setText("St&art");
    bStart->setDisabled(true);
    slider->setMinimum( 0 );
    slider->setMaximum( 100 );
    slider->setValue( 50 ); setQuality( 50 );
    progressBar->setMinimum(0);
    progressBar->setMaximum(6);
    progressBar->setValue(0);

    connect( bSelectFile, SIGNAL( clicked() ), this, SLOT( selectFile() ) );
    connect( bStart, SIGNAL( clicked() ), this, SLOT( start() ) );
    connect( slider, SIGNAL( valueChanged( int ) ), this, SLOT( setQuality(int) ) );

    h1Layout->addWidget(leFilePath);
    h1Layout->addWidget(bSelectFile);
    h1Layout->addWidget(bStart);

    h2Layout->addWidget( lSlider );
    h2Layout->addWidget( slider );

    vLayout->addLayout(h1Layout);
    vLayout->addLayout( h2Layout );
    vLayout->addWidget(progressBar);

    cWidget->setLayout(vLayout);
    setCentralWidget(cWidget);
}
void PanoramicTFTPStreamreader::setStreamParams(StreamParams newParam)
{
	if (!m_inited) return;
	Mutex mutex(m_params_CS);
	if (newParam.quality!=m_streamParam.quality)
		setQuality(newParam.quality);

	if (newParam.resolution != m_streamParam.resolution)
		setResolution(newParam.resolution);


	if (newParam.width != m_streamParam.width  || newParam.height != m_streamParam.height)
		setResolution(newParam.width, newParam.height);


	if (newParam.bitrate != m_streamParam.bitrate)
		setBitrate(newParam.bitrate);


	m_streamParam = newParam;
}
Esempio n. 29
0
BOOL JpegOptionsDialog::doInitDialog(HWND /*hKbControl*/)
{
	int index;
	int i;

	quality = options->getQuality();
	hQualityField = GetDlgItem(hWindow, IDC_JPEG_QUAL_FIELD);
	hQualitySpin = GetDlgItem(hWindow, IDC_JPEG_QUAL_SPIN);
	hQualitySlider = GetDlgItem(hWindow, IDC_JPEG_QUAL_SLIDER);
	trackBarSetup(IDC_JPEG_QUAL_SLIDER, 1, 100, 10, quality);
	for (i = 10; i < 100; i += 10)
	{
		trackBarSetTic(IDC_JPEG_QUAL_SLIDER, i);
	}
	textFieldSetLimitText(IDC_JPEG_QUAL_FIELD, 3);
	upDownSetup(IDC_JPEG_QUAL_SPIN, 1, 100, quality);
	setQuality(quality);
	comboAddString(IDC_JPEG_SUBSAMPLING_COMBO,
		ls(_UC("Jpeg444ss")));
	comboAddString(IDC_JPEG_SUBSAMPLING_COMBO,
		ls(_UC("Jpeg422ss")));
	comboAddString(IDC_JPEG_SUBSAMPLING_COMBO,
		ls(_UC("Jpeg420ss")));
	switch (options->getSubSampling())
	{
	case TCJpegOptions::SS422:
		index = 1;
		break;
	case TCJpegOptions::SS420:
		index = 2;
		break;
	default:	// TCJpegOptions::SS444
		index = 0;
		break;
	}
	comboSetCurSel(IDC_JPEG_SUBSAMPLING_COMBO, index);
	checkSet(IDC_JPEG_PROGRESSIVE_CHECK, options->getProgressive());
	return TRUE;
}
Esempio n. 30
0
LRESULT JpegOptionsDialog::doTextFieldChange(int controlId, HWND control)
{
	if (controlId == IDC_JPEG_QUAL_FIELD)
	{
		long value;

		if (windowGetValue(controlId, value))
		{
			int start, end;

			textFieldGetSelection(controlId, start, end);
			if (value > 100)
			{
				while (value > 100)
				{
					value /= 10;
				}
			}
			setQuality(value);
			if (start > 2)
			{
				if (value == 100)
				{
					start = 3;
				}
				else
				{
					start = 2;
				}
			}
			textFieldSetSelection(controlId, start, start);
		}
		return 0;
	}
	return CUIDialog::doTextFieldChange(controlId, control);
}