Пример #1
0
void SerenityConfig::load(KConfig*)
{
	m_config->setGroup("General");
	
	bool alternateSinking = m_config->readBoolEntry("AlternateSunkenEffect", false);
	m_dialog->m_alternateSinking->setChecked(alternateSinking);
	int borderSize = limitedTo(0, 5, m_config->readNumEntry("BorderSize", 2));
	m_dialog->m_borderSize->setCurrentItem(borderSize);
	int buttonBaseColor = limitedTo(0, 1, m_config->readNumEntry("ButtonBaseColor", 0));
	m_dialog->m_buttonBaseColor->setCurrentItem(buttonBaseColor);
	int buttonStyle = limitedTo(0, 3, m_config->readNumEntry("ButtonStyle", 0));
	m_dialog->m_buttonStyle->setCurrentItem(buttonStyle);
	bool buttonTint = m_config->readBoolEntry("ButtonTint", false);
	m_dialog->m_buttonTint->setChecked(buttonTint);
	int buttonTintColor = limitedTo(0, 14, m_config->readNumEntry("ButtonTintColor", 0));
	m_dialog->m_buttonTintColor->setCurrentItem(buttonTintColor);
	int buttonTintRate = limitedTo(-8, 8, m_config->readNumEntry("ButtonTintRate", 0));
	m_dialog->m_buttonTintRate->setValue(buttonTintRate);
	bool centerTitle = m_config->readBoolEntry("CenterTitle", true);
	m_dialog->m_centerTitle->setChecked(centerTitle);
	bool extraSpacing = m_config->readBoolEntry("ExtraSpacing", false);
	m_dialog->m_extraSpacing->setChecked(extraSpacing);
	int frameColor = limitedTo(0, 2, m_config->readNumEntry("FrameColor", 1));
	m_dialog->m_frameColor->setCurrentItem(frameColor);
	int globalStyle = limitedTo(0, 2, m_config->readNumEntry("GlobalStyle", 1));
	m_dialog->m_globalStyle->setCurrentItem(globalStyle);
	int hidePolicy = m_config->readNumEntry("HidePolicy", 0);
	m_dialog->m_hidePolicy->setCurrentItem(hidePolicy);
	bool noMaxBorder = m_config->readBoolEntry("NoMaxBorder", false);
	m_dialog->m_noMaxBorder->setChecked(noMaxBorder);
	bool purerHover = m_config->readBoolEntry("PurerHover", false);
	m_dialog->m_purerHover->setChecked(purerHover);
	bool singleHover = m_config->readBoolEntry("SingleHover", false);
	m_dialog->m_singleHover->setChecked(singleHover);
	int singleHoverColor = limitedTo(0, 12, m_config->readNumEntry("SingleHoverColor", 0));
	m_dialog->m_singleHoverColor->setCurrentItem(singleHoverColor);
	bool styledMenu = m_config->readBoolEntry("StyledMenu", true);
	m_dialog->m_styledMenu->setChecked(styledMenu);
	int sunkenColor = limitedTo(0, 13, m_config->readNumEntry("ActivatedButtonColor", 0));
	m_dialog->m_sunkenColor->setCurrentItem(sunkenColor);
	int symbolBaseColor = limitedTo(0, 0, m_config->readNumEntry("SymbolBaseColor", 0));
	m_dialog->m_symbolBaseColor->setCurrentItem(symbolBaseColor);
	int symbolTheme = limitedTo(0, 4, m_config->readNumEntry("SymbolTheme", 0));
	m_dialog->m_symbolTheme->setCurrentItem(symbolTheme);
	bool symbolTint = m_config->readBoolEntry("SymbolTint", false);
	m_dialog->m_symbolTint->setChecked(symbolTint);
	int symbolTintColor = limitedTo(0, 13, m_config->readNumEntry("SymbolTintColor", 0));
	m_dialog->m_symbolTintColor->setCurrentItem(symbolTintColor);
	int symbolTintRate = limitedTo(-8, 8, m_config->readNumEntry("SymbolTintRate", 0));
	m_dialog->m_symbolTintRate->setValue(symbolTintRate);
	bool titleFrame = m_config->readBoolEntry("TitleFraming", false);
	m_dialog->m_titleFrame->setChecked(titleFrame);
	int titleGround = limitedTo(0, 13, m_config->readNumEntry("TitlebarBackground", 0));
	m_dialog->m_titleGround->setCurrentItem(titleGround);
	int titleSize = limitedTo(18, 36, m_config->readNumEntry("TitleSize", 20));
	if (titleSize & 1)
		titleSize++;	// Only odd values.
	m_dialog->m_titleSize->setValue(titleSize);
	bool zenBorder = m_config->readBoolEntry("ZenBorder", true);
	m_dialog->m_zenBorder->setChecked(zenBorder);
	//
	bool closerWide = m_config->readBoolEntry("WideCloser", false);
	m_dialog->m_closerWide->setChecked(closerWide);
	bool menuWide = m_config->readBoolEntry("WideMenu", false);
	m_dialog->m_menuWide->setChecked(menuWide);
	bool maxWide = m_config->readBoolEntry("WideMaximizer", false);
	m_dialog->m_maxWide->setChecked(maxWide);
	bool minWide = m_config->readBoolEntry("WideMinimizer", false);
	m_dialog->m_minWide->setChecked(minWide);
	bool stickyWide = m_config->readBoolEntry("WideSticker", false);
	m_dialog->m_stickyWide->setChecked(stickyWide);
	bool aboveWide = m_config->readBoolEntry("WideAbove", false);
	m_dialog->m_aboveWide->setChecked(aboveWide);
	bool belowWide = m_config->readBoolEntry("WideBelow", false);
	m_dialog->m_belowWide->setChecked(belowWide);
	bool helpWide = m_config->readBoolEntry("WideHelp", false);
	m_dialog->m_helpWide->setChecked(helpWide);
	//
	int closerGlow = limitedTo(0, 11, m_config->readNumEntry("CloserGlow", 0));
	m_dialog->m_closerGlow->setCurrentItem(closerGlow);
	int menuGlow = limitedTo(0, 11, m_config->readNumEntry("MenuGlow", 2));
	m_dialog->m_menuGlow->setCurrentItem(menuGlow);
	int maxGlow = limitedTo(0, 11, m_config->readNumEntry("MaximizerGlow", 1));
	m_dialog->m_maxGlow->setCurrentItem(maxGlow);
	int minGlow = limitedTo(0, 11, m_config->readNumEntry("MinimizerGlow", 3));
	m_dialog->m_minGlow->setCurrentItem(minGlow);
	int stickyGlow = limitedTo(0, 11, m_config->readNumEntry("StickerGlow", 5));
	m_dialog->m_stickyGlow->setCurrentItem(stickyGlow);
	int aboveGlow = limitedTo(0, 11, m_config->readNumEntry("AboveGlow", 6));
	m_dialog->m_aboveGlow->setCurrentItem(aboveGlow);
	int belowGlow = limitedTo(0, 11, m_config->readNumEntry("BelowGlow", 7));
	m_dialog->m_belowGlow->setCurrentItem(belowGlow);
	int helpGlow = limitedTo(0, 11, m_config->readNumEntry("HelpGlow", 4));
	m_dialog->m_helpGlow->setCurrentItem(helpGlow);
	//
	QColor defaultColor0(255, 0, 0);
	QColor defaultColor1(0, 255, 0);
	QColor defaultColor2(0, 192, 255);
	QColor defaultColor3(255, 160, 0);
	QColor defaultColor4(255, 0, 255);
	QColor defaultColor5(255, 255, 0);
	QColor defaultColor6(128, 128, 128);
	QColor defaultColor7(255, 255, 255);
	QColor defaultColor8(64, 64, 64);
	QColor defaultColor9(128, 128, 128);
	QColor defaultColor10(192, 192, 192);
	QColor defaultColor11(255, 255, 255);
	//
	QColor color0 = m_config->readColorEntry("Color0", &defaultColor0);
	m_dialog->listColor0->setColor(color0);
	QColor color1 = m_config->readColorEntry("Color1", &defaultColor1);
	m_dialog->listColor1->setColor(color1);
	QColor color2 = m_config->readColorEntry("Color2", &defaultColor2);
	m_dialog->listColor2->setColor(color2);
	QColor color3 = m_config->readColorEntry("Color3", &defaultColor3);
	m_dialog->listColor3->setColor(color3);
	QColor color4 = m_config->readColorEntry("Color4", &defaultColor4);
	m_dialog->listColor4->setColor(color4);
	QColor color5 = m_config->readColorEntry("Color5", &defaultColor5);
	m_dialog->listColor5->setColor(color5);
	QColor color6 = m_config->readColorEntry("Color6", &defaultColor6);
	m_dialog->listColor6->setColor(color6);
	QColor color7 = m_config->readColorEntry("Color7", &defaultColor7);
	m_dialog->listColor7->setColor(color7);
	QColor color8 = m_config->readColorEntry("Color8", &defaultColor8);
	m_dialog->listColor8->setColor(color8);
	QColor color9 = m_config->readColorEntry("Color9", &defaultColor9);
	m_dialog->listColor9->setColor(color9);
	QColor color10 = m_config->readColorEntry("Color10", &defaultColor10);
	m_dialog->listColor10->setColor(color10);
	QColor color11 = m_config->readColorEntry("Color11", &defaultColor11);
	m_dialog->listColor11->setColor(color11);
}
Пример #2
0
void SerenityHandler::readConfig()
{
	KConfig config("kwinserenityrc");
	m_gradientContrast = config.readNumEntry("/Qt/KDE/contrast", 5);
	if (m_gradientContrast<0 || m_gradientContrast>10)
		m_gradientContrast = 5;

	config.setGroup("General");
	m_alternateSinking = config.readBoolEntry("AlternateSunkenEffect", false);
	m_borderSize = limitedTo(0, 5, config.readNumEntry("BorderSize", 2));
	m_buttonBaseColor = limitedTo(0, 1, config.readNumEntry("ButtonBaseColor", 0));
	// m_buttonSize = m_titleSize;
	m_buttonStyle = limitedTo(0, 3, config.readNumEntry("ButtonStyle", 0));
	m_buttonTint = config.readBoolEntry("ButtonTint", false);
	m_buttonTintColor = limitedTo(0, 14, config.readNumEntry("ButtonTintColor", 0));
	m_buttonTintRate = limitedTo(-8, 8, config.readNumEntry("ButtonTintRate", 0));
	m_centerTitle = config.readBoolEntry("CenterTitle", true);
	m_extraSpacing = config.readBoolEntry("ExtraSpacing", false);
	m_frameColor = limitedTo(0, 2, config.readNumEntry("FrameColor", 1));
	m_globalStyle = limitedTo(0, 2, config.readNumEntry("GlobalStyle", 1));
	m_hidePolicy = limitedTo(0, 4, config.readNumEntry("HidePolicy", 0));
	m_noMaxBorder = config.readBoolEntry("NoMaxBorder", false);
	m_purerHover = config.readBoolEntry("PurerHover", false);
	m_singleHover = config.readBoolEntry("SingleHover", false);
	m_singleHoverColor = limitedTo(0, 12, config.readNumEntry("SingleHoverColor", 0));
	m_solidBar = config.readBoolEntry("SolidBar", false); /// Remove
	m_styledMenu = config.readBoolEntry("StyledMenu", true);
	m_sunkenColor = limitedTo(0, 13, config.readNumEntry("ActivatedButtonColor", 0));
	m_symbolBaseColor = limitedTo(0, 0, config.readNumEntry("SymbolBaseColor", 0));
	m_symbolTheme = limitedTo(0, 4, config.readNumEntry("SymbolTheme", 0));
	m_symbolTint = config.readBoolEntry("SymbolTint", false);
	m_symbolTintColor = limitedTo(0, 13, config.readNumEntry("SymbolTintColor", 0));
	m_symbolTintRate = limitedTo(-8, 8, config.readNumEntry("SymbolTintRate", 0));
	m_titleFrame = config.readBoolEntry("TitleFraming", false);
	m_titleGround = limitedTo(0, 3, config.readNumEntry("TitlebarBackground", 0));
	m_titleSize = limitedTo(18, 36, config.readNumEntry("TitleSize", 20));
	if (m_titleSize & 1)	// If odd size
		m_titleSize++;
	m_zenBorder = config.readBoolEntry("ZenBorder", true);
	//
	m_closerWide = config.readBoolEntry("WideCloser", false);
	m_menuWide = config.readBoolEntry("WideMenu", false);
	m_maxWide = config.readBoolEntry("WideMaximizer", false);
	m_minWide = config.readBoolEntry("WideMinimizer", false);
	m_stickyWide = config.readBoolEntry("WideSticker", false);
	m_aboveWide = config.readBoolEntry("WideAbove", false);
	m_belowWide = config.readBoolEntry("WideBelow", false);
	m_helpWide = config.readBoolEntry("WideHelp", false);
	//
	m_closerGlow = limitedTo(0, 11, config.readNumEntry("CloserGlow", 0));
	m_menuGlow = limitedTo(0, 11, config.readNumEntry("MenuGlow", 2));
	m_maxGlow = limitedTo(0, 11, config.readNumEntry("MaximizerGlow", 1));
	m_minGlow = limitedTo(0, 11, config.readNumEntry("MinimizerGlow", 3));
	m_stickyGlow = limitedTo(0, 11, config.readNumEntry("StickerGlow", 5));
	m_aboveGlow = limitedTo(0, 11, config.readNumEntry("AboveGlow", 6));
	m_belowGlow = limitedTo(0, 11, config.readNumEntry("BelowGlow", 7));
	m_helpGlow = limitedTo(0, 11, config.readNumEntry("HelpGlow", 4));
	//
	QColor defaultColor0(255, 0, 0);
	QColor defaultColor1(0, 255, 0);
	QColor defaultColor2(0, 192, 255);
	QColor defaultColor3(255, 160, 0);
	QColor defaultColor4(255, 0, 255);
	QColor defaultColor5(255, 255, 0);
	QColor defaultColor6(128, 128, 128);
	QColor defaultColor7(255, 255, 255);
	QColor defaultColor8(64, 64, 64);
	QColor defaultColor9(128, 128, 128);
	QColor defaultColor10(192, 192, 192);
	QColor defaultColor11(255, 255, 255);
	//
	listColor0 = config.readColorEntry("Color0", &defaultColor0);
	listColor1 = config.readColorEntry("Color1", &defaultColor1);
	listColor2 = config.readColorEntry("Color2", &defaultColor2);
	listColor3 = config.readColorEntry("Color3", &defaultColor3);
	listColor4 = config.readColorEntry("Color4", &defaultColor4);
	listColor5 = config.readColorEntry("Color5", &defaultColor5);
	listColor6 = config.readColorEntry("Color6", &defaultColor6);
	listColor7 = config.readColorEntry("Color7", &defaultColor7);
	listColor8 = config.readColorEntry("Color8", &defaultColor8);
	listColor9 = config.readColorEntry("Color9", &defaultColor9);
	listColor10 = config.readColorEntry("Color10", &defaultColor10);
	listColor11 = config.readColorEntry("Color11", &defaultColor11);
}