[go: up one dir, main page]

Menu

[r604]: / textbrowserext.cpp  Maximize  Restore  History

Download this file

121 lines (100 with data), 3.3 kB

  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
/* Marcion
Copyright (C) 2009-2013 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; 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. */
#include "textbrowserext.h"
CTextBrowserExt::CTextBrowserExt(QWidget *parent)
:CBookTextBrowser(parent),
preview(0),
lsj_preview(0),
copnum_preview(0)
{
}
CTextBrowserExt::~CTextBrowserExt()
{
if(preview)
delete preview;
if(lsj_preview)
delete lsj_preview;
if(copnum_preview)
delete copnum_preview;
}
//
MDocHeader * CTextBrowserExt::header()
{
return ui->wdgDictHeader;
}
void CTextBrowserExt::find_greek_word(QString const & word)
{
QString w(word);
CTranslit::Script const lang=CTranslit::identify(w);
switch(lang)
{
case CTranslit::Copt :
w=CTranslit::tr(w,CTranslit::CopticNToGreekTr,true,CTranslit::RemoveAll);
break;
case CTranslit::Greek :
w=CTranslit::tr(w,CTranslit::GreekNToGreekTr,true,CTranslit::RemoveAll);
break;
case CTranslit::Latin :
w=CTranslit::tr(w,CTranslit::LatinNToLatinTr,true,CTranslit::RemoveAll);
break;
}
bool const greek=!(lang==CTranslit::Latin);
gkDict()->prepareParse(w,greek);
lsj_preview->parse(greek);
ui->wdgDictHeader->setDocMode(MDocHeader::GkDict);
}
void CTextBrowserExt::find_word(QString const & word)
{
copDict()->queryCoptic(CTranslit::tr(word,CTranslit::CopticNToCopticTr,true,CTranslit::RemoveAll));
ui->wdgDictHeader->setDocMode(MDocHeader::CopDict);
}
void CTextBrowserExt::convert_number(QString const & number)
{
copNum()->convertNumber(number);
ui->wdgDictHeader->setDocMode(MDocHeader::NumConv);
}
void CTextBrowserExt::init(QString const & title,
Script script,
bool change_font
)
{
CBookTextBrowser::init(title, script,change_font);
}
CWordPreview * CTextBrowserExt::copDict()
{
if(!preview)
{
preview=new CWordPreview(m_msg());
ui->wdgDictHeader->initPage(MDocHeader::CopDict,ui->stwContent->addWidget(preview));
}
return preview;
}
CLSJ * CTextBrowserExt::gkDict()
{
if(!lsj_preview)
{
lsj_preview=new CLSJ(m_msg());
ui->wdgDictHeader->initPage(MDocHeader::GkDict,ui->stwContent->addWidget(lsj_preview));
}
return lsj_preview;
}
MCopticNumerals * CTextBrowserExt::copNum()
{
if(!copnum_preview)
{
copnum_preview=new MCopticNumerals(0,true);
ui->wdgDictHeader->initPage(MDocHeader::NumConv,ui->stwContent->addWidget(copnum_preview));
}
return copnum_preview;
}