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:
parent
def9e3791a
commit
b3e7114e84
|
@ -45,6 +45,10 @@ IdentityForm::IdentityForm() :
|
|||
toxId->setFont(Style::getFont(Style::Small));
|
||||
|
||||
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()));
|
||||
|
@ -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()
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user