/*
 *  Copyright (C) 2007-2008 CMM Sigma Andrzej Chmielowiec <cmmsigma@cmmsigma.eu>
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License version 3
 *  as published by the Free Software Foundation.
 *
 *  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.
 */

#ifndef MAIN_WINDOW_H
#define MAIN_WINDOW_H

#include <QtGui>

#include "TreeModel.h"
#include "STokenItem.h"
#include "AdminOptions.h"
#include "AboutBox.h"

class MainWindow: public QMainWindow
{
	Q_OBJECT;
	
public:
	MainWindow(QMainWindow *parent = 0);
	AdminOptions *getConfig();
	void sendRequest(const QString &fileName, const QString &mail);
	static MainWindow *mainWnd;
	
public slots:
	void setActivePage(QWidget *page);
	void deletePage(QWidget *page);
	
private slots:
	void settings();
	void incFontSize();
	void decFontSize();
	void showPop();
	void helpSlot();
	void aboutSlot();
	void refresh();
	void langEnSlot();
	void langPlSlot();
	
private:
	bool readXmlConfig();
	bool writeXmlConfig();
	void langExclamation();
	
	void createActions();
	void createMenus();
	void createToolBars();
	void createAboutBox();
	
	QString mFontName;
	int mFontSize;
	
	TreeModel *mModel;
	AdminOptions config;
	
	QSplitter *mSplitter;
	QTreeView *mView;
	QWidget *mMainPage;
	QStackedWidget *mPages;
	QString mConfDirPath;
	QString mXmlConfFileName;
	
	QMenu *mGeneralMenu;
	QMenu *mViewMenu;
	QMenu *mHelpMenu;
	QToolBar *mGeneralToolBar;
	QToolBar *mViewToolBar;
	QToolBar *mHelpToolBar;
	QAction *mExitAct;
	QAction *mSettingsAct;
	QAction *mRefreshAct;
	QAction *mIncFontSizeAct;
	QAction *mDecFontSizeAct;
	QAction *mHelpAct;
	QAction *mAboutAct;
	QActionGroup *mLang;
	QAction *mLangEn;
	QAction *mLangPl;
	
	AboutBox *mAboutBox;
	
};

#endif
