[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kmymoney-devel
Subject:    Re: [Kmymoney-devel] AccountsModel loadInstitution and
From:       Cristian_Oneţ <onet.cristian () gmail ! com>
Date:       2010-09-25 17:56:08
Message-ID: AANLkTimB7HH1uP+t6HFs_Tq5y6eOdJRA=qUrQ9kXzKoQ () mail ! gmail ! com
[Download RAW message or body]

On Sat, Sep 25, 2010 at 5:44 PM, Alvaro Soliverez <asoliverez@kde.org> wrot=
e:
> On Sat, Sep 25, 2010 at 11:23 AM, Cristian One=C5=A3 <onet.cristian@gmail=
.com> wrote:
>>>
>>> How about adding two sets of signals? One that is emitted whenever
>>> there is an account change, and another that covers transactions?
>> I don't know if it would but it would be a solution only for this
>> model and not a complete solution. The complete solution would be to
>> have signals for each mymoney objects that are changed but adding such
>> a facility is a pretty big task (I've just checked) and I don't know
>> if it is worth it.
>>
> I know it's not complete, but this is one of the big performance
> problems we have. Solving this would give us more time until we find a
> complete solution.
>
> At the moment, recurring calls to load the accounts model, and the
> slow loading when auto entering schedules are two of the main issues
> we have regarding performance.
>
> Also, I would disconnect dataChanged and AccountsModel, and only
> connect it through views that actually use the accountmodel, if
> possible.
> For example, any change on the home view will trigger an update of the
> model, even if that view doesn't really use it at all.
>

I know it's not much but could you guys please take a look at this
patch (I haven't submitted it trough the reviewboard since it's a
pinpointed change)? It delays calling AccountsModel::load() after
dataChanged() is emitted until the moment there is nothing else to
execute in the event loop. This means that the UI has time to update
after dataChange is emitted (the ledger seems a bit more responsive
when changing the status of a transaction) and after load() does get
executed (hopefully while the user is idle) all the data in the UI
will be correct since the model notifies the view of any data change
during load().

Regards,
Cristian

["call_load_on_idle.patch" (text/x-patch)]

Index: kmymoney/models/models.cpp
===================================================================
--- kmymoney/models/models.cpp	(revision 1179449)
+++ kmymoney/models/models.cpp	(working copy)
@@ -23,6 +23,8 @@
 // ----------------------------------------------------------------------------
 // QT Includes
 
+#include <QTimer>
+
 // ----------------------------------------------------------------------------
 // KDE Includes
 
@@ -65,7 +67,17 @@
 
 void Models::dataChanged(void)
 {
-  accountsModel()->load();
+  static bool firstCall = true;
+  if (firstCall)
+  {
+    // make sure we load the accounts model initially
+    firstCall = false;
+    accountsModel()->load();
+  } else
+  {
+    // load the accounts model on idle
+    QTimer::singleShot(0, accountsModel(), SLOT(load()));
+  }
 }
 
 void Models::fileClosed(void)
Index: kmymoney/models/accountsmodel.h
===================================================================
--- kmymoney/models/accountsmodel.h	(revision 1179449)
+++ kmymoney/models/accountsmodel.h	(working copy)
@@ -93,8 +93,6 @@
 
   ~AccountsModel();
 
-  void load();
-
   /**
     * Compute the value of the given account using the provided balance.
     * The value is defined as the balance of the account converted to the base \
currency. @@ -110,6 +108,8 @@
 
   void slotReconcileAccount(const MyMoneyAccount &account, const QDate \
&reconciliationDate, const MyMoneyMoney &endingBalance);  
+  void load();
+
 signals:
   /**
     * Emit this signal when the net worth based on the value of the loaded accounts \
is changed.



_______________________________________________
KMyMoney-devel mailing list
KMyMoney-devel@kde.org
https://mail.kde.org/mailman/listinfo/kmymoney-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic