Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MythContext refactoring #671

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open

Conversation

ulmus-scott
Copy link
Contributor

I had planned to do more, but I got fed up with the use of global state and Singletons, so this is all I have done for now.

Checklist

These details do not need to be exposed in the header,
since MythContextPrivate is already a QObject.
Convert it to a nested private class and rename
MythContext::d to m_impl.
It was only used once by a shockingly old (17 years old,
commit 0d4ef8e) line.

Use MythContext::Impl's own members and methods instead of redirecting
back to them through MythContext.
Whether to show the prompt was never determined at runtime
and in one case was forced regardless of whether or not a
temporary window already existed (which would have prevented
the prompt from showing as it would return early from
TempMainWindow()).
and directly access the MythDB singleton.

This should help reasoning about further changes.
…calls

The only functional difference is that m_dbParams::m_localEnabled
is now conditionally set before the first
`gCoreContext->GetDB()->SetDatabaseParams(m_dbParams);` call.

This doesn't matter since it was set before the second SetDatabaseParams()
call, likely via ResetDatabase().  Also, DatabaseParams::m_localEnabled
is practically unused.

This split is to enable refactoring out the DatabaseSettingsCache into
its own class by reducing LoadDatabaseSettings() to its core functionality.
This is necessary to enable loading the cache in its constructor before
the MythCoreContext constructor has finished, i.e. while gCoreContext is
nullptr.
…ingleton

This should allow moving the DatabaseSettingsCache to MythDB since
save can now be called at any time.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant