~ubuntu-branches/ubuntu/trusty/ginkgocadx/trusty

« back to all changes in this revision

Viewing changes to src/cadxcore/api/initwx.cpp

  • Committer: Package Import Robot
  • Author(s): Dmitry Smirnov
  • Date: 2013-07-21 11:58:53 UTC
  • mfrom: (7.2.1 sid)
  • Revision ID: package-import@ubuntu.com-20130721115853-44e7n1xujqglu78e
Tags: 3.4.0.928.29+dfsg-1
* New upstream release [July 2013]
  + new B-D: "libjsoncpp-dev".
  + new patch "unbundle-libjsoncpp.patch" to avoid building bundled
    "libjsoncpp-dev".
  + new patch "fix-wx.patch" to avoid FTBFS due to missing
    "-lwx_gtk2u_html-2.8".
* Removed unnecessary versioned Build-Depends.
* Removed obsolete lintian override.
* Reference get-orig-source implementation for orig.tar clean-up and
  DFSG-repackaging.
* Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
#include <wx/wfstream.h>
50
50
#include <wx/wxsqlite3/wxsqlite3.h>
51
51
#include <wx/socket.h>
 
52
#include <wx/dcclient.h>
52
53
 
53
54
#include <main/controllers/configurationcontroller.h>
54
55
#include <main/tools/coretools.h>
55
56
#include "singleinstance.h"
56
57
#include "initwx.h"
 
58
#include <curl/curl.h>
57
59
 
58
60
#if defined(__DEPRECATED)
59
61
#undef __DEPRECATED
84
86
#include <api/toolsystem/itoolsregistry.h>
85
87
#include <api/controllers/imodulecontroller.h>
86
88
#include <api/controllers/icontroladorlog.h>
87
 
#include <api/controllers/icommandscontroller.h>
 
89
#include <main/controllers/commandcontroller.h>
88
90
#include <api/controllers/ieventscontroller.h>
89
91
#include <api/dicom/idicomconformance.h>
90
92
#include <eventos/hidesplashwindow.h>
91
93
 
92
 
 
93
94
#include "main/entorno.h"
94
95
 
95
96
#include <main/controllers/controladorextensiones.h>
261
262
        wxLog *logger = new wxLogStderr();
262
263
        wxLog::SetActiveTarget(logger);
263
264
        wxSQLite3Database::InitializeSQLite();
 
265
        //initialize WSA on windows
 
266
#if defined(_WINDOWS)
 
267
                WSADATA wsaData;
 
268
                if (WSAStartup(MAKEWORD( 2, 2 ), &wsaData) != 0) {
 
269
                        LOG_ERROR("INIT", "Error initializing network");
 
270
                }
 
271
#endif
 
272
        //initialize curl...
 
273
        /* Must initialize libcurl before any threads are started */
 
274
        curl_global_init(CURL_GLOBAL_ALL);
264
275
 
265
276
        WriteHeaderLog();
266
277
 
303
314
                        name, inst_name);
304
315
                if (connection)
