mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Nospam id part edit
This commit is contained in:
parent
bf4ed63eac
commit
c541291aac
|
@ -1866,3 +1866,10 @@ bool Core::isReady()
|
|||
{
|
||||
return ready;
|
||||
}
|
||||
|
||||
void Core::setNospam(uint32_t nospam)
|
||||
{
|
||||
uint8_t *nspm = reinterpret_cast<uint8_t*>(&nospam);
|
||||
std::reverse(nspm, nspm + 4);
|
||||
tox_set_nospam(tox, nospam);
|
||||
}
|
||||
|
|
|
@ -118,6 +118,8 @@ public slots:
|
|||
void micMuteToggle(int callId);
|
||||
void volMuteToggle(int callId);
|
||||
|
||||
void setNospam(uint32_t nospam);
|
||||
|
||||
static void joinGroupCall(int groupId); ///< Starts a call in an existing AV groupchat. Call from the GUI thread.
|
||||
static void leaveGroupCall(int groupId); ///< Will not leave the group, just stop the call. Call from the GUI thread.
|
||||
static void disableGroupCallMic(int groupId);
|
||||
|
|
|
@ -30,16 +30,12 @@ PrivacyForm::PrivacyForm() :
|
|||
bodyUI = new Ui::PrivacySettings;
|
||||
bodyUI->setupUi(this);
|
||||
|
||||
bodyUI->cbTypingNotification->setChecked(Settings::getInstance().isTypingNotificationEnabled());
|
||||
bodyUI->cbKeepHistory->setChecked(Settings::getInstance().getEnableLogging());
|
||||
bodyUI->cbEncryptHistory->setChecked(Settings::getInstance().getEncryptLogs());
|
||||
bodyUI->cbEncryptHistory->setEnabled(Settings::getInstance().getEnableLogging());
|
||||
bodyUI->cbEncryptTox->setChecked(Settings::getInstance().getEncryptTox());
|
||||
|
||||
connect(bodyUI->cbTypingNotification, SIGNAL(stateChanged(int)), this, SLOT(onTypingNotificationEnabledUpdated()));
|
||||
connect(bodyUI->cbKeepHistory, SIGNAL(stateChanged(int)), this, SLOT(onEnableLoggingUpdated()));
|
||||
connect(bodyUI->cbEncryptHistory, SIGNAL(clicked()), this, SLOT(onEncryptLogsUpdated()));
|
||||
connect(bodyUI->cbEncryptTox, SIGNAL(clicked()), this, SLOT(onEncryptToxUpdated()));
|
||||
connect(bodyUI->nospamLineEdit, SIGNAL(editingFinished()), this, SLOT(setNospam()));
|
||||
connect(bodyUI->randomNosapamButton, SIGNAL(clicked()), this, SLOT(generateRandomNospam()));
|
||||
}
|
||||
|
||||
PrivacyForm::~PrivacyForm()
|
||||
|
@ -134,3 +130,36 @@ void PrivacyForm::onEncryptToxUpdated()
|
|||
if (!Settings::getInstance().getEncryptTox())
|
||||
Core::getInstance()->clearPassword(Core::ptMain);
|
||||
}
|
||||
|
||||
void PrivacyForm::setNospam()
|
||||
{
|
||||
QString newNospam = bodyUI->nospamLineEdit->text();
|
||||
|
||||
bool ok;
|
||||
uint32_t nospam = newNospam.toLongLong(&ok, 16);
|
||||
if (ok)
|
||||
Core::getInstance()->setNospam(nospam);
|
||||
}
|
||||
|
||||
void PrivacyForm::present()
|
||||
{
|
||||
bodyUI->nospamLineEdit->setText(Core::getInstance()->getSelfId().noSpam);
|
||||
bodyUI->cbTypingNotification->setChecked(Settings::getInstance().isTypingNotificationEnabled());
|
||||
bodyUI->cbKeepHistory->setChecked(Settings::getInstance().getEnableLogging());
|
||||
bodyUI->cbEncryptHistory->setChecked(Settings::getInstance().getEncryptLogs());
|
||||
bodyUI->cbEncryptHistory->setEnabled(Settings::getInstance().getEnableLogging());
|
||||
bodyUI->cbEncryptTox->setChecked(Settings::getInstance().getEncryptTox());
|
||||
}
|
||||
|
||||
void PrivacyForm::generateRandomNospam()
|
||||
{
|
||||
QTime time = QTime::currentTime();
|
||||
qsrand((uint)time.msec());
|
||||
|
||||
uint8_t *newNospam = new uint8_t[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);
|
||||
}
|
||||
|
|
|
@ -30,9 +30,13 @@ public:
|
|||
PrivacyForm();
|
||||
~PrivacyForm();
|
||||
|
||||
virtual void present();
|
||||
|
||||
private slots:
|
||||
void onEnableLoggingUpdated();
|
||||
void onTypingNotificationEnabledUpdated();
|
||||
void setNospam();
|
||||
void generateRandomNospam();
|
||||
|
||||
void onEncryptLogsUpdated();
|
||||
void onEncryptToxUpdated();
|
||||
|
|
|
@ -96,6 +96,46 @@
|
|||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item alignment="Qt::AlignTop">
|
||||
<widget class="QGroupBox" name="nospamGroup">
|
||||
<property name="title">
|
||||
<string>Nospam</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="nospamLineEdit">
|
||||
<property name="inputMask">
|
||||
<string>HHHHHHHH</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="randomNosapamButton">
|
||||
<property name="text">
|
||||
<string>Generate random nospam</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
|
|
Loading…
Reference in New Issue
Block a user