Example #1
0
void MathTest::onUserName()
{
    if((userNameEdit->text() != userName)
    && (userNameEdit->text() != "")) {
        openResultFile();
        getDefaults();
    }
}
Example #2
0
File: rui.c Project: Maxsl/r-source
void readconsolecfg()
{
    char  fn[128];
    int   sty = Plain;
    char  optf[PATH_MAX+1];

    struct structGUI gui;

    getDefaults(&gui);

    if (R_LoadRconsole) {
	snprintf(optf, PATH_MAX+1, "%s/Rconsole", getenv("R_USER"));
	if (!loadRconsole(&gui, optf)) {
	    snprintf(optf, PATH_MAX+1, "%s/etc/Rconsole", getenv("R_HOME"));
	    if (!loadRconsole(&gui, optf)) {
		app_cleanup();
		RConsole = NULL;
		exit(10);
	    }
	}
    }
    if (gui.tt_font) {
	strcpy(fn, "TT ");
	strcpy(fn+3, gui.font);
    } else strcpy(fn, gui.font);

    MDIsize = gui.MDIsize;

    if (gui.MDI)  RguiMDI |= RW_MDI;
    else          RguiMDI &= ~RW_MDI;

    if (MDIset == 1)  RguiMDI |= RW_MDI;
    if (MDIset == -1) RguiMDI &= ~RW_MDI;

    if (gui.toolbar) RguiMDI |= RW_TOOLBAR;
    else	     RguiMDI &= ~RW_TOOLBAR;
    if (gui.statusbar) RguiMDI |= RW_STATUSBAR;
    else	       RguiMDI &= ~RW_STATUSBAR;

    if (!strcmp(gui.style, "normal")) sty = Plain;
    if (!strcmp(gui.style, "bold")) sty = Bold;
    if (!strcmp(gui.style, "italic")) sty = Italic;

    Rwin_graphicsx = gui.grx;
    Rwin_graphicsy = gui.gry;

    if(strlen(gui.language)) {
	char *buf = malloc(50);
	snprintf(buf, 50, "LANGUAGE=%s", gui.language);
	putenv(buf);
    }
    setconsoleoptions(fn, sty, gui.pointsize, gui.crows, gui.ccols,
		      gui.cx, gui.cy,
		      gui.guiColors,
		      gui.prows, gui.pcols, gui.pagerMultiple, gui.setWidthOnResize,
		      gui.cbb, gui.cbl, gui.buffered, gui.cursor_blink);
}
Example #3
0
MathTest::MathTest(QPoint origin, QWidget *parent) :
    QDialog(parent)
{
    setWindowFlags(Qt::Window); // min, max and close buttons
    setGeometry(origin.x(), origin.y(), mt::winWid, mt::winHgt);
    QpAppStyle style;
    setStyleSheet(*style.getAppStyle());

    initDisplay();

    bRunning = false;
    bFirstPass = true;
    iTotalCount = 0;
    pGradesPopup = new QMessageBox;
    resultFileName = QString("");
    resultFile = new QpFile(pMsg);
    resultStream = new QTextStream(resultFile);

    getDefaults();
    getMaxops();
}
void SchemaDB::initPerStatement(NABoolean lightweight)
{
  if (!lightweight) {
    //CMPASSERT(domainDList_.entries() == 0);
    //CMPASSERT(valueDArray_.entries() == 1);
    //CMPASSERT(tableDB_.entries() == 0);

    // WE CANNOT DO THIS HERE:
    //	TransMode::IsolationLevel il;
    //	if (getDefaults().getIsolationLevel(il))
    //	  CmpCommon::transMode()->isolationLevel() = il;
    // BECAUSE THEN WE'D BE RESETTING DURING A TXN UNDER THE AEGIS OF
    // A "SET TRANSACTION" STMT, WHICH WOULD BE WRONG...
    // Instead, a] CmpCommon::transMode() init's itself once,
    // and b] NADefaults::validateAndInsert() updates CmpCommon::transMode glob
    // when necessary...
  }

  // The defaults table contains EXTERNAL names (and has validated them).
  // The SchemaName object we fill in here has to be INTERNAL format.

  // First, ensure the NADefaults and the SqlParser_NADefaults globals
  // have been initialized.
  //
  NAString cat, sch;
  getDefaults().getCatalogAndSchema(cat, sch);

  // NB: These two ToInternalIdentifier() calls are essential to making
  // delimited identifiers work properly. Is it not useless emitting their
  // return codes into cerr? Would it not be better to CMPASSERT them instead?
  Lng32 err1, err2;
  err1 = ToInternalIdentifier(cat);
  err2 = ToInternalIdentifier(sch);
    if (err1 || err2)
      cerr << err1 << ' ' << cat << '\t'
	   << err2 << ' ' << sch << endl;
  defaultSchema_.setCatalogName(cat);
  defaultSchema_.setSchemaName (sch);

}
Example #5
0
void getActive(Gui gui)
{
    rect r;
    ConsoleData p;
    if (RConsole && (p = (ConsoleData) getdata(RConsole))) {

	gui->toolbar = ((RguiMDI & RW_TOOLBAR) != 0);
	gui->statusbar = ((RguiMDI & RW_STATUSBAR) != 0);
	gui->MDI = ((RguiMDI & RW_MDI) != 0);
	gui->pagerMultiple = pagerMultiple;
	{
	    const char *p = getenv("LANGUAGE");
	    strcpy(gui->language, p ? p : "");
	}

	/* Font, pointsize, style */

	gui->tt_font = FALSE;
	{
	    const char *pf;
	    if ((strlen(fontname) > 1) &&
		(fontname[0] == 'T') && (fontname[1] == 'T')) {
		gui->tt_font = TRUE;
		for (pf = fontname+2; isspace(*pf) ; pf++);
	    } else pf = fontname;
	    strcpy(gui->font, pf);
	}

	gui->pointsize = pointsize;

	if (fontsty & Italic) strcpy(gui->style, "italic");
	else if (fontsty & Bold) strcpy(gui->style, "Bold");
	else strcpy(gui->style, "normal");

	/* Console size, set widthonresize */
	gui->crows = ROWS;
	gui->ccols = COLS;
	r = GetCurrentWinPos(RConsole);
	gui->cx = r.x;
	gui->cy = r.y;
	gui->setWidthOnResize = setWidthOnResize;
	gui->cbb = p->lbuf->dim;
	gui->cbl = p->lbuf->ms;
	gui->buffered = consolebuffered;

	/* Pager size */
	gui->prows = pagerrow;
	gui->pcols = pagercol;

	/* Graphics window */
	gui->grx = Rwin_graphicsx;
	gui->gry = Rwin_graphicsy;

        /* Cursor blink */
        gui->cursor_blink = p->cursor_blink;
        
	/* Font colours */
	for (int i=0; i<numGuiColors; i++)
	    gui->guiColors[i] = guiColors[i];

	/* MDIsize is not currently a choice in the dialog, only in the Rconsole file, so is not set here */
	gui->warning[0] = 0;
    } else
	getDefaults(gui);
}
Example #6
0
void MathTest::onGo()
{
    int iCount = 0;

    // Only do this if we're not already running.
    //
    if(bRunning) {
        pMsg->sendAlert("Tests are already running.");
    }
    else {
        iTotalCount = 0;
        iTotalRight = 0;
        iGradeLevel = pGradeLevel->buttonGroup->checkedId();

        // Initialize the test matrix and the other global control
        // parameters.
        //
        for(int i = 0; i < op_boundary; i++)
        {
            if(pTests->widgetList[i]->isChecked()) {
                testMatrix[i].bOn = true;
                testMatrix[i].eOp = (op_t)i;
                testMatrix[i].iCount = pProblems->widgetList[i]->text().toInt();
                testMatrix[i].iPass = 0;
                testMatrix[i].iSeconds = pTimes->widgetList[i]->text().toInt();
                testMatrix[i].bFirst = true;
                iCount++;
            }
            else {
                testMatrix[i].bOn = false;
                testMatrix[i].eOp = op_boundary;
                testMatrix[i].iCount = 0;
                testMatrix[i].iPass = 0;
                testMatrix[i].bFirst = false;
            }
            testMatrix[i].iRight = 0;
            testMatrix[i].iWrong = 0;
            testMatrix[i].iScore = 0;
            testMatrix[i].qsGrade = "";
        }

        if(iCount == 0) {
            pMsg->sendAlert("No tests selected.\nPlease select a test.");
        }
        else {

            // If we have a file for this session, reopen it now.
            //
            if(!bFirstPass && !resultFile->isOpen()
            && (userNameEdit->text() == userName)
            && (userName != "")) {
                if (! resultFile->open(QIODevice::Append | QIODevice::Text))
                    pMsg->sendInfo("Continuing without appending to the file.");
            }

            if(bFirstPass || (userNameEdit->text() != userName)) {
                openResultFile();
                getDefaults();
            }

            if(bFirstPass)
                bFirstPass = false;

            setEditable(false);
            bRunning = true;
            testIndex = 0;
            rnd.clear();
            runTest();
        }
    }
}