Staging
v0.5.1
rsync://a.cvs.sourceforge.net/cvsroot/titano/titano
Raw File
Tip revision: caf6b08e7ee50ea57b401dbf73c67715c80ad881 authored by amid on 31 January 2001, 05:11:03 UTC
*** empty log message ***
Tip revision: caf6b08
prefs.h
/* prefs.h - Preferences classes -*- C++ -*-
 * Copyright (C) 2000 Malenko Dmitry <maldim@mail.ru>
 *
 * 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.  
 */

#ifndef _PREFS_H
#define _PREFS_H

#include <string>

#include "iexceptions.h"
#include "titano-app.h"
#include "views.h"

typedef list<string> recent_list;

class PrefsDialog;

class Preferences
{
private:
	const TitanoApp &parent;
	
	string file;
	
	string defaultdir, lastproj;
	
	recent_list recent;
	int recentmax;
	
	string name, mail;

	string view;
	ViewSettings sets;
public:
	Preferences(const TitanoApp &_parent) : parent(_parent)
	{
		file = parent.homedir + ".titano/titano";
		recentmax = 0;
	
		if(check())
			load();
		else
			create();
		defaults();
		save();
	};
	
	Preferences(const Preferences &pr) : parent(pr.parent)
	{
		file = pr.file;
		
		name = pr.name;
		mail = pr.mail;
		defaultdir = pr.defaultdir;
		lastproj = pr.lastproj;
		recent = pr.recent;
		recentmax = pr.recentmax;
	};

	bool check(void);
	void defaults(void);
	void create(void) throw(EIOError);
	void load(void) throw(EIOError);
	void save(void) throw(EIOError);

	void setup(void);

	friend class TitanoApp;
	friend class PrefsDialog;
};

#endif
back to top