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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*
 *  
 *  $Id: exportdicomdirtool.cpp $
 *  Ginkgo CADx Project
 *
 *  Copyright 2008-12 MetaEmotion S.L. All rights reserved.
 *  http://ginkgo-cadx.com
 *
 *  This file is licensed under LGPL v3 license.
 *  See License.txt for details
 *
 *
 */
//#define _GINKGO_TRACE

#include <wx/msgdlg.h>

#include "exportdicomdirtool.h"

#include <api/imodelointegracion.h>

#include <api/controllers/icontroladorpermisos.h>
#include <main/gui/dicomdirexport/exportdicomdir.h>
#include <main/gui/history3/synchronizedialog.h>
#include <resources/ginkgoresourcesmanager.h>
#include <main/controllers/historytoolscontroller.h>

#include <api/internationalization/internationalization.h>

//----------------------------------------------------------------------

GNC::ExportDicomDirTool::ExportDicomDirTool(): GNC::GCS::IHistoryTool(ID,GNC::GCS::IHistoryTool::TFamily_Export, _Std("Export to DICOM Dir"), _Std("Export to DICOM Dir")+ " \tAlt+e", GinkgoResourcesManager::MenuIcons::GetIcoDicomDir()) 
{
}

GNC::ExportDicomDirTool::~ExportDicomDirTool()
{
}

bool GNC::ExportDicomDirTool::Enabled() 
{
	return GNC::GCS::IControladorPermisos::Instance()->Get("core.restrictions","export");
}

void GNC::ExportDicomDirTool::Execute()
{
	GNC::GCS::IHistoryPanel* pHistory = GNC::HistoryToolsController::Instance()->GetHistoryPanel();
	std::list<long> listOfPks;
	pHistory->GetSelectedSeriesPk(listOfPks);
	Execute(listOfPks);
}

void GNC::ExportDicomDirTool::Execute(const std::list<long>& listOfPks)
{
	GNC::GCS::IHistoryPanel* pHistory = GNC::HistoryToolsController::Instance()->GetHistoryPanel();
	if (listOfPks.empty()) {
		wxMessageBox(_("Select at least one series"), _("Info"), wxICON_INFORMATION, pHistory->GetWxWindow());
		return;
	}

	if (!AreSeriesFullyDownloaded(listOfPks)) {
		GNC::GUI::SynchronizeDialog dlg(pHistory->GetWxWindow(), listOfPks, this);
		dlg.ShowModal();
	} else {
		GNC::GUI::ExportDicomDir dlg(pHistory->GetWxWindow(), listOfPks);
		dlg.ShowModal();
	}
}