Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

omglocalitiesoptions.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2005 by Tim Sutton   *
00003  *   tim@linfiniti.com   *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 
00021 #include <omglocalitiesoptions.h>
00022 //qt includes
00023 #include <QSettings>
00024 #include <QString>
00027 OmgLocalitiesOptions::OmgLocalitiesOptions(QWidget* parent, Qt::WFlags fl)
00028     : QDialog(parent,fl)
00029 {
00030   //required by Qt4 to initialise the ui
00031   setupUi(this);
00032   QSettings mySettings;
00033   QString myLocalitiesOption = mySettings.value("localities/loaderType","FILE").toString();
00034   if (myLocalitiesOption ==  "FILE")
00035   {
00036       radSingleFile->setChecked(true);
00037   }
00038   else
00039   {
00040       radFilesInDirectory->setChecked(true);
00041   }
00042 
00043   QString myFilterType = 
00044     mySettings.value("localities/localitiesFilterType","NO_FILTER").toString();
00045   if (myFilterType=="ENVIRONMENTALLY_UNIQUE")
00046   {
00047     radEnvironmentallyUnique->setChecked(true);
00048   }
00049   else if (myFilterType=="SPATIALLY_UNIQUE")
00050   {
00051     radSpatiallyUnique->setChecked(true);
00052   }
00053   else //no filtering
00054   {
00055     radNoFilter->setChecked(true);
00056   }
00057 }
00058 
00059 OmgLocalitiesOptions::~OmgLocalitiesOptions()
00060 {
00061 }
00062 void OmgLocalitiesOptions::accept()
00063 {
00064   QSettings mySettings;
00065   qDebug("Saving localities options");
00066   if (radSingleFile->isChecked())
00067   {
00068     mySettings.setValue("localities/loaderType", "FILE");
00069   }
00070   else // radFilesInDirectory->isChecked();
00071   {
00072     mySettings.setValue("localities/loaderType", "DIRECTORY");
00073   }
00074 
00075 
00076   QString myFilterType="NO_FILTER"; //default
00077   if (radEnvironmentallyUnique->isChecked())
00078   {
00079     myFilterType="ENVIRONMENTALLY_UNIQUE";
00080   }
00081   else if (radSpatiallyUnique->isChecked())
00082   {
00083     myFilterType="SPATIALLY_UNIQUE";
00084   }
00085   mySettings.setValue("localities/localitiesFilterType",myFilterType);
00086 
00087   done(1);
00088 }
00089 

Generated on Mon Apr 28 15:07:28 2008 for openModellerDesktop by  doxygen 1.4.1-20050210