305
316
                {
306
 
                        wxFileName fileName;
 
317
                        
307
318
                        if (argc == 2) {
308
 
                                fileName = wxFileName(argv[1]);
309
 
                                if (fileName.IsRelative()) {
310
 
                                        #if defined(__WXGTK__)
311
 
                                        char* invocation_dir = getenv("INVOCATION_DIR");                                        
312
 
                                        if (invocation_dir != NULL) {
313
 
                                                wxString invocationDir = wxString::FromUTF8(invocation_dir);
314
 
                                                if (!invocationDir.IsEmpty()) {
315
 
                                                        fileName = invocationDir + wxFileName::GetPathSeparator() + fileName.GetFullPath();
316
 
                                                }
317
 
                                        }                                       
318
 
                                        #else
319
 
                                        fileName.MakeAbsolute();
320
 
                                        #endif
321
 
                                }                       
322
 
                                if (fileName.IsOk() && ((fileName.FileExists() && fileName.IsFileReadable()) || (wxDirExists(fileName.GetFullPath()) && fileName.IsDirReadable()))) {
323
 
                                        LOG_INFO("Core", "The client sends following file: " << fileName.GetFullPath().ToUTF8());
 
319
                                wxString str = wxString(argv[1]);
 
320
                                if (str.Lower().StartsWith(wxT("ginkgocadx://"))) {
 
321
                                        LOG_INFO("Core", "The client sends following URL: " << str.ToUTF8());
324
322
                                        // Ask the other instance to open a file or raise itself
325
 
                                        connection->Execute(fileName.GetFullPath());
 
323
                                        connection->Execute(str);
326
324
                                        connection->Disconnect();
327
325
                                        delete connection;
328
326
                                }
329
327
                                else {
330
 
                                        wxString err = wxString::Format(wxT("Error: The file %s does not exists or is not readable"), argv[1]);
331
 
                                        LOG_ERROR("Core", TOPATH(err));
332
 
                                        wxMessageBox(err, wxT("Ginkgo CADx"), wxICON_INFORMATION|wxOK);
333
 
                                }                       
 
328
 
 
329
                                        wxFileName fileName = wxFileName(argv[1]);
 
330
                                        if (fileName.IsRelative()) {
 
331
                                                #if defined(__WXGTK__)
 
332
                                                char* invocation_dir = getenv("INVOCATION_DIR");                                        
 
333
                                                if (invocation_dir != NULL) {
 
334
                                                        wxString invocationDir = wxString::FromUTF8(invocation_dir);
 
335
                                                        if (!invocationDir.IsEmpty()) {
 
336
                                                                fileName = invocationDir + wxFileName::GetPathSeparator() + fileName.GetFullPath();
 
337
                                                        }
 
338
                                                }                                       
 
339
                                                #else
 
340
                                                fileName.MakeAbsolute();
 
341
                                                #endif
 
342
                                        }                       
 
343
                                        if (fileName.IsOk() && ((fileName.FileExists() && fileName.IsFileReadable()) || (wxDirExists(fileName.GetFullPath()) && fileName.IsDirReadable()))) {
 
344
                                                LOG_INFO("Core", "The client sends following file: " << fileName.GetFullPath().ToUTF8());
 
345
                                                // Ask the other instance to open a file or raise itself
 
346
                                                connection->Execute(fileName.GetFullPath());
 
347
                                                connection->Disconnect();
 
348
                                                delete connection;
 
349
                                        }
 
350
                                        else {
 
351
                                                wxString err = wxString::Format(wxT("Error: The file %s does not exists or is not readable"), argv[1]);
 
352
                                                LOG_ERROR("Core", TOPATH(err));
 
353
                                                wxMessageBox(err, wxT("Ginkgo CADx"), wxICON_INFORMATION|wxOK);
 
354
                                        }
 
355
                                }
334
356
                        } else {
335
357
                                // Ask the other instance to open a file or raise itself
336
358
                                connection->Execute(wxT(""));
359
381
                GNC::GCS::ControladorInternacionalizacion::Instance()->AddCatalog("cadxcore");
360
382
        }
361
383
        //permisos del core
 
384
        GNC::GCS::IControladorPermisos::Instance()->AddDefinicionPermiso("core.restrictions", _Std("Ginkgo CADx restrictions"), "reutilize_study", _Std("Open only one tab for each study"), false, "", true);
362
385
        GNC::GCS::IControladorPermisos::Instance()->AddDefinicionPermiso("core.restrictions", _Std("Ginkgo CADx restrictions"), "anonymous_history", _Std("Anonymous mode (history is cleaned)"), false, "", false);
363
386
        GNC::GCS::IControladorPermisos::Instance()->AddDefinicionPermiso("core.restrictions", _Std("Ginkgo CADx restrictions"), "max_tabs", _Std("Max number of tabs opened"), false, "2", false);
364
387
        GNC::GCS::IControladorPermisos::Instance()->AddDefinicionPermiso("core.restrictions", _Std("Ginkgo CADx restrictions"), "inactivity_time", _Std("Max seconds of Ginkgo CADx application inactivity"), false, "600", false);
409
432
 
410
433
        GNC::GCS::IControladorPermisos::Instance()->AddDefinicionPermiso("core.opengl", _Std("OpenGL"), "enable_shaders", _Std("Enable shaders"), false, "", true);
411
434
 
 
435
        //ginkgocloud
 
436
        GNC::GCS::IControladorPermisos::Instance()->AddDefinicionPermiso("ginkgocloud",_Std("Ginkgo Cloud"), "download",_Std("Download from Ginkgo Cloud"),false, "", true);
 
437
 
412
438
        //
413
439
 
414
440
        /*
550
576
 
551
577
                DoProgress(wxString(_("Interpreting parameters ...")));
552
578
 
 
579
 
553
580
        }
554
581
        //parseo
555
582
        wxCommandEvent ce(wxEVT_COMMAND_MENU_SELECTED, ID_Inicio_Aplicacion);
556
 
        m_pVentanaPrincipal->AddPendingEvent(ce);
557
 
 
 
583
        m_pVentanaPrincipal->GetEventHandler()->AddPendingEvent(ce);
558
584
 
559
585
#if defined (__WXMAC__)
560
586
        m_Inicializado = true;
606
632
        GNC::GCS::ControladorAcciones::FreeInstance();
607
633
        GNC::GCS::InactivityController::FreeInstance();
608
634
        GIL::DICOM::PACSController::FreeInstance();
609
 
        GNC::GCS::IControladorComandos::FreeInstance();
 
635
        GNC::GCS::ICommandController::FreeInstance();
610
636
        GNC::ControladorExtensiones::FreeInstance();
611
637
        GNC::GCS::ControladorCarga::FreeInstance();
612
638
        GNC::HistoryToolsController::FreeInstance();
633
659
 
634
660
        GNC::GCS::IControladorLog::FreeInstance();
635
661
 
 
662
#if defined(_WINDOWS)
 
663
                WSACleanup();
 
664
#endif
 
665
        curl_global_cleanup();
 
666
 
636
667
        #if defined(_WINDOWS) && defined(_DEBUG)
637
668
        cairo_debug_reset_static_data();
638
669
        #endif