void TabBar::setTheme(const Theme* theme) { qDebug("TabBar theme is changed"); if (!theme) { qWarning("theme is null"); return; } if (theme->tabBarSettings != nullptr) { QString style; ColorSettings* tabBarSettings = theme->tabBarSettings.get(); style = QString( "TabBar { background-color: %1; }" "TabBar::tab {" "background-color: %1;" "color: %2;" "}") .arg(Util::qcolorForStyleSheet(tabBarSettings->value("background"))) .arg(Util::qcolorForStyleSheet(tabBarSettings->value("foreground"))); style += QString( "TabBar::tab:selected {" "background-color: %1;" "color: %2;" "border-bottom: 2px solid;" "border-color: %3;" "}") .arg(Util::qcolorForStyleSheet(tabBarSettings->value("selected"))) .arg(Util::qcolorForStyleSheet(tabBarSettings->value("foreground"))) .arg(Util::qcolorForStyleSheet(tabBarSettings->value("selectedBorder"))); this->setStyleSheet(style); } }
void HighlightManager::load(SimpleXML& aXml){ aXml.resetCurrentChild(); if(aXml.findChild("Highlights")) { aXml.stepIn(); while(aXml.findChild("Highlight")) { try{ ColorSettings cs; cs.setContext(aXml.getIntChildAttrib("Context")); cs.setMatch( Text::toT( aXml.getChildAttrib("Match") ) ); cs.setBold( aXml.getBoolChildAttrib("Bold") ); cs.setItalic( aXml.getBoolChildAttrib("Italic") ); cs.setUnderline( aXml.getBoolChildAttrib("Underline") ); cs.setStrikeout( aXml.getBoolChildAttrib("Strikeout") ); //Convert old setting to correct context if(aXml.getBoolChildAttrib("IncludeNickList") == true) cs.setContext(CONTEXT_NICKLIST); cs.setCaseSensitive( aXml.getBoolChildAttrib("CaseSensitive") ); cs.setWholeLine( aXml.getBoolChildAttrib("WholeLine") ); cs.setWholeWord( aXml.getBoolChildAttrib("WholeWord") ); cs.setPopup( aXml.getBoolChildAttrib("Popup") ); cs.setTab( aXml.getBoolChildAttrib("Tab") ); cs.setPlaySound( aXml.getBoolChildAttrib("PlaySound") ); //cs.setLog( aXml.getBoolChildAttrib("LastLog") ); cs.setFlashWindow( aXml.getBoolChildAttrib("FlashWindow") ); cs.setMatchType( aXml.getIntChildAttrib("MatchType") ); cs.setHasFgColor(aXml.getBoolChildAttrib("HasFgColor")); cs.setHasBgColor(aXml.getBoolChildAttrib("HasBgColor")); cs.setBgColor(aXml.getIntChildAttrib("BgColor")); cs.setFgColor(aXml.getIntChildAttrib("FgColor")); cs.setSoundFile(aXml.getChildAttrib("SoundFile")); cs.setMatchColumn(aXml.getIntChildAttrib("MatchColumn")); cs.setRegexp(); colorSettings.push_back(cs); }catch(...) { } } aXml.stepOut(); } else { aXml.resetCurrentChild(); } }
void HighlightManager::load(SimpleXML& aXml){ aXml.resetCurrentChild(); if(aXml.findChild("Highlights")) { aXml.stepIn(); while(aXml.findChild("Highlight")) { try{ ColorSettings cs; cs.setContext(aXml.getIntChildAttrib("Context")); cs.setMatch( Text::utf8ToWide( aXml.getChildAttrib("Match") ) ); cs.setBold( aXml.getBoolChildAttrib("Bold") ); cs.setItalic( aXml.getBoolChildAttrib("Italic") ); cs.setUnderline( aXml.getBoolChildAttrib("Underline") ); cs.setStrikeout( aXml.getBoolChildAttrib("Strikeout") ); //Convert old setting to correct context if(aXml.getBoolChildAttrib("IncludeNickList") == true) cs.setContext(CONTEXT_NICKLIST); cs.setCaseSensitive( aXml.getBoolChildAttrib("CaseSensitive") ); cs.setWholeLine( aXml.getBoolChildAttrib("WholeLine") ); cs.setWholeWord( aXml.getBoolChildAttrib("WholeWord") ); cs.setPopup( aXml.getBoolChildAttrib("Popup") ); cs.setTab( aXml.getBoolChildAttrib("Tab") ); cs.setPlaySound( aXml.getBoolChildAttrib("PlaySound") ); //cs.setLog( aXml.getBoolChildAttrib("LastLog") ); cs.setFlashWindow( aXml.getBoolChildAttrib("FlashWindow") ); cs.setMatchType( aXml.getIntChildAttrib("MatchType") ); cs.setHasFgColor( aXml.getBoolChildAttrib("HasFgColor") ); cs.setHasBgColor( aXml.getBoolChildAttrib("HasBgColor") ); cs.setBgColor( (int)aXml.getLongLongChildAttrib("BgColor") ); cs.setFgColor( (int)aXml.getLongLongChildAttrib("FgColor") ); cs.setSoundFile( Text::utf8ToWide( aXml.getChildAttrib("SoundFile") ) ); cs.setMatchColumn(aXml.getIntChildAttrib("MatchColumn")); cs.setRegexp(); colorSettings.push_back(cs); }catch(...) { } } aXml.stepOut(); } else { aXml.resetCurrentChild(); } //convert the old setting to highlights if(!SETTING(HIGHLIGHT_LIST).empty()) { ColorSettings cs; cs.setContext(CONTEXT_FILELIST); cs.setMatch(Text::toT(SETTING(HIGHLIGHT_LIST))); cs.setHasFgColor(true); cs.setFgColor( SETTING(LIST_HL_COLOR) ); cs.setHasBgColor(true); cs.setBgColor( SETTING(LIST_HL_BG_COLOR) ); SettingsManager::getInstance()->set(SettingsManager::HIGHLIGHT_LIST, ""); SettingsManager::getInstance()->set(SettingsManager::USE_HIGHLIGHT, true); colorSettings.push_back(cs); } }
void HighlightManager::load(SimpleXML& aXml) { aXml.resetCurrentChild(); if(aXml.findChild("Highlights")) { aXml.stepIn(); while(aXml.findChild("Highlight")) { ColorSettings cs; cs.setMatch( Text::utf8ToWide( aXml.getChildAttrib("Match") ) ); cs.setBold( aXml.getBoolChildAttrib("Bold") ); cs.setItalic( aXml.getBoolChildAttrib("Italic") ); cs.setUnderline( aXml.getBoolChildAttrib("Underline") ); cs.setStrikeout( aXml.getBoolChildAttrib("Strikeout") ); cs.setIncludeNickList( aXml.getBoolChildAttrib("IncludeNickList") ); cs.setCaseSensitive( aXml.getBoolChildAttrib("CaseSensitive") ); cs.setWholeLine( aXml.getBoolChildAttrib("WholeLine") ); cs.setWholeWord( aXml.getBoolChildAttrib("WholeWord") ); cs.setPopup( aXml.getBoolChildAttrib("Popup") ); cs.setTab( aXml.getBoolChildAttrib("Tab") ); cs.setPlaySound( aXml.getBoolChildAttrib("PlaySound") ); cs.setLog( aXml.getBoolChildAttrib("LastLog") ); cs.setFlashWindow( aXml.getBoolChildAttrib("FlashWindow") ); cs.setMatchType( aXml.getIntChildAttrib("MatchType") ); cs.setHasFgColor( aXml.getBoolChildAttrib("HasFgColor") ); cs.setHasBgColor( aXml.getBoolChildAttrib("HasBgColor") ); cs.setBgColor( (int)aXml.getLongLongChildAttrib("BgColor") ); cs.setFgColor( (int)aXml.getLongLongChildAttrib("FgColor") ); cs.setSoundFile( Text::utf8ToWide( aXml.getChildAttrib("SoundFile") ) ); colorSettings.push_back(cs); } aXml.stepOut(); } else { aXml.resetCurrentChild(); } }
void FindReplaceView::setTheme(core::Theme* theme) { ui->prevButton->setIcon(QIcon(":/images/prevButton-black.svg")); ui->nextButton->setIcon(QIcon(":/images/nextButton-black.svg")); qDebug("FindReplaceView theme is changed"); if (!theme) { qWarning("theme is null"); return; } if (theme->findReplaceViewSettings != nullptr) { ColorSettings* findReplaceViewSettings = theme->findReplaceViewSettings.get(); QString defaultIconColor = QStringLiteral("black"); QString checkedIconColor = QStringLiteral("white"); if (theme->isDarkTheme()) { defaultIconColor = "white"; checkedIconColor = "black"; ui->prevButton->setIcon(QIcon(":/images/prevButton-white.svg")); ui->nextButton->setIcon(QIcon(":/images/nextButton-white.svg")); } QList<QCheckBox*> allCkButtons = this->findChildren<QCheckBox*>(); for (int i = 0; i < allCkButtons.size(); i++) { const QString& style = QStringLiteral( "#%1::indicator {" "image: url(:/images/%1-%2);" "}" "#%1::indicator:checked {" "image: url(:/images/%1-%3);" "}") .arg(allCkButtons.at(i)->objectName()) .arg(defaultIconColor) .arg(checkedIconColor); allCkButtons.at(i)->setStyleSheet(style); }; const QString& style = QStringLiteral( "#%1 {" "background-color: %2;" "}") .arg(this->objectName()) .arg(Util::qcolorForStyleSheet(findReplaceViewSettings->value("background"))) + QStringLiteral( "#%1 QPushButton {" "color: %2;" "outline: 0;" "}" "#%1 QCheckBox:checked {" "background-color: %3;" "}") .arg(this->objectName()) .arg(defaultIconColor) .arg(Util::qcolorForStyleSheet( findReplaceViewSettings->value("buttonCheckedBackgroundColor"))) + QStringLiteral( "#%1 QPushButton:focus, #%1 QLineEdit:focus {" "border-color: %2;" "}") .arg(this->objectName()) .arg(Util::qcolorForStyleSheet(findReplaceViewSettings->value("focusColor"))) + QStringLiteral( "#%1 QPushButton:hover, " "#%1 QCheckBox:unchecked:hover {" "background:%2;" "}" "#%1 QPushButton:pressed, " "#%1 QCheckBox:unchecked:pressed {" "background:%3;" "}") .arg(this->objectName()) .arg(Util::qcolorForStyleSheet(findReplaceViewSettings->value("hoverColor"))) .arg(Util::qcolorForStyleSheet(findReplaceViewSettings->value("pressedColor"))); this->setStyleSheet(style); } }
void CFulEditCtrl::Colorize(const tstring& aLine, int begin) { CHARFORMAT2 cf; cf.cbSize = sizeof(CHARFORMAT2); ColorList *cList = HighlightManager::getInstance()->getList(); int end = GetTextLengthEx(GTL_NUMCHARS); SetSel(begin, end); //otroligt fulhack, måste lagas riktigt nån gång SetSelectionCharFormat(selFormat); logged = false; //compare the last line against all strings in the vector for(ColorIter i = cList->begin(); i != cList->end(); ++i) { ColorSettings* cs = &(*i); int pos; //set start position for find if( cs->getIncludeNick() ) { pos = 0; } else { pos = aLine.find(_T(">")); if(pos == tstring::npos) pos = aLine.find(_T("**")) + nick.length(); } //prepare the charformat cf.dwMask = CFM_BOLD | CFM_UNDERLINE | CFM_STRIKEOUT | CFM_ITALIC; cf.dwEffects = 0; if(cs->getBold()) cf.dwEffects |= CFE_BOLD; if(cs->getItalic()) cf.dwEffects |= CFE_ITALIC; if(cs->getUnderline()) cf.dwEffects |= CFE_UNDERLINE; if(cs->getStrikeout()) cf.dwEffects |= CFE_STRIKEOUT; if(cs->getHasBgColor()){ cf.dwMask |= CFM_BACKCOLOR; cf.crBackColor = cs->getBgColor(); } if(cs->getHasFgColor()){ cf.dwMask |= CFM_COLOR; cf.crTextColor = cs->getFgColor(); } while( pos != string::npos ){ if(cs->usingRegexp()) pos = RegExpMatch(cs, cf, aLine, begin); else pos = FullTextMatch(cs, cf, aLine, pos, begin); } matchedPopup = false; matchedSound = false; }//end for }//end Colorize