Initial version
[gpssportsniffer] / loadtracksWindow.cpp
index 7db2e25..3584500 100755 (executable)
@@ -1,3 +1,22 @@
+/****************************************************************************
+**
+**  Copyright (C) 2011  Tito Eritja Real <jtitoo@gmail.com>
+**
+**  This program is free software: you can redistribute it and/or modify
+**  it under the terms of the GNU General Public License as published by
+**  the Free Software Foundation, either version 3 of the License, or
+**  (at your option) any later version.
+**
+**  This program is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+**  GNU General Public License for more details.
+**
+**  You should have received a copy of the GNU General Public License
+**  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+**
+****************************************************************************/
+
 #include "loadTracksWindow.h"
 #include "ui_loadtracksWindow.h"
 
@@ -71,10 +90,16 @@ void LoadTracksWindow::browse(){
 
 
 void LoadTracksWindow::closeEvent(QCloseEvent *event){
+    /*
     //event->ignore();
     log->debug("CLOSE EVENT OF LOADTRACKS!!!!!!!!!!!!!!!!!!!");
     QMessageBox::warning(this, tr("GPSSniffer"),QString(tr("No file selected!")));
     this->hide();
+    */
+
+    this->parentWidget()->hide();
+    this->parentWidget()->parentWidget()->show();
+    this->hide();
 }
 
 void LoadTracksWindow::showEvent(QShowEvent *){
@@ -91,6 +116,7 @@ void LoadTracksWindow::accept(){
 
     QString fileName = ui->fileCombo->currentText();
     //QString fileName=QString("/home/user/MyDocs/FitxersGPXiTCX/VallDelRiuLac.tcx");
+    //QString fileName=QString("/home/user/MyDocs/GPSSniffer/12-07-2011_09-09-16_Cycling.tcx");
 
     if(!fileName.endsWith(".gpx",Qt::CaseInsensitive) && !fileName.endsWith(".tcx",Qt::CaseInsensitive) ){
         QMessageBox::warning(this, tr("GPSSniffer"),QString(tr("No file selected!")));
@@ -98,6 +124,8 @@ void LoadTracksWindow::accept(){
         Track* toSniff = readFromXML(fileName);
         log->debug("XML readed without problem");
         windowMap->setTrackToSniff(toSniff);
+        settings->setIsCache(ui->mapCacheOn->isChecked());
+
 
         if(windowMap->getMode()==Mode_LoadTracksWindow){
             settings->setMapType((MapType)ui->mapsType->currentIndex());
@@ -109,6 +137,7 @@ void LoadTracksWindow::accept(){
                 windowMap->desactivatePossitionPaint();
             }
         }
+        windowMap->setIsCacheEnabled(ui->mapCacheOn->isChecked());
         windowMap->updateSummary();
         windowMap->drawFullTrackMaps(toSniff);
         settings->setIsConfigured(true);