[KLF Application]
[KLF Tools]
[KLF Backend]
[KLF Home]
KLatexFormula Project
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
src
klfmain.h
Go to the documentation of this file.
1
/***************************************************************************
2
* file klfmain.h
3
* This file is part of the KLatexFormula Project.
4
* Copyright (C) 2011 by Philippe Faist
5
* philippe.faist at bluewin.ch
6
* *
7
* This program is free software; you can redistribute it and/or modify *
8
* it under the terms of the GNU General Public License as published by *
9
* the Free Software Foundation; either version 2 of the License, or *
10
* (at your option) any later version. *
11
* *
12
* This program is distributed in the hope that it will be useful, *
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15
* GNU General Public License for more details. *
16
* *
17
* You should have received a copy of the GNU General Public License *
18
* along with this program; if not, write to the *
19
* Free Software Foundation, Inc., *
20
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
21
***************************************************************************/
22
/* $Id: klfmain.h 603 2011-02-26 23:14:55Z phfaist $ */
23
24
#ifndef KLFMAIN_H
25
#define KLFMAIN_H
26
27
#include <QCoreApplication>
28
#include <QString>
29
#include <QList>
30
#include <QMap>
31
#include <QStringList>
32
#include <QDataStream>
33
#include <QTranslator>
34
#include <QDir>
35
36
#include <
klfdefs.h
>
37
38
39
40
41
// SOME DEFINITIONS
42
43
#if defined(Q_WS_WIN)
44
#define KLF_DLL_EXT_LIST (QStringList()<<"*.dll")
45
#elif defined(Q_WS_MAC)
46
#define KLF_DLL_EXT_LIST (QStringList()<<"*.so"<<"*.dylib")
47
#else
48
#define KLF_DLL_EXT_LIST (QStringList()<<"*.so")
49
#endif
50
51
52
53
// SOME DECLARATIONS FOR ADD-ONS
54
55
class
KLF_EXPORT
KLFAddOnInfo
56
{
57
public
:
60
KLFAddOnInfo
(
QString
rccfpath,
bool
isFresh =
false
);
61
63
KLFAddOnInfo
(
const
KLFAddOnInfo
& o);
64
65
struct
KLF_EXPORT
PluginSysInfo
{
67
QString
dir
;
70
QString
qtminversion
;
73
QString
klfminversion
;
75
QString
os
;
77
QString
arch
;
78
79
bool
isCompatibleWithCurrentSystem()
const
;
80
};
81
82
~
KLFAddOnInfo
();
83
85
QString
dir
() {
return
d->dir; }
87
QString
fname
() {
return
d->fname; };
89
QString
fpath
() {
return
d->fpath; }
91
bool
islocal
() {
return
d->islocal; }
92
94
QString
title
() {
return
d->title; }
96
QString
author
() {
return
d->author; }
98
QString
description
() {
return
d->description; }
100
QString
klfminversion
() {
return
d->klfminversion; }
101
103
QString
rccmountroot
() {
return
d->rccmountroot; }
104
113
QStringList
pluginList
()
const
{
return
d->pluginList; }
114
115
PluginSysInfo
pluginSysInfo
(
const
QString
& plugin)
const
{
return
d->plugins[plugin]; }
116
117
QString
pluginLocalSubDirName(
const
QString
& plugin)
const
118
{
119
if
( ! d->plugins[plugin].klfminversion.isEmpty() )
120
return
QString
(
"klf%1"
).
arg
(d->plugins[plugin].klfminversion);
121
return
QString
(
"."
);
122
}
123
130
QStringList
localPluginList()
const
;
131
132
135
QStringList
translations
() {
return
d->translations; }
136
140
bool
isfresh
() {
return
d->isfresh; }
141
142
private
:
143
145
struct
Private {
146
int
ref;
// number of times this data structure is referenced
147
148
QString
dir;
149
QString
fname;
150
QString
fpath;
151
bool
islocal;
152
153
QString
title;
154
QString
author;
155
QString
description;
156
QString
klfminversion;
157
158
QString
rccmountroot;
159
160
QStringList
pluginList;
161
QMap<QString,PluginSysInfo>
plugins;
162
163
QStringList
translations;
164
165
bool
isfresh;
166
};
167
168
Private *d;
169
170
void
initPlugins();
171
};
172
173
KLF_EXPORT
extern
QList<KLFAddOnInfo>
klf_addons
;
174
KLF_EXPORT
extern
bool
klf_addons_canimport
;
175
176
KLF_EXPORT QDebug&
operator<<
(QDebug& str,
const
KLFAddOnInfo::PluginSysInfo
& i);
177
178
179
180
// SOME DEFINITIONS FOR PLUGINS
181
182
class
KLFPluginGenericInterface
;
183
184
struct
KLFPluginInfo
185
{
186
QString
name
;
187
QString
author
;
188
QString
title
;
189
QString
description
;
190
191
QString
fpath
;
192
QString
fname
;
193
194
KLFPluginGenericInterface
*
instance
;
195
};
196
197
198
KLF_EXPORT
extern
QList<KLFPluginInfo>
klf_plugins
;
199
200
201
202
203
204
212
struct
KLF_EXPORT
KLFTranslationInfo
213
{
214
KLFTranslationInfo
() : hasnicetranslatedname(false) { }
215
216
QString
localename
;
217
QString
translatedname
;
221
bool
hasnicetranslatedname
;
222
};
223
225
KLF_EXPORT
extern
QList<KLFTranslationInfo>
klf_avail_translations
;
226
228
KLF_EXPORT
extern
QList<QTranslator*>
klf_translators
;
229
230
239
class
KLF_EXPORT
KLFI18nFile
240
{
241
public
:
242
QString
fpath
;
244
QString
name
;
246
QString
locale
;
248
int
locale_specificity
;
249
251
KLFI18nFile
(
QString
filepath);
252
};
253
254
255
256
KLF_EXPORT
void
klf_add_avail_translation
(
KLFI18nFile
i18nfile);
257
258
260
KLF_EXPORT
void
klf_reload_translations
(
QCoreApplication
*app,
const
QString
& currentlocale);
261
262
263
264
// eg. baseFileName="cmdl-help" extension=".txt" will look for
265
// "cmdl-help_fr_CH.txt", "cmdl-help_fr.txt", "cmdl-help.txt" assuming current locale is "fr_CH"
266
KLF_EXPORT
QString
klfFindTranslatedDataFile
(
const
QString
& baseFileName,
const
QString
& extension);
267
268
269
270
280
#define KLF_DATA_STREAM_APP_VERSION "3.2"
281
// --- don't forget to update below too! ---
282
284
#define KLF_DATA_STREAM_APP_VERSION_MAJ 3
285
286
#define KLF_DATA_STREAM_APP_VERSION_MIN 2
287
288
293
inline
QString
klfDataStreamAppVersion
(
const
QDataStream
& d)
294
{
return
d.
device
()->property(
"klfDataStreamAppVersion"
).toString(); }
295
296
304
KLF_EXPORT
void
klfDataStreamWriteHeader
(
QDataStream
& stream,
const
QString
headermagic);
305
308
KLF_EXPORT
bool
klfDataStreamReadHeader
(
QDataStream
& stream,
const
QStringList
possibleHeaders,
309
QString
* readHeader = NULL,
QString
* readCompatKLFVersion = NULL) ;
310
311
312
313
#endif
Generated by
doxygen
1.8.2