Re: QML question

2016-04-27 Thread Tomaz Canabrava
On Wed, Apr 27, 2016 at 2:15 PM, Joakim Bygdell  wrote:

>
> > On 27 Apr 2016, at 18:55, Tomaz Canabrava  wrote:
> >
> > Please, please:
> >
> > don't add more stuff to the QMLManager, it's a huge beast already :)
> > crete something like this:
> >
> > Q_INVOKABLE QStringListModel : DiveObjectHelper::buddies() {
> >static QStringListModel buddies = new QStringListModel();
> > QStringList temp;
> >   for_each_dive (i, d) {
> > temp << d->buddy;
> >   }
> >temp.removeDuplicates();
> >buddies.setStringList(temp);
> >qDebug() << temp;
> >return buddies;
> > }
> >
> > What can be happening is that a QStringList will not tell QML that it
> changed, and thus, it wont update it's contents.
> > a Model will.
> Fully understandable.
>
> But why do I get data in my combobox if I do this: buddies << “foo” <<
> “bar”
> and not this: buddies << d->buddy.
>
> If I add
> buddies << “foo” << “bar”;
> before the return statement, the combobox will have two entries, “foo” and
> “bar".
>
> If i replace the combobox with a label where the text is a QString
> generated by joining the QStringList
> I get all buddies displayed on one line. “Buddy A, Buddy B, foo, bar"
>

I have *no* idea, really.
can you create a branch where I can try this?
currently I'm in the middle of a subsurface refactor for 5.0 (
tcanabrava/subsurface:new_ui )
with almost 100 commits, I need to speed things there too.



>
>
>
>
> >
> >
>
> /Jocke
>
>
___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


Re: QML question

2016-04-27 Thread Joakim Bygdell

> On 27 Apr 2016, at 18:55, Tomaz Canabrava  wrote:
> 
> Please, please:
> 
> don't add more stuff to the QMLManager, it's a huge beast already :)
> crete something like this:
> 
> Q_INVOKABLE QStringListModel : DiveObjectHelper::buddies() {
>static QStringListModel buddies = new QStringListModel();
> QStringList temp;
>   for_each_dive (i, d) {
> temp << d->buddy;
>   }
>temp.removeDuplicates();
>buddies.setStringList(temp);
>qDebug() << temp;
>return buddies;
> }
> 
> What can be happening is that a QStringList will not tell QML that it 
> changed, and thus, it wont update it's contents.
> a Model will. 
Fully understandable.

But why do I get data in my combobox if I do this: buddies << “foo” << “bar”
and not this: buddies << d->buddy.

If I add 
buddies << “foo” << “bar”; 
before the return statement, the combobox will have two entries, “foo” and 
“bar".

If i replace the combobox with a label where the text is a QString generated by 
joining the QStringList
I get all buddies displayed on one line. “Buddy A, Buddy B, foo, bar"




> 
> 

/Jocke

___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


Re: QML question

2016-04-27 Thread Tomaz Canabrava
Please, please:

don't add more stuff to the QMLManager, it's a huge beast already :)
crete something like this:

Q_INVOKABLE QStringListModel : DiveObjectHelper::buddies() {
   static QStringListModel buddies = new QStringListModel();
QStringList temp;
for_each_dive (i, d) {
temp << d->buddy;
}
   temp.removeDuplicates();
   buddies.setStringList(temp);
   qDebug() << temp;
   return buddies;
}

What can be happening is that a QStringList will not tell QML that it
changed, and thus, it wont update it's contents.
a Model will.
___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


Re: QML question

2016-04-27 Thread Joakim Bygdell

> On 27 Apr 2016, at 18:27, Thiago Macieira  wrote:
> 
> On quarta-feira, 27 de abril de 2016 17:40:53 PDT Joakim Bygdell wrote:
>> Thomas or Thiago can you explain what’s going on here?
>> 
>> I have a combobox that gets populated from a QStringList.
>> 
>> If I generate the QStringList on the C++ side like so,
>>  list << “foo” << “bar << “baz"
>> my combobox contains 3 elements as expected.
>> 
>> If I populate the QStringList with data from the dive struct,
>>  list << dive.buddy << dive.divemaster
>> the combobox is empty.
>> 
>> In the later example the QStringList contains the expected data as I can
>> join the QStringList into a QString  that displays correctly on the QML
>> side.
> 
> The source of the data is not the issue here. That's a red herring. The 
> problem is something else.
> 
> 1) are you sure dive.buddy and dive.divemasters are non-empty strings?

