+ support::addFontResources();
+ pimpl_->application_.reset(createApplication(argc, argv));
+ initGuiFont();
+ // FIXME: this global pointer should probably go.
+ theApp = pimpl_->application_.get();
+ restoreGuiSession(files);
+ // Start the real execution loop.
+
+ // FIXME
+ /* Create a CoreApplication class that will provide the main event loop
+ * and the socket callback registering. With Qt4, only QtCore
+ * library would be needed.
+ * When this is done, a server_mode could be created and the following two
+ * line would be moved out from here.
+ */
+ pimpl_->lyx_server_.reset(new LyXServer(&pimpl_->lyxfunc_, lyxrc.lyxpipes));
+ pimpl_->lyx_socket_.reset(new LyXServerSocket(&pimpl_->lyxfunc_,
+ support::os::internal_path(package().temp_dir() + "/lyxsocket")));
+
+ // handle the batch commands the user asked for
+ if (!batch_command.empty()) {
+ pimpl_->lyxfunc_.dispatch(lyxaction.lookupFunc(batch_command));
+ }
+
+ exit_status = pimpl_->application_->start(batch_command);
+ // Kill the application object before exiting. This avoid crash
+ // on exit on Linux.
+ pimpl_->application_.reset();
+ // Restore original font resources after Application is destroyed.
+ support::restoreFontResources();
+ }
+ else {
+ // FIXME: create a ConsoleApplication
+ theApp = 0;