]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/qt_helpers.h
some tabular fixes for the problems reported by Helge
[lyx.git] / src / frontends / qt2 / 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
19 class LengthCombo;
20 class QComboBox;
21 class QLineEdit;
22 class QString;
23
24 std::string makeFontName(std::string const & family, std::string const & foundry);
25
26 std::pair<std::string,std::string> parseFontName(std::string const & name);
27
28 /// method to get a LyXLength from widgets (LengthCombo)
29 std::string widgetsToLength(QLineEdit const * input, LengthCombo const * combo);
30 /// method to get a LyXLength from widgets (QComboBox)
31 LyXLength widgetsToLength(QLineEdit const * input, QComboBox const * combo);
32
33 /// method to set widgets from a LyXLength
34 void lengthToWidgets(QLineEdit * input, LengthCombo * combo,
35         std::string const & len, LyXLength::UNIT default_unit);
36
37 /// format a string to the given width
38 std::string const formatted(std::string const & text, int w = 80);
39
40 /**
41  * toqstr - convert char * into unicode
42  *
43  * Use this whenever there's a user-visible string that is encoded
44  * for the locale (menus, dialogs etc.)
45  */
46 QString const toqstr(char const * str);
47
48
49 /**
50  * toqstr - convert string into unicode
51  *
52  * Use this whenever there's a user-visible string that is encoded
53  * for the locale (menus, dialogs etc.)
54  */
55 QString const toqstr(std::string const & str);
56
57
58 /**
59  * qt_ - i18nize string and convert to unicode
60  *
61  * Use this in qt2/ instead of qt_()
62  */
63 QString const qt_(char const * str);
64
65
66 /**
67  * qt_ - i18nize string and convert to unicode
68  *
69  * Use this in qt2/ instead of qt_()
70  */
71 QString const qt_(std::string const & str);
72
73
74 /**
75  * fromqstr - convert QString into std::string in locale
76  *
77  * Return the QString encoded in the locale
78  */
79 std::string const fromqstr(QString const & str);
80
81 #endif // QTHELPERS_H