Yes as I can concatenate the list to a single string that is displayed on 
the QML side with the correct content.

> 
> 2) is there anything special about the content of those strings?

Nope, just normal names.

> 
> 3) can you show the code after that?

QML side:

Combobox {
id: buddyBox
model: buddyList
}



C++ side:

QStringList QMLManger::buddyList() const
{
QStringList buddies;
struct dive *d;
int i = 0;
for_each_dive (i, d) {
buddies << d->buddy;
}
buddies.removeDuplicates();
return buddies;
}

> 
> -- 
> Thiago Macieira - thiago (AT) macieira.info  - thiago 
> (AT) kde.org 
>   Software Architect - Intel Open Source Technology Center
> 
> ___
> subsurface mailing list
> subsurface@subsurface-divelog.org 
> http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface 
> 
/Jocke

___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


Re: QML question

2016-04-27 Thread Thiago Macieira
On quarta-feira, 27 de abril de 2016 17:40:53 PDT Joakim Bygdell wrote:
> Thomas or Thiago can you explain what’s going on here?
> 
> I have a combobox that gets populated from a QStringList.
> 
> If I generate the QStringList on the C++ side like so,
>   list << “foo” << “bar << “baz"
> my combobox contains 3 elements as expected.
> 
> If I populate the QStringList with data from the dive struct,
>   list << dive.buddy << dive.divemaster
> the combobox is empty.
> 
> In the later example the QStringList contains the expected data as I can
> join the QStringList into a QString  that displays correctly on the QML
> side.

The source of the data is not the issue here. That's a red herring. The 
problem is something else.

1) are you sure dive.buddy and dive.divemasters are non-empty strings?

2) is there anything special about the content of those strings?

3) can you show the code after that?

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center

___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


QML question

2016-04-27 Thread Joakim Bygdell
Thomas or Thiago can you explain what’s going on here?

I have a combobox that gets populated from a QStringList.

If I generate the QStringList on the C++ side like so,
list << “foo” << “bar << “baz"
my combobox contains 3 elements as expected.

If I populate the QStringList with data from the dive struct,
list << dive.buddy << dive.divemaster
the combobox is empty.

In the later example the QStringList contains the expected data as I can 
join the QStringList into a QString  that displays correctly on the QML side.

/Jocke

___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


Re: Cloud user details set via command line or log file?

2016-04-27 Thread Dirk Hohndel
On Wed, Apr 27, 2016 at 09:39:53AM +1000, Michael Morley wrote:
> Hi,
> 
> I've been using Subsurface for a year or so now and find it fantastic.
> 
> Currently I use 2 different log files saved on the local hard disk to
> manage my log and my wifes log. I then use 2 difference shortcuts on the
> windows desktop with the log file in the target to open either my log or my
> wifes. This automatically opens the correct log without having to go
> through the file menu. I can also open the different logs in 2 windows very
> easily. Works fantastic!
> 
> Anyway, I've started testing the cloud sync to be able to access my log on
> my Android tablet. Seems to work, however there doesn't seem to be an
> option to switch between different cloud users in SubSurface for windows?
> 
> The cloud sync settings are set in preferences, is there any change these
> could be set in the current log file, or an ini file that could be sent to
> subsurface via the command line?
> 
> At the moment I still use a local log file but once I've finished editing I
> sync it to the cloud and close Subsurface. I like having the local
> XML file, makes me feel all warm and fuzzy having my log stored locally in
> one file.

Well, with the cloud option the data is still stored locally as well, just
not in a single XML file but instead as a git repository (which is much
more powerful than just a simple XML file - but we don't expose the
options this can give you to the user in Subsurface - the challenges with
creating a good UI for that are daunting).

But to answer your underlying question - yes, I am thinking about ways to
make Subsurface much more useful for multi-user scenarios. But as usual,
the issue is "who is going to write that code and when". We simply don't
have enough people with the time and the talent to work on the UI, and
even though there are lots of great ideas out there on how to improve
Subsurface, there just aren't enough people working on implementing them.

/D
___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


Re: latest kirigami, latest master, Subsurface-mobile fails

2016-04-27 Thread Marco Martin
On Wednesday 27 April 2016, Dirk Hohndel wrote:
> Yes it does.
> 
> The commit message seems to sell a little short the number of changes this
> commit makes, but it does fix the problem.
> 
> Thank you

yeah, unfortunately i didn't really understood why it fixes it, seems a 
problem in the qtquick layout positioners, in the end what the patch does is 
to diminish the quantity of property bindings to be evalues when the layout 
puts the items in the row.
So unfortunately is mostly working around to whatever the issue is :/

