4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
10 * Full author contact details are available in file CREDITS.
17 #include "support/qstring_helpers.h"
27 template <class T> class QList;
33 namespace support { class FileName; }
37 LyXErr & operator<<(LyXErr &, QString const &);
41 /// method to get a Length from widgets (LengthCombo)
42 std::string widgetsToLength(QLineEdit const * input, LengthCombo const * combo);
43 /// method to get a Length from widgets (QComboBox)
44 Length widgetsToLength(QLineEdit const * input, QComboBox const * combo);
46 //FIXME It would be nice if defaultUnit were a default argument
47 /// method to set widgets from a Length
48 void lengthToWidgets(QLineEdit * input, LengthCombo * combo,
49 Length const & len, Length::UNIT default_unit);
50 /// method to set widgets from a string
51 void lengthToWidgets(QLineEdit * input, LengthCombo * combo,
52 std::string const & len, Length::UNIT default_unit);
53 /// method to set widgets from a Length with optional "auto" if zero
54 void lengthAutoToWidgets(QLineEdit * input, LengthCombo * combo,
55 Length const & len, Length::UNIT defaultUnit);
57 /// colors a widget red if invalid
58 void setValid(QWidget * widget, bool valid);
60 } // namespace frontend
64 * qt_ - i18nize string and convert to QString
66 * Use this in qt4/ instead of _()
68 QString const qt_(std::string const & str);
71 typedef std::pair<QString, QString> LanguagePair;
74 QList<LanguagePair> languageData();
76 support::FileName libFileSearch(QString const & dir, QString const & name,
77 QString const & ext = QString());
79 /** Wrapper around browseFile which tries to provide a filename
80 relative to relpath. If the relative path is of the form "foo.txt"
81 or "bar/foo.txt", then it is returned as relative. OTOH, if it is
82 of the form "../baz/foo.txt", an absolute path is returned. This is
83 intended to be useful for insets which encapsulate files/
85 QString browseRelFile(QString const & filename,
86 QString const & refpath,
87 QString const & title,
88 QStringList const & filters,
90 QString const & label1 = QString(),
91 QString const & dir1 = QString(),
92 QString const & label2 = QString(),
93 QString const & dir2 = QString());
96 /** Build filelists of all availabe bst/cls/sty-files. Done through
97 * kpsewhich and an external script, saved in *Files.lst.
99 void rescanTexStyles();
101 /** Fill \c contents from one of the three texfiles.
102 * Each entry in the file list is returned as a name_with_path
104 QStringList texFileList(QString const & filename);
106 // wrapper around the docstring versions
107 QString internalPath(QString const &);
108 QString onlyFilename(QString const & str);
109 QString onlyPath(QString const & str);
110 QStringList fileFilters(QString const & description);
112 QString changeExtension(QString const & oldname, QString const & extension);
114 /// Remove the extension from \p name
115 QString removeExtension(QString const & name);
117 /** Add the extension \p ext to \p name.
118 Use this instead of changeExtension if you know that \p name is without
119 extension, because changeExtension would wrongly interpret \p name if it
122 QString addExtension(QString const & name, QString const & extension);
124 /// Return the extension of the file (not including the .)
125 QString getExtension(QString const & name);
126 QString makeAbsPath(QString const & relpath, QString const & base);
127 QString changeExtension(QString const & oldname, QString const & ext);
131 #endif // QTHELPERS_H