/***************************************************************************
                          html_widget.h  -  description
                             -------------------
    begin                : December 2007
    copyright            : (c) 2007 by Iven Wold - 526f6c616e642053756368616e
    email                : hour.glass2@yahoo.com
    license              : GPL v 2.0
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This file is part of QTrans.                                          *
 *                                                                         *
 *   QTrans 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; version 2 of the License.               *
 *                                                                         *
 *   QTrans 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 QTrans. If not, see <http://www.gnu.org/licenses/> or      *
 *   write to the Free Software Foundation, Inc.,                          *
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.         *
 *                                                                         *
 ***************************************************************************/

#ifndef HTML_WIDGET_H
#define HTML_WIDGET_H

//#include <khtml_part.h>
//#include <KMenu>      //o
#include <QMenu>        //x
//#include <KAction>    //o
#include <QAction>      //x
#include <QMessageBox>

//#include <QWebView>		//ooo
//#include <QtWebKitWidgets/QWebView> //x
//#include <QtWebEngineWidgets/QtWebEngineWidgets>    //xx
#include <QWebEngineView>   //xx
#include <QContextMenuEvent>	//ooo
#include <KMessageBox>		//ooo
#include <QVBoxLayout>		//ooo
#include <QHBoxLayout>		//ooo
#include <QLineEdit>		//ooo
#include <QLabel>		//ooo
#include <QPushButton>		//ooo
#include <QAction>		//ooo
#include <QMenu>		//ooo
#include <QList>		//ooo
#include <QAction>		//ooo
//#include <KStandardDirs>	//ooo
#include <QStandardPaths>   //x
#include <QCheckBox>		//ooo
//#include <QWebPage>		//ooo
//#include <QtWebKitWidgets/QWebPage>		//x
#include <QWebEnginePage>   //xx

//#include "qtrans.h"		//ooo
#include "settings_widg.h"	//ooo

//class QTrans;

//class Html_Widget : public KHTMLPart  {
//class Html_Widget : public QWebView		//ooo
class Html_Widget : public QWebEngineView		//xx
{
	Q_OBJECT
public:
	//Html_Widget(QWidget *parentWidget=0, const char *widgetname=0,QObject *parent=0,
	//					const char *name=0,GUIProfile prof=DefaultGUI);
	//Html_Widget(QWidget *parentWidget=0, QObject *parent=0, GUIProfile prof=DefaultGUI);

	//Html_Widget(QWidget *parent = 0);	//ooo
	//Html_Widget(QWidget *parent = 0, bool *compactMode = 0);					//ooo
	Html_Widget(QWidget *parent = 0, bool *saveTranslation = 0, bool *compactMode = 0, bool *stayOnTop = 0, bool *enableAlternates = 0, bool *wordStartsWith = 0, bool *wholeWordsOnly = 0, bool *wholeStarDict = 0, QList<Dictionary> *bab_dict = 0, bool *enabled = 0);	//ooo
	~Html_Widget();

	QWidget *Par;				//ooo

	void clear();
	void setOut(QString);
	//void setFont(QString,int,QString);
	void setFont(QString,int,QFont::Style,int,QString);	//ooo
	void buildMenu();
	QString bgColor, txtColor;
	QString expressionTxtColor;		//ooo
	QString sentencePartTxtColor;		//ooo
	//KPopupMenu *popMenu;   		//ooo_

	QMenu *languageMenu_;			//ooo
	//KMenu *popMenu;   			//ooo
	QMenu *popMenu;   			//x
	QActionGroup *languageGroup_;		//ooo
	QList<Dictionary> *bab_dict_;		//ooo
	QList<QAction*> actionsList_;		//ooo
	QAction *saveOutputAct_;		//ooo
	QAction *findAct;			//ooo
	//QMenu *menu;				//ooo

	QAction *normalModeAct_;		//ooo
	QAction *compactModeAct_;		//ooo
	QAction *stayOnTopAct_;			//ooo
	QAction *alternatesAct_;		//ooo
	QAction *wordStartsWithAct_;		//ooo
	QAction *wholeWordsOnlyAct_;		//ooo
	QAction *lookUpInWholeStarDictAct_;	//ooo
	QAction *searchAllAct_;			//ooo
	QAction *searchEveryDictAct_;		//ooo
	QAction *enableAct_;			//ooo
	QAction *disableAct_;			//ooo
	bool *compactMode_;			//ooo
	bool *stayOnTop_;			//ooo
	bool *enableAlternates_;		//ooo
	bool *wordStartsWith_;			//ooo
	bool *wholeWordsOnly_;			//ooo
	bool *wholeStarDict_;			//ooo
	bool *enabled_;				//ooo
	bool *saveTranslation_;			//ooo

public slots:
	//void slot_chooseLibrary(QAction *action);			//ooo
	void slot_changeModeSelected();					//ooo
	void slot_languageFromLanguagemenuSelected(QAction *);		//ooo
	void slot_stayOnTopSelected();
	//void slot_PopupMenu(const QString& , const QPoint &);
	void slot_PopupMenu(QAction *);
	void slot_findMenu();
	void slot_saveTranslation();					//ooo
	void slot_OnTop();						//ooo
	void slot_Alternates();						//ooo
	void slot_WordStartsWith();					//ooo
	void slot_WholeWordsOnly();					//ooo
	void slot_LookUpInWholeDictionary();				//ooo
	void slot_searchInAllDictionaries();				//ooo
	void slot_searchInEveryDictionary();				//ooo
	void slot_Enable();						//ooo

signals:
	void saveTranslationSelected();					//ooo
	void changeModeSelected();					//ooo
	//void languageFromLanguagemenuSelected(QAction *);		//ooo
	void languageFromLanguagemenuSelected_(int);			//ooo
	void stayOnTopSelected();					//ooo
	void alternatesSelected();					//ooo
	void wordStartsWithSelected();					//ooo
	void wholeWordsOnlySelected();					//ooo
	void lookUpInWholeDictionarySelected();				//ooo
	void searchInAllDictionariesSelected();				//ooo
	void searchInEveryDictionarySelected();				//ooo
	void enabledSelected();						//ooo

private:
	QString fontName,Charset;
	QString fontStyle;		//ooo
	QString fontWeight;		//ooo
	int Size;
	int Size_less1;			//ooo
	int Size_less2;			//ooo
	//QWidget *Par;
        //webPage *m_page;

protected:
	void contextMenuEvent(QContextMenuEvent *event);	//ooo
	//void mousePressEvent(QMouseEvent *event);	//ooo

};


class FindWidget : public QWidget
{
	 Q_OBJECT
public:
	FindWidget(Html_Widget *parent=0);
	~FindWidget();

	Html_Widget *Par2;

	QVBoxLayout *mainLayout;
	QHBoxLayout *Box1;
	QLabel *Label1;
	QLineEdit *wordName;

	QHBoxLayout *Box4;

	QCheckBox *checkBox1;
	QCheckBox *checkBox2;
	QCheckBox *checkBox3;

	QPushButton *bOk;
	QPushButton *bCancel;

public slots:
	void slot_Close();
	void slot_Ok();
};

#endif
