/*
 *  Copyright (C) 2004 Bucote Software LLC
 *  tbradley@bucote.com
 *
 *  file: BSettings.cpp
 *
 *  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, 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 *
 */

#include <qsettings.h>
#include <qapplication.h>

#include "BSettings.h"

//=====================================================
//=====================================================
void BSettings::loadSettings() 
{
 	QSettings settings;
	settings.setPath( "bucote.com", "bdesktopclock" );

	showWM      = settings.readBoolEntry ("/bdesktopclock/showWindowManager", false);
	showAH      = settings.readBoolEntry ("/bdesktopclock/showAcurateHour",   true);
	stayOnTop   = settings.readBoolEntry ("/bdesktopclock/stayOnTop",         true);
	showDate    = settings.readBoolEntry ("/bdesktopclock/showDate",          true);
	showTime    = settings.readBoolEntry ("/bdesktopclock/showTime",          false);
	showSeconds = settings.readBoolEntry ("/bdesktopclock/showSeconds",       false);
	showGlare   = settings.readBoolEntry ("/bdesktopclock/showGlare",         false);
	timeFormat  = settings.readEntry     ("/bdesktopclock/timeFormat",        "h:mm AP");
	dateFormat  = settings.readEntry     ("/bdesktopclock/dateFormat",        "MMMM d, yyyy");
	fontFormat  = settings.readEntry     ("/bdesktopclock/fontFormat",        QApplication::font().toString());
	hourColor   = settings.readEntry     ("/bdesktopclock/hourColor",         "#000000");
	secondColor = settings.readEntry     ("/bdesktopclock/secondColor",       "#FF0000");
}

//=====================================================
//=====================================================
void BSettings::saveSettings() 
{
	QSettings settings;
	settings.setPath( "bucote.com", "bdesktopclock" );
	
	settings.writeEntry("/bdesktopclock/showWindowManager", showWM);
	settings.writeEntry("/bdesktopclock/showAcurateHour",   showAH);
	settings.writeEntry("/bdesktopclock/stayOnTop",         stayOnTop);
	settings.writeEntry("/bdesktopclock/showDate",          showDate);
	settings.writeEntry("/bdesktopclock/showTime",          showTime);
	settings.writeEntry("/bdesktopclock/showSeconds",       showSeconds);
	settings.writeEntry("/bdesktopclock/showGlare",         showGlare);
	settings.writeEntry("/bdesktopclock/timeFormat",        timeFormat);
	settings.writeEntry("/bdesktopclock/dateFormat",        dateFormat);
	settings.writeEntry("/bdesktopclock/fontFormat",        fontFormat);
	settings.writeEntry("/bdesktopclock/hourColor",         hourColor);
	settings.writeEntry("/bdesktopclock/secondColor",       secondColor);
}
