Browse Source

refactor: remove Core::getInstance from SettingsWidget

reviewable/pr6124/r6
sudden6 5 years ago
parent
commit
2809cd91f5
No known key found for this signature in database
GPG Key ID: 279509B499E032B9
  1. 4
      src/widget/form/settingswidget.cpp
  2. 3
      src/widget/form/settingswidget.h
  3. 6
      src/widget/widget.cpp

4
src/widget/form/settingswidget.cpp

@ -41,10 +41,10 @@ @@ -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();

3
src/widget/form/settingswidget.h

@ -28,6 +28,7 @@ @@ -28,6 +28,7 @@
#include <memory>
class Camera;
class Core;
class GenericForm;
class GeneralForm;
class IAudioControl;
@ -43,7 +44,7 @@ class SettingsWidget : public QWidget @@ -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;

6
src/widget/widget.cpp

@ -276,16 +276,18 @@ void Widget::init() @@ -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);

Loading…
Cancel
Save