2006-03-05 17:24:44 +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
|
2007-04-05 14:58:15 +00:00
|
|
|
* \author Richard Heck
|
2006-03-05 17:24:44 +00:00
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef QTHELPERS_H
|
|
|
|
#define QTHELPERS_H
|
|
|
|
|
2007-04-28 12:58:49 +00:00
|
|
|
#include "Length.h"
|
Make libQtCore a support library like boost and implement encoding conversion
from/to the local 8bit encoding with it.
Only the autotools build system is updated, scons and cmake users need to
add qt4 cpp flags when compiling libsupport, and link libsupport against
libQtCore.
* src/frontends/qt4/qt_helpers.[Ch]
(toqstr, qchar_to_ucs4, ucs4_to_qchar, ucs4_to_qstring,
qstring_to_ucs4, fromqstr): Move these qstring conversion functions
from here ...
* src/support/qstring_helpers.[Ch] ... to these new files
* src/support/docstring.[Ch]
(from_local8bit): new conversion function from local 8bit encoding
to ucs4
(to_local8bit): new conversion function from ucs4 to local 8bit
encoding to ucs4
(to_local8bit_failure): exception that is thrown by to_local8bit if
the argument cannot be converted to the local encoding
* src/support/filename.C
(FileName::toFilesystemEncoding): implement with the help of QFile
* src/support/Makefile.am: Add new files, qt4 cpp flags and link
against libQtCore
* src/client/client.C: Convert commandline input from local encoding
to ucs4. Convert stuff that is sent to to the server to utf8,
because LyX interprets it as utf8 on the other end of the pipe.
* src/lyx_main.C
(LyX::exec): convert commandline input from local encoding to utf8
(LyX::init): ditto
(LyX::easyParse): ditto
* development/scons/scons_manifest.py: Add new files
* config/qt4.m4: Define new variables QT4_CORE_INCLUDES,
QT4_CORE_LDFLAGS and QT4_CORE_LIB
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16257 a592a061-630c-0410-9148-cb99ea01b6c8
2006-12-12 20:19:46 +00:00
|
|
|
#include "support/qstring_helpers.h"
|
2007-11-05 21:42:08 +00:00
|
|
|
#include "support/strfwd.h"
|
2006-08-30 14:59:07 +00:00
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
class QComboBox;
|
|
|
|
class QLineEdit;
|
2007-04-05 14:58:15 +00:00
|
|
|
class QCheckBox;
|
2007-09-15 15:42:22 +00:00
|
|
|
class QString;
|
2007-09-15 13:06:48 +00:00
|
|
|
class QWidget;
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
class LengthCombo;
|
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
|
2007-04-28 12:58:49 +00:00
|
|
|
/// method to get a Length from widgets (LengthCombo)
|
2006-03-05 17:24:44 +00:00
|
|
|
std::string widgetsToLength(QLineEdit const * input, LengthCombo const * combo);
|
2007-04-28 12:58:49 +00:00
|
|
|
/// method to get a Length from widgets (QComboBox)
|
|
|
|
Length widgetsToLength(QLineEdit const * input, QComboBox const * combo);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2007-04-05 14:58:15 +00:00
|
|
|
//FIXME It would be nice if defaultUnit were a default argument
|
2007-04-28 12:58:49 +00:00
|
|
|
/// method to set widgets from a Length
|
2007-05-28 22:27:45 +00:00
|
|
|
void lengthToWidgets(QLineEdit * input, LengthCombo * combo,
|
2007-04-28 12:58:49 +00:00
|
|
|
Length const & len, Length::UNIT default_unit);
|
2007-04-05 14:58:15 +00:00
|
|
|
/// method to set widgets from a string
|
2006-03-05 17:24:44 +00:00
|
|
|
void lengthToWidgets(QLineEdit * input, LengthCombo * combo,
|
2007-04-28 12:58:49 +00:00
|
|
|
std::string const & len, Length::UNIT default_unit);
|
|
|
|
/// method to set widgets from a Length with optional "auto" if zero
|
2007-05-28 22:27:45 +00:00
|
|
|
void lengthAutoToWidgets(QLineEdit * input, LengthCombo * combo,
|
2007-04-28 12:58:49 +00:00
|
|
|
Length const & len, Length::UNIT defaultUnit);
|
2007-04-05 14:58:15 +00:00
|
|
|
|
2007-09-15 13:06:48 +00:00
|
|
|
/// colors a widget red if invalid
|
|
|
|
void setValid(QWidget * widget, bool valid);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
2006-12-08 08:57:57 +00:00
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
/**
|
2006-12-08 08:57:57 +00:00
|
|
|
* qt_ - i18nize string and convert to QString
|
2006-03-05 17:24:44 +00:00
|
|
|
*
|
2006-12-03 00:28:14 +00:00
|
|
|
* Use this in qt4/ instead of _()
|
2006-03-05 17:24:44 +00:00
|
|
|
*/
|
2006-12-03 01:09:09 +00:00
|
|
|
QString const qt_(char const * str, const char * comment = 0);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
2006-12-08 08:57:57 +00:00
|
|
|
* qt_ - i18nize string and convert to QString
|
2006-03-05 17:24:44 +00:00
|
|
|
*
|
2006-12-03 00:28:14 +00:00
|
|
|
* Use this in qt4/ instead of _()
|
2006-03-05 17:24:44 +00:00
|
|
|
*/
|
|
|
|
QString const qt_(std::string const & str);
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
} // namespace lyx
|
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
#endif // QTHELPERS_H
|