-- 
Marco Martin
___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


Re: latest kirigami, latest master, Subsurface-mobile fails

2016-04-27 Thread Dirk Hohndel
On Wed, Apr 27, 2016 at 02:12:46PM +0200, Marco Martin wrote:
> On Wednesday 27 April 2016, Marco Martin wrote:
> > On Wed, Apr 27, 2016 at 10:19 AM, Marco Martin  wrote:
> > > subsurface mobile is master too?
> > > i tried a bit yesterday and it gave a weird crash but couldn't reach the
> > > culript of it, i'll try to update and give a look to see what's wrong
> > 
> > that's the backtrace i get, do you get the same?
> 
> latest commit 1cff3a25dff seems to fix the crash on page push for me

Yes it does.

The commit message seems to sell a little short the number of changes this
commit makes, but it does fix the problem.

Thank you

/D
___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


Re: latest kirigami, latest master, Subsurface-mobile fails

2016-04-27 Thread Marco Martin
On Wednesday 27 April 2016, Marco Martin wrote:
> On Wed, Apr 27, 2016 at 10:19 AM, Marco Martin  wrote:
> > subsurface mobile is master too?
> > i tried a bit yesterday and it gave a weird crash but couldn't reach the
> > culript of it, i'll try to update and give a look to see what's wrong
> 
> that's the backtrace i get, do you get the same?

latest commit 1cff3a25dff seems to fix the crash on page push for me

-- 
Marco Martin
___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


Re: latest kirigami, latest master, Subsurface-mobile fails

2016-04-27 Thread Marco Martin
On Wed, Apr 27, 2016 at 10:19 AM, Marco Martin  wrote:
> subsurface mobile is master too?
> i tried a bit yesterday and it gave a weird crash but couldn't reach the
> culript of it, i'll try to update and give a look to see what's wrong

that's the backtrace i get, do you get the same?

#0  0x759f3d2c in QTextEngine::justify (this=,
line=) at text/qtextengine.cpp:2151
#1  0x759f85e5 in QTextEngine::alignLine (this=0x2496750,
line=...) at text/qtextengine.cpp:3078
#2  0x75a0a3fa in QTextLine::naturalTextRect
(this=0x7f8029a0) at text/qtextlayout.cpp:1413
#3  0x7620da61 in QQuickTextPrivate::setupTextLayout
(this=0x2496560, baseline=0x7f802b00)
at items/qquicktext.cpp:741
#4  0x7620bb0e in QQuickTextPrivate::updateSize
(this=0x2496560) at items/qquicktext.cpp:394
#5  0x76212264 in QQuickText::geometryChanged (this=0x2430bd0,
newGeometry=..., oldGeometry=...)
at items/qquicktext.cpp:
#6  0x76199350 in QQuickItem::setSize (this=0x2430bd0,
size=...) at items/qquickitem.cpp:6593
#7  0x7fffd809f6b9 in QQuickGridLayoutItem::setGeometry
(this=0x24ced60, rect=...) at qquickgridlayoutengine_p.h:117
#8  0x75c11c34 in QGridLayoutEngine::setGeometries
(this=0x41bdec0, contentsGeometry=..., styleInfo=0x241e6e0)
at util/qgridlayoutengine.cpp:1034
#9  0x7fffd809d572 in QQuickGridLayoutBase::rearrange
(this=0x24666e0, size=...) at qquicklinearlayout.cpp:528
#10 0x7fffd809a4fc in QQuickLayout::geometryChanged
(this=0x24666e0, newGeometry=..., oldGeometry=...)
at qquicklayout.cpp:785
___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


Re: latest kirigami, latest master, Subsurface-mobile fails

2016-04-27 Thread Marco Martin
On Wednesday 27 April 2016, Dirk Hohndel wrote:
> Marco,
> 
> With the latest Kirigami, pushing the DiveDetails page on the page stack
> once you click on a dive fails. Subsurface-mobile becomes non-responsive.
> 
> I can track it down to the stackView.push(detailsWindow) in the onClicked
> handler of the diveDelegate in DiveList.qml
> 
> I spent quite a bit of time trying to figure out why this fails but am
> kinda stuck. Any idea how to debug that?

subsurface mobile is master too?
i tried a bit yesterday and it gave a weird crash but couldn't reach the 
culript of it, i'll try to update and give a look to see what's wrong

-- 
Marco Martin
___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface