示例#1
0
void About::aboutInit()
{
  setModal(true);
  resize(400, 400);
  setWindowTitle("About");
  setWindowIcon(QIcon("icons/backupsoft.png"));

  QWidget *icon = new QWidget(this);
  icon->setStyleSheet("background-image: url(icons/backupsoft.png)");
  icon->setGeometry(250 , 10, 100, 100);

  QLabel *title = new QLabel("BackupSoft", this);
  title->setFont(QFont("Helvetica", 25, 10, false));
  title->setGeometry(10, 10, 200, 30);

  QLabel *version = new QLabel("Copyright 2010 by\nMichael Kohler and Fabian Gammenthaler\n\nVersion: 1.0", this);
  version->setFont(QFont("Helvetica", 8, 2, false));
  version->setGeometry(10, 70, 200, 55);

  QTextEdit *licence = new QTextEdit(this);
  licence->setGeometry(10, 160, 380, 230);
  licence->setReadOnly(true);

  QFile *file = new QFile("licence.txt");
  if (file->open(QIODevice::ReadOnly)) {
    QTextStream *stream = new QTextStream(file);
    licence->setText(stream->readAll());
  }
  else {
    QString errorMsg = "Could not open licence.txt.. Please make sure it is existent and readable.";
    AlertWindow *alertWin = new AlertWindow("ERROR", "", errorMsg);
    alertWin->show();
  }
}
示例#2
0
void Gui::newTab(QListWidgetItem *_item)
{
	for (int i = 0; i < _tabs->count(); ++i)
        if (_tabs->tabText(i) == _item->text()) return;
    QTextEdit *outputArea = new QTextEdit;
    outputArea->setReadOnly(true);
	_outputAreas.append(outputArea);
	outputArea->setGeometry(0,0,395,230);
    _tabs->addTab(outputArea,_item->text());
}
示例#3
0
 void CQTOpenGLMainWindow::POVRaySceneXMLPopUp() {
    /* Set the text window up */
    QTextEdit* pcPOVRayOutput = new QTextEdit();
    /* Calculate the geometry of the window so that it's 1/4 of the main window
       and placed in the exact center of it */
    QRect cGeom = geometry();
    cGeom.setBottomRight(geometry().center());
    cGeom.moveCenter(geometry().center());
    pcPOVRayOutput->setGeometry(cGeom);
    /* This window steals all input */
    pcPOVRayOutput->setWindowModality(Qt::ApplicationModal);
    /* You can't modify its contents (but can copy-paste them) */
    pcPOVRayOutput->setReadOnly(true);
    /* Set nice document name and window title */
    pcPOVRayOutput->setDocumentTitle("ARGoS-POVRay XML camera config");
    pcPOVRayOutput->setWindowTitle("ARGoS-POVRay XML camera config");
    /* Set the actual text to visualize */
    pcPOVRayOutput->setPlainText(GetPOVRaySceneXMLData());
    /* Finally, show the resulting window */
    pcPOVRayOutput->show();
 }
