~ubuntu-branches/ubuntu/wily/ginkgocadx/wily-proposed

« back to all changes in this revision

Viewing changes to src/cadxcore/main/gui/import/pasoperfilimportacion.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Andreas Tille
  • Date: 2011-05-02 08:09:26 UTC
  • Revision ID: james.westby@ubuntu.com-20110502080926-bql5wep49c7hg91t
Tags: upstream-2.4.1.1
ImportĀ upstreamĀ versionĀ 2.4.1.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *  
 
3
 *  $Id: pasoperfilimportacion.cpp 3746 2011-04-19 10:41:32Z carlos $
 
4
 *  Ginkgo CADx Project
 
5
 *
 
6
 *  Copyright 2008-10 MetaEmotion S.L. All rights reserved.
 
7
 *  http://ginkgo-cadx.com
 
8
 *
 
9
 *  This file is licensed under LGPL v3 license.
 
10
 *  See License.txt for details
 
11
 *
 
12
 *
 
13
 */
 
14
#include "pasoperfilimportacion.h"
 
15
#include <wx/msgdlg.h>
 
16
#include <wx/msgout.h>
 
17
#include <wx/filename.h>
 
18
#include <wx/config.h>
 
19
#include <vector>
 
20
#include <sstream>
 
21
#include <wx/file.h>
 
22
#include <wx/dir.h>
 
23
#include <main/controllers/controladorextensiones.h>
 
24
#include <api/internacionalizacion.h>
 
25
#include <api/ientorno.h>
 
26
#include <api/icontextoestudio.h>
 
27
 
 
28
namespace GNC {
 
29
        namespace GUI {
 
30
 
 
31
                PasoPefilImportacion::PasoPefilImportacion(wxWindow* pParent,IWizard* pWizard, GNC::GCS::IEntorno* pEntorno):PasoPerfilImportacionBase(pParent),IPasoWizard(pWizard)
 
32
                {
 
33
                        m_pEntorno = pEntorno;
 
34
                        m_pControladorModulo = NULL;
 
35
 
 
36
                        GNC::ControladorExtensiones::ListaModulos listaModulos = ControladorExtensiones::Instance()->Modulos();
 
37
                        for(GNC::ControladorExtensiones::IteradorListaModulos it=listaModulos.begin();it!=listaModulos.end();++it){
 
38
                                GNC::GCS::IControladorModulo* modulo = (*it).second;
 
39
                                if(modulo->SoportaImportacion()){
 
40
                                        m_pListaModulos->Append(wxString::FromUTF8(modulo->GetNombre().c_str()));
 
41
                                }
 
42
                        }
 
43
                        m_pListaModulos->Select(0);
 
44
 
 
45
                        {
 
46
                                wxConfigBase * config = wxConfigBase::Get();
 
47
                                //se actualiza el fichero de configuracion
 
48
                                config->SetPath(wxT("/GinkgoCore/Importacion"));
 
49
                                int defaultDicomizator;
 
50
                                config->Read(wxT("DefaultDicomizator"),&defaultDicomizator,0);
 
51
                                if (defaultDicomizator < (int)m_pListaModulos->GetCount()) {
 
52
                                        m_pListaModulos->Select(defaultDicomizator);
 
53
                                }
 
54
                        }
 
55
                }
 
56
 
 
57
                PasoPefilImportacion::~PasoPefilImportacion()
 
58
                {
 
59
                        m_pEntorno = NULL;
 
60
                        m_pControladorModulo = NULL;
 
61
                }
 
62
 
 
63
//region "Metodos heredados de Ipasowizard"
 
64
 
 
65
                void PasoPefilImportacion::Attach(wxSizer *sizer){
 
66
                        Show(true);
 
67
                        sizer->Add(this,10, wxEXPAND);
 
68
                        this->GetParent()->Layout();
 
69
                }
 
70
 
 
71
                void PasoPefilImportacion::Detach(wxSizer *sizer){
 
72
                        Hide();
 
73
                        sizer->Detach(this);
 
74
                        sizer->GetContainingWindow()->Layout();
 
75
                }
 
76
 
 
77
                std::string PasoPefilImportacion::GetTitle(){
 
78
                        return _Std("Selecting Import Profile");
 
79
                }
 
80
 
 
81
                std::string PasoPefilImportacion::GetSubTitle(){
 
82
                        return _Std("You must select the profile you want to use import");
 
83
                }
 
84
 
 
85
                bool PasoPefilImportacion::Siguiente(){
 
86
                        return true;
 
87
                }
 
88
 
 
89
                bool PasoPefilImportacion::Anterior(){
 
90
                        return false;
 
91
                }
 
92
 
 
93
                bool PasoPefilImportacion::Cancelar(){
 
94
                        return true;
 
95
                }
 
96
 
 
97
                bool PasoPefilImportacion::Validar(){
 
98
                        if(m_pListaModulos->GetSelection()<0){
 
99
                                wxMessageBox(_("You must select the import profile"), _("Info"),
 
100
                                         wxOK | wxICON_INFORMATION, this);
 
101
                                return false;
 
102
                        }
 
103
 
 
104
                        std::string nombreModulo(m_pListaModulos->GetStringSelection().ToUTF8());
 
105
 
 
106
                        GNC::ControladorExtensiones::ListaModulos listaModulos = ControladorExtensiones::Instance()->Modulos();
 
107
                        for(GNC::ControladorExtensiones::IteradorListaModulos it=listaModulos.begin();it!=listaModulos.end();++it){
 
108
                                GNC::GCS::IControladorModulo* modulo=(*it).second;
 
109
                                if(modulo->GetNombre() == nombreModulo){
 
110
                                        m_pControladorModulo = modulo;
 
111
 
 
112
 
 
113
                                        wxConfigBase * config = wxConfigBase::Get();
 
114
                                        //se actualiza el fichero de configuracion
 
115
                                        config->SetPath(wxT("/GinkgoCore/Importacion"));
 
116
                                        config->Write(wxT("DefaultDicomizator"),m_pListaModulos->GetSelection());
 
117
                                        
 
118
                                        return true;
 
119
                                }
 
120
                        }
 
121
                        //
 
122
                        wxMessageBox(_("Unexpected error, select the module again"), _("Info"),
 
123
                                         wxOK | wxICON_INFORMATION, this);
 
124
                        return false;
 
125
                }
 
126
        //endregion
 
127
        }
 
128
}