From 5cebfce8203630e633d28eb11cafe3d0b3936b58 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de>
Date: Sat, 17 Apr 2021 15:19:19 +0200
Subject: [PATCH] GUI: rm splashscreen

Claim was outdated (GISAS only).

This resolves Redmine2486
---
 GUI/coregui/mainwindow/SplashScreen.cpp | 79 -------------------------
 GUI/coregui/mainwindow/SplashScreen.h   | 37 ------------
 GUI/main/appoptions.cpp                 |  1 -
 GUI/main/main.cpp                       | 10 ----
 4 files changed, 127 deletions(-)
 delete mode 100644 GUI/coregui/mainwindow/SplashScreen.cpp
 delete mode 100644 GUI/coregui/mainwindow/SplashScreen.h

diff --git a/GUI/coregui/mainwindow/SplashScreen.cpp b/GUI/coregui/mainwindow/SplashScreen.cpp
deleted file mode 100644
index e52b19353a3..00000000000
--- a/GUI/coregui/mainwindow/SplashScreen.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-//  ************************************************************************************************
-//
-//  BornAgain: simulate and fit reflection and scattering
-//
-//! @file      GUI/coregui/mainwindow/SplashScreen.cpp
-//! @brief     Implements class SplashScreen
-//!
-//! @homepage  http://www.bornagainproject.org
-//! @license   GNU General Public License v3 or higher (see COPYING)
-//! @copyright Forschungszentrum Jülich GmbH 2018
-//! @authors   Scientific Computing Group at MLZ (see CITATION, AUTHORS)
-//
-//  ************************************************************************************************
-
-#include "GUI/coregui/mainwindow/SplashScreen.h"
-#include "GUI/coregui/utils/GUIHelpers.h"
-#include "GUI/coregui/utils/StyleUtils.h"
-#include <QCoreApplication>
-#include <QDebug>
-#include <QElapsedTimer>
-#include <QStyle>
-#include <QTime>
-
-SplashScreen::SplashScreen(QWidget*)
-    : QSplashScreen(QPixmap(":/images/splashscreen.png")), m_percentage_done(0)
-
-{
-    QSplashScreen::setCursor(Qt::BusyCursor);
-
-    QFont font;
-    font.setPointSize(StyleUtils::SystemPointSize() * 0.9);
-    font.setBold(false);
-    QSplashScreen::setFont(font);
-}
-
-void SplashScreen::start(int show_during)
-{
-    show();
-    QTime dieTime = QTime::currentTime().addMSecs(show_during);
-    QElapsedTimer timer;
-    timer.start();
-    while (QTime::currentTime() < dieTime) {
-        setProgress(timer.elapsed() / (show_during / 100));
-        QCoreApplication::processEvents(QEventLoop::AllEvents, 100);
-    }
-}
-
-void SplashScreen::setProgress(int value)
-{
-    m_percentage_done = value;
-    if (m_percentage_done > 100)
-        m_percentage_done = 100;
-    if (m_percentage_done < 0)
-        m_percentage_done = 0;
-    update();
-}
-
-void SplashScreen::drawContents(QPainter* painter)
-{
-    QSplashScreen::drawContents(painter);
-
-    auto img_rect = frameGeometry();
-    auto char_height = StyleUtils::SizeOfLetterM().height();
-
-    QRect textRect(img_rect.width() * 0.02, img_rect.height() - char_height * 2.5,
-                   img_rect.width() * 0.5, char_height * 3);
-
-    QString versionText = QString("version ").append(GUIHelpers::getBornAgainVersionString());
-    style()->drawItemText(painter, textRect, 0, this->palette(), true, versionText);
-
-    QString loadingText("loading . ");
-    for (size_t i = 0; i < size_t(m_percentage_done / 20); ++i) {
-        loadingText.append(". ");
-    }
-
-    QRect loadingRect(img_rect.width() * 0.8, img_rect.height() - char_height * 2.5,
-                      img_rect.width(), char_height * 3);
-    style()->drawItemText(painter, loadingRect, 0, this->palette(), true, loadingText);
-}
diff --git a/GUI/coregui/mainwindow/SplashScreen.h b/GUI/coregui/mainwindow/SplashScreen.h
deleted file mode 100644
index a10e86d0561..00000000000
--- a/GUI/coregui/mainwindow/SplashScreen.h
+++ /dev/null
@@ -1,37 +0,0 @@
-//  ************************************************************************************************
-//
-//  BornAgain: simulate and fit reflection and scattering
-//
-//! @file      GUI/coregui/mainwindow/SplashScreen.h
-//! @brief     Defines class SplashScreen
-//!
-//! @homepage  http://www.bornagainproject.org
-//! @license   GNU General Public License v3 or higher (see COPYING)
-//! @copyright Forschungszentrum Jülich GmbH 2018
-//! @authors   Scientific Computing Group at MLZ (see CITATION, AUTHORS)
-//
-//  ************************************************************************************************
-
-#ifndef BORNAGAIN_GUI_COREGUI_MAINWINDOW_SPLASHSCREEN_H
-#define BORNAGAIN_GUI_COREGUI_MAINWINDOW_SPLASHSCREEN_H
-
-#include <QSplashScreen>
-
-class SplashScreen : public QSplashScreen {
-    Q_OBJECT
-public:
-    explicit SplashScreen(QWidget* parent = nullptr);
-
-    void start(int show_during = 1500);
-
-public slots:
-    void setProgress(int value);
-
-protected:
-    void drawContents(QPainter* painter);
-
-private:
-    int m_percentage_done;
-};
-
-#endif // BORNAGAIN_GUI_COREGUI_MAINWINDOW_SPLASHSCREEN_H
diff --git a/GUI/main/appoptions.cpp b/GUI/main/appoptions.cpp
index 5abca7ce96c..805e7fdd4fd 100644
--- a/GUI/main/appoptions.cpp
+++ b/GUI/main/appoptions.cpp
@@ -50,7 +50,6 @@ ApplicationOptions::ApplicationOptions(int argc, char** argv) : m_options_is_con
 {
     m_options.add_options()("help,h", "print help message");
     m_options.add_options()("with-debug", "run application with debug printout");
-    m_options.add_options()("no-splash", "do not show splash screen");
     m_options.add_options()(geometry, bpo::value<std::string>(),
                             "Main window geometry, e.g. 1600x1000");
     m_options.add_options()(nohighdpi, "Run without high-dpi support");
diff --git a/GUI/main/main.cpp b/GUI/main/main.cpp
index b06908bc8bf..c322f72728f 100644
--- a/GUI/main/main.cpp
+++ b/GUI/main/main.cpp
@@ -13,7 +13,6 @@
 //  ************************************************************************************************
 
 #include "GUI/coregui/Views/FitWidgets/FitProgressInfo.h"
-#include "GUI/coregui/mainwindow/SplashScreen.h"
 #include "GUI/coregui/mainwindow/mainwindow.h"
 #include "GUI/coregui/utils/hostosinfo.h"
 #include "GUI/main/MessageHandler.h"
@@ -39,20 +38,11 @@ int main(int argc, char* argv[])
 
     qInstallMessageHandler(MessageHandler);
 
-    std::unique_ptr<SplashScreen> splash;
-    if (!options.find("no-splash")) {
-        splash.reset(new SplashScreen);
-        splash->start(/*show_during*/ 1200);
-    }
-
     MainWindow win;
     if (options.find("geometry"))
         win.resize(options.mainWindowSize());
 
     win.show();
 
-    if (splash)
-        splash->finish(&win);
-
     return QApplication::exec();
 }
-- 
GitLab