OpenAlbum 1.0.b

/home/manuel/PFC/open-album/OpenAlbum-Unix/introduccionwizard.cpp

00001 #include "introduccionwizard.h"
00002 #include "ui_introduccionwizard.h"
00003 #include "formprincipal.h"
00004 #include "parser.h"
00005 
00006 introduccionWizard::introduccionWizard(QWidget *parent, FormPrincipal *form_) :
00007     QWizardPage(parent),
00008     ui(new Ui::introduccionWizard)
00009 {
00010     ui->setupUi(this);
00011     ui->checkAsistente->setStyle(new QWindowsStyle);
00012     this->form=form_;
00013     this->setWindowFlags(Qt::WindowCloseButtonHint); 
00014 
00015  QIcon *iconoVentana=new QIcon(form_->GetDirectorioDeTrabajo().absolutePath() + "/data/iconlargue.png");
00016     this->setWindowIcon(*iconoVentana);
00017     delete iconoVentana;   
00018 }
00019 
00020 introduccionWizard::~introduccionWizard()
00021 {
00022     delete ui;
00023 }
00024 
00025 void introduccionWizard::checkCasilla(){
00026     this->ui->checkAsistente->setChecked(true);
00027 }
00028 
00029 void introduccionWizard::setConfiguracion(){
00030     QDir dir;
00031    
00032     if(this->ui->checkAsistente->isChecked()){
00033         
00034         QFile file(dir.homePath() + "/.openAlbum/configuracion.xml"); 
00035         if(!file.exists()){
00036                 file.open(QIODevice::WriteOnly | QIODevice::Truncate); 
00037                 QTextStream textStream(&file);
00038                 textStream << "<general wizard=\"no\">\n<creados_recientemente>\n</creados_recientemente></general>";
00039         }else{
00040             if(file.open(QIODevice::ReadOnly | QIODevice::Text)){
00041                 QFile file2(dir.homePath() + "/.openAlbum/configuracion.xml");
00042                 if(file2.open(QIODevice::ReadWrite)){
00043                     QTextStream in(&file);
00044                     QTextStream out(&file2);
00045                     while(!in.atEnd()){
00046                         QString linea=in.readLine();
00047                         if((linea=="<general wizard=\"no\">")){
00048                             out << "<general wizard=\"no\">\n";
00049                         }else{
00050                             if((linea=="<general wizard=\"si\">")){
00051                                 out << "<general wizard=\"no\">\n"; 
00052                            }else{
00053                             out << linea.append("\n");
00054                            }
00055                         }
00056                         
00057                        
00058                     }
00059                 }
00060                 file2.close();
00061             }
00062            
00063         }
00064         file.close();
00065     }else{
00066        QFile file(dir.homePath() + "/.openAlbum/configuracion.xml"); 
00067        if(!file.exists()){
00068                 file.open(QIODevice::WriteOnly | QIODevice::Truncate); 
00069                 QTextStream textStream(&file);
00070                 textStream << "<general wizard=\"si\">\n<creados_recientemente>\n</creados_recientemente></general>"; 
00071        }else{
00072           if(file.open(QIODevice::ReadOnly | QIODevice::Text)){
00073                 QFile file2(dir.homePath() + "/.openAlbum/configuracion.xml");
00074                 if(file2.open(QIODevice::ReadWrite)){
00075                     QTextStream in(&file);
00076                     QTextStream out(&file2);
00077                     while(!in.atEnd()){
00078                         QString linea=in.readLine();
00079                         if((linea=="<general wizard=\"no\">")){
00080                             out << "<general wizard=\"si\">\n";
00081                         }else{
00082                             if((linea=="<general wizard=\"si\">")){
00083                                 out << "<general wizard=\"si\">\n"; 
00084                            }else{
00085                             out << linea.append("\n");
00086                            }
00087                         }
00088                         
00089                        
00090                     }
00091                 }
00092                 file2.close();
00093             } 
00094        }
00095         file.close();
00096     }
00097 }
00098 
00099 bool introduccionWizard::validatePage(){
00100     this->form->ActivarSeleccionPlantilla();
00101     
00102     this->setConfiguracion();
00103     
00104     return true;
00105 }
00106 
00107 
 Todo Clases Archivos Funciones Variables