示例#1
0
networkDialog::networkDialog(MainWindow *parent, gpibSocket *gpibSocket) :
    QDialog(parent),
    ui(new Ui::networkDialog)
{
    ui->setupUi(this);
    w=parent;
    this->gpib=gpibSocket;

    connect(ui->lockButton,SIGNAL(toggled(bool)),this,SLOT(lockCurrentServer(bool)));
    connect(ui->searchButton,SIGNAL(clicked()),this,SLOT(searchServers()));
    connect(gpib,SIGNAL(serverFound(QHostAddress)),this,SLOT(serverFound(QHostAddress)));
    connect(this,SIGNAL(accepted()),this,SLOT(setCurrentServer()));
    connect(gpib,SIGNAL(serverIdleRunning(bool)),this,SLOT(setServerStatus(bool)));
    connect(gpib,SIGNAL(serverInterval(int)),this,SLOT(setServerInterval(int)));
    connect(ui->refreshButton,SIGNAL(clicked()),SLOT(refreshButtonClicked()));
    connect(ui->startStopButton,SIGNAL(clicked(bool)),SLOT(startStopButtonClicked(bool)));



    if (!gpib->getServerAddress().isNull()) {
        ui->serversComboBox->insertItem(0,gpib->getServerAddress().toString());
        ui->lockButton->setChecked(true);
        ui->settingsGroupBox->setEnabled(true);
        this->refreshButtonClicked();
    } else {
        gpib->scan();
    }



}
示例#2
0
GomokuWindow::GomokuWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow),
    m_client(new LocalClient(this))
{
    ui->setupUi(this);

    connect(ui->createServer, SIGNAL(clicked(bool)),
            this, SLOT(createServer()));

    connect(ui->message, SIGNAL(returnPressed()),
            this, SLOT(sendMessage()));

    connect(ui->sendButton, SIGNAL(clicked(bool)),
            this, SLOT(sendMessage()));

    m_serverDiscovery = new ServerDiscovery(this);
    m_server = new Server(this);

    connect(m_server, SIGNAL(serverStarted(quint16)),
            this, SLOT(addServerToDiscovery(quint16)));

    connect(m_server, SIGNAL(messageReceived(QString,QString)),
            this, SLOT(onServerMessageReceived(QString,QString)));

    connect(m_serverDiscovery,SIGNAL(serverFound(QString,quint16)),
            this, SLOT(addServer(QString,quint16)));

    connect(m_client, SIGNAL(messageReceived(QString,QString)),
            this, SLOT(addMessage(QString,QString)));

    connect(m_client, SIGNAL(connected()),
            this, SLOT(onClientConnected()));

    connect(m_client, SIGNAL(participantsReceived(QList<int>,QStringList)),
            this, SLOT(participantsOnReceived(QList<int>,QStringList)));

    m_serverDiscovery->discoveryServer();
}