Exemple #1
0
bool SnesEmu::init(const QString &diskPath, QString *error) {
	S9xSetSoundMute(FALSE);
	setDefaultSettings();
	S9xSetPlaybackRate();
	m_frame = QImage(512, 239, QImage::Format_RGB16);
	setVideoSrcRect(QRectF(0.0f, 0.0f, 256.0f, 224.f));
	setFrameRate(60);

	GFX.Pitch = 512 * 2;
	GFX.RealPitch = 512 * 2;
	GFX.PPL = GFX.Pitch >> 1;
	GFX.PPLx2 = GFX.Pitch;
	GFX.Screen = (u8 *)m_frame.bits();
	GFX.SubScreen = (u8 *) malloc(GFX.RealPitch * 239);
	GFX.ZBuffer = (u8 *) malloc(GFX.PPL * 239);
	GFX.SubZBuffer = (u8 *) malloc(GFX.PPL * 239);
	GFX.Delta = (GFX.SubScreen - GFX.Screen) >> 1;

	if (!GFX.Screen || !GFX.SubScreen || !GFX.ZBuffer || !Memory.Init() || !S9xInitAPU() || !GFX.SubZBuffer ) {
		*error = tr("SNES emulation init failed!");
		return false;
	}
	S9xInitSound();
	if (!S9xGraphicsInit()) {
		*error = tr("SNES emulation init failed!");
		return false;
	}
	S9xReset();
	setDefaultSettings();
	*error = setDisk(diskPath);
	return error->isEmpty();
}
void S60AudioCaptureSession::initializeSessionL()
{
    m_recorderUtility = CMdaAudioRecorderUtility::NewL(*this, 0, 80,(TMdaPriorityPreference) 0x5210001);
    updateAudioContainersL();
    populateAudioCodecsDataL();
    setDefaultSettings();
}
Exemple #3
0
// constructor
Config::Config()
{
    _settings = new QSettings(getConfigFile(), QSettings::IniFormat );

    _shortcuts = new ShortcutManager(_settings);

    // check existing config file
    if (!QFile::exists(getConfigFile()))
    {
        // creating conf file from set defaults
		QFile cf(getConfigFile());
		if (cf.open(QIODevice::WriteOnly))
		{
			cf.close();
			qDebug() << "creating";
		}
		
        setDefaultSettings();
        saveSettings();
    }

    _imageFormats << "png" << "jpg" << "bmp";

#if QT_VERSION >= 0x040500
    _settings->setIniCodec("UTF-8");
#endif
    _scrNum = 0;
}
Exemple #4
0
void EmuSettings::loadSettings()
	{
	__DEBUG_IN
	QSettings settings;
	int version = settings.value("gpsp_version").toInt();
	if( version != KSettingsVersion )
		{
		__DEBUG1("No version was set, creating default settings");
		setDefaultSettings();
		savecurrentSettings();
		return;
		}
	gpspsettings.iVersion = version;

	for(int i=0;i<10;i++)
		{
	    QString keyval = "gpsp_kebind";
	    keyval.append( QString::number(i) );
	    gpspsettings.iScanKeyTable[i] = settings.value(keyval).toUInt();
		}
	gpspsettings.iLastROM = settings.value("gpsp_lastrom").toString();
	gpspsettings.iBios = settings.value("gpsp_bios").toString();
	gpspsettings.iShowFPS = settings.value("gpsp_showfps").toBool();
	gpspsettings.ikeepAspectRatio = settings.value("gpsp_aspectratio").toBool();
	gpspsettings.iFrameSkip = settings.value("gpsp_frameskip").toInt();
	gpspsettings.iAudioOn = settings.value("gpsp_audioOn").toBool();
	gpspsettings.iVolume = settings.value("gpsp_volume").toInt();
	gpspsettings.iLastSlot = settings.value("gpsp_lastslot").toInt();
	gpspsettings.iScreenSettings = settings.value("gpsp_screensettings").toInt();
	__DEBUG_OUT
	}
Exemple #5
0
/**
 * @brief CodeEditor::CodeEditor Create empty code editor.
 * @param parent Get parent of this object.
 * @param path Path of opened file.
 * @param type Type of opened shader.
 */
CodeEditor::CodeEditor(QWidget *parent, QString path, InfoManager::SHADERTYPE type) :
    QPlainTextEdit(parent)
{
    lineNumberArea = new LineNumberArea(this);
    oldBlockNumber = 0;

    customConnect();

    updateLineNumberAreaWidth(0);
    highlightCurrentLine();

    pathSet = true;
    filePath = path;
    //textModif = false;

    // set shader type
    sType = type;

    // set syntax highlighter
    highlight = new Highlighter(this);
    highlight->setDocument(document());

    // read the file
    readFile();

    setDefaultSettings();
    createRegExps();
}
void EmuSettings::loadSettings()
	{
	__DEBUG_IN
	QSettings settings;
	int version = settings.value("gpsp_version").toInt();
	if( version != KSettingsVersion )
		{
		__DEBUG1("No version was set, creating default settings");
		setDefaultSettings();
		savecurrentSettings();
		return;
		}
	gpspsettings.iVersion = version;

	for(int i=0;i<10;i++)
		{
	    QString keyval = "gpsp_kebind";
	    keyval.append( QString::number(i) );
	    gpspsettings.iScanKeyTable[i] = settings.value(keyval).toUInt();
		}
	gpspsettings.iLastROM = settings.value("gpsp_lastrom").toString();
	gpspsettings.iBios = settings.value("gpsp_bios").toString();
	gpspsettings.iShowFPS = settings.value("gpsp_showfps").toBool();
	gpspsettings.iAudioOn = settings.value("gpsp_audioOn").toBool();
	gpspsettings.iVolume = settings.value("gpsp_volume").toInt();
	gpspsettings.iLastSlot = settings.value("gpsp_lastslot").toInt();
        gpspsettings.iDpadSettings = settings.value("gpsp_dpadsettings").toInt();
        gpspsettings.iButtonOpacity = settings.value("gpsp_ButtonOpacity").toInt();
        gpspsettings.iStretch = settings.value("gpsp_Stretch").toInt();
        gpspsettings.iButtonSettings = settings.value("gpsp_ButtonSettings").toInt();
	__DEBUG_OUT
	}
