Skip to content

Commit

Permalink
Lazily load settings view widget
Browse files Browse the repository at this point in the history
Signed-off-by: Claudio Cambra <[email protected]>
  • Loading branch information
claucambra committed Sep 4, 2023
1 parent f2bebce commit 62e85b3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/gui/macOS/ui/fileprovidersettingscontroller.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ class FileProviderSettingsController : public QObject
[[nodiscard]] QQuickWidget *settingsViewWidget();

private:
void instantiateSettingsWidget();

class MacImplementation;
std::unique_ptr<MacImplementation> d;

Expand Down
7 changes: 7 additions & 0 deletions src/gui/macOS/ui/fileprovidersettingscontroller_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@
: QObject{parent}
{
d = std::make_unique<FileProviderSettingsController::MacImplementation>(this);
}

void FileProviderSettingsController::instantiateSettingsWidget()
{
_settingsViewWidget = std::make_unique<QQuickWidget>(Systray::instance()->trayEngine(), nullptr);
_settingsViewWidget->setResizeMode(QQuickWidget::SizeRootObjectToView);
_settingsViewWidget->setSource(QUrl(fpSettingsQmlPath));
Expand All @@ -69,6 +72,10 @@

QQuickWidget *FileProviderSettingsController::settingsViewWidget()
{
if (!_settingsViewWidget) {
instantiateSettingsWidget();
}

return _settingsViewWidget.get();
}

Expand Down

0 comments on commit 62e85b3

Please sign in to comment.