Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SplashScreen] use directly QSplashScreen & update splash medInria logo #1168

Merged
merged 4 commits into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 2 additions & 26 deletions src/app/medInria/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@

#include <medMainWindow.h>
#include <medApplication.h>
#include <medSplashScreen.h>

#include <medPluginManager.h>
#include <medDataIndex.h>
#include <medDataManager.h>
Expand Down Expand Up @@ -90,14 +88,9 @@ int main(int argc,char* argv[])
fmt.setAlphaBufferSize(1);
fmt.setStereo(false);
fmt.setSamples(0);

QSurfaceFormat::setDefaultFormat(fmt);

// this needs to be done before creating the QApplication object, as per the
// Qt doc, otherwise there are some edge cases where the style is not fully applied
//QApplication::setStyle("plastique");
medApplication application(argc,argv);
medSplashScreen splash(QPixmap(":/pixmaps/medInria-logo-homepage.png"));

setlocale(LC_NUMERIC, "C");
QLocale::setDefault(QLocale("C"));
Expand All @@ -116,16 +109,6 @@ int main(int argc,char* argv[])
return 1;
}

// Do not show the splash screen in debug builds because it hogs the
// foreground, hiding all other windows. This makes debugging the startup
// operations difficult.

#if !defined(_DEBUG)
bool show_splash = true;
#else
bool show_splash = false;
#endif

QStringList posargs;
for (int i=1;i<application.arguments().size();++i)
{
Expand Down Expand Up @@ -161,8 +144,8 @@ int main(int argc,char* argv[])
const bool DirectView = dtkApplicationArgumentsContain(&application,"--view") || posargs.size()!=0;

int runningMedInria = 0;
if (DirectView) {
show_splash = false;
if (DirectView)
{
for (QStringList::const_iterator i=posargs.constBegin();i!=posargs.constEnd();++i) {
const QString& message = QString("/open ")+*i;
runningMedInria = application.sendMessage(message);
Expand All @@ -174,11 +157,6 @@ int main(int argc,char* argv[])
if (runningMedInria)
return 0;

if (show_splash)
{
splash.show();
}

medDataManager::instance().setDatabaseLocation();

#if(USE_PYTHON)
Expand Down Expand Up @@ -246,8 +224,6 @@ int main(int argc,char* argv[])
QGLFormat::setDefaultFormat(format);
}

splash.close();

#if(USE_PYTHON)
if(!pythonErrorMessage.isEmpty())
{
Expand Down
10 changes: 10 additions & 0 deletions src/app/medInria/medApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class medApplicationPrivate
public:
medMainWindow *mainWindow;
QStringList systemOpenInstructions;
QSplashScreen *splashScreen;
};

// /////////////////////////////////////////////////////////////////
Expand All @@ -49,6 +50,12 @@ medApplication::medApplication(int & argc, char**argv) :
{
d->mainWindow = nullptr;

d->splashScreen = new QSplashScreen(QPixmap(":/pixmaps/medInria-splash.png"),
Qt::WindowStaysOnTopHint | Qt::X11BypassWindowManagerHint);
d->splashScreen->setAttribute(Qt::WA_DeleteOnClose, true);
d->splashScreen->show();
this->processEvents();

this->setApplicationName("medInria");
this->setApplicationVersion(MEDINRIA_VERSION);
this->setOrganizationName("inria");
Expand Down Expand Up @@ -98,6 +105,9 @@ void medApplication::setMainWindow(medMainWindow *mw)
QVariant var = QVariant::fromValue((QObject*)d->mainWindow);
this->setProperty("MainWindow",var);
d->systemOpenInstructions.clear();

// Wait until the app is displayed to close itself
d->splashScreen->finish(d->mainWindow);
}

void medApplication::redirectMessageToSplash(const QString &message)
Expand Down
76 changes: 0 additions & 76 deletions src/app/medInria/medSplashScreen.cpp

This file was deleted.

45 changes: 0 additions & 45 deletions src/app/medInria/medSplashScreen.h

This file was deleted.

Binary file modified src/app/medInria/resources/pixmaps/medInria-splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading