Extend application branding

This commit is contained in:
wmayer
2012-02-23 20:25:33 +01:00
parent 72ae257ac4
commit c21ac1b6b0
11 changed files with 104 additions and 58 deletions

View File

@@ -1303,12 +1303,15 @@ QPixmap MainWindow::splashImage() const
if (fi.isFile() && fi.exists())
splash_image.load(fi.filePath(), "PNG");
if (splash_image.isNull())
splash_image = Gui::BitmapFactory().pixmap(App::Application::Config()["SplashPicture"].c_str());
splash_image = Gui::BitmapFactory().pixmap(App::Application::Config()["SplashScreen"].c_str());
// include application name and version number
std::map<std::string,std::string>::const_iterator tc = App::Application::Config().find("SplashExeColor");
std::map<std::string,std::string>::const_iterator tc = App::Application::Config().find("SplashInfoColor");
if (tc != App::Application::Config().end()) {
QString exeName = QString::fromAscii(App::Application::Config()["ExeName"].c_str());
QString title = QString::fromAscii(App::Application::Config()["ExeName"].c_str());
std::map<std::string,std::string>::iterator it = App::Application::Config().find("Application");
if (it != App::Application::Config().end())
title = QString::fromUtf8(it->second.c_str());
QString major = QString::fromAscii(App::Application::Config()["BuildVersionMajor"].c_str());
QString minor = QString::fromAscii(App::Application::Config()["BuildVersionMinor"].c_str());
QString version = QString::fromAscii("%1.%2").arg(major).arg(minor);
@@ -1318,7 +1321,7 @@ QPixmap MainWindow::splashImage() const
QFont fontExe = painter.font();
fontExe.setPointSize(20);
QFontMetrics metricExe(fontExe);
int l = metricExe.width(exeName);
int l = metricExe.width(title);
int w = splash_image.width();
int h = splash_image.height();
@@ -1329,17 +1332,14 @@ QPixmap MainWindow::splashImage() const
QColor color;
color.setNamedColor(QString::fromAscii(tc->second.c_str()));
if (!color.isValid()) {
color.setRed(200);
color.setGreen(200);
color.setBlue(200);
if (color.isValid()) {
painter.setPen(color);
painter.setFont(fontExe);
painter.drawText(w-(l+v+10),h-20, title);
painter.setFont(fontVer);
painter.drawText(w-(v+5),h-20, version);
painter.end();
}
painter.setPen(color);
painter.setFont(fontExe);
painter.drawText(w-(l+v+10),h-20, exeName);
painter.setFont(fontVer);
painter.drawText(w-(v+5),h-20, version);
painter.end();
}
return splash_image;