2002-11-27 21:49:50 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/**
|
|
|
|
* \file qt_helpers.h
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* \author Dekel Tsur
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
* Full author contact details are available in file CREDITS.
|
2002-11-27 21:49:50 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef QTHELPERS_H
|
|
|
|
#define QTHELPERS_H
|
|
|
|
|
|
|
|
#include <utility>
|
|
|
|
|
2002-12-04 02:57:14 +00:00
|
|
|
#include "lyxlength.h"
|
2006-09-03 07:02:38 +00:00
|
|
|
#include "support/docstring.h"
|
2003-02-25 13:35:26 +00:00
|
|
|
|
2002-12-04 02:57:14 +00:00
|
|
|
class LengthCombo;
|
2004-11-27 18:47:41 +00:00
|
|
|
class QComboBox;
|
2002-12-04 02:57:14 +00:00
|
|
|
class QLineEdit;
|
2002-12-17 20:37:13 +00:00
|
|
|
class QString;
|
2003-02-25 13:35:26 +00:00
|
|
|
|
2003-10-06 15:43:21 +00:00
|
|
|
std::string makeFontName(std::string const & family, std::string const & foundry);
|
2003-02-25 13:35:26 +00:00
|
|
|
|
2003-10-06 15:43:21 +00:00
|
|
|
std::pair<std::string,std::string> parseFontName(std::string const & name);
|
2002-11-27 21:49:50 +00:00
|
|
|
|
2004-11-27 18:47:41 +00:00
|
|
|
/// method to get a LyXLength from widgets (LengthCombo)
|
2003-10-06 15:43:21 +00:00
|
|
|
std::string widgetsToLength(QLineEdit const * input, LengthCombo const * combo);
|
2004-11-27 18:47:41 +00:00
|
|
|
/// method to get a LyXLength from widgets (QComboBox)
|
|
|
|
LyXLength widgetsToLength(QLineEdit const * input, QComboBox const * combo);
|
2003-02-25 13:35:26 +00:00
|
|
|
|
2002-12-04 02:57:14 +00:00
|
|
|
/// method to set widgets from a LyXLength
|
|
|
|
void lengthToWidgets(QLineEdit * input, LengthCombo * combo,
|
2003-10-06 15:43:21 +00:00
|
|
|
std::string const & len, LyXLength::UNIT default_unit);
|
2003-02-25 13:35:26 +00:00
|
|
|
|
2003-03-29 07:09:13 +00:00
|
|
|
/// format a string to the given width
|
2006-09-11 10:07:39 +00:00
|
|
|
lyx::docstring const formatted(lyx::docstring const & text, int w = 80);
|
2003-03-29 07:09:13 +00:00
|
|
|
|
2002-12-17 20:37:13 +00:00
|
|
|
/**
|
|
|
|
* toqstr - convert char * into unicode
|
|
|
|
*
|
|
|
|
* Use this whenever there's a user-visible string that is encoded
|
|
|
|
* for the locale (menus, dialogs etc.)
|
|
|
|
*/
|
|
|
|
QString const toqstr(char const * str);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* toqstr - convert string into unicode
|
|
|
|
*
|
|
|
|
* Use this whenever there's a user-visible string that is encoded
|
|
|
|
* for the locale (menus, dialogs etc.)
|
|
|
|
*/
|
2003-10-06 15:43:21 +00:00
|
|
|
QString const toqstr(std::string const & str);
|
2002-12-17 20:37:13 +00:00
|
|
|
|
|
|
|
|
2006-09-03 07:02:38 +00:00
|
|
|
/**
|
|
|
|
* toqstr - convert UCS4 encoded docstring to QString
|
|
|
|
*/
|
|
|
|
QString const toqstr(lyx::docstring const & str);
|
|
|
|
|
|
|
|
|
2002-12-17 20:37:13 +00:00
|
|
|
/**
|
|
|
|
* qt_ - i18nize string and convert to unicode
|
|
|
|
*
|
2006-04-24 13:48:24 +00:00
|
|
|
* Use this in qt3/ instead of qt_()
|
2002-12-17 20:37:13 +00:00
|
|
|
*/
|
|
|
|
QString const qt_(char const * str);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* qt_ - i18nize string and convert to unicode
|
|
|
|
*
|
2006-04-24 13:48:24 +00:00
|
|
|
* Use this in qt3/ instead of qt_()
|
2002-12-17 20:37:13 +00:00
|
|
|
*/
|
2003-10-06 15:43:21 +00:00
|
|
|
QString const qt_(std::string const & str);
|
2002-12-17 20:37:13 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* fromqstr - convert QString into std::string in locale
|
|
|
|
*
|
|
|
|
* Return the QString encoded in the locale
|
|
|
|
*/
|
2003-10-06 15:43:21 +00:00
|
|
|
std::string const fromqstr(QString const & str);
|
2002-12-17 20:37:13 +00:00
|
|
|
|
2006-09-03 07:02:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* qstring_to_ucs4 - convert QString to UCS4 encoded docstring
|
|
|
|
*/
|
|
|
|
lyx::docstring const qstring_to_ucs4(QString const & str);
|
|
|
|
|
2002-11-27 21:49:50 +00:00
|
|
|
#endif // QTHELPERS_H
|