mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
refactor: remove Core::getInstance from PrivacyForm
This commit is contained in:
parent
2809cd91f5
commit
ef18afcbf1
|
@ -39,9 +39,10 @@
|
|||
#include "src/widget/translator.h"
|
||||
#include "src/widget/widget.h"
|
||||
|
||||
PrivacyForm::PrivacyForm()
|
||||
PrivacyForm::PrivacyForm(Core* _core)
|
||||
: GenericForm(QPixmap(":/img/settings/privacy.png"))
|
||||
, bodyUI(new Ui::PrivacySettings)
|
||||
, core{_core}
|
||||
{
|
||||
bodyUI->setupUi(this);
|
||||
|
||||
|
@ -85,14 +86,15 @@ void PrivacyForm::on_nospamLineEdit_editingFinished()
|
|||
|
||||
bool ok;
|
||||
uint32_t nospam = newNospam.toLongLong(&ok, 16);
|
||||
if (ok)
|
||||
Core::getInstance()->setNospam(nospam);
|
||||
if (ok) {
|
||||
core->setNospam(nospam);
|
||||
}
|
||||
}
|
||||
|
||||
void PrivacyForm::showEvent(QShowEvent*)
|
||||
{
|
||||
const Settings& s = Settings::getInstance();
|
||||
bodyUI->nospamLineEdit->setText(Core::getInstance()->getSelfId().getNoSpamString());
|
||||
bodyUI->nospamLineEdit->setText(core->getSelfId().getNoSpamString());
|
||||
bodyUI->cbTypingNotification->setChecked(s.getTypingNotification());
|
||||
bodyUI->cbKeepHistory->setChecked(Settings::getInstance().getEnableLogging());
|
||||
bodyUI->blackListTextEdit->setText(s.getBlackList().join('\n'));
|
||||
|
@ -115,8 +117,8 @@ void PrivacyForm::on_randomNosapamButton_clicked()
|
|||
newNospam = (newNospam << 8) + (qrand() % 256); // Generate byte by byte. For some reason.
|
||||
#endif
|
||||
|
||||
Core::getInstance()->setNospam(newNospam);
|
||||
bodyUI->nospamLineEdit->setText(Core::getInstance()->getSelfId().getNoSpamString());
|
||||
core->setNospam(newNospam);
|
||||
bodyUI->nospamLineEdit->setText(core->getSelfId().getNoSpamString());
|
||||
}
|
||||
|
||||
void PrivacyForm::on_nospamLineEdit_textChanged()
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
|
||||
#include "genericsettings.h"
|
||||
|
||||
class Core;
|
||||
|
||||
namespace Ui {
|
||||
class PrivacySettings;
|
||||
}
|
||||
|
@ -30,7 +32,7 @@ class PrivacyForm : public GenericForm
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
PrivacyForm();
|
||||
PrivacyForm(Core* _core);
|
||||
~PrivacyForm();
|
||||
QString getFormName() final
|
||||
{
|
||||
|
@ -54,6 +56,7 @@ private:
|
|||
|
||||
private:
|
||||
Ui::PrivacySettings* bodyUI;
|
||||
Core* core;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -61,7 +61,7 @@ SettingsWidget::SettingsWidget(UpdateCheck* updateCheck, IAudioControl& audio, C
|
|||
connect(gfrm.get(), &GeneralForm::updateIcons, parent, &Widget::updateIcons);
|
||||
|
||||
std::unique_ptr<UserInterfaceForm> uifrm(new UserInterfaceForm(this));
|
||||
std::unique_ptr<PrivacyForm> pfrm(new PrivacyForm());
|
||||
std::unique_ptr<PrivacyForm> pfrm(new PrivacyForm(core));
|
||||
connect(pfrm.get(), &PrivacyForm::clearAllReceipts, parent, &Widget::clearAllReceipts);
|
||||
|
||||
AVForm* rawAvfrm = new AVForm(audio, coreAV, camera, audioSettings, videoSettings);
|
||||
|
|
Loading…
Reference in New Issue
Block a user