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;
|
return lcStartupMode::Error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AASamples > 1)
|
|
||||||
{
|
|
||||||
#ifdef LC_USE_QOPENGLWIDGET
|
#ifdef LC_USE_QOPENGLWIDGET
|
||||||
QSurfaceFormat Format = QSurfaceFormat::defaultFormat();
|
if (!InitializeRenderer(AASamples))
|
||||||
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 lcStartupMode::Error;
|
return lcStartupMode::Error;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1014,8 +1000,47 @@ lcStartupMode lcApplication::Initialize(QList<QPair<QString, bool>>& LibraryPath
|
||||||
|
|
||||||
void lcApplication::Shutdown()
|
void lcApplication::Shutdown()
|
||||||
{
|
{
|
||||||
|
delete gMainWindow;
|
||||||
|
gMainWindow = nullptr;
|
||||||
|
|
||||||
|
delete mProject;
|
||||||
|
mProject = nullptr;
|
||||||
|
|
||||||
delete mLibrary;
|
delete mLibrary;
|
||||||
mLibrary = nullptr;
|
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()
|
void lcApplication::ShowPreferencesDialog()
|
||||||
|
|
|
@ -104,6 +104,8 @@ public:
|
||||||
QByteArray mClipboard;
|
QByteArray mClipboard;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
bool InitializeRenderer(int AASamples);
|
||||||
|
void ShutdownRenderer();
|
||||||
void UpdateStyle();
|
void UpdateStyle();
|
||||||
QString GetTabLayoutKey() const;
|
QString GetTabLayoutKey() const;
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
#include "lc_global.h"
|
#include "lc_global.h"
|
||||||
#include "lc_application.h"
|
#include "lc_application.h"
|
||||||
#include "lc_qupdatedialog.h"
|
#include "lc_qupdatedialog.h"
|
||||||
#include "lc_mainwindow.h"
|
|
||||||
#include "lc_profile.h"
|
#include "lc_profile.h"
|
||||||
#include "lc_context.h"
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
|
|
||||||
|
@ -198,12 +196,7 @@ int main(int argc, char *argv[])
|
||||||
ExecReturn = Application.exec();
|
ExecReturn = Application.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef LC_USE_QOPENGLWIDGET
|
Application.Shutdown();
|
||||||
lcContext::DestroyOffscreenContext();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
delete gMainWindow;
|
|
||||||
gMainWindow = nullptr;
|
|
||||||
|
|
||||||
return ExecReturn;
|
return ExecReturn;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue