/***************************************************************************
 *   Copyright (C) 2005 by Joe Ferris                                      *
 *   jferris@optimistictech.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 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.             *
 ***************************************************************************/
#ifndef KATAPULTSETTINGS_H
#define KATAPULTSETTINGS_H

#include <tqobject.h>
#include <tqptrlist.h>
#include <tqdict.h>

class KatapultCatalog;
class KatapultDisplay;
class TQStringList;
class TQString;

/**
@author Joe Ferris
*/
class KatapultSettings : public TQObject
{
	TQ_OBJECT
  
public:
	enum NRAction {
		NR_DoNothing = 0,
		NR_ClearQuery = 1,
		NR_HideDisplay = 2
	};
	
	KatapultSettings();
	~KatapultSettings();
	
	bool isConfiguring() const;
	
	// general settings
	bool isAutoExecute() const;
	void setAutoExecute(bool);
	int hideDelay() const;
	void setHideDelay(int);
	int noResultsDelay() const;
	void setNoResultsDelay(int);
	NRAction noResultsAction() const;
	void setNoResultsAction(NRAction);
	bool systrayIcon() const;
	void setSystrayIcon(bool);
	bool hideNotification() const;
	int notificationTimeout() const;

	// display settings
	TQString displayName() const;
	TQStringList displayNames() const;
	TQStringList displayIds() const;
	int displayNumber() const;
	KatapultDisplay * display() const;
	void setDisplayName(TQString name);
	
	// catalog settings
	TQStringList catalogNames() const;
	TQStringList catalogIds() const;
	TQStringList activeCatalogNames() const;
	TQStringList inactiveCatalogNames() const;
	TQDict<KatapultCatalog> activeCatalogs() const;
	void activateCatalog(TQString catalogName);
	void deactivateCatalog(TQString catalogName);
	KatapultCatalog * catalog(TQString catalogName) const;

public slots:	
	void readSettings();
	void writeSettings();
	void configure();
	
signals:
	void systrayChanged();
	void displayChanged();
	void catalogsChanged();
	
private:
	void loadCatalogPlugins();
	void loadDisplayPlugins();

	bool _isConfiguring;
	bool _forceWrite;

	// general settings
	int _hideSessionNotification; // Hide Katapult Notification? (session restore / manual start)
	int _hideUserNotification;    // if 0: show always, if 1: show once, else: show never
	int _notificationTimeout;     // Delay before notification hides.
	bool _autoExec;
	int _hideDelay;
	int _noResultsDelay;
	NRAction _noResultsAction;
	bool _systrayIcon;

	// display settings
	TQString _displayName;
	TQStringList _displayNames;
	TQStringList _displayIds;
	KatapultDisplay *_display;
	
	// catalog settings
	TQStringList _catalogNames, _catalogIds, _activeCatalogNames;
	TQDict<KatapultCatalog> _activeCatalogs;
};

#endif
