summaryrefslogtreecommitdiffstats
path: root/katapult/katapult/katapultsettings.h
blob: 079ea2b3c4f90e6f7e4c83f854a585943294fda7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
/***************************************************************************
 *   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 <qobject.h>
#include <qptrlist.h>
#include <qdict.h>

class KatapultCatalog;
class KatapultDisplay;
class QStringList;
class QString;

/**
@author Joe Ferris
*/
class KatapultSettings : public QObject
{
	Q_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
	QString displayName() const;
	QStringList displayNames() const;
	QStringList displayIds() const;
	int displayNumber() const;
	KatapultDisplay * display() const;
	void setDisplayName(QString name);
	
	// catalog settings
	QStringList catalogNames() const;
	QStringList catalogIds() const;
	QStringList activeCatalogNames() const;
	QStringList inactiveCatalogNames() const;
	QDict<KatapultCatalog> activeCatalogs() const;
	void activateCatalog(QString catalogName);
	void deactivateCatalog(QString catalogName);
	KatapultCatalog * catalog(QString 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
	QString _displayName;
	QStringList _displayNames;
	QStringList _displayIds;
	KatapultDisplay *_display;
	
	// catalog settings
	QStringList _catalogNames, _catalogIds, _activeCatalogNames;
	QDict<KatapultCatalog> _activeCatalogs;
};

#endif