improved dark theme handling on mupp for qt6.

This commit is contained in:
2025-03-29 20:17:28 +01:00
parent 1eff68886a
commit 71de742840
5 changed files with 66 additions and 33 deletions

View File

@@ -156,8 +156,12 @@ bool PmuppAdminXMLParser::startElement()
if (qName == "path_file_name") {
fKeyWord = eRecentFile;
} else if (qName == "dark_theme") {
fKeyWord = eDarkTheme;
} else if (qName == "ignore_theme_auto_detection") {
fKeyWord = eIgnoreThemeAutoDetection;
} else if (qName == "dark_theme_icons_menu") {
fKeyWord = eDarkThemeIconsMenu;
} else if (qName == "dark_theme_icons_toolbar") {
fKeyWord = eDarkThemeIconsToolbar;
} else if (qName == "marker") {
fKeyWord = eMarker;
} else if (qName == "color") {
@@ -201,11 +205,23 @@ bool PmuppAdminXMLParser::characters()
case eRecentFile:
fAdmin->addRecentFile(QString(str.toLatin1()).trimmed());
break;
case eDarkTheme:
if ((str == "yes") || (str == "1") || (str == "true"))
fAdmin->setTheme(true);
case eIgnoreThemeAutoDetection:
if ((str == "yes") || (str == "y") || (str == "1") || (str == "true"))
fAdmin->setIgnoreThemeAutoDetection(true);
else
fAdmin->setTheme(false);
fAdmin->setIgnoreThemeAutoDetection(false);
break;
case eDarkThemeIconsMenu:
if ((str == "yes") || (str == "1") || (str == "true"))
fAdmin->setThemeIconsMenu(true);
else
fAdmin->setThemeIconsMenu(false);
break;
case eDarkThemeIconsToolbar:
if ((str == "yes") || (str == "1") || (str == "true"))
fAdmin->setThemeIconsToolbar(true);
else
fAdmin->setThemeIconsToolbar(false);
break;
case eMarker:
tok = str.split(",", Qt::SkipEmptyParts);
@@ -272,7 +288,7 @@ bool PmuppAdminXMLParser::endDocument()
* <p>Initializes that PmuppAdmin object, and calls the XML parser which feeds
* the object variables.
*/
PmuppAdmin::PmuppAdmin() : QObject(), fDarkTheme(false)
PmuppAdmin::PmuppAdmin() : QObject()
{
// XML Parser part
// 1st: check local directory
@@ -433,7 +449,7 @@ void PmuppAdmin::getColor(int idx, int &r, int &g, int &b)
* @param marker marker code
* @param size marker size
*/
void PmuppAdmin::setMarker(int marker, double size)
void PmuppAdmin::setMarker(const int marker, const double size)
{
PmuppMarker markerObj;
@@ -456,7 +472,7 @@ void PmuppAdmin::setMarker(int marker, double size)
* @param b blue value (0..255)
* @param name color name
*/
void PmuppAdmin::setColor(int r, int g, int b, QString name)
void PmuppAdmin::setColor(const int r, const int g, const int b, QString name)
{
if (((r<0) || (r>255)) ||
((g<0) || (g>255)) ||