Exemple #7
0
void Settings::createSettingsFile()
{
    if (!fileExists(Settings::getSettingsPath()))
    {
        qCritical() << "Settings file" << Settings::getSettingsPath() <<"does not exist. Creating it now...";
        QFile sfile(Settings::getSettingsPath());
        if(!sfile.open(QIODevice::WriteOnly))
        {
            qDebug() << "Unable to create" << Settings::getSettingsPath() << "Check folder permissions.";
            return;
        }

        QTextStream header(&sfile);
        header << "##############################################################"
                 << "\n#    SEGS configuration file."
                 << "\n#"
                 << "\n#    listen_addr values below should contain the IP the"
                 << "\n#      clients will connect to."
                 << "\n#"
                 << "\n#    location_addr values below should contain the IP the"
                 << "\n#      clients will receive data from."
                 << "\n#"
                 << "\n#    Both values are set to 127.0.0.1 by default but should"
                 << "\n#      be set to your local IP address on the network"
                 << "\n#      for example: 10.0.0.2"
                 << "\n#"
                 << "\n#    Default ports are listed below:"
                 << "\n#      AccountDatabase db_port:		5432"
                 << "\n#      CharacterDatabase db_port:	5432"
                 << "\n#      AuthServer location_addr:		2106"
                 << "\n#      GameServer listen_addr:		7002"
                 << "\n#      GameServer location_addr:     7002"
                 << "\n#      MapServer listen_addr:		7003"
                 << "\n#      MapServer location_addr:		7003"
                 << "\n#"
                 << "\n##############################################################";

        sfile.close();

        setDefaultSettings();

        return;
    }
    else
    {
        qDebug() << "Settings file already exists at" << Settings::getSettingsPath();
        return;
    }
}
void STDRenderer::restore()
{
    MemoryTexture memwhite;
    memwhite.init(4, 4, TF_R8G8B8A8);

    oxygine::operations::op_fill fill;
    ImageData im = memwhite.lock();
    oxygine::operations::applyOperation(fill, im);

    white = IVideoDriver::instance->createTexture();
    white->setName("!renderer. white");
    white->init(im, false);
    white->setLinearFilter(false);

    setDefaultSettings();
    _restored = true;
}
Exemple #9
0
void NaoCamera::init() {

    if(!initialized) {
        initOpenVideoDevice();
    }
    initSetImageFormat();
    initSetFrameRate();

    if (!initialized) {
        initRequestAndMapBuffers();
        initQueueAllBuffers();
    }

    enableStreaming();
    setDefaultSettings();

    initialized = true;
}
Exemple #10
0
PointTableWidget::PointTableWidget(QWidget * parent, const QPolygonF * const points, const Settings * const settings) : QTableWidget(parent) , points(*points) {
    if (settings == NULL)
        setDefaultSettings();
    else
        this->settings = *settings;

    setColumnCount(this->settings.colHeader.size());
    setHorizontalHeaderLabels(this->settings.colHeader);

    setColumnWidths();

    setSelectionMode(QAbstractItemView::ExtendedSelection);
    if (this->settings.autoSelectRow)
        setSelectionBehavior(QAbstractItemView::SelectRows);

    editingCell = QPoint(-1, -1);
    connect(this, SIGNAL(cellDoubleClicked(int,int)), this, SLOT(cellEditingSlot(int,int)));
    connect(this, SIGNAL(cellChanged(int,int)), this, SLOT(updateCell(int,int)));
}
Exemple #11
0
// constructor
Config::Config()
{
    _settings = new QSettings(getConfigFile(), QSettings::IniFormat);

    _shortcuts = new ShortcutManager(_settings);

    // check existing config file
    if (!QFile::exists(getConfigFile()))
    {
        // creating conf file from set defaults
        QFile cf(getConfigFile());
        if (cf.open(QIODevice::WriteOnly))
        {
            cf.close();
        }

        setDefaultSettings();
        saveSettings();
    }

    _settings->setIniCodec("UTF-8");
    _scrNum = 0;
}
 void VideoDriverGLES20::restore()
 {
     //_us.restore();
     setDefaultSettings();
 }
