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

« back to all changes in this revision

Viewing changes to src/cadxcore/main/gui/history3/historypanel3.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:
33
33
#include <main/controllers/historycontroller.h>
34
34
#include <main/controllers/controladoreventos.h>
35
35
#include <main/controllers/controladorpermisos.h>
36
 
#include <main/controllers/controladorcomandos.h>
 
36
#include <main/controllers/commandcontroller.h>
37
37
#include <main/controllers/configurationcontroller.h>
38
38
#include <main/controllers/controladorvistas.h>
39
39
#include <main/controllers/controladorlog.h>
42
42
#include <main/controllers/streaming/streamingloader.h>
43
43
#include <main/controllers/integrationcontroller.h>
44
44
#include <main/controllers/hangingprotocolcontroller.h>
 
45
#include <main/controllers/windowattributescontroller.h>
45
46
 
46
47
#include <commands/comandoincluirhistorial.h>
 
48
#include <commands/synchronizationcommand.h>
47
49
 
48
50
#include <main/gui/import/wxwizardimportacionginkgo.h>
49
51
#include <main/gui/acquisition/dialogoadquisicion.h>
69
71
 
70
72
#define ICONO_ESTUDIO 0
71
73
#define ICONO_SERIE 1
72
 
#define ICONO_HOMBRE 2
73
 
#define ICONO_MUJER 3
74
 
#define ICONO_OTRO 4
75
 
 
76
 
 
77
 
#define SIZE_THUMBNAILS 96
 
74
#define ICONO_LOCAL_DATABASE 2
 
75
#define ICONO_LOCAL_LINKED 3
 
76
#define ICONO_WADO_LINKED 4
 
77
 
 
78
 
 
79
#define SIZE_THUMBNAILS 76
 
80
#define HISTORY_WINDOW_ID "GinkgoCADxHistory"
78
81
 
79
82
                
80
83
 
161
164
                                        return false;
162
165
                                }
163
166
                                wxTreeItemId nodeStudy = mapOfStudies[pk_study];
164
 
                                m_pTree->DeleteChildren(nodeStudy);
 
167
                                //m_pTree->DeleteChildren(nodeStudy);
165
168
                                GNC::GCS::HistoryController::SeriesModelList seriesList;
166
169
                                GNC::GCS::HistoryController::Instance()->GetSeriesFromStudy(pk_study, seriesList);
167
170
                                for(GNC::GCS::HistoryController::SeriesModelList::const_iterator it = seriesList.begin(); it != seriesList.end(); ++it) {
168
 
                                        InsertSeries(nodeStudy,(*it));
 
171
                                        InsertOrUpdateSeries(nodeStudy,(*it));
169
172
                                }
 
173
                                //delete series that doesn't exists...
170
174
                                m_pTree->SortChildren(nodeStudy, m_sortCriteria, m_reverse);
171
175
 
172
176
                                return true;                            
258
262
 
259
263
                                //iconos
260
264
                                int icono = 0;
261
 
                                if(studyModel.pat_sex == 'M') {
262
 
                                        icono = ICONO_HOMBRE;
263
 
                                } else if(studyModel.pat_sex == 'F') {
264
 
                                        icono = ICONO_MUJER;
265
 
                                } else {
266
 
                                        icono = ICONO_OTRO;
 
265
                                switch(studyModel.location)
 
266
                                {
 
267
                                        case GNC::GCS::IHistoryController::TL_LocalDatabase:
 
268
                                                icono = ICONO_LOCAL_DATABASE;
 
269
                                                break;
 
270
                                        case GNC::GCS::IHistoryController::TL_LocalLinked:
 
271
                                                icono = ICONO_LOCAL_LINKED;
 
272
                                                break;
 
273
                                        case GNC::GCS::IHistoryController::TL_WadoLinked:
 
274
                                                icono = ICONO_WADO_LINKED;
 
275
                                                break;
267
276
                                }
268
277
 
269
278
                                if(itMap != mapOfStudies.end()) 
270
279
                                {
271
280
                                        idNode = (*itMap).second;       
272
281
                                        m_pTree->SetItemText(m_pTree->GetRootItem(), wxString::FromUTF8(studyModel.pat_name.c_str()));
 
282
                                        m_pTree->SetItemImage(idNode, icono, wxTreeItemIcon_Max);
273
283
                                        if (m_pTree->GetChildrenCount(idNode) == 0) {
274
284
                                                m_pTree->AppendItem(idNode, _("Searching..."));
275
285
                                        }
309
319
                                m_pTree->SetItemText(idNode, COL_DATE_TIME, dateTimeStr);
310
320
                                m_pTree->SetItemText(idNode, COL_ACCNUMBER, wxString::FromUTF8(studyModel.study_acc_no.c_str()));
311
321
                                m_pTree->SetItemText(idNode, COL_PK, wxString::Format(wxT("%d"),(studyModel.pk)));
 
322
                                m_pTree->SetItemText(idNode, COL_LOCATION, wxString::Format(wxT("%c"),(GNC::GCS::IHistoryController::LocationToChar(studyModel.location))));
 
323
 
312
324
                                if (studyModel.pending_tasks > 0) {
313
325
                                        m_pTree->SetItemBackgroundColour(idNode, wxColour(255,128,64));
314
326
                                } else {
316
328
                                }
317
329
                                m_pTree->SetItemText(idNode, COL_PENDING_TASKS, wxString::Format(wxT("%d"),studyModel.pending_tasks));
318
330
 
319
 
                                //to enable expand...
320
 
                                if (m_pTree->GetChildrenCount(idNode) == 0) {
321
 
                                        //m_pTree->AppendItem(idNode, _("Searching..."));
 
331
                                //if it's expanded then refresh series...
 
332
                                if (m_pTree->IsExpanded(idNode)) {
 
333
                                        ExpandStudy(studyModel.pk);
322
334
                                }
323
335
 
324
336
                                return idNode;
345
357
                                }
346
358
                        }
347
359
 
348
 
                        wxTreeItemId InsertSeries(wxTreeItemId parent, const GNC::GCS::HistoryController::SeriesModel& model)
 
360
                        wxTreeItemId InsertOrUpdateSeries(wxTreeItemId parent, const GNC::GCS::HistoryController::SeriesModel& model)
349
361
                        {
350
362
                                wxDateTime seriesDate;
351
363
                                seriesDate.ParseFormat(wxString::FromUTF8( model.series_datetime.c_str() ).GetData(), wxT("%Y-%m-%dT%H:%M:%S"), wxDefaultDateTime);
359
371
                                        }
360
372
                                }
361
373
 
362
 
                                wxTreeItemId idNode = m_pTree->AppendItem(parent, wxString::FromUTF8(model.series_desc.c_str()), -1, -1, NULL);
 
374
                                int icono = 0;
 
375
                                switch(model.location)
 
376
                                {
 
377
                                        case GNC::GCS::IHistoryController::TL_LocalDatabase:
 
378
                                                icono = ICONO_LOCAL_DATABASE;
 
379
                                                break;
 
380
                                        case GNC::GCS::IHistoryController::TL_LocalLinked:
 
381
                                                icono = ICONO_LOCAL_LINKED;
 
382
                                                break;
 
383
                                        case GNC::GCS::IHistoryController::TL_WadoLinked:
 
384
                                                icono = ICONO_WADO_LINKED;
 
385
                                                break;
 
386
                                }
 
387
 
 
388
                                wxTreeItemId idNode;
 
389
                                wxTreeItemIdValue cookie;
 
390
                                wxTreeItemId searchingNode;
 
391
                                wxString modelPK = wxString::Format(wxT("%d"),model.pk);
 
392
                                for (wxTreeItemId child = m_pTree->GetFirstChild(parent, cookie); child.IsOk(); child = m_pTree->GetNextChild(parent, cookie)) {
 
393
                                        if (m_pTree->GetItemText(child, COL_PK).CompareTo(modelPK) == 0) {
 
394
                                                idNode = child;
 
395
                                                m_pTree->SetItemText(idNode, wxString::FromUTF8(model.series_desc.c_str()));
 
396
                                                m_pTree->SetItemImage(idNode, icono, wxTreeItemIcon_Max);
 
397
                                                break;
 
398
                                        } else if (m_pTree->GetItemText(child, COL_PK).IsEmpty()) {
 
399
                                                searchingNode = child;
 
400
                                        }
 
401
                                }
 
