scaled startwindow background for bigger tablets. better gfx coming soon

This commit is contained in:
doitux
2012-12-15 09:19:00 +01:00
parent 09d2fc8f4e
commit 208439b261
@@ -78,7 +78,28 @@ startWindowImpl::startWindowImpl(ConfigFile *c, Log *l)
#ifdef GUI_800x480 #ifdef GUI_800x480
#ifdef ANDROID #ifdef ANDROID
this->menubar->hide(); this->menubar->hide();
//check if custom background picture for the resolution is there. Otherwise create it!
QString UserDataDir = QString::fromUtf8(myConfig->readConfigString("UserDataDir").c_str());
QDesktopWidget dw;
int screenWidth = dw.screenGeometry().width();
int screenHeight = dw.screenGeometry().height();
QString customStartWindowBgFileString(UserDataDir+"/startwindowbg_"+QString::number(screenWidth)+"x"+QString::number(screenHeight)+".png");
QFile customStartWindowBgFile(customStartWindowBgFileString);
if(customStartWindowBgFile.exists()) {
centralwidget->setStyleSheet(".QWidget { background-image: url("+QFileInfo(customStartWindowBgFile).absoluteFilePath()+"); background-position: bottom center; background-origin: content; background-repeat: no-repeat;}");
}
else {
QPixmap pix(":/android/android-data/gfx/gui/misc/startwindowbg_800x480.png");
pix = pix.scaled(screenWidth, screenHeight, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
if(pix.save(customStartWindowBgFileString)) {
centralwidget->setStyleSheet(".QWidget { background-image: url("+QFileInfo(customStartWindowBgFile).absoluteFilePath()+"); background-position: bottom center; background-origin: content; background-repeat: no-repeat;}");
}
else {
centralwidget->setStyleSheet(".QWidget { background-image: url(:/android/android-data/gfx/gui/misc/startwindowbg_800x480.png); background-position: bottom center; background-origin: content; background-repeat: no-repeat;}"); centralwidget->setStyleSheet(".QWidget { background-image: url(:/android/android-data/gfx/gui/misc/startwindowbg_800x480.png); background-position: bottom center; background-origin: content; background-repeat: no-repeat;}");
}
}
this->showFullScreen(); this->showFullScreen();
#else #else
// this->menubar->setStyleSheet("QMenuBar { background-color: #4B4B4B; font-size:20px; border-width: 0px;} QMenuBar::item { color: #F0F0F0; }"); // this->menubar->setStyleSheet("QMenuBar { background-color: #4B4B4B; font-size:20px; border-width: 0px;} QMenuBar::item { color: #F0F0F0; }");