Skip to content

Commit

Permalink
Stop app correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
sguionni committed Jul 12, 2024
1 parent b07be1a commit 03269ff
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 20 deletions.
1 change: 0 additions & 1 deletion lib/app/include/app/vtx_app.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ namespace VTX::App

void _handleArgs( const Args & p_args );
void _update( const float p_elapsedTime );
void _stop();
};

// Convenient accessors
Expand Down
35 changes: 16 additions & 19 deletions lib/app/src/app/vtx_app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ namespace VTX::App

void VTXApp::init()
{
VTX_INFO( "Init application" );

//_systemHandler = std::make_unique<Core::System::SystemHandler>();

Internal::Application::Settings::initSettings( SETTINGS() );
Expand All @@ -61,8 +63,7 @@ namespace VTX::App

void VTXApp::start( const Args & p_args )
{
VTX_INFO( "Starting application: {}", Filesystem::EXECUTABLE_ABSOLUTE_PATH.string() );
VTX_INFO( "Arguments: {}", p_args.toString() );
VTX_INFO( "Starting application: {}", p_args.toString() );

// Regsiter loop events
onUpdate += []( const float p_elapsedTime ) { SCENE().update( p_elapsedTime ); };
Expand Down Expand Up @@ -148,7 +149,19 @@ namespace VTX::App

void VTXApp::stop()
{
_stop();
SCENE().reset();

//// Prevent events throw for nothing when quitting app
// Old::Manager::EventManager::get().freezeEvent( true );
// Manager::WorkerManager::get().stopAll();

//_setting.backup();

// VTX::MVC_MANAGER().deleteModel( _representationLibrary );
// VTX::MVC_MANAGER().deleteModel( _renderEffectLibrary );

// Old::Application::Selection::SelectionManager::get().deleteModel();

onStop();
}

Expand Down Expand Up @@ -201,22 +214,6 @@ namespace VTX::App
// #endif
// }

void VTXApp::_stop()
{
//_timer.stop();

//// Prevent events throw for nothing when quitting app
// Old::Manager::EventManager::get().freezeEvent( true );
// Manager::WorkerManager::get().stopAll();

//_setting.backup();

// VTX::MVC_MANAGER().deleteModel( _representationLibrary );
// VTX::MVC_MANAGER().deleteModel( _renderEffectLibrary );

// Old::Application::Selection::SelectionManager::get().deleteModel();
}

Application::Scene & VTXApp::getScene() { return _systemHandler->get<Application::Scene>( SCENE_KEY ); }
const Application::Scene & VTXApp::getScene() const { return _systemHandler->get<Application::Scene>( SCENE_KEY ); }

Expand Down
3 changes: 3 additions & 0 deletions lib/ui/qt/src/qt/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ namespace VTX::UI::QT
using namespace Resources;
using namespace VTX::App::Info;

VTX_INFO( "Show splashscreen" );
_qSplashScreen = new QSplashScreen( QPixmap( SPRITE_SPLASH ) );
_qSplashScreen->show();
_qSplashScreen->showMessage( "Loading..." );
Expand Down Expand Up @@ -70,6 +71,7 @@ namespace VTX::UI::QT
_qSplashScreen->finish( _mainWindow.get() );
_mainWindow->show();

// On quit.
onStop += [ this ]
{
_timer.stop();
Expand All @@ -88,6 +90,7 @@ namespace VTX::UI::QT
_elapsedTimer.start();

// Then block.
VTX_INFO( "Show user interface" );
exec();
}

Expand Down
2 changes: 2 additions & 0 deletions lib/ui/qt/src/qt/main_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ namespace VTX::UI::QT

void MainWindow::build()
{
VTX_INFO( "Build main window" );

// Main menu.
createMenu<Menu::File>();
createMenu<Menu::Camera>();
Expand Down

0 comments on commit 03269ff

Please sign in to comment.