Merge branch 'master' of https://vcs.maemo.org/git/gpssportsniffer
[gpssportsniffer] / settingsWindow.cpp
index cd059ca..8dda226 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 "settingsWindow.h"
 #include "windowMap.h"
 #include "ui_settingsWindow.h"
@@ -212,6 +231,9 @@ void SettingsWindow::accept(){
         log->debug(QString("---- ONLINE:%1").arg(ui->onlineButton->isChecked()));
         activitySettings->setIsOnline(ui->onlineButton->isChecked());
 
+        activitySettings->setIsCache(ui->tileCacheOn->isChecked());
+        activityMap->setIsCacheEnabled(ui->tileCacheOn->isChecked());
+
         activitySettings->setXmlFile(ui->fileCombo->currentText());
 
         activitySettings->setMapType((MapType)ui->mapsType->currentIndex());
@@ -220,10 +242,15 @@ void SettingsWindow::accept(){
         log->debug("going to add activity:" + activitySettings->getActivity());
 
         activityMap->setTrack(activitySettings->getXmlFile(),activitySettings->getActivity());
+        activityMap->setWindowTitle(nameFromFile(activitySettings->getXmlFile()));
+
 
         activitySettings->setIsConfigured(true);
         log->debug("starting services");
         activityMap->startServices();
+        activityMap->changeMapType(activitySettings->getMapType());
+
+
         log->debug("done");
 
         //activityMap->startSPositioningTimer();
@@ -233,6 +260,8 @@ void SettingsWindow::accept(){
             Track* toDo = readFromXML(activitySettings->getXmlFile());
             //Track* toDo = readFromXML("/home/user/MyDocs/FitxersGPXiTCX/PobletLaPena.tcx");
             log->debug("XML readed without problem");
+
+
             activityMap->setTrackToSimulate(toDo->getGpsPoints());
             activityMap->changeUpdateInterval(activitySettings->getGpsInterval());
 
@@ -243,6 +272,7 @@ void SettingsWindow::accept(){
             activityMap->startAutosaveTimer(60000*TIME_MIN_TIMEAUTOSAVE);
 
         }
+        activityMap->setWindowTitle("Activity -> " + (activitySettings->getXmlFile()));
         log->debug("accept done");
 
     }else{
@@ -269,6 +299,10 @@ void SettingsWindow::accept(){
                 activityMap->startNetworking();
             }
         }
+        if(activitySettings->getIsCache()!=ui->tileCacheOn->isChecked()){
+            activitySettings->setIsCache(ui->tileCacheOn->isChecked());
+            activityMap->setIsCacheEnabled(activitySettings->getIsCache());
+        }
 
         if(activitySettings->getMapType()!=(MapType)ui->mapsType->currentIndex()){
             activitySettings->setMapType((MapType)ui->mapsType->currentIndex());