Widget::Widget(QWidget *parent) : QWidget(parent), ui(new Ui::Widget) { ui->setupUi(this); connector = new Server(this); myself.setName(QString("user ") + QString::number(qrand())); // connect(connector,SIGNAL(massageReceived(QByteArray)),this,SLOT(audioOutput(QByteArray))); \\ connect(connector,SIGNAL(massageReceived(QByteArray)),this,SLOT(audioOutput(QByteArray))); \ decoder = new AudioDecoder(this); recorder = new AudioRecorder(this); connect(recorder,SIGNAL(audioBufferder(QByteArray)), connector, SLOT(sendMessage(QByteArray))); ui->message_output->setReadOnly(true); ui->text_log->setReadOnly(true); QString host_rand = QString::number(rand() * 255) + QString(".") + QString::number(rand() * 255) + QString(".") + QString::number(rand() * 255) + QString(".") + QString::number(rand() * 255); // QHostAddress host = QHostAddress(host_rand); // QHostAddress host = QHostAddress::LocalHost ;; QHostAddress host = QHostAddress::Broadcast; connector->setPort(qrand()); connector->setHostAdress(host); connector->bindHostPort(); // connector->joinMulticastGroup(host); client_tcp = new ClientTcp(this); server_tcp = new ServerTCP(this); connect(client_tcp,SIGNAL(sendedMessage(QByteArray)),this,SLOT(messageOutput(QByteArray))); connect(client_tcp,SIGNAL(receivedMessage(QByteArray)),this,SLOT(messageOutput(QByteArray))); connect(client_tcp,SIGNAL(connected()),this,SLOT(serverFounded())); //connect(server_tcp,SIGNAL(),this,SLOT()); connect(server_tcp,SIGNAL(sendedMessage(QByteArray)),this,SLOT(messageOutput(QByteArray))); connect(server_tcp,SIGNAL(receivedMessage(QByteArray)),this,SLOT(messageOutput(QByteArray))); connect(server_tcp,SIGNAL(newConnection()),this,SLOT(clientConnected())); QHostAddress hosta("127.15.10.12"); quint16 port = 135665; client_tcp->setHostAdress(hosta); client_tcp->setPort(port); server_tcp->setHostAdress(hosta); server_tcp->setPort(port); // connecor->ho }
menix::menix(QWidget *parent) : QMainWindow(parent), m_ui(new Ui::menix) { m_ui->setupUi(this); QToolBar *toolbarIconos = addToolBar(tr("Iconos")); toolbarIconos->addAction(QIcon(":/preferences-system.png"),"Opciones",this,SLOT( abrirOpciones() ) ); toolbarIconos->addAction(QIcon(":/terminal.png"),"Debug",this,SLOT(abrirDebug())); opciones = new opcionesGlobales(); numero = opciones->NumeroDestino(); puerto = opciones->Puerto(); pin = opciones->Pin(); centro = opciones->CentroMensajes(); fixok = opciones->Fixok(); ips = new QStringList( opciones->Ips() ); file = new QFile( opciones->fileLog() ); file->open( QIODevice::WriteOnly | QIODevice::Text ); flog = new QTextStream( file ); mensaje = new smsat(centro,puerto,flog,pin,fixok); crearAcciones(); crearBandeja(); // testPuerto( mensaje ); Server *tcp = new Server(ips,this); connect(tcp,SIGNAL(sendMessage(QString)),this,SLOT(sendMessage(QString))); connect(mensaje,SIGNAL(sendAt(QString)),this,SLOT(sendedMessage(QString))); connect(mensaje,SIGNAL(displayMsg(QString)),this,SLOT(showPopup(QString))); }