Beispiel #1
0
 void SpringLayoutUi::setActive(bool active)
 {
   if (active && m_thread == NULL)
     onStartStop();
   else
     if (!active && m_thread != NULL)
       onStartStop();
 }
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    game = new Game();
    guitar = new Guitar();
    guitar->setGeometry(0,0,790,140);
    ui->verticalLayout->insertWidget(0,guitar);
    result = new QLabel();
    result->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Fixed);
    result->setAlignment(Qt::AlignCenter);
    ui->verticalLayout->addWidget(result);
    connect(ui->Note0,SIGNAL(clicked()),this,SLOT(onNote0()));
    connect(ui->Note1,SIGNAL(clicked()),this,SLOT(onNote1()));
    connect(ui->Note2,SIGNAL(clicked()),this,SLOT(onNote2()));
    connect(ui->Note3,SIGNAL(clicked()),this,SLOT(onNote3()));
    connect(ui->Note4,SIGNAL(clicked()),this,SLOT(onNote4()));
    connect(ui->Note5,SIGNAL(clicked()),this,SLOT(onNote5()));
    connect(ui->Note6,SIGNAL(clicked()),this,SLOT(onNote6()));
    connect(ui->start,SIGNAL(clicked()),this,SLOT(onStartStop()));
    connect(game,SIGNAL(statusChanged()),this,SLOT(updateScore()));
    connect(game,SIGNAL(positionChanged(QPoint)),guitar,SLOT(setPosition(QPoint)));

    updateScore();
}
NetworkClientWidget::NetworkClientWidget(RawTcpListener *nlistener, QWidget *parent) :
    QWidget(parent),
    ui(new Ui::NetworkClientWidget)
{
    listener = nlistener;
    ui->setupUi(this);
    ui->startStopPushButton->setIcon(QIcon(":/Images/icons/media-playback-start.png"));
    ui->startStopPushButton->setText(START_STRING);

    connect(ui->startStopPushButton, SIGNAL(clicked()), SLOT(onStartStop()));
    connect(ui->restartPushButton, SIGNAL(clicked()), SLOT(onRestart()));

    if (listener != NULL) {
        connect(this, SIGNAL(start()), listener, SLOT(startListening()));
        connect(this, SIGNAL(stop()), listener, SLOT(stopListening()));
        connect(this, SIGNAL(restart()), listener, SLOT(restart()));
        connect(listener, SIGNAL(connectionclosed()), this, SLOT(reset()));
    }

}