402
                                if (searchingNode.IsOk()) {
 
403
                                        m_pTree->Delete(searchingNode);
 
404
                                }
 
405
                                if (!idNode.IsOk()) {
 
406
                                        idNode = m_pTree->AppendItem(parent, wxString::FromUTF8(model.series_desc.c_str()), icono, icono, NULL);
 
407
                                }
363
408
                                m_pTree->SetItemText(idNode, COL_MODALITY, wxString::FromUTF8(model.series_modality.c_str()));
364
409
                                m_pTree->SetItemText(idNode, COL_DESCRIPTION, wxString::FromUTF8(model.series_desc.c_str()));
365
410
                                m_pTree->SetItemText(idNode, COL_DATE_TIME, dateTimeStr);
366
411
                                m_pTree->SetItemText(idNode, COL_PENDING_TASKS, wxString::Format(wxT("%d"),model.pendingTasks.size()));
367
 
                                m_pTree->SetItemText(idNode, COL_PK, wxString::Format(wxT("%d"),model.pk));
 
412
                                m_pTree->SetItemText(idNode, COL_PK, modelPK);
 
413
                                m_pTree->SetItemText(idNode, COL_LOCATION, wxString::Format(wxT("%c"),(GNC::GCS::IHistoryController::LocationToChar(model.location))));
368
414
                                return idNode;
369
415
                        }
370
416
 
413
459
 
414
460
                        void OnOpenMenu(wxCommandEvent& )
415
461
                        {
416
 
                                HistoryPanel->OpenSeriesOrStudy(SeriesPk, true);
 
462
                                HistoryPanel->OpenSeriesOrStudy(SeriesPk, true,!GNC::GCS::IControladorPermisos::Instance()->Get("core.restrictions", "reutilize_study"));
417
463
                        }
418
464
 
419
465
                        void OnOpenWithMenu(wxCommandEvent& )
438
484
                //TODO all tasks are sendcommands
439
485
                GADAPI::SendPACSCommand* pCmd = new GADAPI::SendPACSCommand((*it).pk, (*it).seriesId);
440
486
                pCmd->init((*it).data);
441
 
                GNC::ControladorComandos::Instance()->ProcessAsync("",pCmd,NULL);
 
487
                GNC::CommandController::Instance()->ProcessAsync("",pCmd,NULL);
442
488
        }
443
489
}
444
490
//---------------------------------------------------------------------------
462
508
GNC::GUI::HistoryPanel3* GNC::GUI::HistoryPanel3::m_pInstance = NULL;
463
509
 
464
510
 
465
 
GNC::GUI::HistoryPanel3::HistoryPanel3(wxWindow* pParent) : HistoryPanel3Base(pParent), Loader(new GNC::StreamingLoader())
 
511
GNC::GUI::HistoryPanel3::HistoryPanel3(wxWindow* pParent) : HistoryPanel3Base(pParent), Loader(new GNC::StreamingLoader()),
 
512
        m_RefreshOnIdle(false)
466
513
{
 
514
        //load attributes
 
515
        GNC::GCS::WindowAttributesController::LoadWindowAttributes(HISTORY_WINDOW_ID, this, false);
 
516
        //
 
517
 
467
518
        m_pImageList = new wxImageList(SIZE_ICONOS,SIZE_ICONOS,true);
468
519
        m_pTimerReload = new ReloadHistoryTimer(this);
469
520
        
491
542
        if (bmp.IsOk()) {
492
543
                m_pImageList->Add(bmp);
493
544
        }
494
 
        bmp = GinkgoResourcesManager::History::GetIcoHombre();
495
 
        if (bmp.IsOk()) {
496
 
                m_pImageList->Add(bmp);
497
 
        }
498
 
        bmp = GinkgoResourcesManager::History::GetIcoMujer();
499
 
        if (bmp.IsOk()) {
500
 
                m_pImageList->Add(bmp);
501
 
        }
502
 
        bmp = GinkgoResourcesManager::History::GetIcoOtro();
 
545
        bmp = GinkgoResourcesManager::History::GetIcoLocalFile();
 
546
        if (bmp.IsOk()) {
 
547
                m_pImageList->Add(bmp);
 
548
        }
 
549
        bmp = GinkgoResourcesManager::History::GetIcoLocalLinked();
 
550
        if (bmp.IsOk()) {
 
551
                m_pImageList->Add(bmp);
 
552
        }
 
553
        bmp = GinkgoResourcesManager::History::GetIcoWadoLinked();
503
554
        if (bmp.IsOk()) {
504
555
                m_pImageList->Add(bmp);
505
556
        }
565
616
        ViewImage2D->Detach();
566
617
        //necesario para que no haga un doble delete
567
618
        ViewInteractor2D->Delete();
568
 
        ViewInteractor2D->Reparent(NULL);               
 
619
        ViewInteractor2D->Reparent(NULL);
 
620
 
 
621
        //save window attributes
 
622
        GNC::GCS::WindowAttributesController::SaveWindowAttributes(HISTORY_WINDOW_ID, this);
 
623
 
569
624
}
570
625
 
