/***************************************************************************
 *   Copyright (C) 2010 by Volker Lanz <vl@fidra.de>                       *
 *                                                                         *
 *   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 2 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, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.          *
 ***************************************************************************/

#if !defined(SETTINGS__H)

#define SETTINGS__H

class QString;
class QDialog;

namespace Veneer
{
	void saveDialogSize(const QString& group, QDialog* dlg);
	void restoreDialogSize(const QString& group, QDialog* dlg);
}

#if defined (HAVE_KDE)

#include <config.h>

namespace Veneer
{

	class Settings : public Config
	{
		protected:
			Settings() : Config() {}

		public:
			static Settings* self();
	};

}

#else

#include <QList>
#include <QString>

class QSettings;

namespace Veneer
{

	class Settings
	{
		public:
			class EnumEnergyUnit
			{
				public:
					enum type { kJoule, kCal, COUNT };
			};
			class EnumMeasureSystem
			{
				public:
					enum type { Metric, Imperial, COUNT };
			};

		protected:
			Settings();

		public:
			static Settings* self();

			void writeConfig();

			void setShowStatusbar(bool v);
			bool showStatusbar() const;

			void setEnergyUnit(int v);
			int energyUnit() const;

			void setHeightCalcThreshold(int v);
			int heightCalcThreshold() const;

			void setActivitiesTreeColumnWidths(const QList<int>& v);
			QList<int> activitiesTreeColumnWidths() const;

			void setActivitiesTreeColumnPositions(const QList<int>& v);
			QList<int> activitiesTreeColumnPositions() const;

			void setActivitiesTreeColumnVisible(const QList<int>& v);
			QList<int> activitiesTreeColumnVisible() const;

			void setLastProfile(const QString& v);
			QString lastProfile() const;

			void setActivityPageSplitterSizes(const QList<int>& v);
			QList<int> activityPageSplitterSizes() const;

			void setAthleteLogTreeColumnWidths(const QList<int>& v);
			QList<int> athleteLogTreeColumnWidths() const;

			void setAthleteLogTreeColumnPositions(const QList<int>& v);
			QList<int> athleteLogTreeColumnPositions() const;

			void setAthleteLogTreeColumnVisible(const QList<int>& v);
			QList<int> athleteLogTreeColumnVisible() const;

			void setAthleteLogPageSplitterSizes(const QList<int>& v);
			QList<int> athleteLogPageSplitterSizes() const;

			void setImportTreeColumnWidths(const QList<int>& v);
			QList<int> importTreeColumnWidths() const;

			void setImportTreeColumnPositions(const QList<int>& v);
			QList<int> importTreeColumnPositions() const;

			void setImportTreeColumnVisible(const QList<int>& v);
			QList<int> importTreeColumnVisible() const;

			void setAutoCenterCheckBox(bool v);
			bool autoCenterCheckBox() const;

			void setMeasureSystem(int v);
			int measureSystem() const;

			void setKmlExportPoints(bool v);
			bool kmlExportPoints() const;

			void setKmlExportSummary(bool v);
			bool kmlExportSummary() const;

			QSettings* qs() { return m_QSettings; }
			QSettings* qs() const { return m_QSettings; }

		protected:
			mutable QSettings* m_QSettings;
	};

}

#endif

#endif
