Create window widget after the library is loaded.

This commit is contained in:
leo 2015-01-23 23:18:32 +00:00
parent 06f11badde
commit 1f1c93c28b
2 changed files with 10 additions and 5 deletions

View file

@ -11,6 +11,7 @@
#include "lc_mainwindow.h"
#include "lc_shortcuts.h"
#include "view.h"
#include "lc_qmainwindow.h"
lcApplication* g_App;
@ -270,6 +271,8 @@ bool lcApplication::Initialize(int argc, char* argv[], const char* LibraryInstal
}
}
gMainWindow = new lcMainWindow();
if (!LoadPiecesLibrary(LibPath, LibraryInstallPath, LDrawPath, LibraryCachePath))
{
if (SaveImage || SaveWavefront)
@ -286,6 +289,8 @@ bool lcApplication::Initialize(int argc, char* argv[], const char* LibraryInstal
"Please visit http://www.leocad.org for information on how to download and install a library.", LC_MB_OK | LC_MB_ICONERROR);
}
gMainWindow->mHandle = new lcQMainWindow;
// Create a new project.
Project* NewProject = new Project();
SetProject(NewProject);

View file

@ -175,18 +175,16 @@ int main(int argc, char *argv[])
QDir dir;
dir.mkpath(cachePath);
gMainWindow = new lcMainWindow();
lcQMainWindow w;
gMainWindow->mHandle = &w;
if (!g_App->Initialize(argc, argv, libPath, LDrawPath, cachePath.toLocal8Bit().data()))
return 1;
w.LibraryLoaded();
lcQMainWindow* MainWindow = (lcQMainWindow*)gMainWindow->mHandle;
MainWindow->LibraryLoaded();
lcGetActiveModel()->UpdateInterface();
gMainWindow->SetColorIndex(lcGetColorIndex(4));
gMainWindow->UpdateRecentFiles();
w.show();
MainWindow->show();
#if !LC_DISABLE_UPDATE_CHECK
lcDoInitialUpdateCheck();
@ -199,6 +197,8 @@ int main(int argc, char *argv[])
delete g_App;
g_App = NULL;
delete MainWindow;
return execReturn;
}