BallViewer::BallViewer(QWidget* parent): QWidget(parent), visionBallOut(base()), odometryOut(base()), localizationOut(base()) { ballPainter = new BallViewerPainter(this); mainLayout = new QVBoxLayout(this); //GUI zoomInButton = new QPushButton("+", this); zoomOutButton = new QPushButton("-", this); paintLogBox = new QCheckBox("Log", this); paintOfflineBox = new QCheckBox("Offline", this); field = new QHBoxLayout(); field->addWidget(ballPainter); resizeLayout = new QHBoxLayout(); resizeLayout->addWidget(zoomInButton); resizeLayout->addWidget(zoomOutButton); checkBoxes = new QHBoxLayout(); checkBoxes->addWidget(paintLogBox); checkBoxes->addWidget(paintOfflineBox); ballStateLayout = new QHBoxLayout(); logState = new QLabel(this); logState->setText("?"); offState = new QLabel(this); offState->setText("?"); ballStateLayout->addWidget(logState); ballStateLayout->addWidget(offState); // Connect the resize paintfield buttons connect(zoomInButton, SIGNAL(released()), ballPainter, SLOT(handleZoomIn())); connect(zoomOutButton, SIGNAL(released()), ballPainter, SLOT(handleZoomOut())); // Connect paint options connect(paintLogBox, SIGNAL(toggled(bool)), ballPainter, SLOT(paintLogAction(bool))); connect(paintOfflineBox, SIGNAL(toggled(bool)), ballPainter, SLOT(paintOfflineAction(bool))); mainLayout->addLayout(checkBoxes); mainLayout->addLayout(resizeLayout); mainLayout->addLayout(field); mainLayout->addLayout(ballStateLayout); this->setLayout(mainLayout); //Setup offline balltrack trackMod.visionBallInput.wireTo(&visionBallOut, true); trackMod.odometryInput.wireTo(&odometryOut, true); trackMod.localizationInput.wireTo(&localizationOut, true); subdiagram.addModule(trackMod); subdiagram.addModule(ballListen); ballListen.ballIn.wireTo(&trackMod.ballLocationOutput, true); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow), curPage(0), curQuestion(0), zoomFactor(1.0) { /* Set up the Qt user interface */ ui->setupUi(this); Global::setMainWindow(this); /* Set up a status bar in the main window */ QStatusBar *sb = statusBar(); QLabel *statusLabel = new QLabel (""); sb->addWidget(statusLabel); Global::setStatusLabel(statusLabel); /* Set up the GradeWindow and also fill the table with initial values from the database */ Global::setGradeWindow(new GradeWindow); /* Set up page change buttons */ connect(ui->pageLeft , SIGNAL(clicked()), this, SLOT(handlePagePrev())); connect(ui->pageRight, SIGNAL(clicked()), this, SLOT(handlePageNext())); connect(ui->studentPrev, SIGNAL(clicked()), this, SLOT(handleStudentPrev())); connect(ui->studentNext, SIGNAL(clicked()), this, SLOT(handleStudentNext())); connect(ui->questionPrev, SIGNAL(clicked()), this, SLOT(handleQuestionPrev())); connect(ui->questionNext, SIGNAL(clicked()), this, SLOT(handleQuestionNext())); connect(ui->zoomIn, SIGNAL(clicked()), this, SLOT(handleZoomIn())); connect(ui->zoomOut, SIGNAL(clicked()), this, SLOT(handleZoomOut())); connect(ui->zoomWidth, SIGNAL(clicked()), this, SLOT(handleZoomWidth())); connect(ui->zoomHeight, SIGNAL(clicked()), this, SLOT(handleZoomHeight())); connect(ui->zoomOne, SIGNAL(clicked()), this, SLOT(handleZoomOne())); /* Set up various actions */ connect(ui->actionSave, SIGNAL(triggered()), this, SLOT(handleSave())); connect(ui->actionGenPDFs, SIGNAL(triggered()), this, SLOT(handleGeneratePDFs())); connect(Global::gw()->getUI()->actionSave, SIGNAL(triggered()), this, SLOT(handleSave())); connect(ui->actionPagePrev, SIGNAL(triggered()), this, SLOT(handlePagePrev())); connect(ui->actionPageNext, SIGNAL(triggered()), this, SLOT(handlePageNext())); connect(ui->actionStudentPrev, SIGNAL(triggered()), this, SLOT(handleStudentPrev())); connect(ui->actionStudentNext, SIGNAL(triggered()), this, SLOT(handleStudentNext())); connect(ui->actionGradeWindow, SIGNAL(triggered()), Global::gw(), SLOT(handleGradeWindow())); connect(Global::gw()->getUI()->actionGradeWindow, SIGNAL(triggered()), Global::gw(), SLOT(handleGradeWindow())); connect(ui->actionResizeContents, SIGNAL(triggered()), Global::gw(), SLOT(handleResizeContents())); connect(ui->actionResizeLarge, SIGNAL(triggered()), Global::gw(), SLOT(handleResizeLarge())); connect(ui->actionResizeSmall, SIGNAL(triggered()), Global::gw(), SLOT(handleResizeSmall())); /* Detect user input in data entry fields */ connect(ui->studentId, SIGNAL(textEdited(const QString&)), this, SLOT(handleEditStudentId(const QString&))); connect(ui->studentName, SIGNAL(textEdited(const QString&)), this, SLOT(handleEditStudentName(const QString&))); connect(ui->questionScore, SIGNAL(textEdited(const QString&)), this, SLOT(handleEditQuestionScore(const QString&))); connect(ui->questionFeedback, SIGNAL(textEdited(const QString&)), this, SLOT(handleEditQuestionFeedback(const QString&))); connect(ui->questionMaximum, SIGNAL(textEdited(const QString&)), this, SLOT(handleEditQuestionMaximum(const QString&))); connect(ui->questionPage, SIGNAL(textEdited(const QString&)), this, SLOT(handleEditQuestionPage(const QString&))); connect(ui->action0_Points, SIGNAL(triggered()), this, SLOT(handleScore0())); connect(ui->action1_Point, SIGNAL(triggered()), this, SLOT(handleScore1())); connect(ui->action2_Points, SIGNAL(triggered()), this, SLOT(handleScore2())); connect(ui->action3_Points, SIGNAL(triggered()), this, SLOT(handleScore3())); connect(ui->action4_Points, SIGNAL(triggered()), this, SLOT(handleScore4())); connect(ui->action5_Points, SIGNAL(triggered()), this, SLOT(handleScore5())); connect(ui->action6_Points, SIGNAL(triggered()), this, SLOT(handleScore6())); connect(ui->action7_Points, SIGNAL(triggered()), this, SLOT(handleScore7())); connect(ui->action8_Points, SIGNAL(triggered()), this, SLOT(handleScore8())); connect(ui->actionEmpty_Points, SIGNAL(triggered()), this, SLOT(handleScoreEmpty())); /* Now set the first page and first question */ adjustPage(0); adjustQuestion(0); }