Skip to content

Commit

Permalink
Splash Screen
Browse files Browse the repository at this point in the history
Since we will remove the console/terminal on Windows we will need a splash screen, as some configurations may delay the startup.
  • Loading branch information
rodlie committed Sep 29, 2024
1 parent e9b82d9 commit 8fb5279
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -273,9 +273,9 @@ if(APPLE)
set_target_properties(${PROJECT_NAME} PROPERTIES MACOSX_BUNDLE TRUE)
endif()

#if(WIN32)
# set_target_properties(${PROJECT_NAME} PROPERTIES WIN32_EXECUTABLE TRUE)
#endif()
if(WIN32)
set_target_properties(${PROJECT_NAME} PROPERTIES WIN32_EXECUTABLE TRUE)
endif()

target_link_directories(
${PROJECT_NAME}
Expand Down
39 changes: 35 additions & 4 deletions src/app/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <QDesktopWidget>
//#include <QScreen>
#include <QMessageBox>
#include <QSplashScreen>

#include <libavutil/ffversion.h>

Expand Down Expand Up @@ -143,6 +144,12 @@ int main(int argc, char *argv[])
}
#endif

QSplashScreen splash(QPixmap(":/pixmaps/splash.png"));
splash.show();
splash.raise();
splash.showMessage(QObject::tr("Loading ..."),
Qt::AlignLeft | Qt::AlignBottom, Qt::white);

#ifdef Q_OS_WIN
QWindowsWindowFunctions::setHasBorderInFullScreenDefault(true);
#endif
Expand All @@ -162,6 +169,10 @@ int main(int argc, char *argv[])
gPrintExceptionCritical(e);
}

splash.raise();
splash.showMessage(QObject::tr("Using OpenGL Renderer: %1").arg(HardwareInfo::sGpuRendererString()),
Qt::AlignLeft | Qt::AlignBottom, Qt::white);

std::cout << "OpenGL Vendor: " << HardwareInfo::sGpuVendorString().toStdString() << std::endl
<< "OpenGL Renderer: " << HardwareInfo::sGpuRendererString().toStdString() << std::endl
<< "OpenGL Version: " << HardwareInfo::sGpuVersionString().toStdString() << std::endl
Expand Down Expand Up @@ -205,7 +216,10 @@ int main(int argc, char *argv[])
generateAlphaMesh(alphaMesh, size/2);
});
ALPHA_MESH_PIX = &alphaMesh;
std::cout << "Generated Alpha Mesh" << std::endl;

splash.raise();
splash.showMessage(QObject::tr("Generated Alpha Mesh"),
Qt::AlignLeft | Qt::AlignBottom, Qt::white);

ThemeSupport::setupTheme(eSizesUI::widget);

Expand Down Expand Up @@ -244,6 +258,10 @@ int main(int argc, char *argv[])
// process->start("prlimit --data=3000000000 --pid " + QString::number(pId));
//#endif

splash.raise();
splash.showMessage(QObject::tr("Loading Settings ..."),
Qt::AlignLeft | Qt::AlignBottom, Qt::white);

try {
settings.loadFromFile();
std::cout << "Loaded settings" << std::endl;
Expand Down Expand Up @@ -274,6 +292,10 @@ int main(int argc, char *argv[])
Document document(taskScheduler);
Actions actions(document);

splash.raise();
splash.showMessage(QObject::tr("Initializing GPU ..."),
Qt::AlignLeft | Qt::AlignBottom, Qt::white);

EffectsLoader effectsLoader;
try {
effectsLoader.initializeGpu();
Expand Down Expand Up @@ -303,7 +325,10 @@ int main(int argc, char *argv[])
scene->updateIfUsesProgram(program);
document.actionFinished();
});
std::cout << "Shader effects initialized" << std::endl;

splash.raise();
splash.showMessage(QObject::tr("Shader effects initialized"),
Qt::AlignLeft | Qt::AlignBottom, Qt::white);

// disabled for now
//effectsLoader.iniCustomBoxes();
Expand All @@ -319,12 +344,17 @@ int main(int argc, char *argv[])
} catch(const std::exception& e) {
gPrintExceptionCritical(e);
}
std::cout << "Audio initialized" << std::endl;
splash.raise();
splash.showMessage(QObject::tr("Audio initialized"),
Qt::AlignLeft | Qt::AlignBottom, Qt::white);

const auto videoEncoder = enve::make_shared<VideoEncoder>();
RenderHandler renderHandler(document, audioHandler,
*videoEncoder, memoryHandler);
std::cout << "Render handler initialized" << std::endl;

splash.raise();
splash.showMessage(QObject::tr("Render handler initialized"),
Qt::AlignLeft | Qt::AlignBottom, Qt::white);

av_log_set_level(AV_LOG_ERROR);
#ifndef QT_DEBUG
Expand All @@ -342,6 +372,7 @@ int main(int argc, char *argv[])
renderHandler,
openProject);
w.show();
splash.finish(&w);

try {
return app.exec();
Expand Down
Binary file added src/app/pixmaps/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/app/resources.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,6 @@
<file>xdg/friction.xml</file>
<file>xdg/friction.desktop</file>
<file>icons/hicolor/scalable/apps/graphics.friction.Friction.svg</file>
<file>pixmaps/splash.png</file>
</qresource>
</RCC>

0 comments on commit 8fb5279

Please sign in to comment.