Exemple #13
0
int main(int argc, char **argv) {
	scs_int n, m, col_nnz, nnz, i, q_total, q_num_rows, max_q;
	Cone * k;
	Data * d;
	Sol * sol, * opt_sol;
	Info info = { 0 };
	scs_float p_f, p_l;
	int seed = 0;

	/* default parameters */
	p_f = 0.1;
	p_l = 0.3;
	seed = time(SCS_NULL);

	switch (argc) {
	case 5:
		seed = atoi(argv[4]);
		/* no break */
	case 4:
		p_f = atof(argv[2]);
		p_l = atof(argv[3]);
		/* no break */
	case 2:
		n = atoi(argv[1]);
		break;
	default:
		scs_printf("usage:\t%s n p_f p_l s\n"
				"\tcreates an SOCP with n variables where p_f fraction of rows correspond\n"
				"\tto equality constraints, p_l fraction of rows correspond to LP constraints,\n"
				"\tand the remaining percentage of rows are involved in second-order\n"
				"\tcone constraints. the random number generator is seeded with s.\n"
				"\tnote that p_f + p_l should be less than or equal to 1, and that\n"
				"\tp_f should be less than .33, since that corresponds to as many equality\n"
				"\tconstraints as variables.\n", argv[0]);
		scs_printf("\nusage:\t%s n p_f p_l\n"
				"\tdefaults the seed to the system time\n", argv[0]);
		scs_printf("\nusage:\t%s n\n"
				"\tdefaults to using p_f = 0.1 and p_l = 0.3\n", argv[0]);
		return 0;
	}
	srand(seed);
	scs_printf("seed : %i\n", seed);

    k = scs_calloc(1, sizeof(Cone));
    d = scs_calloc(1, sizeof(Data));
    d->stgs = scs_calloc(1, sizeof(Settings));
    sol = scs_calloc(1, sizeof(Sol));
    opt_sol = scs_calloc(1, sizeof(Sol));

	m = 3 * n;
	col_nnz = (int) ceil(sqrt(n));
	nnz = n * col_nnz;

	max_q = (scs_int) ceil(3 * n / log(3 * n));

	if (p_f + p_l > 1.0) {
		printf("error: p_f + p_l > 1.0!\n");
		return 1;
	}

	k->f = (scs_int) floor(3 * n * p_f);
	k->l = (scs_int) floor(3 * n * p_l);

	k->qsize = 0;
	q_num_rows = 3 * n - k->f - k->l;
	k->q = scs_malloc(q_num_rows * sizeof(scs_int));

	while (q_num_rows > max_q) {
		int size;
		size = (rand() % max_q) + 1;
		k->q[k->qsize] = size;
		k->qsize++;
		q_num_rows -= size;
	}
	if (q_num_rows > 0) {
		k->q[k->qsize] = q_num_rows;
		k->qsize++;
	}

	q_total = 0;
	for (i = 0; i < k->qsize; i++) {
		q_total += k->q[i];
	}

	k->s = SCS_NULL;
	k->ssize = 0;
	k->ep = 0;
	k->ed = 0;

	scs_printf("\nA is %ld by %ld, with %ld nonzeros per column.\n", (long) m, (long) n, (long) col_nnz);
	scs_printf("A has %ld nonzeros (%f%% dense).\n", (long) nnz, 100 * (scs_float) col_nnz / m);
	scs_printf("Nonzeros of A take %f GB of storage.\n", ((scs_float) nnz * sizeof(scs_float)) / POWF(2, 30));
	scs_printf("Row idxs of A take %f GB of storage.\n", ((scs_float) nnz * sizeof(scs_int)) / POWF(2, 30));
	scs_printf("Col ptrs of A take %f GB of storage.\n\n", ((scs_float) n * sizeof(scs_int)) / POWF(2, 30));

	printf("Cone information:\n");
	printf("Zero cone rows: %ld\n", (long) k->f);
	printf("LP cone rows: %ld\n", (long) k->l);
	printf("Number of second-order cones: %ld, covering %ld rows, with sizes\n[", (long) k->qsize, (long) q_total);
	for (i = 0; i < k->qsize; i++) {
		printf("%ld, ", (long) k->q[i]);
	}
	printf("]\n");
	printf("Number of rows covered is %ld out of %ld.\n\n", (long) (q_total + k->f + k->l), (long) m);

	/* set up SCS structures */
	d->m = m;
	d->n = n;
	genRandomProbData(nnz, col_nnz, d, k, opt_sol);
	setDefaultSettings(d);

	scs_printf("true pri opt = %4f\n", innerProd(d->c, opt_sol->x, d->n));
	scs_printf("true dua opt = %4f\n", -innerProd(d->b, opt_sol->y, d->m));
    /* solve! */
	scs(d, k, sol, &info);
	scs_printf("true pri opt = %4f\n", innerProd(d->c, opt_sol->x, d->n));
	scs_printf("true dua opt = %4f\n", -innerProd(d->b, opt_sol->y, d->m));

    if (sol->x) { scs_printf("scs pri obj= %4f\n", innerProd(d->c, sol->x, d->n)); }
    if (sol->y) { scs_printf("scs dua obj = %4f\n", -innerProd(d->b, sol->y, d->m)); }

    freeData(d, k);
	freeSol(sol);
    freeSol(opt_sol);

    return 0;
}
Exemple #14
0
static PyObject *csolve(PyObject *self, PyObject *args, PyObject *kwargs) {
    /* data structures for arguments */
    PyArrayObject *Ax, *Ai, *Ap, *c, *b;
    PyObject *cone, *warm = SCS_NULL;
    PyObject *verbose = SCS_NULL;
    PyObject *normalize = SCS_NULL;
    /* get the typenum for the primitive scs_int and scs_float types */
    int scs_intType = getIntType();
    int scs_floatType = getFloatType();
    struct ScsPyData ps = {
        SCS_NULL, SCS_NULL, SCS_NULL, SCS_NULL, SCS_NULL,
    };
    /* scs data structures */
    Data *d = scs_calloc(1, sizeof(Data));
    Cone *k = scs_calloc(1, sizeof(Cone));

    AMatrix *A;
    Sol sol = {0};
    Info info;
    char *kwlist[] = {"shape",     "Ax",    "Ai",   "Ap",      "b",
                      "c",         "cone",  "warm", "verbose", "normalize",
                      "max_iters", "scale", "eps",  "cg_rate", "alpha",
                      "rho_x",     SCS_NULL};

/* parse the arguments and ensure they are the correct type */
#ifdef DLONG
#ifdef FLOAT
    char *argparse_string = "(ll)O!O!O!O!O!O!|O!O!O!lfffff";
    char *outarg_string = "{s:l,s:l,s:f,s:f,s:f,s:f,s:f,s:f,s:f,s:f,s:f,s:s}";
#else
    char *argparse_string = "(ll)O!O!O!O!O!O!|O!O!O!lddddd";
    char *outarg_string = "{s:l,s:l,s:d,s:d,s:d,s:d,s:d,s:d,s:d,s:d,s:d,s:s}";
#endif
#else
#ifdef FLOAT
    char *argparse_string = "(ii)O!O!O!O!O!O!|O!O!O!ifffff";
    char *outarg_string = "{s:i,s:i,s:f,s:f,s:f,s:f,s:f,s:f,s:f,s:f,s:f,s:s}";
#else
    char *argparse_string = "(ii)O!O!O!O!O!O!|O!O!O!iddddd";
    char *outarg_string = "{s:i,s:i,s:d,s:d,s:d,s:d,s:d,s:d,s:d,s:d,s:d,s:s}";
#endif
#endif
    npy_intp veclen[1];
    PyObject *x, *y, *s, *returnDict, *infoDict;

    d->stgs = scs_malloc(sizeof(Settings));

    /* set defaults */
    setDefaultSettings(d);

    if (!PyArg_ParseTupleAndKeywords(
            args, kwargs, argparse_string, kwlist, &(d->m), &(d->n),
            &PyArray_Type, &Ax, &PyArray_Type, &Ai, &PyArray_Type, &Ap,
            &PyArray_Type, &b, &PyArray_Type, &c, &PyDict_Type, &cone,
            &PyDict_Type, &warm, &PyBool_Type, &verbose, &PyBool_Type,
            &normalize, &(d->stgs->max_iters), &(d->stgs->scale),
            &(d->stgs->eps), &(d->stgs->cg_rate), &(d->stgs->alpha),
            &(d->stgs->rho_x))) {
        PySys_WriteStderr("error parsing inputs\n");
        return SCS_NULL;
    }

    if (d->m < 0) {
        PyErr_SetString(PyExc_ValueError, "m must be a positive integer");
        return SCS_NULL;
    }

    if (d->n < 0) {
        PyErr_SetString(PyExc_ValueError, "n must be a positive integer");
        return SCS_NULL;
    }

    /* set A */
    if (!PyArray_ISFLOAT(Ax) || PyArray_NDIM(Ax) != 1) {
        return finishWithErr(d, k, &ps, "Ax must be a numpy array of floats");
    }
    if (!PyArray_ISINTEGER(Ai) || PyArray_NDIM(Ai) != 1) {
        return finishWithErr(d, k, &ps, "Ai must be a numpy array of ints");
    }
    if (!PyArray_ISINTEGER(Ap) || PyArray_NDIM(Ap) != 1) {
        return finishWithErr(d, k, &ps, "Ap must be a numpy array of ints");
    }
    ps.Ax = getContiguous(Ax, scs_floatType);
    ps.Ai = getContiguous(Ai, scs_intType);
    ps.Ap = getContiguous(Ap, scs_intType);

    A = scs_malloc(sizeof(AMatrix));
    A->n = d->n;
    A->m = d->m;
    A->x = (scs_float *)PyArray_DATA(ps.Ax);
    A->i = (scs_int *)PyArray_DATA(ps.Ai);
    A->p = (scs_int *)PyArray_DATA(ps.Ap);
    d->A = A;
    /*d->Anz = d->Ap[d->n]; */
    /*d->Anz = PyArray_DIM(Ai,0); */
    /* set c */
    if (!PyArray_ISFLOAT(c) || PyArray_NDIM(c) != 1) {
        return finishWithErr(
            d, k, &ps, "c must be a dense numpy array with one dimension");
    }
    if (PyArray_DIM(c, 0) != d->n) {
        return finishWithErr(d, k, &ps, "c has incompatible dimension with A");
    }
    ps.c = getContiguous(c, scs_floatType);
    d->c = (scs_float *)PyArray_DATA(ps.c);
    /* set b */
    if (!PyArray_ISFLOAT(b) || PyArray_NDIM(b) != 1) {
        return finishWithErr(
            d, k, &ps, "b must be a dense numpy array with one dimension");
    }
    if (PyArray_DIM(b, 0) != d->m) {
        return finishWithErr(d, k, &ps, "b has incompatible dimension with A");
    }
    ps.b = getContiguous(b, scs_floatType);
    d->b = (scs_float *)PyArray_DATA(ps.b);

    if (getPosIntParam("f", &(k->f), 0, cone) < 0) {
        return finishWithErr(d, k, &ps, "failed to parse cone field f");
    }
    if (getPosIntParam("l", &(k->l), 0, cone) < 0) {
        return finishWithErr(d, k, &ps, "failed to parse cone field l");
    }
    if (getConeArrDim("q", &(k->q), &(k->qsize), cone) < 0) {
        return finishWithErr(d, k, &ps, "failed to parse cone field q");
    }
    if (getConeArrDim("s", &(k->s), &(k->ssize), cone) < 0) {
        return finishWithErr(d, k, &ps, "failed to parse cone field s");
    }
    if (getConeFloatArr("p", &(k->p), &(k->psize), cone) < 0) {
        return finishWithErr(d, k, &ps, "failed to parse cone field p");
    }
    if (getPosIntParam("ep", &(k->ep), 0, cone) < 0) {
        return finishWithErr(d, k, &ps, "failed to parse cone field ep");
    }
    if (getPosIntParam("ed", &(k->ed), 0, cone) < 0) {
        return finishWithErr(d, k, &ps, "failed to parse cone field ed");
    }

    d->stgs->verbose = verbose ? (scs_int)PyObject_IsTrue(verbose) : VERBOSE;
    d->stgs->normalize =
        normalize ? (scs_int)PyObject_IsTrue(normalize) : NORMALIZE;
    if (d->stgs->max_iters < 0) {
        return finishWithErr(d, k, &ps, "max_iters must be positive");
    }
    if (d->stgs->scale < 0) {
        return finishWithErr(d, k, &ps, "scale must be positive");
    }
    if (d->stgs->eps < 0) {
        return finishWithErr(d, k, &ps, "eps must be positive");
    }
    if (d->stgs->cg_rate < 0) {
        return finishWithErr(d, k, &ps, "cg_rate must be positive");
    }
    if (d->stgs->alpha < 0) {
        return finishWithErr(d, k, &ps, "alpha must be positive");
    }
    if (d->stgs->rho_x < 0) {
        return finishWithErr(d, k, &ps, "rho_x must be positive");
    }
    /* parse warm start if set */
    d->stgs->warm_start = WARM_START;
    if (warm) {
        d->stgs->warm_start = getWarmStart("x", &(sol.x), d->n, warm);
        d->stgs->warm_start |= getWarmStart("y", &(sol.y), d->m, warm);
        d->stgs->warm_start |= getWarmStart("s", &(sol.s), d->m, warm);
    }

    Py_BEGIN_ALLOW_THREADS
        /* Solve! */
        scs(d, k, &sol, &info);
    Py_END_ALLOW_THREADS

        /* create output (all data is *deep copied*) */
        /* x */
        /* matrix *x; */
        /* if(!(x = Matrix_New(n,1,DOUBLE))) */
        /*   return PyErr_NoMemory(); */
        /* memcpy(MAT_BUFD(x), mywork->x, n*sizeof(scs_float)); */
        veclen[0] = d->n;
    x = PyArray_SimpleNewFromData(1, veclen, scs_floatType, sol.x);
    PyArray_ENABLEFLAGS((PyArrayObject *)x, NPY_ARRAY_OWNDATA);

    /* y */
    /* matrix *y; */
    /* if(!(y = Matrix_New(p,1,DOUBLE))) */
    /*   return PyErr_NoMemory(); */
    /* memcpy(MAT_BUFD(y), mywork->y, p*sizeof(scs_float)); */
    veclen[0] = d->m;
    y = PyArray_SimpleNewFromData(1, veclen, scs_floatType, sol.y);
    PyArray_ENABLEFLAGS((PyArrayObject *)y, NPY_ARRAY_OWNDATA);

    /* s */
    /* matrix *s; */
    /* if(!(s = Matrix_New(m,1,DOUBLE))) */
    /*   return PyErr_NoMemory(); */
    /* memcpy(MAT_BUFD(s), mywork->s, m*sizeof(scs_float)); */
    veclen[0] = d->m;
    s = PyArray_SimpleNewFromData(1, veclen, scs_floatType, sol.s);
    PyArray_ENABLEFLAGS((PyArrayObject *)s, NPY_ARRAY_OWNDATA);

    infoDict = Py_BuildValue(
        outarg_string, "statusVal", (scs_int)info.statusVal, "iter",
        (scs_int)info.iter, "pobj", (scs_float)info.pobj, "dobj",
        (scs_float)info.dobj, "resPri", (scs_float)info.resPri, "resDual",
        (scs_float)info.resDual, "relGap", (scs_float)info.relGap, "resInfeas",
        (scs_float)info.resInfeas, "resUnbdd", (scs_float)info.resUnbdd,
        "solveTime", (scs_float)(info.solveTime), "setupTime",
        (scs_float)(info.setupTime), "status", info.status);

    returnDict = Py_BuildValue("{s:O,s:O,s:O,s:O}", "x", x, "y", y, "s", s,
                               "info", infoDict);
    /* give up ownership to the return dictionary */
    Py_DECREF(x);
    Py_DECREF(y);
    Py_DECREF(s);
    Py_DECREF(infoDict);

    /* no longer need pointers to arrays that held primitives */
    freePyData(d, k, &ps);
    return returnDict;
}
Exemple #15
0
OptionsWidget::OptionsWidget(QString productName,QWidget *parent) :
QScrollArea(parent), m_productName(productName), m_settings(QSettings::SystemScope,"osll",m_productName)
{
  m_widget = new QWidget(this);

  QVBoxLayout * layout = new QVBoxLayout(m_widget);

  layout->addWidget(new QLabel("Login", m_widget));
  layout->addWidget(m_nameEdit = new QLineEdit(m_widget));
  layout->addWidget(new QLabel("Password", m_widget));
  layout->addWidget(m_passwordEdit = new QLineEdit(m_widget));
  layout->addWidget(m_passwordCheckBox = new QCheckBox("Show password", m_widget));
  layout->addWidget(new QLabel("Channel name", m_widget));
  layout->addWidget(m_channelEdit = new QLineEdit(m_widget));
  // NOTE if we use m_widget windget in tracker addition field for username will displayed
  if (m_productName == "tracker")
  {
    layout->addWidget(new QLabel("Name that will be displayed\non Observer map:", m_widget));
    layout->addWidget(m_visibleNameEdit = new QLineEdit());
  }

  m_passwordEdit->setEchoMode(QLineEdit::Password);
  m_passwordCheckBox->setChecked(false);

  layout->addWidget(new QLabel("Server", m_widget));
  layout->addWidget(m_serverUrlEdit = new QLineEdit(m_widget));
  layout->addWidget(new QLabel("Port", m_widget));
  layout->addWidget(m_serverPortEdit = new QSpinBox(m_widget));

  m_serverPortEdit->setMinimum(0);
  m_serverPortEdit->setMaximum(65535);

  layout->addWidget(new QLabel("Proxy type", m_widget));
  layout->addWidget(m_proxyType = new QComboBox(m_widget));
  layout->addWidget(new QLabel("Proxy host", m_widget));
  layout->addWidget(m_proxyHostEdit = new QLineEdit(m_widget));
  layout->addWidget(new QLabel("Proxy port", m_widget));
  layout->addWidget(m_proxyPortEdit = new QSpinBox(m_widget));

  m_proxyType->addItem("DefaultProxy", QNetworkProxy::DefaultProxy);
  m_proxyType->addItem("Socks5Proxy", QNetworkProxy::Socks5Proxy);
  m_proxyType->addItem("NoProxy", QNetworkProxy::NoProxy);
  m_proxyType->addItem("HttpProxy", QNetworkProxy::HttpProxy);
  m_proxyType->addItem("HttpCachingProxy", QNetworkProxy::HttpCachingProxy);
  m_proxyType->addItem("FtpCachingProxy", QNetworkProxy::FtpCachingProxy);
  m_proxyPortEdit->setMinimum(0);
  m_proxyPortEdit->setMaximum(65535);

  layout->addWidget(new QLabel("Cache type", m_widget));
  layout->addWidget(m_cacheType = new QComboBox(m_widget));
  layout->addWidget(new QLabel("Cache path", m_widget));
  layout->addWidget(m_cachePath = new QLineEdit(m_widget));
  layout->addWidget(m_cachePathButton = new QPushButton("Choose dir...", m_widget));
  layout->addWidget(new QLabel("Max cache size", m_widget));
  layout->addWidget(m_cacheMaxSize = new QSpinBox(m_widget));

  m_cacheType->addItem("None", 0);
  m_cacheType->addItem("Network cache", 1);
  m_cacheType->addItem("Disk cache", 2);
  m_cacheType->setCurrentIndex(-1);

  layout->addWidget(m_doneButton = new QPushButton("Done", m_widget));
  layout->addWidget(m_defaultButton = new QPushButton("Default settings", m_widget));
  layout->addWidget(m_cancelButton = new QPushButton("Cancel", m_widget));

  m_widget->setLayout(layout);
  this->setWidget(m_widget);
  this->setWidgetResizable(true);

  connect(m_doneButton, SIGNAL(clicked()), this, SLOT(onDoneClicked()));
  connect(m_cancelButton, SIGNAL(clicked()), this, SLOT(onCancelClicked()));
  connect(m_defaultButton,SIGNAL(clicked()), this, SLOT(setDefaultSettings()));
  connect(m_proxyType, SIGNAL(currentIndexChanged(int)), this, SLOT(onProxyTypeChanged(int)));
  connect(m_cacheType, SIGNAL(currentIndexChanged(int)), this, SLOT(onCacheTypeChanged(int)));
  connect(m_cachePathButton, SIGNAL(clicked()), this, SLOT(onCachePathButtonClick()));
  connect(m_passwordCheckBox, SIGNAL(clicked(bool)), this, SLOT(onShowPasswordChecked(bool)));

  onProxyTypeChanged(m_proxyType->currentIndex());

  if( m_settings.value("magic").toString() != APP_MAGIC )
  {
    setDefaultSettings();
    createSettings();
  }

  initSettings();
  applyProxySettings();
}
Exemple #16
0
    << "-rp<#> - Set COM # port for remote link"
    << "-rs<#> - Remote link speed: 1=slowest, 2=slow, 3=medium, 4=fast"
    << "-sc - No case checking on symbols"
    << "-sd<dir> - Source file directory <dir>"
    << "-vd<dllname> - Use DLL <dllname> for video mode switching"
    << "-vg - Complete graphics screen save"
    << "-vn - 43/50 line display not allowed"
    << "-vp - Enable EGA/VGA palette save";
    foreach(QString s, sl3){
        menu3->addAction(s);
    }
    ui->toolButton_6->setMenu(menu3);
    connect(menu1,SIGNAL(triggered(QAction*)),this,SLOT(menu1_triggered(QAction*)));
    connect(menu2,SIGNAL(triggered(QAction*)),this,SLOT(menu2_triggered(QAction*)));
    connect(menu3,SIGNAL(triggered(QAction*)),this,SLOT(menu3_triggered(QAction*)));
    connect(ui->pushButton_2,SIGNAL(released()),this,SLOT(setDefaultSettings()));
}

