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

respond to copying id, fixes #537

This commit is contained in:
dubslow 2014-11-10 17:20:10 -06:00
parent def9e3791a
commit b3e7114e84
2 changed files with 11 additions and 2 deletions

View File

@ -46,6 +46,10 @@ IdentityForm::IdentityForm() :
bodyUI->toxGroup->layout()->addWidget(toxId);
timer.setInterval(1000);
timer.setSingleShot(true);
connect(&timer, &QTimer::timeout, this, [=]() {bodyUI->toxIdLabel->setText(bodyUI->toxIdLabel->text().replace("", ""));});
connect(bodyUI->toxIdLabel, SIGNAL(clicked()), this, SLOT(copyIdClicked()));
connect(toxId, SIGNAL(clicked()), this, SLOT(copyIdClicked()));
connect(core, &Core::idSet, this, &IdentityForm::setToxId);
@ -68,8 +72,8 @@ IdentityForm::IdentityForm() :
connect(core, &Core::avPeerTimeout, this, &IdentityForm::enableSwitching);
connect(core, &Core::avRequestTimeout, this, &IdentityForm::enableSwitching);
connect(Core::getInstance(), &Core::usernameSet, this, [=](const QString& val) { bodyUI->userName->setText(val); });
connect(Core::getInstance(), &Core::statusMessageSet, this, [=](const QString& val) { bodyUI->statusMessage->setText(val); });
connect(core, &Core::usernameSet, this, [=](const QString& val) { bodyUI->userName->setText(val); });
connect(core, &Core::statusMessageSet, this, [=](const QString& val) { bodyUI->statusMessage->setText(val); });
}
IdentityForm::~IdentityForm()
@ -84,6 +88,9 @@ void IdentityForm::copyIdClicked()
txt.replace('\n',"");
QApplication::clipboard()->setText(txt);
toxId->setCursorPosition(0);
bodyUI->toxIdLabel->setText(bodyUI->toxIdLabel->text() + "");
timer.start();
}
void IdentityForm::onUserNameEdited()

View File

@ -22,6 +22,7 @@
#include <QTextEdit>
#include <QLineEdit>
#include <QLabel>
#include <QTimer>
class CroppingLabel;
class Core;
@ -72,6 +73,7 @@ private slots:
private:
Ui::IdentitySettings* bodyUI;
Core* core;
QTimer timer;
ClickableTE* toxId;
};