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

improved usability

This commit is contained in:
apprb 2014-11-16 02:16:56 +09:00
parent c541291aac
commit 2c22968480
No known key found for this signature in database
GPG Key ID: B001911B5B22FB9B
2 changed files with 15 additions and 2 deletions

View File

@ -36,6 +36,7 @@ PrivacyForm::PrivacyForm() :
connect(bodyUI->cbEncryptTox, SIGNAL(clicked()), this, SLOT(onEncryptToxUpdated()));
connect(bodyUI->nospamLineEdit, SIGNAL(editingFinished()), this, SLOT(setNospam()));
connect(bodyUI->randomNosapamButton, SIGNAL(clicked()), this, SLOT(generateRandomNospam()));
connect(bodyUI->nospamLineEdit, SIGNAL(textChanged(QString)), this, SLOT(onNospamEdit()));
}
PrivacyForm::~PrivacyForm()
@ -156,10 +157,22 @@ void PrivacyForm::generateRandomNospam()
QTime time = QTime::currentTime();
qsrand((uint)time.msec());
uint8_t *newNospam = new uint8_t[4];
uint8_t newNospam[4];
for (int i = 0; i < 4; i++)
newNospam[i] = qrand() % 256;
Core::getInstance()->setNospam(*reinterpret_cast<uint32_t*>(newNospam));
bodyUI->nospamLineEdit->setText(Core::getInstance()->getSelfId().noSpam);
}
void PrivacyForm::onNospamEdit()
{
QString str = bodyUI->nospamLineEdit->text();
int curs = bodyUI->nospamLineEdit->cursorPosition();
if (str.length() != 8)
{
str = QString("00000000").replace(0, str.length(), str);
bodyUI->nospamLineEdit->setText(str);
bodyUI->nospamLineEdit->setCursorPosition(curs);
};
}

View File

@ -37,7 +37,7 @@ private slots:
void onTypingNotificationEnabledUpdated();
void setNospam();
void generateRandomNospam();
void onNospamEdit();
void onEncryptLogsUpdated();
void onEncryptToxUpdated();