]> git.lyx.org Git - features.git/blob - src/frontends/qt3/qt_helpers.h
Fix clipboard/selection encoding
[features.git] / src / frontends / qt3 / qt_helpers.h
1 // -*- C++ -*-
2 /**
3  * \file qt_helpers.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Dekel Tsur
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef QTHELPERS_H
13 #define QTHELPERS_H
14
15 #include <utility>
16
17 #include "lyxlength.h"
18 #include "support/docstring.h"
19
20 class LengthCombo;
21 class QComboBox;
22 class QLineEdit;
23 class QString;
24
25 std::string makeFontName(std::string const & family, std::string const & foundry);
26
27 std::pair<std::string,std::string> parseFontName(std::string const & name);
28
29 /// method to get a LyXLength from widgets (LengthCombo)
30 std::string widgetsToLength(QLineEdit const * input, LengthCombo const * combo);
31 /// method to get a LyXLength from widgets (QComboBox)
32 LyXLength widgetsToLength(QLineEdit const * input, QComboBox const * combo);
33
34 /// method to set widgets from a LyXLength
35 void lengthToWidgets(QLineEdit * input, LengthCombo * combo,
36         std::string const & len, LyXLength::UNIT default_unit);
37
38 /// format a string to the given width
39 std::string const formatted(std::string const & text, int w = 80);
40
41 /**
42  * toqstr - convert char * into unicode
43  *
44  * Use this whenever there's a user-visible string that is encoded
45  * for the locale (menus, dialogs etc.)
46  */
47 QString const toqstr(char const * str);
48
49
50 /**
51  * toqstr - convert string into unicode
52  *
53  * Use this whenever there's a user-visible string that is encoded
54  * for the locale (menus, dialogs etc.)
55  */
56 QString const toqstr(std::string const & str);
57
58
59 /**
60  * toqstr - convert UCS4 encoded docstring to QString
61  */
62 QString const toqstr(lyx::docstring const & str);
63
64
65 /**
66  * qt_ - i18nize string and convert to unicode
67  *
68  * Use this in qt3/ instead of qt_()
69  */
70 QString const qt_(char const * str);
71
72
73 /**
74  * qt_ - i18nize string and convert to unicode
75  *
76  * Use this in qt3/ instead of qt_()
77  */
78 QString const qt_(std::string const & str);
79
80
81 /**
82  * fromqstr - convert QString into std::string in locale
83  *
84  * Return the QString encoded in the locale
85  */
86 std::string const fromqstr(QString const & str);
87
88
89 /**
90  * qstring_to_ucs4 - convert QString to UCS4 encoded docstring
91  */
92 lyx::docstring const qstring_to_ucs4(QString const & str);
93
94 #endif // QTHELPERS_H