add a dark_theme flag to the mupp_startup.xml. This is can help if mupp at runtime cannot decide on the used theme.
This commit is contained in:
parent
1bcfa1de80
commit
5d70f9f078
@ -109,6 +109,8 @@ bool PmuppAdminXMLParser::startElement( const QString&, const QString&,
|
|||||||
{
|
{
|
||||||
if (qName == "path_file_name") {
|
if (qName == "path_file_name") {
|
||||||
fKeyWord = eRecentFile;
|
fKeyWord = eRecentFile;
|
||||||
|
} else if (qName == "dark_theme") {
|
||||||
|
fKeyWord = eDarkTheme;
|
||||||
} else if (qName == "marker") {
|
} else if (qName == "marker") {
|
||||||
fKeyWord = eMarker;
|
fKeyWord = eMarker;
|
||||||
} else if (qName == "color") {
|
} else if (qName == "color") {
|
||||||
@ -152,6 +154,12 @@ bool PmuppAdminXMLParser::characters(const QString& str)
|
|||||||
case eRecentFile:
|
case eRecentFile:
|
||||||
fAdmin->addRecentFile(QString(str.toLatin1()).trimmed());
|
fAdmin->addRecentFile(QString(str.toLatin1()).trimmed());
|
||||||
break;
|
break;
|
||||||
|
case eDarkTheme:
|
||||||
|
if ((str == "yes") || (str == "1") || (str == "true"))
|
||||||
|
fAdmin->setTheme(true);
|
||||||
|
else
|
||||||
|
fAdmin->setTheme(false);
|
||||||
|
break;
|
||||||
case eMarker:
|
case eMarker:
|
||||||
tok = str.split(",", QString::SkipEmptyParts);
|
tok = str.split(",", QString::SkipEmptyParts);
|
||||||
|
|
||||||
@ -277,7 +285,7 @@ bool PmuppAdminXMLParser::fatalError( const QXmlParseException & exception )
|
|||||||
* <p>Initializes that PmuppAdmin object, and calls the XML parser which feeds
|
* <p>Initializes that PmuppAdmin object, and calls the XML parser which feeds
|
||||||
* the object variables.
|
* the object variables.
|
||||||
*/
|
*/
|
||||||
PmuppAdmin::PmuppAdmin() : QObject()
|
PmuppAdmin::PmuppAdmin() : QObject(), fDarkTheme(false)
|
||||||
{
|
{
|
||||||
// XML Parser part
|
// XML Parser part
|
||||||
// 1st: check local directory
|
// 1st: check local directory
|
||||||
|
@ -98,7 +98,7 @@ class PmuppAdminXMLParser : public QXmlDefaultHandler
|
|||||||
virtual ~PmuppAdminXMLParser() {}
|
virtual ~PmuppAdminXMLParser() {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum EAdminKeyWords {eEmpty, eRecentFile, eMarker, eColor};
|
enum EAdminKeyWords {eEmpty, eRecentFile, eDarkTheme, eMarker, eColor};
|
||||||
|
|
||||||
bool startDocument();
|
bool startDocument();
|
||||||
bool startElement( const QString&, const QString&, const QString& ,
|
bool startElement( const QString&, const QString&, const QString& ,
|
||||||
@ -133,6 +133,8 @@ class PmuppAdmin : public QObject
|
|||||||
int getNumRecentFiles() { return fRecentFile.size(); }
|
int getNumRecentFiles() { return fRecentFile.size(); }
|
||||||
QString getRecentFile(int idx);
|
QString getRecentFile(int idx);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int getNoOfMarkers() { return fMarker.size(); }
|
int getNoOfMarkers() { return fMarker.size(); }
|
||||||
QVector<PmuppMarker> getMarkers() { return fMarker; }
|
QVector<PmuppMarker> getMarkers() { return fMarker; }
|
||||||
PmuppMarker getMarker(int idx);
|
PmuppMarker getMarker(int idx);
|
||||||
@ -142,6 +144,9 @@ class PmuppAdmin : public QObject
|
|||||||
void getColor(QString name, int &r, int &g, int &b);
|
void getColor(QString name, int &r, int &g, int &b);
|
||||||
void getColor(int idx, int &r, int &g, int &b);
|
void getColor(int idx, int &r, int &g, int &b);
|
||||||
|
|
||||||
|
bool isDarkTheme() { return fDarkTheme; }
|
||||||
|
|
||||||
|
void setTheme(bool theme) { fDarkTheme = theme; }
|
||||||
void setMarker(int marker, double size);
|
void setMarker(int marker, double size);
|
||||||
void setColor(int r, int g, int b, QString name="");
|
void setColor(int r, int g, int b, QString name="");
|
||||||
|
|
||||||
@ -150,6 +155,7 @@ class PmuppAdmin : public QObject
|
|||||||
|
|
||||||
QVector<QString> fRecentFile; ///< keep vector of recent path-file names
|
QVector<QString> fRecentFile; ///< keep vector of recent path-file names
|
||||||
|
|
||||||
|
bool fDarkTheme;
|
||||||
QVector<PmuppMarker> fMarker;
|
QVector<PmuppMarker> fMarker;
|
||||||
QVector<PmuppColor> fColor;
|
QVector<PmuppColor> fColor;
|
||||||
|
|
||||||
|
@ -827,6 +827,14 @@ void PmuppGui::getTheme()
|
|||||||
|
|
||||||
QString str = QIcon::themeName();
|
QString str = QIcon::themeName();
|
||||||
|
|
||||||
|
if (str.isEmpty()) {
|
||||||
|
if (fAdmin->isDarkTheme()) {
|
||||||
|
fDarkTheme = true;
|
||||||
|
fDarkToolBarIcon = true;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (str.contains("dark", Qt::CaseInsensitive)) {
|
if (str.contains("dark", Qt::CaseInsensitive)) {
|
||||||
fDarkTheme = true;
|
fDarkTheme = true;
|
||||||
if (str.contains("ubuntu", Qt::CaseInsensitive)) {
|
if (str.contains("ubuntu", Qt::CaseInsensitive)) {
|
||||||
@ -835,6 +843,8 @@ void PmuppGui::getTheme()
|
|||||||
fDarkToolBarIcon = true;
|
fDarkToolBarIcon = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QMessageBox::information(0, "INFO", QString("str='%1', fDarkTheme=%2").arg(str).arg(fDarkTheme));
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
</comment>
|
</comment>
|
||||||
<recent_files>
|
<recent_files>
|
||||||
</recent_files>
|
</recent_files>
|
||||||
|
<dark_theme>no</dark_theme>
|
||||||
<root_settings>
|
<root_settings>
|
||||||
<marker_list>
|
<marker_list>
|
||||||
<!-- Root marker numbers -->
|
<!-- Root marker numbers -->
|
||||||
|
Loading…
x
Reference in New Issue
Block a user