QTfrontend/main.cpp
changeset 1150 ae86e36dad2e
parent 1149 c2d3b4f71836
child 1152 c72b939c00df
equal deleted inserted replaced
1149:c2d3b4f71836 1150:ae86e36dad2e
    51 	QDateTime zero;
    51 	QDateTime zero;
    52 	srand(now.secsTo(zero));
    52 	srand(now.secsTo(zero));
    53 
    53 
    54 	Q_INIT_RESOURCE(hedgewars);
    54 	Q_INIT_RESOURCE(hedgewars);
    55 
    55 
    56 	QString imgAddr=":/res/Background.png";
       
    57 	QImage bgrndIm(imgAddr);
       
    58 	QRect deskSz=qApp->desktop()->screenGeometry();
       
    59 	bgrndIm=bgrndIm.scaled(deskSz.width()-deskSz.left(), deskSz.height()-deskSz.top(), 
       
    60 			       Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
       
    61 	if (bgrndIm.save(QDir::tempPath()+"/hedgewarsScaledBgrnd.png")) {
       
    62 	  imgAddr=QDir::tempPath()+"/hedgewarsScaledBgrnd.png";
       
    63 	}
       
    64 	
       
    65 	qApp->setStyleSheet
    56 	qApp->setStyleSheet
    66 	  (QString(
    57 	  (QString(
    67 		   ".HWForm{"
    58 		   ".HWForm{"
    68 		   "background-image: url(\"%1\");"
    59 		   "background-image: url(\":/res/Background.png\");"
    69 		   "background-position: bottom center;"
    60 		   "background-position: bottom center;"
    70 		   //" background-origin: content;"
    61 		   //" background-origin: content;"
    71 		   "background-repeat: no-repeat;"
    62 		   "background-repeat: repeat-x;"
    72 		   "background-color: #3f095f;"
    63 		   "background-color: #870c8f;"
    73 		   "}"
    64 		   "}"
    74 		   "PageMain > QPushButton{"
    65 		   "PageMain > QPushButton{"
    75 		   "border: solid transparent;"
    66 		   "border: solid transparent;"
    76 		   "}"
    67 		   "}"
    77 		   ).arg(imgAddr)
    68 		   )
    78 	   );
    69 	   );
    79 	
    70 
    80 	bindir->cd("bin"); // workaround over NSIS installer
    71 	bindir->cd("bin"); // workaround over NSIS installer
    81 
    72 
    82 	cfgdir->setPath(cfgdir->homePath());
    73 	cfgdir->setPath(cfgdir->homePath());
    83 	if (checkForDir(cfgdir->absolutePath() + "/.hedgewars"))
    74 	if (checkForDir(cfgdir->absolutePath() + "/.hedgewars"))
    84 	{
    75 	{