Mailing List Archive

RFC: Refactoring and code standards
Hello all,

I am currently working on refactoring mythcontex and mythcorecontext.

I am requesting comments on the forum:

/mythtv/configure --compile-type questions - MythTV Official Community Forum
https://forum.mythtv.org/viewtopic.php?f=6&t=4511

Coding standards clarifications - MythTV Official Community Forum
https://forum.mythtv.org/viewtopic.php?f=6&t=4574

I also didn't see any way to register for the wiki, which also needs some
cleanup. So how do I register for the wiki?

Thanks,

Scott (ulmus-scott)

PS--Is someone going to merge this:
https://github.com/MythTV/mythtv/pull/385 ?
Re: RFC: Refactoring and code standards [ In reply to ]
On 05/09/2021 17:35, Scott T wrote:
> Hello all,
>
> I am currently working on refactoring mythcontex and mythcorecontext.

Can you share your thoughts on what you are looking to achieve here?

Having just pulled the startup sequence apart, i agree it's not the
prettiest thing, and there is likely to be room for improvement.

For background, I'm working towards being able to configure the whole
backend from the built in web server, however that will at minimum need
the backend to have state which represents if the DB is unconfigured,
configured, connected etc....

>
> I also didn't see any way to register for the wiki, which also needs
> some cleanup.  So how do I register for the wiki?
>

Ping either myself or hampton on IRC (#mythtv @libera.chat) and we
can enable wiki registration while you register, and then disable it
again afterwards (we have had lots of issues with spam before and this
helps a lot)


Regards
Stuart
_______________________________________________
mythtv-dev mailing list
mythtv-dev@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-dev
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: RFC: Refactoring and code standards [ In reply to ]
On 9/6/21 4:48 AM, Stuart Auchterlonie wrote:
>
> Can you share your thoughts on what you are looking to achieve here?
>
> Having just pulled the startup sequence apart, i agree it's not the
> prettiest thing, and there is likely to be room for improvement.

When I was looking at the code to figure out a bug I found (fix:
https://github.com/MythTV/mythtv/pull/385 ;
https://github.com/MythTV/mythtv/pull/369 (changes in 385 now);
discussion:
https://forum.mythtv.org/viewtopic.php?f=36&t=4470&start=45#p22285), I
noticed the code in mythcontext was messy and not very readable.

My goal is to make the code more readable (some work, subject to changes
and rebasing, is on my fork https://github.com/ulmus-scott/mythtv ). 
Much work remains, e.g. merging the anemic MythContextSlotHandler into
MythContextPrivate, separating the settings caches into their own
classes, some old cache format code to remove, some hacks to test.

I was originally only looking at MythContext, but I got distracted by
the unnecessary shim duplication of MythDB’s methods in
MythCoreContext.  I was also thinking of making the MythDB instance a
global variable, but thinking on it some more, it would probably be
better to make it a member of MythCoreContext (still exposing it via the
global GetMythDB() ), since trying to access it uninitialized doesn’t
make any sense.

Communicating between MythCoreContext and MythContext via QObjects and
QEvents, seems, at the very least, hack-y, if not breaking
encapsulation.  I’m thinking of renaming MythContext to MythGUIContext,
as seems to have been the intent, and make it a subclass of
MythCoreContext, overriding the CLI superclass methods with the subclass
GUI counterparts.


To investigate:
Does MythCoreContext need to be a QObject?  The TVPlayback signals
(without having looked at them) seem out of scope for MythCoreContext
(frontend only? And thus GUI only?).


Beyond current scope of work:
cleanup in MythMainWindow (similarly quasi-global as MythDB) (seems to
also be MythCoreContext’s GUIObject)

Improve logging with __FILE__, __LINE__, and __func__.  Readability:
define masks with bit shifting.  Add a mask for fonts to enable
disabling output (debug produces lots of extraneous font messages).

Regards,
Scott
_______________________________________________
mythtv-dev mailing list
mythtv-dev@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-dev
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org