mirror of
https://github.com/leozide/leocad
synced 2025-01-30 20:34:56 +01:00
This commit is contained in:
parent
6bfc4ff9b1
commit
5ca460c0bf
3 changed files with 32 additions and 15 deletions
|
@ -140,26 +140,20 @@ void lcPreferences::SetInterfaceColors(lcColorTheme ColorTheme)
|
||||||
lcApplication::lcApplication(int& Argc, char** Argv)
|
lcApplication::lcApplication(int& Argc, char** Argv)
|
||||||
: QApplication(Argc, Argv)
|
: QApplication(Argc, Argv)
|
||||||
{
|
{
|
||||||
setApplicationDisplayName("LeoCAD");
|
setApplicationDisplayName(QLatin1String("LeoCAD"));
|
||||||
setOrganizationDomain("leocad.org");
|
setOrganizationDomain(QLatin1String("leocad.org"));
|
||||||
setOrganizationName("LeoCAD Software");
|
setOrganizationName(QLatin1String("LeoCAD Software"));
|
||||||
setApplicationName("LeoCAD");
|
setApplicationName(QLatin1String("LeoCAD"));
|
||||||
setApplicationVersion(LC_VERSION_TEXT);
|
setApplicationVersion(QLatin1String(LC_VERSION_TEXT));
|
||||||
|
|
||||||
gApplication = this;
|
gApplication = this;
|
||||||
mProject = nullptr;
|
|
||||||
mLibrary = nullptr;
|
|
||||||
mDefaultStyle = style()->objectName();
|
mDefaultStyle = style()->objectName();
|
||||||
|
|
||||||
mPreferences.LoadDefaults();
|
mPreferences.LoadDefaults();
|
||||||
|
|
||||||
UpdateStyle();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
lcApplication::~lcApplication()
|
lcApplication::~lcApplication()
|
||||||
{
|
{
|
||||||
delete mProject;
|
|
||||||
delete mLibrary;
|
|
||||||
gApplication = nullptr;
|
gApplication = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -764,7 +758,10 @@ lcStartupMode lcApplication::Initialize(QList<QPair<QString, bool>>& LibraryPath
|
||||||
|
|
||||||
if (!SaveAndExit)
|
if (!SaveAndExit)
|
||||||
{
|
{
|
||||||
|
UpdateStyle();
|
||||||
|
|
||||||
gMainWindow = new lcMainWindow();
|
gMainWindow = new lcMainWindow();
|
||||||
|
|
||||||
lcLoadDefaultKeyboardShortcuts();
|
lcLoadDefaultKeyboardShortcuts();
|
||||||
lcLoadDefaultMouseShortcuts();
|
lcLoadDefaultMouseShortcuts();
|
||||||
}
|
}
|
||||||
|
@ -1062,10 +1059,12 @@ void lcApplication::Shutdown()
|
||||||
}
|
}
|
||||||
|
|
||||||
bool lcApplication::InitializeRenderer(int AASamples)
|
bool lcApplication::InitializeRenderer(int AASamples)
|
||||||
{
|
|
||||||
if (AASamples > 1)
|
|
||||||
{
|
{
|
||||||
QSurfaceFormat Format = QSurfaceFormat::defaultFormat();
|
QSurfaceFormat Format = QSurfaceFormat::defaultFormat();
|
||||||
|
const int FormatSamples = Format.samples() > 1 ? Format.samples() : 1;
|
||||||
|
|
||||||
|
if (AASamples != FormatSamples)
|
||||||
|
{
|
||||||
Format.setSamples(AASamples);
|
Format.setSamples(AASamples);
|
||||||
QSurfaceFormat::setDefaultFormat(Format);
|
QSurfaceFormat::setDefaultFormat(Format);
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,8 +98,8 @@ public:
|
||||||
void SetClipboard(const QByteArray& Clipboard);
|
void SetClipboard(const QByteArray& Clipboard);
|
||||||
void ExportClipboard(const QByteArray& Clipboard);
|
void ExportClipboard(const QByteArray& Clipboard);
|
||||||
|
|
||||||
Project* mProject;
|
Project* mProject = nullptr;
|
||||||
lcPiecesLibrary* mLibrary;
|
lcPiecesLibrary* mLibrary = nullptr;
|
||||||
lcPreferences mPreferences;
|
lcPreferences mPreferences;
|
||||||
QByteArray mClipboard;
|
QByteArray mClipboard;
|
||||||
|
|
||||||
|
|
|
@ -121,8 +121,23 @@ static void lcRegisterShellFileTypes()
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static void lcInitializeSurfaceFormat(int argc, char* argv[])
|
||||||
|
{
|
||||||
|
lcApplication Application(argc, argv);
|
||||||
|
const int AASamples = lcGetProfileInt(LC_PROFILE_ANTIALIASING_SAMPLES);
|
||||||
|
|
||||||
|
if (AASamples > 1)
|
||||||
|
{
|
||||||
|
QSurfaceFormat Format = QSurfaceFormat::defaultFormat();
|
||||||
|
Format.setSamples(AASamples);
|
||||||
|
QSurfaceFormat::setDefaultFormat(Format);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
lcInitializeSurfaceFormat(argc, argv);
|
||||||
|
|
||||||
QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
|
QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
|
||||||
|
|
||||||
lcApplication Application(argc, argv);
|
lcApplication Application(argc, argv);
|
||||||
|
@ -181,7 +196,10 @@ int main(int argc, char *argv[])
|
||||||
lcStartupMode StartupMode = Application.Initialize(LibraryPaths);
|
lcStartupMode StartupMode = Application.Initialize(LibraryPaths);
|
||||||
|
|
||||||
if (StartupMode == lcStartupMode::Error)
|
if (StartupMode == lcStartupMode::Error)
|
||||||
|
{
|
||||||
|
Application.Shutdown();
|
||||||
return 1;
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
int ExecReturn = 0;
|
int ExecReturn = 0;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue