1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-09-15 06:52:34 +02:00

Replace shared_ptr with unique_ptr where reasonable and add comments

This commit is contained in:
Elias Steurer 2019-09-20 13:31:35 +02:00
parent 77a48d11a5
commit 8e09ee2f13
2 changed files with 15 additions and 19 deletions

View File

@ -9,6 +9,12 @@ App::App()
QGuiApplication::setApplicationName("ScreenPlay");
QGuiApplication::setApplicationVersion("0.3.0");
QGuiApplication::setQuitOnLastWindowClosed(false);
QGuiApplication::setWindowIcon(QIcon(":/assets/icons/favicon.ico"));
QQuickWindow::setTextRenderType(QQuickWindow::TextRenderType::NativeTextRendering);
// Qt < 6.0 needs this init QtWebEngine
QtWebEngine::initialize();
qRegisterMetaType<GlobalVariables*>();
qRegisterMetaType<ScreenPlayManager*>();
@ -22,11 +28,6 @@ App::App()
qRegisterMetaType<MonitorListModel*>();
qRegisterMetaType<ProfileListModel*>();
QGuiApplication::setWindowIcon(QIcon(":/assets/icons/favicon.ico"));
// Qt < 6.0 needs this init QtWebEngine
QtWebEngine::initialize();
m_globalVariables = make_shared<GlobalVariables>();
m_installedListModel = make_shared<InstalledListModel>(m_globalVariables);
m_installedListFilter = make_shared<InstalledListFilter>(m_installedListModel);
@ -34,19 +35,14 @@ App::App()
m_profileListModel = make_shared<ProfileListModel>(m_globalVariables);
m_sdkConnector = make_shared<SDKConnector>();
m_settings = make_shared<Settings>(m_globalVariables);
m_create = make_shared<Create>(m_globalVariables);
m_util = make_shared<Util>(new QNetworkAccessManager(this));
m_screenPlayManager = make_shared<ScreenPlayManager>(m_globalVariables, m_monitorListModel, m_sdkConnector);
m_create = make_unique<Create>(m_globalVariables);
m_util = make_unique<Util>(new QNetworkAccessManager(this));
m_screenPlayManager = make_unique<ScreenPlayManager>(m_globalVariables, m_monitorListModel, m_sdkConnector);
// When the installed storage path changed
QObject::connect(m_settings.get(), &Settings::resetInstalledListmodel, m_installedListModel.get(), &InstalledListModel::reset);
// Instead of setting "renderType: Text.NativeRendering" every time
// we can set it here once :)
QQuickWindow::setTextRenderType(QQuickWindow::TextRenderType::NativeTextRendering);
// Init after we have the paths from settings
m_installedListModel->init();
}

View File

@ -214,9 +214,9 @@ public slots:
}
private:
shared_ptr<Create> m_create;
shared_ptr<ScreenPlayManager> m_screenPlayManager;
shared_ptr<Util> m_util;
unique_ptr<Create> m_create;
unique_ptr<ScreenPlayManager> m_screenPlayManager;
unique_ptr<Util> m_util;
shared_ptr<GlobalVariables> m_globalVariables;
shared_ptr<Settings> m_settings;