make the theme handling in musredit more flexible. At the same time adopted some part to more modern c++.
This commit is contained in:
@ -88,11 +88,11 @@
|
||||
PTextEdit::PTextEdit( QWidget *parent )
|
||||
: QMainWindow( parent )
|
||||
{
|
||||
bool gotTheme = getTheme();
|
||||
|
||||
// reads and manages the conents of the xml-startup (musredit_startup.xml) file
|
||||
fAdmin = std::make_unique<PAdmin>();
|
||||
|
||||
bool gotTheme = getTheme();
|
||||
|
||||
// set default setting of the fDarkMenuIconIcons only if a theme has been recognized, otherwise take the
|
||||
// one from the xml startup file.
|
||||
if (gotTheme) {
|
||||
@ -134,7 +134,6 @@ PTextEdit::PTextEdit( QWidget *parent )
|
||||
|
||||
textFamily(fAdmin->getFontName());
|
||||
textSize(QString("%1").arg(fAdmin->getFontSize()));
|
||||
fFontChanging = false;
|
||||
|
||||
QString iconName("");
|
||||
if (fDarkMenuIcon)
|
||||
@ -1967,7 +1966,7 @@ void PTextEdit::editUncomment()
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Chances the font.
|
||||
* <p>Changes the font.
|
||||
*
|
||||
* \param f font name
|
||||
*/
|
||||
@ -1984,7 +1983,7 @@ void PTextEdit::textFamily( const QString &f )
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Chances the font size.
|
||||
* <p>Changes the font size.
|
||||
*
|
||||
* \param p font size in points.
|
||||
*/
|
||||
@ -2213,6 +2212,7 @@ void PTextEdit::musrMsr2Data()
|
||||
fMsr2DataParam->keepMinuit2Output = fAdmin->getKeepMinuit2OutputFlag();
|
||||
fMsr2DataParam->titleFromDataFile = fAdmin->getTitleFromDataFileFlag();
|
||||
fMsr2DataParam->estimateN0 = fAdmin->getEstimateN0Flag();
|
||||
fMsr2DataParam->yamlOut = fAdmin->getYamlOutFlag();
|
||||
fMsr2DataParam->perRunBlockChisq = fAdmin->getChisqPerRunBlockFlag();
|
||||
|
||||
PMsr2DataDialog *dlg = new PMsr2DataDialog(fMsr2DataParam, fAdmin->getHelpUrl("msr2data"));
|
||||
@ -2235,6 +2235,7 @@ void PTextEdit::musrMsr2Data()
|
||||
fAdmin->setKeepMinuit2OutputFlag(fMsr2DataParam->keepMinuit2Output);
|
||||
fAdmin->setTitleFromDataFileFlag(fMsr2DataParam->titleFromDataFile);
|
||||
fAdmin->setEstimateN0Flag(fMsr2DataParam->estimateN0);
|
||||
fAdmin->setYamlOutFlag(fMsr2DataParam->yamlOut);
|
||||
fAdmin->setChisqPerRunBlockFlag(fMsr2DataParam->perRunBlockChisq);
|
||||
|
||||
// analyze parameters
|
||||
@ -2735,6 +2736,7 @@ void PTextEdit::musrPrefs()
|
||||
}
|
||||
|
||||
if (dlg->exec() == QDialog::Accepted) {
|
||||
fAdmin->setIgnoreThemeAutoDetection(dlg->getIgnoreThemeAutoDetection());
|
||||
fAdmin->setDarkThemeIconsMenuFlag(dlg->getDarkThemeIconsMenuFlag());
|
||||
fAdmin->setDarkThemeIconsToolbarFlag(dlg->getDarkThemeIconsToolbarFlag());
|
||||
fAdmin->setMusrviewShowFourierFlag(dlg->getMusrviewShowFourierFlag());
|
||||
@ -3358,6 +3360,9 @@ void PTextEdit::jumpToBlock(int idx)
|
||||
*/
|
||||
bool PTextEdit::getTheme()
|
||||
{
|
||||
if (fAdmin->getIgnoreThemeAutoDetection())
|
||||
return false;
|
||||
|
||||
fDarkMenuIcon = false; // true if theme is dark
|
||||
fDarkToolBarIcon = false; // needed for ubuntu dark since there the menu icons are dark, however the toolbar icons are plain!
|
||||
|
||||
@ -3389,10 +3394,9 @@ bool PTextEdit::getTheme()
|
||||
|
||||
if (str.contains("dark", Qt::CaseInsensitive)) {
|
||||
fDarkMenuIcon = true;
|
||||
if (str.contains("ubuntu", Qt::CaseInsensitive)) {
|
||||
fDarkMenuIcon = false;
|
||||
fDarkToolBarIcon = false;
|
||||
} else if (str.contains("xfce", Qt::CaseInsensitive)) {
|
||||
if (str.contains("ubuntu", Qt::CaseInsensitive) ||
|
||||
str.contains("xfce", Qt::CaseInsensitive) ||
|
||||
str.contains("mx", Qt::CaseInsensitive)) {
|
||||
fDarkMenuIcon = false;
|
||||
fDarkToolBarIcon = false;
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user