示例#4
0
void Gui::privateMessage(const QString &receiver, const QString &message)
{
#ifdef DEBUG
	qDebug() << "You got the private message";
#endif
	QTextEdit* outputArea = NULL;
	bool isNeededTab = false;
	for (int i = 0; i < _tabs->count(); ++i)
		if (_tabs->tabText(i) == receiver) 
		{
			_outputAreas.at(i)->append(receiver + ": " + message);
			isNeededTab = true;
			break;
		}
	if (isNeededTab) return;
	outputArea = new QTextEdit;
	outputArea->setReadOnly(true);
	_tabs->addTab(outputArea, receiver);
	_outputAreas.append(outputArea);
	outputArea->setGeometry(0,0,395,230);
	outputArea->append(receiver + ": " + message);
}
示例#5
0
void MathTest::initDisplay()
{
    int index;

    // Set the starting coordinates in pixels for the objects that will be
    // laid out.
    //
    const int tests_x = 20;     // x coord of left side of groups
    const int tests_y = 50;     // y coord of top of groups
    const int text_w = 80;      // Width of all text
    const int text_h = 14;      // Height of all text
    const int box_w = 60;       // Width of Edit Boxes and Labels
    const int box_h = 30;       // Height of all controls
    const int vs = 36;          // Vertical Span
    const int hs = 36;          // Horizontal span

    // Instantiate the Layout parameters.
    // See layout.h
    //
    LAYOUT_INIT()

    // Layout the Tests Checkboxes
    //
    LAYOUT(tests_x, tests_y, 0, vs)
    Twidget *tw = new Twidget;
    tw->objName = "Tests";
    tw->objText << "Add" << "Subtract" << "Multiply" << "Divide";
    tw->sizes   << QSize(text_w+10, box_h);
    tw->layout  << CELL(0,0) << CELL(0,1) << CELL(0,2) << CELL(0,3);
    tw->connect = false;
    //
    // Layout the Labels for number of Problems, time in Seconds, and Grade
    // Level.
    // These labels will "belong" to the pTests control group.
    //
    int label_x  = tests_x + text_w + hs;
    int label_y  = 14;
    int label_hs = box_w + hs;
    LAYOUT(label_x, label_y, label_hs, text_h)
    tw->labelText   << "Number of" << "Problems"
                    << "Time in" << "Seconds"
                    << "Grade" << "Level";
    tw->labelSizes  << QSize(text_w, text_h);
    tw->labelLayout << CELL(0,0) << CELL(0,1)
                    << CELL(1,0) << CELL(1,1)
                    << CELL(2,0) << CELL(2,1);
    pTests = new TButtonGroup <QCheckBox>(tw, this);

    // Layout the "Problems" QLineEdit boxes
    //
    tw = new Twidget;
    int prob_x = label_x;
    int prob_y = tests_y;
    LAYOUT(prob_x, prob_y, 0, vs)
    tw->objName = "Problems";
    tw->objText << "5" << "5" << "5" << "5";
    tw->sizes   << QSize(box_w, box_h);
    tw->layout  << CELL(0,0) << CELL(0,1) << CELL(0,2) << CELL (0,3);
    tw->connect = true;
    pProblems   = new TEditGroup <QLineEdit>(tw, this);
    for(index = 0; index < pProblems->widgetList.size(); index++)
        pProblems->widgetList[index]->setInputMask("00");

    // Layout the "Seconds" QLineEdit boxes
    //
    tw = new Twidget;
    int time_x = label_x + box_w + hs;
    int time_y = prob_y;
    LAYOUT(time_x, time_y, 0, vs);
    tw->layout  << CELL(0,0) << CELL(0,1) << CELL(0,2) << CELL(0,3);
    tw->objName = "Seconds";
    tw->objText << "10" << "10" << "25" << "30";
    tw->sizes   << QSize(box_w, box_h);
    tw->connect = false;
    pTimes      = new TEditGroup <QLineEdit>(tw, this);
    for(index = 0; index < pTimes->widgetList.size(); index++)
        pTimes->widgetList[index]->setInputMask("00");

    // Layout the Grade Level radiobuttons.
    //
    tw = new Twidget;
    int gl_x = time_x + box_w + hs - 10;
    int gl_y = time_y;
    LAYOUT(gl_x, gl_y, 0, vs);
    tw->layout << CELL(0,0) << CELL(0,1) << CELL(0,2) << CELL(0,3);
    tw->sizes << QSize(box_w - 10, box_h);
    tw->objText << "1" << "2" << "3" <<"4";
    tw->connect = true;
    tw->grouped = true;
    pGradeLevel = new TButtonGroup <QRadioButton>(tw, this);
    pGradeLevel->widgetList[gl_3]->setChecked(true);
    connect(pGradeLevel->buttonGroup, SIGNAL(buttonClicked(int)),
            this, SLOT(onGradeLevel(int)));

    // Layout the UserName box and its label
    //
    int userName_x = tests_x;
    int userName_y = tests_y + text_h + (4 * vs);
    int userNameEd_x = userName_x + text_w;
    int userNameEd_w = 250;
    userNameLabel = new QLabel(this);
    userNameLabel->setGeometry(userName_x, userName_y, text_w, text_h);
    userNameLabel->setText("Your Name:");
    userNameEdit = new QLineEdit(this);
    userNameEdit->setGeometry(userNameEd_x, userName_y, userNameEd_w, box_h);
    userNameEdit->setText("");
    userNameEdit->setCursorPosition(0);
    connect(userNameEdit, SIGNAL(returnPressed()), this, SLOT(onUserName()));

    // Create and connect the Start button.
    // Because this pushbutton's parent is QDialog, it will have its
    // autoDefault property set when instantiated. This can cause some very
    // confusing behavior if you don't know this. See "autoDefault" in the
    // QPushButton class reference. We will explicitly set this property
    // to FALSE for this button, and also set its "default" property to
    // FALSE.
    //
    const int pbw = 100;
    const int pbhs = 110;
    int goButton_x = tests_x+10;
    int goButton_y = userName_y + vs + 6;
    goButton = new QPushButton("Start", this);
    goButton->setGeometry(goButton_x, goButton_y, pbw, box_h);
    goButton->setAutoDefault(false);
    goButton->setDefault(false);
    connect(goButton, SIGNAL(clicked()), this, SLOT(onGo()));

    // Create and connect the stop button.
    //
    int stopButton_x = goButton_x + pbhs;
    int stopButton_y = goButton_y;
    stopButton = new QPushButton("Stop", this);
    stopButton->setGeometry(stopButton_x, stopButton_y, pbw, box_h);
    stopButton->setAutoDefault(false);
    stopButton->setDefault(false);
    connect(stopButton, SIGNAL(clicked()), this, SLOT(onStop()));

    // Create and connect the Default button.
    //
    int defaultButton_x = stopButton_x + pbhs;
    int defaultButton_y = goButton_y;
    defaultButton = new QPushButton("Defaults", this);
    defaultButton->setGeometry(defaultButton_x, defaultButton_y, pbw, box_h);
    defaultButton->setAutoDefault(false);
    defaultButton->setDefault(false);
    connect(defaultButton, SIGNAL(clicked()), this, SLOT(onDefault()));

    // Layout the Quiz and Answer Boxes and their labels
    //
    tw = new Twidget;
    int quiz_x = tests_x + 20;
    int quiz_y = goButton_y + vs;
    LAYOUT(quiz_x, quiz_y, hs + box_w+10, text_h)
    tw->labelLayout << CELL(0,0) << CELL(1,0) << CELL(2,0)
                    << CELL(0,1) << CELL(1,1) << CELL(2,1);
    tw->labelText   << "Problem" << "The" << "Your"
                    << "Number" << "Problem" << "Answer";
    tw->labelSizes  << QSize(text_w, text_h);
    LAYOUT(quiz_x, quiz_y+(2*text_h)+2, hs + box_w+10, 0)
    tw->objName = "Quiz";
    tw->objText << "";
    tw->sizes   << QSize(box_w, box_h)
                << QSize(box_w+30, box_h)
                << QSize(box_w+10, box_h);
    tw->hOffset << 20 << -5 << 0 << 20 << -5 << 0;
    tw->layout  << CELL(0,0) << CELL(1,0) << CELL(2,0);
    pQuiz = new TEditGroup <QLineEdit>(tw, this);
    //
    // Set the Quiz Box to ReadOnly and connect the returnPressed
    // signal from the Answer Box.
    //
    pQuiz->widgetList[qz_number]->setReadOnly(true);
    pQuiz->widgetList[qz_number]->setAlignment(Qt::AlignRight);
    pQuiz->widgetList[qz_quiz]->setReadOnly(true);
    pQuiz->widgetList[qz_answer]->setEnabled(true);
    pQuiz->widgetList[qz_answer]->setInputMask("0000");
    pQuiz->widgetList[qz_answer]->setCursor(Qt::IBeamCursor);
    pQuiz->widgetList[qz_answer]->setCursorPosition(0);
    QLineEdit *tempLineEdit = pQuiz->widgetList[qz_answer];
    connect (tempLineEdit, SIGNAL(returnPressed()),
        this, SLOT(onAnswer()));

    // Create the Message Box
    //
    int msg_x = tests_x;
    int msg_y = quiz_y + vs + (3 * text_h);
    int msg_w = 340;
    int msg_h = 180;
    QTextEdit* messages = new QTextEdit(this);
    messages->setGeometry(msg_x, msg_y, msg_w, msg_h);
    messages->setReadOnly(true);
    messages->setFocusPolicy(Qt::ClickFocus);
    messages->setUpdatesEnabled(true);
    pMsg = new Msg(messages);
}