Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
messageeditor.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
3
4#ifndef MESSAGEEDITOR_H
5#define MESSAGEEDITOR_H
6
7#include "messagemodel.h"
8
9#include <QtCore/QLocale>
10#include <QtCore/QTimer>
11
12#include <QtWidgets/QFrame>
13#include <QtWidgets/QScrollArea>
14
15QT_BEGIN_NAMESPACE
16
17class QBoxLayout;
18class QMainWindow;
19class QTextEdit;
20
21class MessageEditor;
22class FormatTextEdit;
23class FormWidget;
24class FormMultiWidget;
25
35
37{
39
40public:
43
44 void showNothing();
45 void showMessage(const MultiDataIndex &index);
46 void setNumerusForms(int model, const QStringList &numerusForms);
47 bool eventFilter(QObject *, QEvent *) override;
48 void setNumerusTranslation(int model, const QString &translation, int numerus);
49 int activeModel() const { return (m_editors.size() != 1) ? m_currentModel : 0; }
50 void setEditorFocusForModel(int model);
53 void setVisualizeWhitespace(bool value);
54 void setFontSize(const float fontSize);
55 float fontSize();
56
59 void translatorCommentChanged(const QString &comment);
60 void activeModelChanged(int model);
61
62 void undoAvailable(bool avail);
63 void redoAvailable(bool avail);
64#ifndef QT_NO_CLIPBOARD
65 void cutAvailable(bool avail);
66 void copyAvailable(bool avail);
67 void pasteAvailable(bool avail);
68#endif
69 void beginFromSourceAvailable(bool enable);
70
71public slots:
72 void undo();
73 void redo();
74#ifndef QT_NO_CLIPBOARD
75 void cut();
76 void copy();
77 void paste();
78#endif
79 void selectAll();
80 void beginFromSource();
81 void setEditorFocus();
82 void setTranslation(int latestModel, const QString &translation);
83 void setLengthVariants(bool on);
84 void increaseFontSize();
85 void decreaseFontSize();
86 void resetFontSize();
87
88private slots:
90 void editorDestroyed();
91 void selectionChanged(QTextEdit *);
92 void resetHoverSelection();
93 void emitTranslationChanged(QTextEdit *);
94 void emitTranslatorCommentChanged(QTextEdit *);
95#ifndef QT_NO_CLIPBOARD
96 void updateCanPaste();
97 void clipboardChanged();
98#endif
99 void messageModelAppended();
100 void messageModelDeleted(int model);
101 void allModelsDeleted();
102 void setTargetLanguage(int model);
103 void reallyFixTabOrder();
104
105private:
106 void setupEditorPage();
107 void setEditingEnabled(int model, bool enabled);
108 bool focusNextUnfinished(int start);
109 void resetSelection();
110 void grabFocus(QWidget *widget);
111 void trackFocus(QWidget *widget);
112 void activeModelAndNumerus(int *model, int *numerus) const;
113 QTextEdit *activeTranslation() const;
114 QTextEdit *activeOr1stTranslation() const;
115 QTextEdit *activeTransComment() const;
116 QTextEdit *activeEditor() const;
117 QTextEdit *activeOr1stEditor() const;
118 MessageEditorData *modelForWidget(const QObject *o);
119 int activeTranslationNumerus() const;
120 QStringList translations(int model) const;
121 void updateBeginFromSource();
122 void updateUndoRedo();
123#ifndef QT_NO_CLIPBOARD
124 void updateCanCutCopy();
125#endif
126 void addPluralForm(int model, const QString &label, bool writable);
127 void fixTabOrder();
128 QPalette paletteForModel(int model) const;
129 void applyFontSize();
130
131 MultiDataModel *m_dataModel;
132
133 MultiDataIndex m_currentIndex;
134 int m_currentModel;
135 int m_currentNumerus;
136
137 bool m_lengthVariants;
138 float m_fontSize;
139
140 bool m_undoAvail;
141 bool m_redoAvail;
142 bool m_cutAvail;
143 bool m_copyAvail;
144
145 bool m_clipboardEmpty;
146 bool m_visualizeWhitespace;
147
148 QTextEdit *m_selectionHolder;
149 QWidget *m_focusWidget;
150 QBoxLayout *m_layout;
151 FormWidget *m_source;
152 FormWidget *m_pluralSource;
153 FormWidget *m_commentText;
154 QList<MessageEditorData> m_editors;
155
156 QTimer m_tabOrderTimer;
157};
158
159QT_END_NAMESPACE
160
161#endif // MESSAGEEDITOR_H
void setPhraseBooks(const QList< PhraseBook * > &phrasebooks, int modelIndex)
CheckableListModel(QObject *parent=0)
Qt::ItemFlags flags(const QModelIndex &index) const override
Returns the item flags for the given index.
ContextItemDelegate(QObject *parent, MultiDataModel *model)
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override
This pure abstract function must be reimplemented if you want to provide custom rendering.
void updateStatistics()
void addError(int model, const ErrorType type, const QString &arg=QString())
QString firstError()
void clear()
ErrorsView(MultiDataModel *dataModel, QWidget *parent=0)
FocusWatcher(MessageEditor *msgedit, QObject *parent)
bool eventFilter(QObject *object, QEvent *event) override
Filters events if this object has been installed as an event filter for the watched object.
void setSourceContext(int model, MessageItem *messageItem)
void closeEvent(QCloseEvent *event) override
[21]
bool openFiles(const QStringList &names, bool readWrite=true)
~MainWindow() override
void writeConfig()
static RecentFiles & recentFiles()
bool eventFilter(QObject *obj, QEvent *ev) override
Filters events if this object has been installed as an event filter for the watched object.
void readConfig()
void setLengthVariants(bool on)
int activeModel() const
void redoAvailable(bool avail)
void cutAvailable(bool avail)
void undoAvailable(bool avail)
void translatorCommentChanged(const QString &comment)
void setVisualizeWhitespace(bool value)
void setEditorFocusForModel(int model)
void setTranslation(int latestModel, const QString &translation)
void setNumerusTranslation(int model, const QString &translation, int numerus)
void pasteAvailable(bool avail)
void setFontSize(const float fontSize)
void setUnfinishedEditorFocus()
bool focusNextUnfinished()
void activeModelChanged(int model)
void copyAvailable(bool avail)
void setNumerusForms(int model, const QStringList &numerusForms)
void showMessage(const MultiDataIndex &index)
void beginFromSourceAvailable(bool enable)
bool eventFilter(QObject *, QEvent *) override
bool danger() const
bool isFinished() const
const TranslatorMessage & message() const
TranslatorMessage::Type type() const
bool isObsolete() const
MultiDataIndex(int model, int context, int message)
void setModel(int model)
bool isValid() const
int message() const
int model() const
bool operator!=(const MultiDataIndex &other) const
int context() const
MultiDataModelIterator(MultiDataModel *model, int modelNo, int contextNo=0, int messageNo=0)
MessageItem * current() const
bool isModified(int model) const
MessageItem * messageItem(const MultiDataIndex &index, int model) const
void setModified(int model, bool dirty)
DataModel * model(int i)
bool isModified() const
void languageChanged(int model)
int messageCount() const
int getNumFinished() const
void setDanger(const MultiDataIndex &index, bool danger)
int modelCount() const
bool isModelWritable(int model) const
MultiMessageItem * multiMessageItem(const MultiDataIndex &index) const
int getNumEditable() const
int contextCount() const
MultiContextItem * multiContextItem(int ctxIdx) const
void translationChanged(const MultiDataIndex &index)
MessageItem * messageItem(const MultiDataIndex &index) const
void setFinished(const MultiDataIndex &index, bool finished)
void messageDataChanged(const MultiDataIndex &index)
void close(int model)
void multiContextDataChanged(const MultiDataIndex &index)
bool isModified() const
Definition phrase.h:68
void listChanged()
void update()
void setCurrentMessageFromGuess(int modelIndex, const Candidate &cand)
QVariant headerData(int section, Qt::Orientation orientation, int role) const override
\reimp
SortedContextsModel(QObject *parent, MultiDataModel *model)
SortedMessagesModel(QObject *parent, MultiDataModel *model)
QVariant headerData(int section, Qt::Orientation orientation, int role) const override
\reimp
void setPhraseBook(PhraseBook *phraseBook)
bool isTranslated() const
TranslatableEntryType
@ TranslatableTabPageWhatsThis
@ TranslatableTableWidgetItem
@ TranslatableListWidgetItem
@ TranslatableTreeWidgetItem
@ TranslatableComboBoxItem
@ TranslatableTabPageToolTip
@ TranslatableToolItemToolTip
@ TranslatableProperty
@ TranslatableToolItemText
@ TranslatableTabPageText
Combined button and popup list for selecting options.
static QString leadingWhitespace(const QString &str)
Ending
@ End_Colon
@ End_None
@ End_Interrobang
@ End_Ellipsis
@ End_FullStop
static Ending ending(QString str, QLocale::Language lang)
static bool hasFormPreview(const QString &fileName)
static QString trailingWhitespace(const QString &str)
static QString fileFilters(bool allFirst)
static const QVariant & pxObsolete()
static bool haveMnemonic(const QString &str)
static QT_BEGIN_NAMESPACE const int MessageMS
QList< FormMultiWidget * > transTexts
FormWidget * transCommentText
int firstNonobsoleteMessageIndex(int msgIdx) const
bool isUnfinished() const
OpenedFile(DataModel *_dataModel, bool _readWrite, bool _langGuessed)
DataModel * dataModel
TranslatableEntryType type
QTreeWidgetItem * treeWidgetItem
QListWidgetItem * listWidgetItem
QTabWidget * tabWidget
QTableWidgetItem * tableWidgetItem