ClientAgent::ClientAgent(Client *c, QWidget *parent) : client(c), QDialog(parent), ui(new Ui::ClientAgent) { ui->setupUi(this); setWindowTitle(tr("Client")); if (client->red) { setRed(); } else { setGreen(); } // no need to configure ui->lineEdit_ip->setEnabled(false); ui->lineEdit_port->setEnabled(false); // not work before connection established ui->pushButton_tx->setEnabled(false); ui->pushButton_client_red_green->setEnabled(false); ui->lineEdit_tx->setEnabled(false); // inbox, not editable ui->plainTextEdit_rx->setEnabled(false); ui->plainTextEdit_rx->setStyleSheet("background-color: white;" "font: 24px;"); connect(client, SIGNAL(readed(QByteArray)), this, SLOT(onReaded(QByteArray))); connect(client, SIGNAL(setRed()), this, SLOT(setRed())); connect(client, SIGNAL(setGreen()), this, SLOT(setGreen())); }
QFakeMail::QFakeMail() : QMainWindow(0), email("([a-z0-9._%+-]+@[a-z0-9-]+\\.[a-z0-9.-]+)", Qt::CaseInsensitive) { setupUi(this); connect(server, SIGNAL(textEdited(const QString&)), SLOT(change())); connect(isfrom, SIGNAL(toggled(bool)), SLOT(change())); connect(from, SIGNAL(textEdited(const QString&)), SLOT(change())); connect(to, SIGNAL(textEdited(const QString&)), SLOT(change())); connect(files, SIGNAL(itemSelectionChanged()), SLOT(filesSelected())); connect(removefile, SIGNAL(clicked()), SLOT(removeFile())); connect(addfile, SIGNAL(clicked()), SLOT(addFile())); connect(send, SIGNAL(clicked()), SLOT(sendSlot())); connect(actionAbout, SIGNAL(triggered()), SLOT(about())); connect(&sock, SIGNAL(error(QAbstractSocket::SocketError)), SLOT(gotErrorSlot())); connect(&sock, SIGNAL(disconnected()), SLOT(disconnected())); connect(&sock, SIGNAL(connected()), SLOT(connected())); connect(&sock, SIGNAL(readyRead()), SLOT(readed())); QSettings settings; int size = settings.beginReadArray("recents"); for (int i = 0; i < size; i++) { settings.setArrayIndex(i); recents << settings.value("server").toString(); } settings.endArray(); server->setCompleter(new QCompleter(recents, server)); }