35
35
#include <main/controllers/controladorvistas.h>
36
36
#include <main/controllers/commandcontroller.h>
37
37
#include <main/controllers/historycontroller.h>
38
#include <main/controllers/autocleaningcontroller.h>
38
39
#include <main/gui/history3/historypanel3.h>
39
40
#include <main/entorno.h>
40
41
#include <api/controllers/icontroladorinternacionalizacion.h>
46
47
PanelConfiguracionGeneral::PanelConfiguracionGeneral(wxWindow* pParent,IDialogoConfiguracion* pDialogo): PanelConfiguracionGeneralBase(pParent), IPasoConfiguracion(pDialogo)
49
m_idiomaCambiado = false;
48
50
pProxySettings = new wxProxySettings();
49
if (GNC::GCS::ControladorVistas::Instance()->GetVistas().size() > 0)
51
m_pPanelDicomDir->Enable(false);
52
m_pstaticTextAdvertencia->Show(true);
56
m_pstaticTextAdvertencia->Show(false);
58
m_idiomaCambiado = false;
68
60
void PanelConfiguracionGeneral::Recargar()
72
if(!GNC::GCS::ConfigurationController::Instance()->readStringUser("/GinkgoCore/Estacion","DicomDir", dicomDir)) {
73
m_pathDicomDir = FROMPATH(GNC::GCS::HistoryController::Instance()->GetGinkgoDicomDir());
75
m_pathDicomDir = wxString::FromUTF8(dicomDir.c_str());
77
m_pDICOMDir->SetValue(m_pathDicomDir);
79
62
//check for updates
81
64
GNC::GCS::ConfigurationController::Instance()->readBoolGeneral("/GinkgoCore/Estacion", "CheckForUpdates", check, true);
143
126
bool PanelConfiguracionGeneral::Validar()
145
wxString path = m_pDICOMDir->GetValue();
146
wxFileName fileName(path);
147
if(!fileName.IsAbsolute()) {
148
wxFileName pathOfExec(wxStandardPaths::Get().GetExecutablePath());
149
fileName.MakeAbsolute(pathOfExec.GetPath());
150
path = fileName.GetFullPath();
153
if(!wxDir::Exists(path)) {
154
//se pregunta si desea crearlo
155
int answer = wxMessageBox(_("The selected directory does not exist\nWould you like to create it?"),_("Info"),wxYES_NO,this);
162
wxMkDir(path.ToUTF8(), 0770);
164
if(!wxDirExists(path))
166
wxMessageBox(_("Failed to create directory, make sure the path is correct and you have permissions on parent directory"), _("Info"));
171
//se comprueba que puede escribir(escribimos y borramos un fichero chorra)
172
wxString pathFicheroPrueba = path + wxFileName::GetPathSeparator() + wxString::Format(wxT("%d"),rand());
173
while(wxFileExists(pathFicheroPrueba)) {
174
pathFicheroPrueba = path + wxFileName::GetPathSeparator() + wxString::Format(wxT("%d"),rand());
178
if(!ficheroTmp.Create(pathFicheroPrueba,false)){
179
if(!wxFileExists(pathFicheroPrueba) ) {
180
wxMessageBox(_("There was an error reading the directory, make sure you have write permissions on it"), _("Info"));
184
ficheroTmp.Write(wxT("prueba"));
187
wxRemoveFile(pathFicheroPrueba);
190
128
if(m_idiomaCambiado) {
191
129
wxMessageBox(_("Ginkgo CADx must restart for the changes to take effect"),_("Info"));
197
135
bool PanelConfiguracionGeneral::Guardar()
199
//se actualiza el fichero de configuracion
200
wxFileName dirAnterior(m_pathDicomDir);
201
wxFileName dirNuevo(m_pDICOMDir->GetValue());
202
if(dirAnterior != dirNuevo)
204
GNC::GCS::ConfigurationController::Instance()->writeStringUser("/GinkgoCore/Estacion", "DicomDir",std::string(m_pDICOMDir->GetValue().ToUTF8()));
205
//se vacia el dicomdir actual y se carga el nuevo...
206
GNC::GCS::HistoryController::FreeInstance();
207
if (!GNC::GCS::HistoryController::Instance()->IsOk()) {
209
GNC::GCS::ConfigurationController::Instance()->writeStringUser("/GinkgoCore/Estacion", "DicomDir", std::string(m_pathDicomDir.ToUTF8()));
210
//se vacia el dicomdir actual y se carga el nuevo...
211
GNC::GCS::HistoryController::FreeInstance();
213
GNC::GUI::HistoryPanel3::Instance()->ReloadHistory();
217
137
GNC::GCS::ConfigurationController::Instance()->writeBoolGeneral("/GinkgoCore/Estacion", "CheckForUpdates", m_pCheckForUpdates->GetValue());
219
139
//internacionalizacion
257
177
m_idiomaCambiado = true;
262
void PanelConfiguracionGeneral::OnSeleccionarDirectorio(wxCommandEvent &)
264
wxDirDialog seleccionarDirectorio(this,_("Select DICOMDIR"),m_pDICOMDir->GetValue(),wxDD_DEFAULT_STYLE|wxDD_NEW_DIR_BUTTON);
265
int response = seleccionarDirectorio.ShowModal();
266
if (response == wxID_OK)
268
m_pDICOMDir->SetValue(seleccionarDirectorio.GetPath());
272
void PanelConfiguracionGeneral::OnSize(wxSizeEvent & event){
273
wxSize oldSize = m_pstaticTextAdvertencia->GetSize();
275
m_pstaticTextAdvertencia->Freeze();
276
m_pstaticTextAdvertencia->SetLabel(_("Warning, to update the directory, you must close current opened series."));
277
m_pstaticTextAdvertencia->Wrap( event.GetSize().x - 25 );
278
m_pstaticTextAdvertencia->Thaw();
280
wxSize newSize = m_pstaticTextAdvertencia->GetSize();
281
if (newSize != oldSize) {
289
181
void PanelConfiguracionGeneral::OnProxySettings(wxCommandEvent &)