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

refactor: remove Core::getInstance from SettingsWidget

This commit is contained in:
sudden6 2020-05-01 14:59:25 +02:00
parent c1ec6bc649
commit 2809cd91f5
No known key found for this signature in database
GPG Key ID: 279509B499E032B9
3 changed files with 8 additions and 5 deletions

View File

@ -41,10 +41,10 @@
#include <memory>
SettingsWidget::SettingsWidget(UpdateCheck* updateCheck, IAudioControl& audio, Widget* parent)
SettingsWidget::SettingsWidget(UpdateCheck* updateCheck, IAudioControl& audio, Core* core, Widget* parent)
: QWidget(parent, Qt::Window)
{
CoreAV* coreAV = Core::getInstance()->getAv();
CoreAV* coreAV = core->getAv();
IAudioSettings* audioSettings = &Settings::getInstance();
IVideoSettings* videoSettings = &Settings::getInstance();
CameraSource& camera = CameraSource::getInstance();

View File

@ -28,6 +28,7 @@
#include <memory>
class Camera;
class Core;
class GenericForm;
class GeneralForm;
class IAudioControl;
@ -43,7 +44,7 @@ class SettingsWidget : public QWidget
{
Q_OBJECT
public:
SettingsWidget(UpdateCheck* updateCheck, IAudioControl& audio, Widget* parent = nullptr);
SettingsWidget(UpdateCheck* updateCheck, IAudioControl& audio, Core *core, Widget* parent = nullptr);
~SettingsWidget();
bool isShown() const;

View File

@ -276,16 +276,18 @@ void Widget::init()
filesForm = new FilesForm();
addFriendForm = new AddFriendForm;
groupInviteForm = new GroupInviteForm;
core = Nexus::getCore();
#if UPDATE_CHECK_ENABLED
updateCheck = std::unique_ptr<UpdateCheck>(new UpdateCheck(settings));
connect(updateCheck.get(), &UpdateCheck::updateAvailable, this, &Widget::onUpdateAvailable);
#endif
settingsWidget = new SettingsWidget(updateCheck.get(), audio, this);
settingsWidget = new SettingsWidget(updateCheck.get(), audio, core, this);
#if UPDATE_CHECK_ENABLED
updateCheck->checkForUpdate();
#endif
core = Nexus::getCore();
CoreFile* coreFile = core->getCoreFile();
Profile* profile = Nexus::getProfile();
profileInfo = new ProfileInfo(core, profile);