Пример #1
0
Schedule::Schedule() : QDialog(0)
{
    QVBoxLayout *layout = new QVBoxLayout(this);

    QDialogButtonBox *box = new QDialogButtonBox(Qt::Horizontal);

    QPushButton *button = new QPushButton("Sair");
    connect(button, SIGNAL(clicked()), this, SLOT(sairClicked()));
    box->addButton(button, QDialogButtonBox::AcceptRole);

    button = new QPushButton("Ajuda");
    connect(button, SIGNAL(clicked()), qApp, SLOT(aboutQt()));
    box->addButton(button, QDialogButtonBox::AcceptRole);

    button = new QPushButton("Consulta");
    connect(button, SIGNAL(clicked()), this, SLOT(searchContact()));
    box->addButton(button, QDialogButtonBox::AcceptRole);

    button = new QPushButton("Cadastro");
    connect(button, SIGNAL(clicked()), this, SLOT(registerForm()));
    box->addButton(button, QDialogButtonBox::AcceptRole);

    layout->addWidget(new QLabel("Agendinha"));
    layout->addWidget(box);

    setWindowTitle("AGENDA");
}
Пример #2
0
void                UserWin::manageWin()
{
    this->_serverText = "Serveur: ";
    this->_serverText.append(this->getServer());
    this->_portText = " | Port: ";
    this->_portText.append(QString::number(this->getTcpPort()));
    this->_idText = "Identifiant: ";
    this->_idText.append(this->getClientId());
    this->_call.setText("Appeler");
    this->_mContact->addAction(this->_aAddContact);
    this->_mContact->addAction(this->_aDelContact);
    this->_mContact->addAction(this->_aSearchContact);
    this->_mContact->addAction(this->_aDisconnect);
    this->_mContact->addAction(this->_aQuit);
    this->_mAccount->addAction(this->_aProfile);
    this->_mHelp->addAction(this->_aHelp);
    this->_online.setText("Contacts en ligne");
    this->_offline.setText("Contacts hors ligne");
    this->_idLabel.setText(this->_idText);
    this->_infoLabel.setText(this->_serverText.append(this->_portText));
    this->_call.setFont(QFont("Default", 14));
    this->_call.setCursor(Qt::PointingHandCursor);
    this->_call.setIcon(QIcon(QCoreApplication::applicationDirPath() + "/ressources/Logo.png"));
    this->_modelOn.setStringList(this->getContactOn());
    this->_modelOff.setStringList(this->getContactOff());
    this->_viewOn.setModel(&this->_modelOn);
    this->_viewOn.setEditTriggers(QAbstractItemView::NoEditTriggers);
    this->_viewOff.setModel(&this->_modelOff);
    this->_viewOff.setEditTriggers(QAbstractItemView::NoEditTriggers);
    this->_viewOff.setSelectionMode(QAbstractItemView::NoSelection);
    this->_layout.addWidget(&this->_infoLabel);
    this->_layout.addWidget(&this->_idLabel);
    this->_layout.addWidget(&this->_online, Qt::AlignCenter);
    this->_layout.addWidget(&this->_viewOn);
    this->_layout.addWidget(&this->_offline, Qt::AlignCenter);
    this->_layout.addWidget(&this->_viewOff);
    this->_layout.addWidget(&this->_call);
    this->_core.setLayout(&this->_layout);
    this->getUdpSocket()->bind(this->getUdpPort());
    this->setCentralWidget(&this->_core);
    this->setWindowIcon(QIcon(QCoreApplication::applicationDirPath() + "/ressources/babybel.png"));
    connect(&this->_call, SIGNAL(clicked()), this, SLOT(selectContact()));
    connect(this->_aQuit, SIGNAL(triggered()), qApp, SLOT(quit()));
    connect(this->_aAddContact, SIGNAL(triggered()), this, SLOT(addContact()));
    connect(this->_aDelContact, SIGNAL(triggered()), this, SLOT(delContact()));
    connect(this->_aSearchContact, SIGNAL(triggered()), this, SLOT(searchContact()));
    connect(this->_aDisconnect, SIGNAL(triggered()), this, SLOT(aDisconnect()));
    connect(this->_aHelp, SIGNAL(triggered()), this, SLOT(showHelp()));
    connect(this->_aProfile, SIGNAL(triggered()), this, SLOT(showProfile()));
    connect(this->getTcpSocket(), SIGNAL(readyRead()), this, SLOT(receivedTcpData()));
    connect(this->getUdpSocket(), SIGNAL(readyRead()), this, SLOT(receivedUdpData()));
}