571
626
void GNC::GUI::HistoryPanel3::ReloadHistory()
706
761
        }
707
762
}
708
763
 
 
764
 
709
765
void GNC::GUI::HistoryPanel3::RefreshSearch(bool force)
710
766
{
 
767
        if (force) {
 
768
                doRefresh(force);
 
769
        } else {
 
770
                m_RefreshOnIdle = true;
 
771
        }
 
772
}
 
773
 
 
774
void GNC::GUI::HistoryPanel3::checkPendingTasks()
 
775
{
 
776
        //throw pending commands...
 
777
        if (GNC::GCS::HistoryController::Instance()->IsPendingTasks()) {
 
778
                if (wxMessageBox(_("There are pending tasks, do you want to execute them?"), _("Pending tasks"), wxYES_NO , GNC::Entorno::Instance()->GetVentanaRaiz()) == wxYES)
 
779
                {
 
780
                        std::list<GNC::GCS::HistoryController::TaskModel> tasks;
 
781
                        GNC::GCS::HistoryController::Instance()->GetPendingTasks(tasks);
 
782
                        launchTasks(tasks);
 
783
                        RefreshSearch();
 
784
                }
 
785
        }
 
786
}
 
787
 
 
788
void GNC::GUI::HistoryPanel3::GetSelectedSeriesPk(std::list<long>& listOfPks)
 
789
{
 
790
        std::set<long> setOfPks;
 
791
        m_pTableModel->GetSeriesPkSelected(setOfPks);
 
792
        for (std::set<long>::iterator it = setOfPks.begin(); it != setOfPks.end(); ++it) {
 
793
                listOfPks.push_back((*it));
 
794
        }
 
795
}
 
796
 
 
797
void GNC::GUI::HistoryPanel3::OnHistoryPanelIdle( wxIdleEvent& /*event*/ )
 
798
{
 
799
        if (m_RefreshOnIdle) {
 
800
                doRefresh();
 
801
        }
 
802
}
 
803
 
 
804
void GNC::GUI::HistoryPanel3::doRefresh(bool force)
 
805
{
711
806
        RefreshPatientFilter();
712
807
        RefreshModalityFilter();
713
808
        RefreshDateFilter();
737
832
        }
738
833
 
739
834
        Thaw();
740
 
}
741
 
 
742
 
void GNC::GUI::HistoryPanel3::checkPendingTasks()
743
 
{
744
 
        //throw pending commands...
745
 
        if (GNC::GCS::HistoryController::Instance()->IsPendingTasks()) {
746
 
                if (wxMessageBox(_("There are pending tasks, do you want to execute them?"), _("Pending tasks"), wxYES_NO , GNC::Entorno::Instance()->GetVentanaRaiz()) == wxYES)
747
 
                {
748
 
                        std::list<GNC::GCS::HistoryController::TaskModel> tasks;
749
 
                        GNC::GCS::HistoryController::Instance()->GetPendingTasks(tasks);
750
 
                        launchTasks(tasks);
751
 
                        RefreshSearch();
752
 
                }
753
 
        }
754
 
}
755
 
 
756
 
void GNC::GUI::HistoryPanel3::GetSelectedSeriesPk(std::list<long>& listOfPks)
757
 
