Embed version number into splashscreen
This commit is contained in:
parent
c2039f2590
commit
0c9fb91bd9
|
@ -36,6 +36,7 @@
|
|||
# include <QLabel>
|
||||
# include <QMdiSubWindow>
|
||||
# include <QMessageBox>
|
||||
# include <QPainter>
|
||||
# include <QSettings>
|
||||
# include <QSignalMapper>
|
||||
# include <QStatusBar>
|
||||
|
@ -1303,6 +1304,44 @@ QPixmap MainWindow::splashImage() const
|
|||
splash_image.load(fi.filePath(), "PNG");
|
||||
if (splash_image.isNull())
|
||||
splash_image = Gui::BitmapFactory().pixmap(App::Application::Config()["SplashPicture"].c_str());
|
||||
|
||||
// include application name and version number
|
||||
std::map<std::string,std::string>::const_iterator tc = App::Application::Config().find("SplashExeColor");
|
||||
if (tc != App::Application::Config().end()) {
|
||||
QString exeName = QString::fromAscii(App::Application::Config()["ExeName"].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);
|
||||
|
||||
QPainter painter;
|
||||
painter.begin(&splash_image);
|
||||
QFont fontExe = painter.font();
|
||||
fontExe.setPointSize(20);
|
||||
QFontMetrics metricExe(fontExe);
|
||||
int l = metricExe.width(exeName);
|
||||
int w = splash_image.width();
|
||||
int h = splash_image.height();
|
||||
|
||||
QFont fontVer = painter.font();
|
||||
fontVer.setPointSize(12);
|
||||
QFontMetrics metricVer(fontVer);
|
||||
int v = metricVer.width(version);
|
||||
|
||||
QColor color;
|
||||
color.setNamedColor(QString::fromAscii(tc->second.c_str()));
|
||||
if (!color.isValid()) {
|
||||
color.setRed(200);
|
||||
color.setGreen(200);
|
||||
color.setBlue(200);
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -276,6 +276,7 @@ int main( int argc, char ** argv )
|
|||
//App::Application::Config()["HiddenDockWindow"] = "Property editor";
|
||||
App::Application::Config()["SplashAlignment" ] = "Bottom|Left";
|
||||
App::Application::Config()["SplashTextColor" ] = "#ffffff"; // white
|
||||
App::Application::Config()["SplashExeColor" ] = "#c8c8c8"; // light grey
|
||||
|
||||
try {
|
||||
// Init phase ===========================================================
|
||||
|
|
Loading…
Reference in New Issue
Block a user