summaryrefslogtreecommitdiffstats
path: root/scribus/plugins/short-words/configuration.h
blob: 40e40e99bf94bd56dc5ea00c943b360337c4374a (plain)
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
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
#ifndef _SCRIBUS_SHORTCFG_H_
#define _SCRIBUS_SHORTCFG_H_

#include <QObject>

class QString;
class QStringList;
class PrefsContext;

/*! \brief This is the Scribus Short Words configuratin specification.
Methods of this class read config files and PrefsManager context informations.
Preferences GUI is in SWPrefsGui.

This code is based on the Scribus-Vlna plug in rewritten for
international use.

\author Petr Vanek <petr@yarpen.cz> with contributors.
*/
class SWConfig : public QObject
{
	Q_OBJECT

public:
	/*! \brief Reads config from the ui cfg file */
	SWConfig();
	/*! \brief Writes config into the ui cfg file */
	~SWConfig(){};

	/*! \brief Id of the UI radiobutton  */
	uint action;
	//*! \brief UI checkbox */
	//uint userConfig;
	bool useStyle;
	int currentLanguage;

	/*! \brief Returns all options for specified language.
	\param lang language of the ext frame */
	QStringList getShortWords(QString lang);
	/*! \brief available configs for UI about.
	\retval QString with languages in the configuration. */
	static QString getAvailableLanguages();
	static QStringList getAvailableLanguagesList();
	/*! \brief get lang code (en, cs, pl) from Scribus hyphenator configuration structure.
	\param hyphenCode code of the language.
	\retval QString full named language. */
	static QString getLangCodeFromHyph(QString hyphenCode);
	/*! \brief Save cfg. */
	void saveConfig();

private:
	/*! \brief Configuration structure */
	PrefsContext* prefs;
	/*! \brief getShortWords use this one. for each case from GUI select the right config file (or both).
	\param lang language
	\param filename configuration file.
	\retval QStringList parsed SW. Each SW in one string item. */
	QStringList getShortWordsFromFile(QString lang, QString filename);
	/*! \brief getAvailableLanguages use this one. available config in the specified file for UI about
	\param filename config file
	\retval QString all supported languages in one string */
	static QStringList getAvailableLanguagesFromFile(QString filename);
	/*! \brief returns full lang name by lang code (en -> English)
	\param code language code
	\retval QString full named language */
	static QString getLangFromCode(QString code);
};

#endif