Example #1
0
    /**
      * Constructeur
      */
    JoinGameWindow::JoinGameWindow(QWidget *parent) :
    QWidget(parent)
    {
        setWindowTitle(tr("Reciprocity - Rejoindre une partie"));

        QVBoxLayout *layout = new QVBoxLayout;
        setLayout(layout);
        //On construit la form
        QFormLayout *form = new QFormLayout;
        layout->addLayout(form);
        //On ajoute le pseudo du joueur
        _login = new QLineEdit;
        form->addRow(tr("Pseudo à utiliser:"),_login);
        //On ajoute le hash du joueur
        _hash = new QLineEdit;
        form->addRow(tr("Hash:"),_hash);
            //On ajoute l'addresse du serveur
            _address = new QLineEdit;
            _address->setText("localhost");
        form->addRow(tr("Adresse du serveur:"),_address);
        //On ajoute le port
        _port = new QSpinBox;
        _port->setMinimum(1);
        _port->setMaximum(65535);
        _port->setValue(BaseConfig::SERVER_PORT);
        form->addRow(tr("Port:"),_port);
        //On ajoute le bouton
        QPushButton *connectButton = new QPushButton(tr("Se connecter !"));
        layout->addWidget(connectButton);
        connect(connectButton,SIGNAL(clicked()),this,SLOT(connectButton_clicked()));

    }
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    // serialport
    m_serial = new QSerialPort(this);

    connect(ui->eStop, SIGNAL(clicked()), this, SLOT(eStop_clicked()));//
    connect(ui->eStepPwr, SIGNAL(clicked()), this, SLOT(eStepPwr_clicked()));//
  //  connect(ui->spinBoxExtTarget, SIGNAL(valueChanged (int)), this, SLOT(extSpinbox_changed()));
    connect(ui->ExtUpX10, SIGNAL(clicked()), this, SLOT(extTarget_Up_10()));//
    connect(ui->ExtUpX1, SIGNAL(clicked()), this, SLOT(extTarget_Up_1()));//
    connect(ui->ExtDnX1, SIGNAL(clicked()), this, SLOT(extTarget_Dn_1()));//
    connect(ui->ExtDnX10, SIGNAL(clicked()), this, SLOT(extTarget_Dn_10()));//

    connect(ui->extEnable, SIGNAL(clicked()), this, SLOT(extEnable_clicked()));
//    connect(ui->spinBoxBedTarget, SIGNAL(valueChanged (int)), this, SLOT(bedSpinbox_changed()));
    connect(ui->BedUpX10, SIGNAL(clicked()), this, SLOT(bedTarget_Up_10()));//
    connect(ui->BedUpX1, SIGNAL(clicked()), this, SLOT(bedTarget_Up_1()));//
    connect(ui->BedDnX1, SIGNAL(clicked()), this, SLOT(bedTarget_Dn_1()));//
    connect(ui->BedDnX10, SIGNAL(clicked()), this, SLOT(bedTarget_Dn_10()));//

    connect(ui->bedEnable, SIGNAL(clicked()), this, SLOT(bedEnable_clicked()));
    connect(ui->getCode, SIGNAL(clicked()), this, SLOT(getCode_clicked()));
    connect(ui->exitButton, SIGNAL(clicked()), this, SLOT(exitButton_clicked()));
    connect(ui->searchButton, SIGNAL(clicked()), this, SLOT(searchButton_clicked()));
    connect(ui->comboBoxDevices, SIGNAL(activated(int)), this, SLOT(comboBoxDevices_clicked()));
    connect(ui->connectButton, SIGNAL(clicked()), this, SLOT(connectButton_clicked()));//
    connect(ui->comboBoxFiles, SIGNAL(activated(int)), this, SLOT(comboBoxFiles_clicked()));
    connect(ui->waittempsButton, SIGNAL(clicked()), this, SLOT(waittempsButton_clicked()));

    m_chartScene.setSceneRect(0, 0, 600, 280);
    m_chartScene.setBackgroundBrush(Qt::white);

    QTimer *timer = new QTimer(this);
    connect(timer, SIGNAL(timeout()), this, SLOT(periodic_update()));

    ui->comboBoxDevices->addItem("Select a Device to connect to","");
    ui->comboBoxFiles->addItem("No \"g\" code file selected","");
    ui->eStop->setStyleSheet("background-color: #00C000; border-radius: 5px; color : #ffffff;");

    timer->start(1000);
}