{
758
 
        std::set<long> setOfPks;
759
 
        m_pTableModel->GetSeriesPkSelected(setOfPks);
760
 
        for (std::set<long>::iterator it = setOfPks.begin(); it != setOfPks.end(); ++it) {
761
 
                listOfPks.push_back((*it));
762
 
        }
763
 
}
764
 
 
 
835
        m_RefreshOnIdle = false;
 
836
}
765
837
 
766
838
void GNC::GUI::HistoryPanel3::RefreshPatientFilter()
767
839
{
903
975
                long pk;
904
976
                m_pTreeListResults->GetItemText(item, COL_PK).ToLong(&pk);              
905
977
                if (m_pTreeListResults->GetItemParent(item) != m_pTreeListResults->GetRootItem()){
906
 
                        OpenSeriesOrStudy(pk, true);
 
978
                        OpenSeriesOrStudy(pk, true,!GNC::GCS::IControladorPermisos::Instance()->Get("core.restrictions", "reutilize_study"));
907
979
                } else {
908
 
                        OpenSeriesOrStudy(pk, false);
 
980
                        OpenSeriesOrStudy(pk, false,!GNC::GCS::IControladorPermisos::Instance()->Get("core.restrictions", "reutilize_study"));
909
981
                }
910
982
                event.Skip(false);
911
983
        }
950
1022
                                menu.AppendSeparator();
951
1023
                        }
952
1024
                        GNC::HistoryToolsController::Instance()->AppendsToolInMenu(&menu, &menu, GNC::GCS::IHistoryTool::TFamily_Q_R);
 
1025
                        {
 
1026
                                //synchronize option
 
1027
                                bool enableSynchronize = GNC::GCS::IHistoryController::Instance()->CharToLocation(*m_pTreeListResults->GetItemText(item, COL_LOCATION).ToUTF8()) 
 
1028
                                        == GNC::GCS::IHistoryController::TL_WadoLinked;
 
1029
                                wxMenuItem* pMenuSynchronize = new wxMenuItem(&menu, idMenuItem, wxString( _("Synchronize") ), _("Synchronize"), wxITEM_NORMAL );
 
1030
                                #ifdef __WXMSW__
 
1031
                                pMenuSynchronize->SetBitmaps(GinkgoResourcesManager::Acquisition::GetIcoDownload());
 
1032
                                #else
 
1033
                                pMenuSynchronize->SetBitmap(GinkgoResourcesManager::Acquisition::GetIcoDownload());
 
1034
                                #endif
 
1035
                                menu.Append(pMenuSynchronize);
 
1036
                                menu.Enable(idMenuItem, enableSynchronize);                             
 
1037
                                menu.Connect(idMenuItem++,wxEVT_COMMAND_MENU_SELECTED,wxCommandEventHandler( HistoryPanel3::OnSynchronizeSelected),NULL,this);
 
1038
                        }
953
1039
                        if (menu.GetMenuItemCount() > 0 && !menu.GetMenuItems().back()->IsSeparator()) {
954
1040
                                menu.AppendSeparator();
955
1041
                        }
1033
1119
 
