Chat::Chat(QWidget *parent) : QDialog(parent), ui(new Ui_Chat) { //! [Construct UI] ui->setupUi(this); #if defined (Q_OS_SYMBIAN) || defined(Q_OS_WINCE) || defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) setWindowState(Qt::WindowFullScreen); #endif connect(ui->quitButton, SIGNAL(clicked()), this, SLOT(accept())); connect(ui->connectButton, SIGNAL(clicked()), this, SLOT(connectClicked())); connect(ui->sendButton, SIGNAL(clicked()), this, SLOT(sendClicked())); //! [Construct UI] //! [Create Chat Server] server = new ChatServer(this); connect(server, SIGNAL(clientConnected(QString)), this, SLOT(clientConnected(QString))); connect(server, SIGNAL(clientDisconnected(QString)), this, SLOT(clientDisconnected(QString))); connect(server, SIGNAL(messageReceived(QString,QString)), this, SLOT(showMessage(QString,QString))); connect(this, SIGNAL(sendMessage(QString)), server, SLOT(sendMessage(QString))); server->startServer(); //! [Create Chat Server] //! [Get local device name] localName = QBluetoothLocalDevice().name(); //! [Get local device name] }
//Slot for when send button is clicked void VideoControlsWidget::sendButtonClicked() { //emit sendClicked(); //Determine the width field and height field QString width(""); QString height(""); QString fps(""); #if !USE_COMBO_BOX width = this->leWidth->text(); height = this->leHeight->text(); fps = leFPS->text(); #else QStringList res = this->cbResolution->currentText().split("x"); width = res.at(0); height = res.at(1); fps = this->cbFps->currentText(); #endif //Check to see if all of the fields have been filled if(width == "" || height == "" || fps == "" || this->lebitRate->text() == "") { //Create a message box to indicate error QMessageBox msgBox; msgBox.setText("All fields must be filled!"); int ret = msgBox.exec(); } else { //Inform the parent to resize the video emit sendClicked(width, height, fps, lebitRate->text()); } }
Chat::Chat(QWidget *parent) : QDialog(parent), currentAdapterIndex(0), ui(new Ui_Chat) { ui->setupUi(this); connect(ui->quitButton, SIGNAL(clicked()), this, SLOT(accept())); connect(ui->connectButton, SIGNAL(clicked()), this, SLOT(connectClicked())); connect(ui->sendButton, SIGNAL(clicked()), this, SLOT(sendClicked())); localAdapters = QBluetoothLocalDevice::allDevices(); if (localAdapters.count() < 2) { ui->localAdapterBox->setVisible(false); } else { //we ignore more than two adapters ui->localAdapterBox->setVisible(true); ui->firstAdapter->setText(tr("Default (%1)", "%1 = Bluetooth address"). arg(localAdapters.at(0).address().toString())); ui->secondAdapter->setText(localAdapters.at(1).address().toString()); ui->firstAdapter->setChecked(true); connect(ui->firstAdapter, SIGNAL(clicked()), this, SLOT(newAdapterSelected())); connect(ui->secondAdapter, SIGNAL(clicked()), this, SLOT(newAdapterSelected())); QBluetoothLocalDevice adapter(localAdapters.at(0).address()); adapter.setHostMode(QBluetoothLocalDevice::HostDiscoverable); } server = new ChatServer(this); connect(server, SIGNAL(clientConnected(QString)), this, SLOT(clientConnected(QString))); connect(server, SIGNAL(clientDisconnected(QString)), this, SLOT(clientDisconnected(QString))); connect(server, SIGNAL(messageReceived(QString,QString)), this, SLOT(showMessage(QString,QString))); connect(this, SIGNAL(sendMessage(QString)), server, SLOT(sendMessage(QString))); server->startServer(); localName = QBluetoothLocalDevice().name(); }
void ConfigWidget::makeConnections() { // networkPage Connections connect(networkPage, SIGNAL(ipChanged(QString)), udpClient, SLOT(setOtherNodeAddress(QString))); connect(networkPage, SIGNAL(portChanged(int)), udpClient, SLOT(setOtherNodePort(int))); // settingsPage Connections connect(settingsPage, SIGNAL(connectClicked()), udpClient, SLOT(startSocket())); connect(settingsPage, SIGNAL(sendClicked(QString)), udpClient, SLOT(sendUserCommand(QString))); connect(settingsPage, SIGNAL(disconnectClicked()), udpClient, SLOT(stopSocket())); connect(settingsPage, SIGNAL(configFileSelected(QString)), ConfigFileHandler::instance(), SLOT(handleFile(QString))); // consolePage Connections connect(consolePage, SIGNAL(startClicked()), this, SLOT(startConsoleStream())); connect(consolePage, SIGNAL(stopClicked()), this, SLOT(stopConsoleStream())); // ConfigFileHandler Connections connect(ConfigFileHandler::instance(), SIGNAL(commandFromFile(QString)), udpClient, SLOT(sendUserCommand(QString))); // udpClient Connection connect(udpClient, SIGNAL(dataReplyReceived(QString)), settingsPage, SLOT(addToViewer(QString))); connect(udpClient, SIGNAL(connectionChanged(bool)), networkPage, SLOT(adjustToConnection(bool))); connect(udpClient, SIGNAL(connectionChanged(bool)), settingsPage, SLOT(adjustToConnection(bool))); connect(udpClient, SIGNAL(connectionChanged(bool)), consolePage, SLOT(adjustToConnection(bool))); }
void SendPacketButton::init() { //QDEBUG() << " sendButton connect attempt:" << connect(this, SIGNAL(clicked()), this, SLOT(sendClicked())); }
ServerTester::ServerTester(QWidget *parent): QWidget(parent), m_connected(0) { this->setWindowTitle("KBang Server Tester"); mp_lineEditAddress = new QLineEdit; mp_lineEditAddress->setText("127.0.0.1"); mp_lineEditAddress->setMaxLength(15); mp_lineEditAddress->setInputMask("009.009.009.009; "); mp_lineEditAddress->setMaximumWidth(100); mp_lineEditPort = new QLineEdit; mp_lineEditPort->setText("6543"); mp_lineEditPort->setMaxLength(6); mp_lineEditPort->setMaximumWidth(40); QValidator *portValidator = new QIntValidator(1, 65535, this); mp_lineEditPort->setValidator(portValidator); mp_pushButtonConnect = new QPushButton; mp_pushButtonConnect->setText("Connect"); mp_pushButtonConnect->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed); mp_layoutButtons = new QGridLayout; mp_layoutConnect = new QHBoxLayout; mp_layoutConnect->addWidget(mp_lineEditAddress); mp_layoutConnect->addWidget(mp_lineEditPort); mp_layoutConnect->addWidget(mp_pushButtonConnect); mp_textEditViewXml = new QTextEdit; mp_textEditViewXml->setReadOnly(1); mp_textEditViewXml->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); mp_textEditInputXml = new QTextEdit; mp_textEditInputXml->setMaximumHeight(100); mp_pushButtonSendXml = new QPushButton; mp_pushButtonSendXml->setText("Send"); mp_pushButtonSendXml->setEnabled(0); mp_layoutXmlInput = new QHBoxLayout; mp_layoutXmlInput->addWidget(mp_textEditInputXml); mp_layoutXmlInput->addWidget(mp_pushButtonSendXml); mp_layoutLeftSide = new QVBoxLayout; mp_layoutLeftSide->addWidget(mp_textEditViewXml); mp_layoutLeftSide->addLayout(mp_layoutXmlInput); mp_layoutRightSide = new QVBoxLayout; mp_layoutRightSide->addLayout(mp_layoutConnect); mp_layoutRightSide->addLayout(mp_layoutButtons); mp_layoutRightSide->addStretch(); mp_layoutRightSide->setSizeConstraint(QLayout::SetFixedSize); //mp_layoutRightSide mp_layoutMain = new QHBoxLayout; mp_layoutMain->addLayout(mp_layoutLeftSide); mp_layoutMain->addLayout(mp_layoutRightSide); //mp_layoutMain->setStretchFactor(mp_layoutLeftSide, 30); //mp_layoutMain->setStretchFactor(mp_layoutRightSide, 10); setLayout(mp_layoutMain); show(); QObject::connect(mp_pushButtonConnect, SIGNAL(clicked()), this, SLOT(connectClicked())); QObject::connect(mp_pushButtonSendXml, SIGNAL(clicked()), this, SLOT(sendClicked())); QObject::connect(&m_tcpSocket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(tcpSocketError())); QObject::connect(&m_tcpSocket, SIGNAL(readyRead()), this, SLOT(incomingData())); QObject::connect(&m_tcpSocket, SIGNAL(connected()), this, SLOT(connected())); QObject::connect(&m_tcpSocket, SIGNAL(disconnected()), this, SLOT(disconnected())); initButtons(); }
void UserButton::initConnect() { connect(this, SIGNAL(clicked()), this, SLOT(sendClicked())); connect(m_userAvatar, SIGNAL(userAvatarClicked()), this, SLOT(sendClicked())); }