Allow different splash and about image

This commit is contained in:
Chris Hennes
2021-02-08 11:10:41 -06:00
committed by wmayer
parent 24ce12d8f3
commit c039217af1
6 changed files with 34 additions and 1 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

View File

@@ -1,6 +1,7 @@
<RCC>
<qresource prefix="/icons">
<file>freecadsplash.png</file>
<file>freecadabout.png</file>
<file>background.png</file>
<file>mouse_pointer.svg</file>
<file>Document.svg</file>

View File

@@ -1456,6 +1456,28 @@ void MainWindow::stopSplasher(void)
}
}
QPixmap MainWindow::aboutImage() const
{
// See if we have a custom About screen image set
QPixmap about_image;
std::string about_path = App::Application::Config()["AboutImage"];
if (!about_path.empty()) {
QString path = QString::fromUtf8(about_path.c_str());
if (QDir(path).isRelative()) {
QString home = QString::fromUtf8(App::GetApplication().getHomePath());
path = QFileInfo(QDir(home), path).absoluteFilePath();
}
about_image.load(path);
// Now try the icon paths
if (about_image.isNull()) {
about_image = Gui::BitmapFactory().pixmap(about_path.c_str());
}
}
return about_image;
}
QPixmap MainWindow::splashImage() const
{
// search in the UserAppData dir as very first

View File

@@ -135,6 +135,8 @@ public:
void startSplasher(void);
/** Stops the splasher after startup. */
void stopSplasher(void);
/* The image of the About dialog, it might be empty. */
QPixmap aboutImage() const;
/* The image of the splash screen of the application. */
QPixmap splashImage() const;
/** Shows the online documentation. */

View File

@@ -228,7 +228,14 @@ AboutDialog::AboutDialog(bool showLic, QWidget* parent)
ui->setupUi(this);
layout()->setSizeConstraint(QLayout::SetFixedSize);
QRect rect = QApplication::primaryScreen()->availableGeometry();
QPixmap image = getMainWindow()->splashImage();
// See if we have a custom About screen image set
QPixmap image = getMainWindow()->aboutImage();
// Fallback to the splashscreen image
if (image.isNull()) {
image = getMainWindow()->splashImage();
}
// Make sure the image is not too big
int denom = 2;

View File

@@ -176,6 +176,7 @@ int main( int argc, char ** argv )
App::Application::Config()["CopyrightInfo"] = sBanner;
App::Application::Config()["AppIcon"] = "freecad";
App::Application::Config()["SplashScreen"] = "freecadsplash";
App::Application::Config()["AboutImage"] = "freecadabout";
App::Application::Config()["StartWorkbench"] = "StartWorkbench";
//App::Application::Config()["HiddenDockWindow"] = "Property editor";
App::Application::Config()["SplashAlignment" ] = "Bottom|Left";