Delay initialization of SettingsDialog
authorMichael Schuster <michael@schuster.ms>
Thu, 22 Oct 2020 01:57:29 +0000 (03:57 +0200)
committerKevin Ottens (Rebase PR Action) <er-vin@users.noreply.github.com>
Thu, 22 Oct 2020 11:29:38 +0000 (11:29 +0000)
ownCloudGui::slotShowSettings already got what it takes to create it only when we try to show it for the first time.

This however has some implications:

Pros:
- Only created when needed, while testing saved ca. 20 MB of RAM and got freed again after closing the dialog.
- Since we defaulted to the new Tray UI from 3.0, this is an added bonus for users don't opening the settings.

Cons:
- Resources like the avatar image have to be refetched everytime the dialog is recreated.
  This may be desired as well, because it ensures displaying no outdated info (e.g. on connection issues).

Signed-off-by: Michael Schuster <michael@schuster.ms>
src/gui/owncloudgui.cpp

index f328cb79d0dcc67893ccc8110e3508d22141f252..9b8c42a7b82a70f9b419fe5617a8e00996964989 100644 (file)
@@ -59,7 +59,7 @@ const char propertyAccountC[] = "oc_account";
 ownCloudGui::ownCloudGui(Application *parent)
     : QObject(parent)
     , _tray(nullptr)
-    , _settingsDialog(new SettingsDialog(this))
+    , _settingsDialog(nullptr)
     , _logBrowser(nullptr)
 #ifdef WITH_LIBCLOUDPROVIDERS
     , _bus(QDBusConnection::sessionBus())