Exemple #1
0
MainWindow::MainWindow(Controller *c) :
    QMainWindow(0),
    ui(new Ui::MainWindow)
{
    controller = c;

    ui->setupUi(this);

    // Controller -> Main window
    connect(controller, &Controller::signalDataReceived,
            this, &MainWindow::processResponse);
    connect(controller, &Controller::signalStatusChange,
            this, &MainWindow::processStatus);
    connect(controller, &Controller::signalDisplayThermalImage,
            this, &MainWindow::processThermalImage);

    SetupDialog dlg;
    if (dlg.exec() == QDialog::Accepted) {
        controller->connectPort(dlg.getSelectedSerialPort());
        ui->statusBar->showMessage("Status: Connecting...");
    } else {
        exit(0);
    }

    ui->thermalImage->setStyleSheet("QLabel { background-color : black; }");
    ui->thermalImage->setMouseTracking(true);
    ui->thermalImage->installEventFilter(this);

    ui->thermalScale->setPixmap(QPixmap::fromImage(getScale()).scaled(ui->thermalScale->size(),
                                                                 Qt::KeepAspectRatio,
                                                                 Qt::FastTransformation));
}
Exemple #2
0
void Game::start(){
	SetupDialog setup;
	if(setup.exec()) {
		start(setup.hostAddress(),8200);
	}

}
void MainWindow::on_actionNew_triggered()
{
    SetupDialog dialog;
    dialog.setModal(true);
    if(dialog.exec() != dialog.Accepted)
        return;
    int port = dialog.getPort();
    int xSize = dialog.xSize();
    int ySize = dialog.ySize();
    Server *tmpState = new Server(port, xSize, ySize);

    line = new Line(tmpState);
    rect = new Rect(tmpState);
    freeHand = new FreeHand(tmpState);
    text = new Text(tmpState);
    ellips = new Ellips(tmpState);
    fill = new Fill(tmpState);
    erasor = new Eraser(tmpState);

    ui->canvas->setActiveState(tmpState);
    ui->canvas->setActiveTool(fill);
    text->setState(tmpState);
    delete state;
    state = tmpState;
}
MainWindow::MainWindow(QWidget * parent):
    QMainWindow(parent), ui(new Ui::MainWindow)
{
	ui->setupUi(this);

    SetupDialog dialog;
    dialog.setModal(true);
    if(dialog.exec() != dialog.Accepted)
        exit(0);
    int port = dialog.getPort();
    if(dialog.isServer() && dialog.newFile()) {
        QString fileName = QFileDialog::getOpenFileName(this,
                                                            "Save Image",                                 // Caption
                                                            "",                                           // Default selection
                                                             "Images (*.png *.jpg);;XML files (*.xml);;All files (*)"); // Filter
            QImage image;
            image.load(fileName);
            state = new Server(port, image.width(), image.height());
            state->draw(&image);
    } else if(dialog.isServer()) {
        int xSize = dialog.xSize();
        int ySize = dialog.ySize();
        state = new Server(port, xSize, ySize);
    } else {
        QHostAddress host = QHostAddress(dialog.hostName());
        cout << "We're a client with the host address: ";
        cout << dialog.hostName().toStdString() << endl;
        state = new Client(host, port);
    }

    ui->statusBar->showMessage(state->getStatus());
    line = new Line(state);
    rect = new Rect(state);
    freeHand = new FreeHand(state);
    text = new Text(state);
    ellips = new Ellips(state);
    fill = new Fill(state);
    erasor = new Eraser(state);
    paste = new Paste(state);

    ui->canvas->setActiveState(state);
    ui->canvas->setActiveTool(freeHand);
    text->setState(state);

    connect(ui->colorPanel, SIGNAL(colorInPanelChanged(QColor)), this, SLOT(colorChanged(QColor)));
//    connect(ui->canvas, SIGNAL(mouseMovedTo(QString)), ui->statusBar, SLOT(showMessage(QString)));
    connect(state, SIGNAL(statusChanged()), this, SLOT(updateStatus()));
    ui->canvas->setMinimumSize(QSize(state->getImage()->width(), state->getImage()->height()));
}
int CoreApplication::initialize()
{
    parseArgs();

    QSettings settings;
    if(!settings.value("application/wizardDone", false).toBool())
    {
        // Show the first time setup dialog
        SetupDialog wizard;
        connect(&wizard, SIGNAL(registerMachine(QString,QString,QString,QString,QString,QString))
                , &_taskManager, SLOT(registerMachine(QString,QString,QString,QString,QString,QString)));
        connect(&_taskManager, SIGNAL(registerMachineStatus(TaskStatus,QString)) , &wizard
                ,SLOT(registerMachineStatus(TaskStatus, QString)));
        connect(&_taskManager, SIGNAL(idle(bool)), &wizard, SLOT(updateLoadingAnimation(bool)), Qt::QueuedConnection);

        if(QDialog::Rejected == wizard.exec())
        {
            quit(); // if we're running in the loop
            return FAILURE; // if called from main
        }
    }