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

« back to all changes in this revision

Viewing changes to src/cadxcore/main/gui/pacsupload/pacsuploaddialog.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:
 
1
#include <set>
 
2
 
 
3
#include "pacsuploaddialog.h"
 
4
#include <main/controllers/dcmtk/dicomservers.h>
 
5
#include <main/controllers/configurationcontroller.h>
 
6
#include <main/controllers/historycontroller.h>
 
7
#include <wx/ginkgostyle/ginkgostyle.h>
 
8
 
 
9
#define SIZE_ICONOS 16
 
10
 
 
11
#define COLUMNA_DCMDIR_FECHA 2
 
12
#define COLUMNA_DCMDIR_MODALIDAD 1
 
13
#define COLUMNA_DCMDIR_MEDICO 3
 
14
#define COLUMNA_DCMDIR_ACCNUMBER 4
 
15
#define COLUMNA_DCMDIR_UID 5
 
16
 
 
17
 
 
18
namespace GNC {
 
19
        namespace GUI {
 
20
                PACSUploadDialog::PACSUploadDialog(wxWindow* pParent, const std::list<long>& seriesId, const std::list<long>& selectedSeriesId) : PACSUploadDialogBase(pParent)
 
21
                {
 
22
                        wxArrayString pacsList;
 
23
                        DicomServerList::TServerList ListOfServers = DicomServerList::Instance()->GetServerList();
 
24
                        for (DicomServerList::TServerList::iterator it = ListOfServers.begin(); it != ListOfServers.end(); ++it)
 
25
                        {
 
26
                                pacsList.push_back(wxString::FromAscii((*it)->ID.c_str()));
 
27
                        }
 
28
                        m_pServer->Append(pacsList);
 
29
 
 
30
                        if(m_pServer->GetCount()>0){
 
31
                                m_pServer->SetSelection(0);
 
32
                                std::string pacsDef;
 
33
                                GNC::GCS::ConfigurationController::Instance()->readStringUser("/GinkgoCore/SubirPACS", "PACSDefecto", pacsDef);
 
34
                                
 
35
                                for (unsigned int i =0; i< m_pServer->GetCount(); ++i) {
 
36
                                        if (m_pServer->GetString(i) == wxString::FromUTF8(pacsDef.c_str())) {
 
37
                                                m_pServer->Select(i);
 
38
                                                break;
 
39
                                        }
 
40
                                }
 
41
                        } else {
 
42
                                m_pServer->AppendString(_("There aren't any PACS configured"));
 
43
                                m_pServer->SetSelection(0);
 
44
                                m_pServer->Disable();
 
45
                                m_pOkButton->Disable();
 
46
                        }
 
47
 
 
48
                        m_pPanelMessage->Layout();
 
49
                        m_pBody->Layout();
 
50
                        
 
51
                        std::set<long> setOfSelected;
 
52
                        setOfSelected.insert(selectedSeriesId.begin(), selectedSeriesId.end());
 
53
                        
 
54
                        for (std::list<long>::const_iterator itSeries = seriesId.begin(); itSeries != seriesId.end(); ++itSeries)
 
55
                        {
 
56
                                GNC::GCS::HistoryController::SeriesModel sm = GNC::GCS::HistoryController::Instance()->GetSeriesModel((*itSeries));
 
57
                                std::ostringstream ostr;
 
58
                                ostr << sm.series_desc << " - " << sm.series_modality << " (" << sm.num_instances << ") ";
 
59
                                wxDateTime seriesDate;
 
60
                                seriesDate.ParseFormat(wxString::FromUTF8( sm.series_datetime.c_str() ).GetData(), wxT("%Y-%m-%dT%H:%M:%S"), wxDefaultDateTime);
 
61
                                {
 
62
                                        if(seriesDate.IsValid()){
 
63
                                                ostr << wxString(seriesDate.Format(_("%m/%d/%Y %H:%M:%S"), wxDateTime::TimeZone(wxDateTime::GMT1))).ToUTF8();
 
64
                                        }
 
65
                                        else {
 
66
                                                ostr << _Std("0000/00/00 00:00:00");
 
67
                                        }
 
68
                                }
 
69
                                int position = m_pSeriesList->Append(wxString::FromUTF8(ostr.str().c_str()));
 
70
                                m_positionsId[position] = (*itSeries);
 
71
                                if (setOfSelected.empty() || setOfSelected.find((*itSeries)) != setOfSelected.end()) {
 
72
                                        m_pSeriesList->Check(position);
 
73
                                }
 
74
                        }
 
75
                }
 
76
                PACSUploadDialog::~PACSUploadDialog()
 
77
                {
 
78
                }
 
79
 
 
80
 
 
81
                std::string PACSUploadDialog::GetSelectedServer()
 
82
                {
 
83
                        int selection = m_pServer->GetSelection();
 
84
                        if (selection >=0){
 
85
                                std::string idServer(m_pServer->GetString(selection).ToUTF8());
 
86
                                GNC::GCS::ConfigurationController::Instance()->writeStringUser("/GinkgoCore/SubirPACS", "PACSDefecto", idServer);
 
87
                                return idServer;
 
88
                        } else {
 
89
                                return "";
 
90
                        }
 
91
                }
 
92
 
 
93
                std::list<long> PACSUploadDialog::GetSelectedSeries()
 
94
                {
 
95
                        std::list<long> series;
 
96
                        for (int i = 0; i < m_pSeriesList->GetCount(); ++i) {
 
97
                                if (m_positionsId.find(i) != m_positionsId.end()) {
 
98
                                        series.push_back(m_positionsId[i]);
 
99
                                }
 
100
                        }
 
101
                        return series;
 
102
                }
 
103
        }
 
104
}