1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00
qTox/widget/form/addfriendform.cpp

48 lines
1.1 KiB
C++
Raw Normal View History

2014-06-25 04:11:11 +08:00
#include "addfriendform.h"
#include "ui_widget.h"
#include <QFont>
AddFriendForm::AddFriendForm()
{
main = new QWidget(), head = new QWidget();
QFont bold;
bold.setBold(true);
headLabel.setText("Add Friends");
headLabel.setFont(bold);
toxIdLabel.setText("Tox ID");
messageLabel.setText("Message");
sendButton.setText("Send friend request");
main->setLayout(&layout);
layout.addWidget(&toxIdLabel);
layout.addWidget(&toxId);
layout.addWidget(&messageLabel);
layout.addWidget(&message);
layout.addWidget(&sendButton);
head->setLayout(&headLayout);
headLayout.addWidget(&headLabel);
connect(&sendButton, SIGNAL(clicked()), this, SLOT(onSendTriggered()));
}
void AddFriendForm::show(Ui::Widget &ui)
{
ui.mainContent->layout()->addWidget(main);
ui.mainHead->layout()->addWidget(head);
main->show();
head->show();
}
void AddFriendForm::onSendTriggered()
{
QString id = toxId.text(), msg = message.toPlainText();
if (id.isEmpty())
return;
2014-06-27 22:19:42 +08:00
if (msg.isEmpty())
msg = "Tox me maybe?";
2014-06-25 04:11:11 +08:00
emit friendRequested(id, msg);
}