1034
1120
void GNC::GUI::HistoryPanel3::OnTreeKeyDown(wxTreeEvent& event)
1035
1121
{
1036
 
        if (event.GetKeyCode() == WXK_DELETE) {
 
1122
        if (event.GetKeyCode() == WXK_DELETE || event.GetKeyCode() == WXK_BACK|| event.GetKeyCode() == WXK_NUMPAD_DELETE) {
1037
1123
                RemoveSelected();
1038
1124
                event.Veto();
1039
1125
        } else {
1110
1196
                wxHistoryImageThumbnailItem* pItem = static_cast<wxHistoryImageThumbnailItem*>(m_pThumbnails->GetItem(selected));
1111
1197
                if (pItem->GetType() == wxHistoryImageThumbnailItem::TI_Series) {
1112
1198
                        //open series
1113
 
                        OpenSeriesOrStudy(pItem->GetSeriesPk(), true);
 
1199
                        OpenSeriesOrStudy(pItem->GetSeriesPk(), true,!GNC::GCS::IControladorPermisos::Instance()->Get("core.restrictions", "reutilize_study"));
1114
1200
                } else {
1115
1201
                        //open image
1116
1202
                        GNC::GCS::IVista* pView = GetViewFromSeries(pItem->GetSeriesPk());
1119
1205
                                std::string pathOfFile(TOPATH(pItem->GetFilename()));
1120
1206
                                pView->ActivarRuta(pItem->GetFilePk());                         
1121
1207
                        } else  {
1122
 
                                OpenSeriesOrStudy(pItem->GetSeriesPk(), true);
 
1208
                                OpenSeriesOrStudy(pItem->GetSeriesPk(), true,!GNC::GCS::IControladorPermisos::Instance()->Get("core.restrictions", "reutilize_study"));
1123
1209
                        }
1124
1210
                }
1125
1211
        }
1147
1233
        if (item.IsOk() && m_pTreeListResults->GetItemParent(item) != m_pTreeListResults->GetRootItem()) {
1148
1234
                long pk;
1149
1235
                m_pTreeListResults->GetItemText(item, COL_PK).ToLong(&pk);
1150
 
                OpenSeriesOrStudy(pk, true);
 
1236
                OpenSeriesOrStudy(pk, true,!GNC::GCS::IControladorPermisos::Instance()->Get("core.restrictions", "reutilize_study"));
1151
1237
        } else if (item.IsOk() && m_pTreeListResults->GetItemParent(item) == m_pTreeListResults->GetRootItem()) {
1152
1238
                long pk;
1153
1239
                m_pTreeListResults->GetItemText(item, COL_PK).ToLong(&pk);
1154
 
                OpenSeriesOrStudy(pk, false);
 
1240
                OpenSeriesOrStudy(pk, false,!GNC::GCS::IControladorPermisos::Instance()->Get("core.restrictions", "reutilize_study"));
1155
1241
        }
1156
1242
}
1157
1243
 
1194
1280
        AdvancedTasksEdition();
1195
1281
}
1196
1282
 
 
1283
void GNC::GUI::HistoryPanel3::OnSynchronizeSelected(wxCommandEvent& /*event*/)
 
1284
{
 
1285
        SynchronizeSelected();
 
1286
}
 
1287
 
1197
1288
 
1198
1289
GNC::GCS::IVista* GNC::GUI::HistoryPanel3::GetViewFromSeries(long pk_series)
1199
1290
{
1234
1325
 
1235
1326
        OpenWithDialog::ListaModalidades listaModalidades;
1236
1327
        for (GNC::GCS::IHistoryController::SeriesModelList::iterator itSeries = seriesModelList.begin(); itSeries != seriesModelList.end(); ++itSeries) {
1237
 
                for (GNC::GCS::HistoryController::StringList::iterator it = (*itSeries).tsuids.begin(); it != (*itSeries).tsuids.end(); ++it) {
1238
 
                        listaModalidades.push_back(std::pair<std::string,std::string>((*itSeries).series_modality, (*it)));
 
1328
                GNC::GCS::IHistoryController::SeriesModel& seriesModel = (*itSeries);
 
1329
                for (GNC::GCS::HistoryController::StringList::iterator it = seriesModel.tsuids.begin(); it != seriesModel.tsuids.end(); ++it) {
 
1330
                        listaModalidades.push_back(std::pair<std::string,std::string>(seriesModel.series_modality, (*it)));
1239
1331
                }
1240
1332
        }
1241
1333
 
1350
1442
                }
1351
1443
        }
1352
1444
 
1353
 
        if (seriesIsAlreadyOpen) {
1354
 
                int answer = wxMessageBox(_("The series selected is already open\nDo you want to open it again?"),_("Open again"), wxYES_NO , GNC::Entorno::Instance()->GetVentanaRaiz());
1355
 
                if (answer != wxYES) {
1356
 
                        return;
1357
 
                }
1358
 
        }
1359
 
 
1360
1445
        if(pModo != NULL && pModulo != NULL){
1361
1446
                //openinG!!!
1362
1447
                OpenSeries(seriesModelList, pModulo, pModo->GetId(), hp);
1550
1635
        RefreshSearch();
1551
1636
}
1552
1637
 
 
1638
void GNC::GUI::HistoryPanel3::SynchronizeSelected()
 
