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

refactor(widget): remove Widget singleton access from GeneralForm

This commit is contained in:
jenli669 2019-06-28 22:34:16 +02:00
parent e57693fa8f
commit c28b2604cd
No known key found for this signature in database
GPG Key ID: 8267F9F7C2BF7E5E
4 changed files with 9 additions and 5 deletions

View File

@ -152,8 +152,7 @@ GeneralForm::GeneralForm(SettingsWidget* myParent)
#ifndef QTOX_PLATFORM_EXT #ifndef QTOX_PLATFORM_EXT
bodyUI->autoAwayLabel->setEnabled( bodyUI->autoAwayLabel->setEnabled(false); // these don't seem to change the appearance of the widgets,
false); // these don't seem to change the appearance of the widgets,
bodyUI->autoAwaySpinBox->setEnabled(false); // though they are unusable bodyUI->autoAwaySpinBox->setEnabled(false); // though they are unusable
#endif #endif
@ -203,7 +202,7 @@ void GeneralForm::on_closeToTray_stateChanged()
void GeneralForm::on_lightTrayIcon_stateChanged() void GeneralForm::on_lightTrayIcon_stateChanged()
{ {
Settings::getInstance().setLightTrayIcon(bodyUI->lightTrayIcon->isChecked()); Settings::getInstance().setLightTrayIcon(bodyUI->lightTrayIcon->isChecked());
Widget::getInstance()->updateIcons(); emit updateIcons();
} }
void GeneralForm::on_minimizeToTray_stateChanged() void GeneralForm::on_minimizeToTray_stateChanged()

View File

@ -38,6 +38,8 @@ public:
{ {
return tr("General"); return tr("General");
} }
signals:
void updateIcons();
private slots: private slots:
void on_transComboBox_currentIndexChanged(int index); void on_transComboBox_currentIndexChanged(int index);

View File

@ -41,7 +41,7 @@
#include <memory> #include <memory>
SettingsWidget::SettingsWidget(UpdateCheck* updateCheck, IAudioControl& audio, QWidget* parent) SettingsWidget::SettingsWidget(UpdateCheck* updateCheck, IAudioControl& audio, Widget* parent)
: QWidget(parent, Qt::Window) : QWidget(parent, Qt::Window)
{ {
CoreAV* coreAV = Core::getInstance()->getAv(); CoreAV* coreAV = Core::getInstance()->getAv();
@ -58,6 +58,8 @@ SettingsWidget::SettingsWidget(UpdateCheck* updateCheck, IAudioControl& audio, Q
bodyLayout->addWidget(settingsWidgets.get()); bodyLayout->addWidget(settingsWidgets.get());
std::unique_ptr<GeneralForm> gfrm(new GeneralForm(this)); std::unique_ptr<GeneralForm> gfrm(new GeneralForm(this));
connect(gfrm.get(), &GeneralForm::updateIcons, parent, &Widget::updateIcons);
std::unique_ptr<UserInterfaceForm> uifrm(new UserInterfaceForm(this)); std::unique_ptr<UserInterfaceForm> uifrm(new UserInterfaceForm(this));
std::unique_ptr<PrivacyForm> pfrm(new PrivacyForm()); std::unique_ptr<PrivacyForm> pfrm(new PrivacyForm());
AVForm* rawAvfrm = new AVForm(audio, coreAV, camera, audioSettings, videoSettings); AVForm* rawAvfrm = new AVForm(audio, coreAV, camera, audioSettings, videoSettings);

View File

@ -37,12 +37,13 @@ class QLabel;
class QTabWidget; class QTabWidget;
class ContentLayout; class ContentLayout;
class UpdateCheck; class UpdateCheck;
class Widget;
class SettingsWidget : public QWidget class SettingsWidget : public QWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
SettingsWidget(UpdateCheck* updateCheck, IAudioControl& audio, QWidget* parent = nullptr); SettingsWidget(UpdateCheck* updateCheck, IAudioControl& audio, Widget* parent = nullptr);
~SettingsWidget(); ~SettingsWidget();
bool isShown() const; bool isShown() const;