/* Marcion
Copyright (C) 2009 - 2011 Milan Konvicka
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; version 2 of the License.
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 */
#ifndef LATCOPT_H
#define LATCOPT_H
//
#include <QWidget>
#include <QMenu>
#include <QClipboard>
#include <QCompleter>
#include <QMessageBox>
#include <QWidgetAction>
#include <QKeyEvent>
#include "settings.h"
#include "ui_latcopt.h"
#include "ctranslit.h"
#include "marckeyb.h"
#include "regexpbuilder.h"
//
class CLatCopt : public QWidget, protected Ui::frmLatCopt
{
Q_OBJECT
public:
enum InputType{Latin,Unicode};
/*CLatCopt(CTranslit::Script script,
QFont const & font,
bool tr_is_visible=true,
CTranslit::Tr tr=CTranslit::CopticDictC,
bool rmnw=false,
bool strip=false,
bool rm_spc=false,
QWidget * parent = 0, Qt::WFlags f = 0);*/
CLatCopt( QWidget * parent = 0, Qt::WFlags f = 0 );
~CLatCopt();
QString text() const;
QString text_utf8() const
{return lblCoptic->text();}
//QString specText() const;
void setText(QString const &);
void setScript(CTranslit::Script,bool cmb=true);
//QFont font() const;
//void setLFont(QFont const &);
void refreshFonts();
void setSwitch(bool visible);
void setSwitchState(bool state);
bool rmNonWordChars() const;
void setRmNonWordChars(bool);
CTranslit::Tr Tr() const;
void setTr(CTranslit::Tr tr);
bool strip() const;
void setStrip(bool strip);
bool rmSpc() const;
void setRmSpc(bool rm_spc);
void setVAsPreferred();
void allowChangeScript();
CTranslit::Script getScript() const{return script;}
QString updateL(bool,bool);
void updateHistory();
void showKeyboard(bool);
void showRegExp(bool);
void copyText() const;
private slots:
void on_cmbChooseScript_currentIndexChanged(int index);
void on_tbReg_clicked();
void on_tbKeyb_clicked();
void on_cbTranslit_toggled(bool checked);
//void on_cmbLatin_activated(QString );
void on_cmbLatin_editTextChanged(QString );
void on_lblCoptic_customContextMenuRequested(QPoint pos);
void slot_keyb_aboutToShow();
void slot_keyb_aboutToHide();
void slot_reg_aboutToShow();
void slot_reg_aboutToHide();
private:
CTranslit::Script script;
CTranslit::Tr _tr;
QMenu popup,keyb,reg,scrmnu;
QAction * copy,*clear,*rm_nw,*upd,*upd_st,*clr_hist,*scr_l,*scr_g,*scr_c,*scr_h;
bool rmnw,_strip,_rm_spc;
QWidgetAction wkeyb,wreg;
//QFont orig_lfont;
//QFont _font;
CMarcKeyb * mk;
MRegExpBuilder * rb;
protected:
void keyPressEvent ( QKeyEvent * event );
signals:
void query();
void textChanged(QString const &);
};
#endif