[go: up one dir, main page]

Menu

[r734]: / lsj.h  Maximize  Restore  History

Download this file

157 lines (125 with data), 4.4 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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
/* Marcion
Copyright (C) 2009-2016 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. */
#ifndef LSJ_H
#define LSJ_H
//#include <QSqlQuery>
//#include <QSqlError>
#include "ctranslit.h"
#include "messages.h"
#include "settings.h"
#include "cmysql.h"
#include "mwindowswidget.h"
#include "regexpbuilder.h"
class MDictTag
{
public:
class MDictAttr{public: QString _key,_value;};
MDictTag(QString const & name,QString const & source);
~MDictTag(){}
QString begin() const {return _begin;}
QString end() const {return _end;}
QString body() const {return _body;}
QString content() const {return _content;}
QString value(QString const & key);
bool hasKeyValue(QString const & key,QString const & value) const;
bool isEmpty() const {return _empty;}
static void updateTag(QString & source,QString const & tag,QString const & replace_by=QString());
static void removeETag(QString & source,QString const & tag);
private:
QString _name,_body,_begin,_end,_content;
QList<MDictAttr> _attr;
bool _empty;
};
typedef QPair<char,QString> WDictItem;
typedef QList<WDictItem> WDict;
class CLSJPiece{
public:
CLSJPiece();
CLSJPiece(bool,QString const &);
bool is_greek;
QString text;
};
class CLSJStore{
public:
CLSJStore();
void appendItem(bool,QString const &);
void clear();
QList<CLSJPiece> items;
int count;
};
struct s_parses
{
int id;
QString m_code,word;
};
namespace Ui {
class CLSJ;
}
class CLSJ : public QWidget {
Q_OBJECT
Q_DISABLE_COPY(CLSJ)
public:
enum SearchMode{Exact,RegExp};
explicit CLSJ(CMessages * const messages,
QWidget *parent = 0);
~CLSJ();
void prepareParse(QString const & str,bool greek);
void directSearch(QString const & str);
void parse(bool greek);
static QString prepareSense(QString const & source,bool greek);
static QString prepareSenseItem(QString const & source);
static void init();
private:
Ui::CLSJ *ui;
CMessages * const messages;
static unsigned int count;
QString _fulltextQuery;
static QString perseusToUtf8(
QString const & latin,bool greek);
static QString utf8ToPerseus(
QString const & utf8,bool greek);
void dictionary(QString const & str, SearchMode mode,bool greek);
/*static QString enclosedBy(QString const & begin,
QString const & end,
QString const & text,
bool outer,
int * from);*/
SearchMode searchMode() const;
QString limit() const;
static WDict wclass,wpers,wnum,wtens,wmode,wvoice,wgender,wcase,wadjform;
static QList<WDict*> mclist;
static QString gwcount,lwcount;
QString morphCode(QString const &) const;
CLSJStore _store;
void displayStore();
private slots:
void on_brOutput_dictionaryRequested(int dict,QString const & word);
void on_txtInput_query();
/*void on_brOutput_highlightActivated(bool*);
void on_brOutput_highlightDeactivated(bool*);*/
void on_brOutput_contentChanged(bool, bool, bool*);
void on_rbGreek_toggled(bool checked);
void on_rbLatin_toggled(bool checked);
void slot_AnchorClicked(QUrl );
void slot_txtInput_textChanged(QString const & text);
void settings_fontChanged(CTranslit::Script, QFont);
void on_cmbResults_activated(int index);
void on_btTabDict_clicked();
void on_btTabInfl_clicked();
void on_twInput_currentChanged(int index);
void on_btFulltextSearch_clicked();
void on_tbRegExpFt_clicked();
void on_cmbFulltext_editTextChanged(const QString &arg1);
};
#endif // LSJ_H