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"
18 #include "support/strfwd.h"
26 template <class T> class QList;
32 namespace support { class FileFilterList; }
33 namespace support { class FileName; }
37 /// method to get a Length from widgets (LengthCombo)
38 std::string widgetsToLength(QLineEdit const * input, LengthCombo const * combo);
39 /// method to get a Length from widgets (QComboBox)
40 Length widgetsToLength(QLineEdit const * input, QComboBox const * combo);
42 //FIXME It would be nice if defaultUnit were a default argument
43 /// method to set widgets from a Length
44 void lengthToWidgets(QLineEdit * input, LengthCombo * combo,
45 Length const & len, Length::UNIT default_unit);
46 /// method to set widgets from a string
47 void lengthToWidgets(QLineEdit * input, LengthCombo * combo,
48 std::string const & len, Length::UNIT default_unit);
49 /// method to set widgets from a Length with optional "auto" if zero
50 void lengthAutoToWidgets(QLineEdit * input, LengthCombo * combo,
51 Length const & len, Length::UNIT defaultUnit);
53 /// colors a widget red if invalid
54 void setValid(QWidget * widget, bool valid);
56 } // namespace frontend
60 * qt_ - i18nize string and convert to QString
62 * Use this in qt4/ instead of _()
64 QString const qt_(std::string const & str);
67 typedef std::pair<QString, QString> LanguagePair;
69 /** If the caller is the character dialog, add "No change" and "Reset"
72 QList<LanguagePair> languageData(bool character_dlg);
74 support::FileName libFileSearch(QString const & dir, QString const & name,
75 QString const & ext = QString());
77 /** Wrapper around browseFile which tries to provide a filename
78 relative to relpath. If the relative path is of the form "foo.txt"
79 or "bar/foo.txt", then it is returned as relative. OTOH, if it is
80 of the form "../baz/foo.txt", an absolute path is returned. This is
81 intended to be useful for insets which encapsulate files/
83 QString browseRelFile(QString const & filename,
84 QString const & refpath,
85 QString const & title,
86 support::FileFilterList const & filters,
88 QString const & label1 = QString(),
89 QString const & dir1 = QString(),
90 QString const & label2 = QString(),
91 QString const & dir2 = QString());
94 /** Build filelists of all availabe bst/cls/sty-files. Done through
95 * kpsewhich and an external script, saved in *Files.lst.
97 void rescanTexStyles();
99 /** Fill \c contents from one of the three texfiles.
100 * Each entry in the file list is returned as a name_with_path
102 QStringList texFileList(QString const & filename);
104 // wrapper around the docstring versions
105 QString internalPath(QString const &);
106 QString onlyFilename(QString const & str);
107 QString onlyPath(QString const & str);
109 QString changeExtension(QString const & oldname, QString const & extension);
111 /// Remove the extension from \p name
112 QString removeExtension(QString const & name);
114 /** Add the extension \p ext to \p name.
115 Use this instead of changeExtension if you know that \p name is without
116 extension, because changeExtension would wrongly interpret \p name if it
119 QString addExtension(QString const & name, QString const & extension);
121 /// Return the extension of the file (not including the .)
122 QString getExtension(QString const & name);
126 #endif // QTHELPERS_H