Qt models uniquely for mobile or desktop

Jan Mulder jlmulder at xs4all.nl
Wed Jan 10 06:19:45 PST 2018


On 10-01-18 14:43, Berthold Stoeger wrote:
> Hi Jan,
> 
> On Mittwoch, 10. Jänner 2018 12:43:53 CET Jan Mulder wrote:
>> On 09-01-18 10:36, Jan Mulder wrote:
>>> I found out (more or less accidentally) that, for example, the
>>> divelistmodel.h/cpp code is uniquely used in mobile only. It is highly
>>> likely that this is true for more models, or models that are uniquely
>>> used in desktop.
>>>
>>> So my question (mainly to Dirk, I think). Is it worthwhile to adapt our
>>> build system to make this more explicit? I would at least help
>>> developers to realize this. Not sure it would help with respect to
>>> footprint of the (primarily mobile) application, as the tool chain might
>>> weed out that unused code.
>>
>> In the meantime, I added a PR (#1033) to implement a split in the models
>> (only mobile, only desktop, and both). This is cmake stuff only, and no
>> other code changes.
>>
>> That said, with one small code change, I have another PR in queue (that
>> waits for the decision on #1033), in which I have split-up the models
>> even further: 3 models generically used, 3 models unique for mobile, and
>> the remaining 17 models unique for desktop.(when I say model, I mean
>> .cpp source file containing the model code). Obviously, those 17 desktop
>> only model code it littered with #ifdef MOBILE blocks, put in in the
>> early phases of the mobile development, as we did want it to get
>> compiled. Formally, they are useless know, but notice that the current
>> split action is based on the current functionality of the mobile app.
>> And we all know that functionality can change, so models might get moved
>> over time.
> 
> I find both ideas appealing - separating the models into common, mobile and
> desktop, as well as removing unused #ifdef-ery.

I was confused here. The mode code is reasonably clean from #ifdef-ery 
:-) It is more in the profile widget, which is somewhat understandable, 
as the widget is used in both mobile and desktop, but mobile lacks a lot 
of features of the widget).

--kam


More information about the subsurface mailing list