1639
{
 
1640
        std::set<long> setOfPks;
 
1641
        m_pTableModel->GetSeriesPkSelected(setOfPks);
 
1642
 
 
1643
        if (setOfPks.empty()) {
 
1644
                wxMessageBox(_("Select at least one series"), _("Info"), wxOK | wxICON_WARNING);
 
1645
                return;
 
1646
        }
 
1647
 
 
1648
        GNC::GCS::HistoryController::IdList pkList;
 
1649
        pkList.insert(pkList.begin(), setOfPks.begin(), setOfPks.end());
 
1650
        
 
1651
        GADAPI::SynchronizationCommandParameters* pParams = new GADAPI::SynchronizationCommandParameters(pkList, NULL);
 
1652
        GADAPI::SynchronizationCommand* pCmd = new GADAPI::SynchronizationCommand(pParams);
 
1653
        GNC::GCS::ICommandController::Instance()->ProcessAsync("syncronizing...", pCmd, NULL);
 
1654
}
 
1655
 
1553
1656
void GNC::GUI::HistoryPanel3::LoadPreviewsFromStudy(const wxTreeItemId& itemStudy)
1554
1657
{
1555
1658
        wxWindowDisabler disableAll;
1561
1664
        long pkStudy;
1562
1665
        m_pTreeListResults->GetItemText(itemStudy, COL_PK).ToLong(&pkStudy);
1563
1666
 
 
1667
        GNC::GCS::IHistoryController::TLocation location = GNC::GCS::IHistoryController::CharToLocation(*m_pTreeListResults->GetItemText(itemStudy, COL_LOCATION).ToUTF8());
 
1668
 
1564
1669
        GNC::GCS::HistoryController::SeriesModelList seriesList;
1565
1670
        GNC::GCS::HistoryController::Instance()->GetSeriesFromStudy(pkStudy, seriesList);
1566
1671
        
1567
1672
        for (GNC::GCS::HistoryController::SeriesModelList::const_iterator it = seriesList.begin(); it != seriesList.end(); ++it) {
1568
1673
                GNC::GCS::HistoryController::FileModel frame = GNC::GCS::HistoryController::Instance()->GetFrameOfReference((*it).pk);
1569
1674
                wxString pathOfItem = wxString::Format(wxT("%ld"),frame.pk);
1570
 
                wxHistoryImageThumbnailItem* pItem = new wxHistoryImageThumbnailItem(pathOfItem, wxHistoryImageThumbnailItem::TI_Series, (*it).pk, frame.pk, !frame.file_path.empty());
 
1675
                
 
1676
 
 
1677
                wxHistoryImageThumbnailItem* pItem = new wxHistoryImageThumbnailItem(pathOfItem, wxHistoryImageThumbnailItem::TI_Series, (*it).pk, frame.pk, location);
1571
1678
                m_pThumbnails->Insert(pItem);
1572
1679
        }
1573
1680
        m_pThumbnails->Thaw();
1583
1690
 
1584
1691
        long pk;
1585
1692
        m_pTreeListResults->GetItemText(itemSeries, COL_PK).ToLong(&pk);
1586
 
        GNC::GCS::HistoryController::FileModelList listOfFiles;
 
1693
        GNC::GCS::HistoryController::LightFileModelList listOfFiles;
1587
1694
        GNC::GCS::HistoryController::Instance()->GetSeriesSortedFileModels(pk, listOfFiles);
1588
1695
 
1589
 
        for (GNC::GCS::HistoryController::FileModelList::const_iterator it = listOfFiles.begin(); it != listOfFiles.end(); ++it) {
 
1696
        for (GNC::GCS::HistoryController::LightFileModelList::const_iterator it = listOfFiles.begin(); it != listOfFiles.end(); ++it) {
1590
1697
                wxString pathOfItem = wxString::Format(wxT("%ld"),(*it).pk);
1591
 
                wxHistoryImageThumbnailItem* pItem = new wxHistoryImageThumbnailItem(pathOfItem, wxHistoryImageThumbnailItem::TI_Image, pk, (*it).pk, !(*it).file_path.empty());
 
1698
                wxHistoryImageThumbnailItem* pItem = new wxHistoryImageThumbnailItem(pathOfItem, wxHistoryImageThumbnailItem::TI_Image, pk, (*it).pk, (*it).location);
1592
1699
                m_pThumbnails->Append(pItem);
1593
1700
        }
1594
1701
        m_pThumbnails->Thaw();