mirror of
https://github.com/leozide/leocad
synced 2025-01-18 22:26:44 +01:00
Reorganized application shutdown.
This commit is contained in:
parent
72763ddc11
commit
80f5eb5582
3 changed files with 43 additions and 23 deletions
|
@ -758,22 +758,8 @@ lcStartupMode lcApplication::Initialize(QList<QPair<QString, bool>>& LibraryPath
|
|||
return lcStartupMode::Error;
|
||||
}
|
||||
|
||||
if (AASamples > 1)
|
||||
{
|
||||
#ifdef LC_USE_QOPENGLWIDGET
|
||||
QSurfaceFormat Format = QSurfaceFormat::defaultFormat();
|
||||
Format.setSamples(AASamples);
|
||||
QSurfaceFormat::setDefaultFormat(Format);
|
||||
#else
|
||||
QGLFormat Format;
|
||||
Format.setSampleBuffers(true);
|
||||
Format.setSamples(AASamples);
|
||||
QGLFormat::setDefaultFormat(Format);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef LC_USE_QOPENGLWIDGET
|
||||
if (!lcContext::CreateOffscreenContext())
|
||||
if (!InitializeRenderer(AASamples))
|
||||
return lcStartupMode::Error;
|
||||
#endif
|
||||
|
||||
|
@ -1014,8 +1000,47 @@ lcStartupMode lcApplication::Initialize(QList<QPair<QString, bool>>& LibraryPath
|
|||
|
||||
void lcApplication::Shutdown()
|
||||
{
|
||||
delete gMainWindow;
|
||||
gMainWindow = nullptr;
|
||||
|
||||
delete mProject;
|
||||
mProject = nullptr;
|
||||
|
||||
delete mLibrary;
|
||||
mLibrary = nullptr;
|
||||
|
||||
ShutdownRenderer();
|
||||
}
|
||||
|
||||
bool lcApplication::InitializeRenderer(int AASamples)
|
||||
{
|
||||
if (AASamples > 1)
|
||||
{
|
||||
#ifdef LC_USE_QOPENGLWIDGET
|
||||
QSurfaceFormat Format = QSurfaceFormat::defaultFormat();
|
||||
Format.setSamples(AASamples);
|
||||
QSurfaceFormat::setDefaultFormat(Format);
|
||||
#else
|
||||
QGLFormat Format;
|
||||
Format.setSampleBuffers(true);
|
||||
Format.setSamples(AASamples);
|
||||
QGLFormat::setDefaultFormat(Format);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef LC_USE_QOPENGLWIDGET
|
||||
if (!lcContext::CreateOffscreenContext())
|
||||
return false;
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void lcApplication::ShutdownRenderer()
|
||||
{
|
||||
#ifdef LC_USE_QOPENGLWIDGET
|
||||
lcContext::DestroyOffscreenContext();
|
||||
#endif
|
||||
}
|
||||
|
||||
void lcApplication::ShowPreferencesDialog()
|
||||
|
|
|
@ -104,6 +104,8 @@ public:
|
|||
QByteArray mClipboard;
|
||||
|
||||
protected:
|
||||
bool InitializeRenderer(int AASamples);
|
||||
void ShutdownRenderer();
|
||||
void UpdateStyle();
|
||||
QString GetTabLayoutKey() const;
|
||||
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
#include "lc_global.h"
|
||||
#include "lc_application.h"
|
||||
#include "lc_qupdatedialog.h"
|
||||
#include "lc_mainwindow.h"
|
||||
#include "lc_profile.h"
|
||||
#include "lc_context.h"
|
||||
#include <QApplication>
|
||||
#include <locale.h>
|
||||
|
||||
|
@ -198,12 +196,7 @@ int main(int argc, char *argv[])
|
|||
ExecReturn = Application.exec();
|
||||
}
|
||||
|
||||
#ifdef LC_USE_QOPENGLWIDGET
|
||||
lcContext::DestroyOffscreenContext();
|
||||
#endif
|
||||
|
||||
delete gMainWindow;
|
||||
gMainWindow = nullptr;
|
||||
Application.Shutdown();
|
||||
|
||||
return ExecReturn;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue