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

Windows GUI: Implement theme preferences #871

Merged
merged 1 commit into from
Jun 18, 2024

Conversation

cjee21
Copy link
Collaborator

@cjee21 cjee21 commented Jun 18, 2024

Enable user to save their preferences for application theme.

This is an implementation of the suggestion in #836 (comment) which I am only able to implement now after studying and figuring out how MediaInfo handle preferences.

Screenshot 2024-06-18 170430

Fixed in latest force push:

Still needs more testing and to fix this bug that occurs when MediaInfo tries to start in dark mode:
Screenshot 2024-06-18 170453
This is something we ran into in the initial dark mode implementation. It is supposedly caused by changing the theme during form show. Before this, we worked around by setting the theme in the form creation part. However, we need to find another place for it now because we need to read the preferences to set the theme and can only do so after the preferences are initialized and loaded.

@JeromeMartinez
Copy link
Member

@cjee21 thank you for your help there, very appreciated.

@JeromeMartinez
Copy link
Member

(and I know that this 20 year old code is super messy, it needs a bug clean up :( )

@cjee21
Copy link
Collaborator Author

cjee21 commented Jun 18, 2024

While looking around I came across this TODO:

	if (Page->ActivePage==Page_Sheet) //TODO : find WHY there is a crash without this...
	   ChangePage(Page_Easy);

	delete Prefs; Prefs=NULL;
	delete I; I=NULL;

Found that the crash is due to this line:

delete Prefs; Prefs=NULL;

After debugging, found that after delete Prefs; Prefs=NULL;, it seems to still run FormResize then at Total+=Prefs->Details[Prefs_Sheet](Z1, 4).To_int32s();, the crash occur because Prefs is already deleted. Putting delete Prefs; Prefs=NULL; in FormDestroy does not work too as this also seems to run before the form is actually destroyed.

@cjee21
Copy link
Collaborator Author

cjee21 commented Jun 18, 2024

After moving stuff around, it appears to be working as expected now but probably need more testing to make sure nothing gets accidentally broken.

@JeromeMartinez
Copy link
Member

@cjee21 please rebase then I do so tests on the GUI.

Enable user to save their preferences for application theme.
Copy link
Member

@JeromeMartinez JeromeMartinez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It could also be in the main page of the preference window (below "output format") in another PR, if you are motivated.

Thank you again, your help is greatly appreciated!

@JeromeMartinez JeromeMartinez merged commit f6b9e72 into MediaArea:master Jun 18, 2024
3 checks passed
@cjee21 cjee21 deleted the dark-mode branch June 18, 2024 13:55
@JeromeMartinez
Copy link
Member

dev snapshot.

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.

2 participants