/***************************************************************************
 *                                                                         *
 *   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.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef KDEVMONCONFIG_H
#define KDEVMONCONFIG_H

#include "resources.h"

#include <qcolor.h>
#include <qstring.h>
#include <qrect.h>
#include <kconfig.h>

struct CommonConfig {
	QColor
		colorIn,
		colorOut;
	int refreshTime;
	Common::Unit unit;
	int smoothFactor;
	
	// not in prefs dialog
	QString configFile;
};

struct GraphConfig {
	Common::ScalingMode scalingMode;
	Common::GraphPosition graphPosition;
	Common::GraphStyle graphStyle;
	long scaling;
	QString device;
	bool showGrid;
};

struct MainFrameConfig {
	QColor
		bgColor,
		gridColor;
	bool showTooltips;
	bool showStatsBar;
	bool showDecorations;
	bool transparent;
	
	// not in prefs dialog
	QRect geometry;
	bool isVisible;
};

struct DockFrameConfig {
	QColor
	bgColor,
	gridColor;
	bool showText;
	int TextSize;
	
	// not in prefs dialog
	bool isVisible;
};

//struct PopupFrameConfig {
//	QColor
//	    fgColor,
//	    bgColor;
//	
//	// not in prefs dialog
//	QPoint position;
//};
//
struct StatsFrameConfig
{
	QColor bgColor;

	// not in prefs dialog
	QPoint position;
};

class KdevmonConfig {
public:
	static KdevmonConfig *m_config;
	static KdevmonConfig *getConfig();
	KConfig* config; //< configuration data
	
	KdevmonConfig();
	
	void readSettings();
	void writeSettings();
	
	struct CommonConfig *getCommonConfig();
	struct GraphConfig *getGraphConfig();
	struct MainFrameConfig *getMainFrameConfig();
	struct DockFrameConfig *getDockFrameConfig();
// 	struct PopupFrameConfig *getPopupFrameConfig();
	struct StatsFrameConfig *getStatsFrameConfig();
private:
	struct CommonConfig *commonConfig;
	struct GraphConfig *graphConfig;
	struct MainFrameConfig *mainFrameConfig;
	struct DockFrameConfig *dockFrameConfig;
// 	struct PopupFrameConfig *popupFrameConfig;
	struct StatsFrameConfig *statsFrameConfig;
	bool m_bIsInitialized;
	
	QString readNameOfConfigFile();
	void writeNameOfConfigFile( const QString& name );
};

#endif

