lokalize
xlifftextedit.cpp
Go to the documentation of this file.
85 bool eventFilter(QObject* , QEvent* ); //reimplemented to deliver more keypresses to XliffTextEdit
143 TranslationUnitTextEdit::TranslationUnitTextEdit(Catalog* catalog, DocPosition::Part part, QWidget* parent)
158 connect (document(), SIGNAL(contentsChange(int,int,int)), this, SLOT(contentsChanged(int,int,int)));
170 QString langCode=m_part==DocPosition::Source? m_catalog->sourceLangCode():m_catalog->targetLangCode();
182 static QLocale::Language rtlLanguages[]={QLocale::Arabic, QLocale::Hebrew, QLocale::Urdu, QLocale::Persian, QLocale::Pashto};
209 disconnect (document(), SIGNAL(contentsChange(int,int,int)), this, SLOT(contentsChanged(int,int,int)));
211 connect (document(), SIGNAL(contentsChange(int,int,int)), this, SLOT(contentsChanged(int,int,int)));
237 CatalogString TranslationUnitTextEdit::showPos(DocPosition docPosition, const CatalogString& refStr, bool keepCursor)
260 disconnect (document(), SIGNAL(contentsChange(int,int,int)), this, SLOT(contentsChanged(int,int,int)));
264 setContent(catalogString,refStr.string.isEmpty()?m_catalog->sourceWithTags(docPosition):refStr);
265 connect (document(), SIGNAL(contentsChange(int,int,int)), this, SLOT(contentsChanged(int,int,int)));
279 t.movePosition(length<0?QTextCursor::PreviousCharacter:QTextCursor::NextCharacter,QTextCursor::KeepAnchor,qAbs(length));
290 void TranslationUnitTextEdit::setContent(const CatalogString& catStr, const CatalogString& refStr)
344 void insertContent(QTextCursor& cursor, const CatalogString& catStr, const CatalogString& refStr, bool insertText)
356 //kDebug()<<"\t"<<catStr.tags.at(i).getElementName()<<catStr.tags.at(i).id<<catStr.tags.at(i).start<<catStr.tags.at(i).end;
405 text=tag.equivText; //TODO add number? when? -- right now this is done for gettext qt's 156 mark
407 text=QString::number(sourceTagIdToIndex.contains(tag.id)?sourceTagIdToIndex.value(tag.id):(tagIndex+refTagIndexOffset));
425 cursor.document()->addResource(QTextDocument::ImageResource, QUrl(name), generateImage(text,font));
438 //kWarning()<<"contentsChanged. offset"<<offset<<"charsRemoved"<<charsRemoved<<"charsAdded"<<charsAdded<<"_oldMsgstr"<<_oldMsgstr;
474 bool markupRemoved=charsRemoved && QString::fromRawData(target.unicode()+offset,charsRemoved).contains(TAGRANGE_IMAGE_SYMBOL);
573 void TranslationUnitTextEdit::insertCatalogString(CatalogString catStr, int start, bool refresh)
669 //qWarning()<<"ins"<<qVariantValue<CatalogString>(v).string<<qVariantValue<CatalogString>(v).ranges.size();
780 else if (!keyEvent->modifiers()&&(keyEvent->key()==Qt::Key_Backspace||keyEvent->key()==Qt::Key_Delete))
785 if (KDE_ISUNLIKELY( !m_catalog->isApproved(m_currentPos.entry) && !textCursor().hasSelection() )
949 cursor.movePosition(QTextCursor::NextCharacter,QTextCursor::MoveAnchor,tag.end+1+tag.isPaired());
953 int TranslationUnitTextEdit::strForMicePosIfUnderTag(QPoint mice, CatalogString& str, bool tryHarder)
1031 // QAction* lookup=menu.addAction(i18nc("@action:inmenu","Lookup selected text in translation memory"));
1111 const QStringList& suggestions=m_highlighter->suggestionsForWord(wordSelectCursor.selectedText());
1237 if( ctxt.startsWith( "NAME OF TRANSLATORS" ) || text.startsWith( "_: NAME OF TRANSLATORS\\n" ))
1245 else if( ctxt.startsWith( "EMAIL OF TRANSLATORS" ) || text.startsWith( "_: EMAIL OF TRANSLATORS\\n" )) {
1321 QStringList s=CompletionStorage::instance()->makeCompletion(QString::fromRawData(target.unicode()+sp+1,len));
int position() const
text
void setApprovementState(bool a)
Definition: syntaxhighlighter.h:45
void contextMenuEvent(QContextMenuEvent *event)
Definition: xlifftextedit.cpp:999
QStringList makeCompletion(const QString &) const
Definition: completionstorage.cpp:80
int indexOf(QChar ch, int from, Qt::CaseSensitivity cs) const
Qt::KeyboardModifiers modifiers() const
void reflectApprovementState()
Definition: xlifftextedit.cpp:201
CatalogString targetWithTags(const DocPosition &pos) const
Definition: catalog.cpp:211
QString & append(QChar ch)
Type type() const
iterator insert(const Key &key, const T &value)
QByteArray data(const QString &mimeType) const
bool contains(const Key &key) const
bool removeTargetSubstring(int start=0, int end=-1, bool refresh=true)
Definition: xlifftextedit.cpp:554
how undo system works: undo() and redo() functions call appropriate private method of Catalog to chan...
Definition: cmd.h:85
void wheelEvent(QWheelEvent *event)
Definition: xlifftextedit.cpp:1069
void toggleApprovementRequested()
QTextCharFormat charFormat() const
void deletePreviousChar()
Definition: pos.h:44
void beginMacro(const QString &text)
QVariant resource(int type, const QUrl &name) const
virtual bool hasFormat(const QString &mimeType) const
QString & prepend(QChar ch)
QVariant data() const
void gotoNextFuzzyUntrRequested()
bool isDigit() const
const T & at(int i) const
void keyPressEvent(QKeyEvent *keyEvent)
Definition: xlifftextedit.cpp:738
int size() const
void gotoLastRequested()
QString selectedText() const
void removeAt(int i)
static CompletionStorage * instance()
Definition: completionstorage.cpp:37
void mouseReleaseEvent(QMouseEvent *event)
Definition: xlifftextedit.cpp:982
void approvedEntryDisplayed()
const QPoint & pos() const
int digitValue() const
iterator erase(iterator pos)
void doExplicitCompletion()
Definition: xlifftextedit.cpp:1346
TranslationUnitTextEdit(Catalog *catalog, DocPosition::Part part, QWidget *parent=0)
Definition: xlifftextedit.cpp:143
void cursorPositionChanged(int column)
void insertContent(QTextCursor &cursor, const CatalogString &catStr, const CatalogString &refStr, bool insertText)
Definition: xlifftextedit.cpp:344
QString & remove(int position, int n)
void undoRequested()
CatalogString catalogString(const DocPosition &pos) const
Definition: catalog.cpp:219
void showText(const QPoint &pos, const QString &text, QWidget *w)
int anchor() const
void redoRequested()
bool movePosition(MoveOperation operation, MoveMode mode, int n)
bool fillTagPlaces(QMap< int, int > &tagPlaces, const CatalogString &catalogString, int start, int len)
CatalogString cmds helper function.
Definition: cmd.cpp:328
int size() const
int lastIndexOf(QChar ch, int from, Qt::CaseSensitivity cs) const
void select(SelectionType selection)
Definition: cmd.h:99
void gotoNextFuzzyRequested()
void replaceRequested()
void findRequested()
bool hasSelection() const
QString fromRawData(const QChar *unicode, int size)
int elapsed() const
QString number(int n, int base)
bool isSpace() const
QString text() const
int toInt(bool *ok) const
bool isNull() const
void keyReleaseEvent(QKeyEvent *e)
Definition: xlifftextedit.cpp:909
void fill(uint pixelValue)
QMap< QString, int > tagIdToIndex() const
Definition: catalogstring.cpp:187
void gotoPrevFuzzyRequested()
void addResource(int type, const QUrl &name, const QVariant &resource)
const QPoint & globalPos() const
Qt::MouseButton button() const
void insertText(const QString &text)
bool isEmpty() const
static QImage generateImage(const QString &str, const QFont &font)
Definition: xlifftextedit.cpp:58
void contentsModified(const DocPosition &)
bool isEmpty() const
QTextDocument * document() const
void untranslatedEntryDisplayed()
bool startsWith(const QString &s, Qt::CaseSensitivity cs) const
QString text() const
void setText(const QString &text)
void gotoPrevFuzzyUntrRequested()
void translatedEntryDisplayed()
T & first()
void tagInsertRequested(const InlineTag &tag)
void tmLookupRequested(DocPosition::Part, const QString &)
void emitCursorPositionChanged()
Definition: xlifftextedit.cpp:936
void adaptCatalogString(CatalogString &target, const CatalogString &ref)
prepares
Definition: catalogstring.cpp:271
void gotoNextRequested()
bool matches(QKeySequence::StandardKey key) const
Definition: prefs_lokalize.h:13
void gotoPrevRequested()
Qt::KeyboardModifiers modifiers() const
void setData(const QVariant &userData)
iterator end()
const T value(const Key &key) const
defaultFont
int key() const
bool contains(QChar ch, Qt::CaseSensitivity cs) const
void findNextRequested()
QStringRef midRef(int position, int n) const
void gotoEntryRequested(const DocPosition &)
void insertCatalogString(CatalogString catStr, int start=0, bool refresh=true)
Definition: xlifftextedit.cpp:573
int delta() const
CatalogString showPos(DocPosition pos, const CatalogString &refStr=CatalogString(), bool keepCursor=true)
makes MsgEdit reflect current entry
Definition: xlifftextedit.cpp:237
QString & replace(int position, int n, QChar after)
const QChar * unicode() const
data structure used to pass info about inline elements a XLIFF tag is represented by a TAGRANGE_IMAGE...
Definition: catalogstring.h:128
QString mid(int position, int n) const
QStyle * style()
void endMacro()
CatalogString sourceWithTags(const DocPosition &pos) const
Definition: catalog.cpp:203
Definition: pos.h:43
virtual void drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const =0
const QChar at(int position) const
int length() const
void gotoPrevUntranslatedRequested()
Definition: catalogstring.h:57
void deleteChar()
void start()
This class represents a catalog It uses CatalogStorage interface to work with catalogs in different f...
Definition: catalog.h:74
void setCharFormat(const QTextCharFormat &format)
void binaryUnitSelectRequested(const QString &)
iterator insert(const Key &key, const T &value)
bool contains(const Key &key) const
void gotoFirstRequested()
Definition: syntaxhighlighter.h:37
void insertImage(const QTextImageFormat &format, QTextFrameFormat::Position alignment)
void setData(const QString &mimeType, const QByteArray &data)
const QPoint & pos() const
static QString spclChars("abfnrtv'?\\")
void reflectUntranslatedState()
Definition: xlifftextedit.cpp:223
void gotoNextUntranslatedRequested()
QMimeData * createMimeDataFromSelection() const
Definition: xlifftextedit.cpp:613
iterator begin()
void setSourceString(const QString &s)
Definition: syntaxhighlighter.h:46
int size() const
data structure used to pass info about inline elements a XLIFF tag is represented by a TAGRANGE_IMAGE...
Definition: catalogstring.h:44
void nonApprovedEntryDisplayed()
void insertFromMimeData(const QMimeData *source)
Definition: xlifftextedit.cpp:657
const T value(const Key &key) const
void setPosition(int pos, MoveMode m)
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:40:07 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:40:07 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.