asmSettings::~asmSettings()
{
    delete ui;
}

void asmSettings::menu1_triggered(QAction *a)
{
    ui->lineEdit_2->setText(ui->lineEdit_2->text()+' '+a->text().remove(a->text().indexOf(QRegExp(" - ")),a->text().length()-a->text().indexOf(QRegExp(" - "))));
}

void asmSettings::menu2_triggered(QAction *a)
{
    ui->lineEdit_4->setText(ui->lineEdit_4->text()+' '+a->text().remove(a->text().indexOf(QRegExp(" - ")),a->text().length()-a->text().indexOf(QRegExp(" - "))));
OMX_ERRORTYPE PcmSplitter::construct(void)
{
    OMX_ERRORTYPE error;
    OMX_U32 idx, nRoleCount=1;
    OMX_AUDIO_PARAM_PCMMODETYPE defaultPcmSettings;
    PcmSplitter_PcmPort *pcmsplitterPort;

    error = AFM_Component::construct(NB_OUTPUT_PORTS + NB_INPUT_PORTS, nRoleCount,mIsHost);
    if (error != OMX_ErrorNone) return error;

    ENS_String<25> role;
    // Same roles for ARM and DSP
    role = "audio_splitter.pcm";
    role.put((OMX_STRING)mRoles[0]);

    setActiveRole(mRoles[0]);

    mBlockSize = DEFAULT_PCM_BLOCKSIZE;
    defaultPcmSettings.nSize          = sizeof(OMX_AUDIO_PARAM_PCMMODETYPE);
    defaultPcmSettings.eNumData       = OMX_NumericalDataSigned;
    defaultPcmSettings.eEndian        = OMX_EndianLittle;
    defaultPcmSettings.bInterleaved   = OMX_TRUE;
    defaultPcmSettings.ePCMMode       = OMX_AUDIO_PCMModeLinear;
    defaultPcmSettings.nBitPerSample  = 16;

    defaultPcmSettings.nChannels      = 2;
    defaultPcmSettings.nSamplingRate  = 48000;
    defaultPcmSettings.nPortIndex     = 0;

    defaultPcmSettings.eChannelMapping[0] = OMX_AUDIO_ChannelLF;
    defaultPcmSettings.eChannelMapping[1] = OMX_AUDIO_ChannelRF;

    //Create PcmSplitter Input Port
    pcmsplitterPort =
        new PcmSplitter_PcmPort(0,
                OMX_DirInput,
                mBlockSize * defaultPcmSettings.nChannels * defaultPcmSettings.nBitPerSample/8,
                defaultPcmSettings,
                *this);

    if (pcmsplitterPort == 0) {
        return OMX_ErrorInsufficientResources;
    }

    addPort(pcmsplitterPort);
    if (mIsHost == OMX_TRUE) {
        pcmsplitterPort->setSupportedProprietaryComm(AFM_HOST_PROPRIETARY_COMMUNICATION);
    } else {
        pcmsplitterPort->setSupportedProprietaryComm(AFM_MPC_PROPRIETARY_COMMUNICATION);;
    }

    //Create PcmSplitter Output Ports
    for (idx=1; idx<getPortCount(); idx++) {
        defaultPcmSettings.nPortIndex = idx;
        pcmsplitterPort = new PcmSplitter_PcmPort(
                idx,
                OMX_DirOutput,
                mBlockSize * defaultPcmSettings.nChannels * defaultPcmSettings.nBitPerSample/8,
                defaultPcmSettings,
                *this);

        if (pcmsplitterPort == 0) {
            return OMX_ErrorInsufficientResources;
        }

        addPort(pcmsplitterPort);
        if (mIsHost == OMX_TRUE) {
            pcmsplitterPort->setSupportedProprietaryComm(AFM_HOST_PROPRIETARY_COMMUNICATION);
        } else {
            pcmsplitterPort->setSupportedProprietaryComm(AFM_MPC_PROPRIETARY_COMMUNICATION);;
        }
    }

    setDefaultSettings();

    return OMX_ErrorNone;
}
Exemple #18
0
int main(int argc, char** argv)
{

//#define CHECK_FPU_EXCEPTIONS 1
#ifdef CHECK_FPU_EXCEPTIONS

	int cw = _control87(0, 0);

	// Set the exception masks off, turn exceptions on
	cw &= ~(EM_ZERODIVIDE | EM_INVALID);

	printf("control87 = %#x\n", cw);

	// Set the control word
	_control87(cw, MCW_EM);
#endif //CHECK_FPU_EXCEPTIONS


	setDefaultSettings();
	
	int bulletVersion = btGetVersion();
	printf("Bullet version %d\n",bulletVersion);

	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE |GLUT_DEPTH | GLUT_STENCIL);
	glutInitWindowSize(width, height);
	mainWindow = glutCreateWindow("http://bulletphysics.com");
#ifdef BT_USE_FREEGLUT
	glutSetOption (GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_GLUTMAINLOOP_RETURNS);
#endif
	entry = g_demoEntries + testIndex;
	demo = CreatDemo(entry);
	
	glutDisplayFunc(SimulationLoop);
	GLUI_Master.set_glutReshapeFunc(Resize);  
	GLUI_Master.set_glutKeyboardFunc(Keyboard);
	GLUI_Master.set_glutSpecialFunc(KeyboardSpecial);
	GLUI_Master.set_glutSpecialUpFunc(KeyboardSpecialUp);
	GLUI_Master.set_glutMouseFunc(Mouse);
	glutMotionFunc(MouseMotion);


	glui = GLUI_Master.create_glui_subwindow( mainWindow, 
		GLUI_SUBWINDOW_RIGHT );

	

	glui->add_statictext("Tests");
	GLUI_Listbox* testList =
		glui->add_listbox("", &testSelection);
	glui->add_button("Next Scene", 0,(GLUI_Update_CB)NextScene);

	glui->add_separator();

	GLUI_Spinner* iterationSpinner =
		glui->add_spinner("Iterations", GLUI_SPINNER_INT, &iterationCount);
	iterationSpinner->set_int_limits(1, 250);

/*	GLUI_Spinner* hertzSpinner =
		glui->add_spinner("Hertz", GLUI_SPINNER_FLOAT, &hz);
	hertzSpinner->set_float_limits(5.0f, 200.0f);
*/

	
	glui->add_checkbox("DisableDeactivation", &gDebugNoDeactivation);
	glui->add_checkbox("Split Impulse", &gUseSplitImpulse);
	GLUI_Spinner* spinner = 0;

	spinner = glui->add_spinner("ERP", GLUI_SPINNER_FLOAT, &gErp);
//	spinner->set_float_limits(0.f,1.f);
//	spinner = glui->add_spinner("ERP2", GLUI_SPINNER_FLOAT, &gErp2);
	spinner->set_float_limits(0.f,1.f);
	spinner = glui->add_spinner("Slop", GLUI_SPINNER_FLOAT, &gSlop);
	spinner->set_float_limits(0.f,1.f);
//	spinner = glui->add_spinner("WSP", GLUI_SPINNER_FLOAT,&gWarmStartingParameter);
//	spinner->set_float_limits (0.f,1.0);
	glui->add_checkbox("Warmstarting", &gUseWarmstarting);
	glui->add_checkbox("Randomize Constraints", &gRandomizeConstraints);
	

	glui->add_button("Reset Defaults", 0,(GLUI_Update_CB)setDefaultSettingsAndSync);
	glui->add_separator();

	GLUI_Panel* drawPanel =	glui->add_panel("Debug Draw");

	glui->add_checkbox_to_panel(drawPanel, "AABBs", &gDrawAabb);
	glui->add_checkbox_to_panel(drawPanel, "Wireframe", &gWireFrame);
	glui->add_checkbox_to_panel(drawPanel, "Contacts", &gDebugContacts);
	glui->add_checkbox_to_panel(drawPanel, "Textures", &gDrawTextures);
	glui->add_checkbox_to_panel(drawPanel, "Shadows", &gDrawShadows);
	glui->add_checkbox_to_panel(drawPanel, "Clusters", &gDrawClusters);

	int testCount = 0;
	btDemoEntry* e = g_demoEntries;
	while (e->createFcn)
	{
		testList->add_item(testCount, e->name);
		++testCount;
		++e;
	}
	
	glui->add_separator();

	glui->add_button("Toggle Pause", 0,(GLUI_Update_CB)TogglePause);
	
	glui->add_button("Single Step", 0,(GLUI_Update_CB)SingleSimulationStep);
	glui->add_button("Reset Scene", 0,(GLUI_Update_CB)ResetScene);
	glui->add_button("Restart Scene", 0,(GLUI_Update_CB)RestartScene);

	glui->add_separator();
	
//	glui->add_button("Exit", 0,(GLUI_Update_CB)exit);

	glui->set_main_gfx_window( mainWindow );

	// Use a timer to control the frame rate.
	glutTimerFunc(framePeriod, Timer, 0);

	glutMainLoop();

	return 0;
}
Exemple #19
0
void	setDefaultSettingsAndSync()
{
	setDefaultSettings();
	glui->sync_live();
}