mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
improved usability
This commit is contained in:
parent
c541291aac
commit
2c22968480
|
@ -36,6 +36,7 @@ PrivacyForm::PrivacyForm() :
|
||||||
connect(bodyUI->cbEncryptTox, SIGNAL(clicked()), this, SLOT(onEncryptToxUpdated()));
|
connect(bodyUI->cbEncryptTox, SIGNAL(clicked()), this, SLOT(onEncryptToxUpdated()));
|
||||||
connect(bodyUI->nospamLineEdit, SIGNAL(editingFinished()), this, SLOT(setNospam()));
|
connect(bodyUI->nospamLineEdit, SIGNAL(editingFinished()), this, SLOT(setNospam()));
|
||||||
connect(bodyUI->randomNosapamButton, SIGNAL(clicked()), this, SLOT(generateRandomNospam()));
|
connect(bodyUI->randomNosapamButton, SIGNAL(clicked()), this, SLOT(generateRandomNospam()));
|
||||||
|
connect(bodyUI->nospamLineEdit, SIGNAL(textChanged(QString)), this, SLOT(onNospamEdit()));
|
||||||
}
|
}
|
||||||
|
|
||||||
PrivacyForm::~PrivacyForm()
|
PrivacyForm::~PrivacyForm()
|
||||||
|
@ -156,10 +157,22 @@ void PrivacyForm::generateRandomNospam()
|
||||||
QTime time = QTime::currentTime();
|
QTime time = QTime::currentTime();
|
||||||
qsrand((uint)time.msec());
|
qsrand((uint)time.msec());
|
||||||
|
|
||||||
uint8_t *newNospam = new uint8_t[4];
|
uint8_t newNospam[4];
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
newNospam[i] = qrand() % 256;
|
newNospam[i] = qrand() % 256;
|
||||||
|
|
||||||
Core::getInstance()->setNospam(*reinterpret_cast<uint32_t*>(newNospam));
|
Core::getInstance()->setNospam(*reinterpret_cast<uint32_t*>(newNospam));
|
||||||
bodyUI->nospamLineEdit->setText(Core::getInstance()->getSelfId().noSpam);
|
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);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ private slots:
|
||||||
void onTypingNotificationEnabledUpdated();
|
void onTypingNotificationEnabledUpdated();
|
||||||
void setNospam();
|
void setNospam();
|
||||||
void generateRandomNospam();
|
void generateRandomNospam();
|
||||||
|
void onNospamEdit();
|
||||||
void onEncryptLogsUpdated();
|
void onEncryptLogsUpdated();
|
||||||
void onEncryptToxUpdated();
|
void onEncryptToxUpdated();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user