Exemplo n.º 1
0
void Application::initialise()
{

	//m_root = new Ogre::Root( "ogre_plugins.txt", "ogre_configuration.txt", "ogre_log.txt" );
	m_root = new Ogre::Root();

	// Initialise display options.
	// It shows the ugly dialog at start-up, so if you don't want to see it, it's up to you 
	// to remove this line and initialise display options manually ( e.g. reading them from 
	// a text file ).
	bool configDialogUserContinue = m_root->showConfigDialog();
	if ( ! configDialogUserContinue )
	{
		throw std::exception( "User closed/canceled config dialog" );
	}

	// Create window with chosen display options.
	m_window = m_root->initialise( true, "Ogre Window" );

	m_sceneManager = m_root->createSceneManager( Ogre::ST_GENERIC );

	m_camera = m_sceneManager->createCamera( "DefaultCamera" );

	m_viewport = m_window->addViewport( m_camera );

	m_viewport->setBackgroundColour( Ogre::ColourValue( 0.5, 0.5, 1 ) );

	SimpleInputManager::initialise( m_window );

	loadResources();

	createScene();

	setupCEGUI();

	setupOverlay();
}
bool CrystalFactory::readConfig()
{
	KConfig config("kwincrystalrc");
	KConfigGroup cg(&config, "General");
	QColor c;

	int value = cg.readEntry("TitleAlignment", 1);
	if (value == 0) titlealign_ = Qt::AlignLeft;
	else if (value == 1) titlealign_ = Qt::AlignHCenter;
	else if (value == 2) titlealign_ = Qt::AlignRight;
	
	drawcaption=(bool)cg.readEntry("DrawCaption",true);
	textshadow=(bool)cg.readEntry("TextShadow",true);
	captiontooltip=(bool)cg.readEntry("CaptionTooltip",true);
	wheelTask=(bool)cg.readEntry("WheelTask",false);

	active.transparency=(int)cg.readEntry("ActiveTransparency", 80);
	inactive.transparency=(int)cg.readEntry("InactiveTransparency", 60);
	
	active.outlineMode=(int)cg.readEntry("ActiveFrame",1);
	inactive.outlineMode=(int)cg.readEntry("InactiveFrame",1);
	c=QColor(160,160,160);
	active.frameColor=cg.readEntry("FrameColor1",c);
	c=QColor(128,128,128);
	inactive.frameColor=cg.readEntry("FrameColor2",c);

	active.inlineMode=(int)cg.readEntry("ActiveInline",0);
	inactive.inlineMode=(int)cg.readEntry("InactiveInline",0);
	c=QColor(160,160,160);
	active.inlineColor=cg.readEntry("InlineColor1",c);
	c=QColor(160,160,160);
	inactive.inlineColor=cg.readEntry("InlineColor2",c);

	borderwidth=cg.readEntry("Borderwidth",6);
	titlesize=cg.readEntry("Titlebarheight",21);
 
	buttonColor_normal=QColor(255,255,255);
	buttonColor_normal=cg.readEntry("ButtonColor",buttonColor_normal);
	buttonColor_hovered=cg.readEntry("ButtonColor2",buttonColor_normal);
	buttonColor_pressed=cg.readEntry("ButtonColor3",buttonColor_normal);
	minColor_normal=QColor(255,255,255);
	minColor_normal=cg.readEntry("MinColor",buttonColor_normal);
	minColor_hovered=cg.readEntry("MinColor2",buttonColor_normal);
	minColor_pressed=cg.readEntry("MinColor3",buttonColor_normal);
	maxColor_normal=QColor(255,255,255);
	maxColor_normal=cg.readEntry("MaxColor",buttonColor_normal);
	maxColor_hovered=cg.readEntry("MaxColor2",buttonColor_normal);
	maxColor_pressed=cg.readEntry("MaxColor3",buttonColor_normal);
	closeColor_normal=QColor(255,255,255);
	closeColor_normal=cg.readEntry("CloseColor",closeColor_normal);
	closeColor_hovered=cg.readEntry("CloseColor2",closeColor_normal);
	closeColor_pressed=cg.readEntry("CloseColor3",closeColor_normal);

	roundCorners=cg.readEntry("RoundCorners", 0x0f);

	hovereffect=cg.readEntry("HoverEffect",true);
	animateHover=cg.readEntry("AnimateHover",true);
	tintButtons=cg.readEntry("TintButtons",false);
	menuImage=cg.readEntry("MenuImage",true);
	buttontheme=cg.readEntry("ButtonTheme",9);

	{
		QString afname = cg.readEntry("OverlayFileActive","");
		QString ifname = cg.readEntry("OverlayFileInactive","");

		int aovmode = cg.readEntry("OverlayModeActive",2);
		int iovmode = cg.readEntry("OverlayModeInactive",2);

		active.stretch_overlay = cg.readEntry("OverlayStretchActive",false);
		inactive.stretch_overlay = cg.readEntry("OverlayStretchInactive",false);

		bool fwidth_active = cg.readEntry("OverlayFWidthActive",true);
		bool fwidth_inactive = cg.readEntry("OverlayFWidthInactive",true);

		int fwvalue_active = cg.readEntry("OverlayFWValueActive",256);
		int fwvalue_inactive = cg.readEntry("OverlayFWValueInactive",256);
		
		if (fwidth_active == false) fwvalue_active = 0;
		if (fwidth_inactive == false) fwvalue_inactive = 0;

		setupOverlay(&active,aovmode,afname,fwvalue_active);
		setupOverlay(&inactive,iovmode,ifname,fwvalue_inactive);
	}


	logoEnabled=cg.readEntry("LogoAlignment",1);
	logoStretch=cg.readEntry("LogoStretch",0);
	logoActive=cg.readEntry("LogoActive",false);
	logoDistance=cg.readEntry("LogoDistance",0);
	
	int logoIndex=cg.readEntry("LogoIndex", 0);
	QString filename=cg.readEntry("LogoFile","");

	if (logoEnabled!=1)
	{
		if (logoIndex == 0)
		{
			if (!filename.isNull() && logo.load(filename))
			{
				
			}else logoEnabled=1;
		} else {
			QImage img;
			
			switch (logoIndex)
			{
				default:
				case 1:
					img=QImage((uchar*)kde_data,26,26,QImage::Format_ARGB32);
					break;
				case 2:
					img=QImage((uchar*)tux_data,36,26,QImage::Format_ARGB32);
					break;
				case 3:
					img=QImage((uchar*)gentoo_data,64,67,QImage::Format_ARGB32);
					break;
				case 4:
					img=QImage((uchar*)kubuntu_data,24,26,QImage::Format_ARGB32);
					break;
				case 5:
					img=QImage((uchar*)ubuntu_data,64,64,QImage::Format_ARGB32);
					break;
				case 6:
					img=QImage((uchar*)opensuse_data,32,26,QImage::Format_ARGB32);
					break;
				case 7:
					img=QImage((uchar*)pclinuxos_data,26,26,QImage::Format_ARGB32);
					break;
			}
			logo = QPixmap::fromImage(img);
		}
		
		if ((logoEnabled != 1) && (logoStretch==0))
		{
			logo=logo.scaled(((titlesize-2)*logo.width())/logo.height(),titlesize-2);
		}
	}
	else logo = QPixmap ();
	return true;
}