8#include "ui_mainwindow.h"
13#include <QtCore/private/qconfig_p.h>
15#include <QtCore/QHash>
17#include <QtCore/QLocale>
19#include <QtWidgets/QMainWindow>
31class QSortFilterProxyModel;
80 void recentFileActivated(QAction *action);
81 void setupRecentFilesMenu();
92 void showTranslateDialog();
93 void showBatchTranslateDialog();
94 void showTranslationSettings();
95 void updateTranslateHit(
bool &hit);
96 void translate(
int mode);
98 void openPhraseBook();
99 void closePhraseBook(QAction *action);
100 void editPhraseBook(QAction *action);
101 void addToPhraseBook();
107 void fileAboutToShow();
108 void editAboutToShow();
110 void showContextDock();
111 void showMessagesDock();
112 void showPhrasesDock();
113 void showSourceCodeDock();
114 void showErrorDock();
118 bool maybeSave(
int model);
119 void updateProgress();
122 void updateCaption();
123 void updateLatestModel(
const QModelIndex &index);
124 void selectedContextChanged(
const QModelIndex &sortedIndex,
const QModelIndex &oldIndex);
125 void selectedLabelChanged(
const QModelIndex &sortedIndex,
const QModelIndex &oldIndex);
126 void selectedMessageChanged(
const QModelIndex &sortedIndex,
const QModelIndex &oldIndex);
127 void setCurrentMessageFromGuess(
int modelIndex,
const Candidate &tm);
128 void contextAndLabelTabChanged();
131 void updateTranslation(
const QStringList &translations);
132 void updateTranslatorComment(
const QString &comment);
134 void updateVisibleColumns();
135 void updateActiveModel(
int);
136 void refreshItemViews();
137 void toggleFinished(
const QModelIndex &index);
138 void openMachineTranslateDialog();
139 void prevUnfinished();
140 void nextUnfinished();
142 FindDialog::FindOptions options,
int statusFilter);
144 void showStatistics();
146 void toggleQmlPreview();
148 void toggleFormPreview();
149 void enablePreviewFromBanner();
150 void toggleVisualizeWhitespace();
152 void updatePhraseDicts();
153 void updatePhraseDict(
int model);
155#if QT_CONFIG(printsupport)
163 QModelIndex nextGroup(
const QModelIndex &index)
const;
164 QModelIndex prevGroup(
const QModelIndex &index)
const;
165 QModelIndex firstMessage()
const;
166 QModelIndex nextMessage(
const QModelIndex ¤tIndex,
bool checkUnfinished =
false)
const;
167 QModelIndex prevMessage(
const QModelIndex ¤tIndex,
bool checkUnfinished =
false)
const;
168 bool doNext(
bool checkUnfinished);
169 bool doPrev(
bool checkUnfinished);
172 void updateStatistics();
173 void initViewHeaders();
174 void modelCountChanged();
176 void setupToolBars();
177 void setCurrentMessage(
const QModelIndex &index);
178 void setCurrentMessage(
const QModelIndex &index,
int model);
179 QModelIndex setMessageViewRoot(
const QModelIndex &index);
180 QModelIndex currentMessageIndex()
const;
181 PhraseBook *doOpenPhraseBook(
const QString &name);
182 bool isPhraseBookOpen(
const QString &name);
183 bool savePhraseBook(QString *name,
PhraseBook &pb);
184 bool maybeSavePhraseBook(
PhraseBook *phraseBook);
185 bool maybeSavePhraseBooks();
186 void pickTranslationFiles();
187 void doShowTranslationSettings(
int model);
188 void doUpdateLatestModel(
int model);
189 void updateSourceView(
int model,
MessageItem *item);
190 void updatePreviewBanner(
const QString &fileName);
191 void refreshFormPreview();
192 bool askPreviewActivation(
bool isQml);
193 QString previewFilePath(
int model,
const QString &fileName)
const;
194 bool hasUiFormPreview(
int model,
const QString &fileName)
const;
196 bool hasQmlFormPreview(
int model,
const QString &fileName)
const;
198 void updatePhraseBookActions();
199 void updatePhraseDictInternal(
int model);
200 void releaseInternal(
int model);
201 void saveInternal(
int model);
203#if QT_CONFIG(printsupport)
212 std::unique_ptr<HelpClient> m_helpClient;
214 QTreeView *m_contextView;
215 QTreeView *m_labelView;
216 QTreeView *m_messageView;
221 QSortFilterProxyModel *m_sortedContextsModel;
222 QSortFilterProxyModel *m_sortedLabelsModel;
223 QSortFilterProxyModel *m_activeSortedGroupsModel;
224 QSortFilterProxyModel *m_sortedIdBasedMessagesModel;
225 QSortFilterProxyModel *m_sortedTextBasedMessagesModel;
226 QSortFilterProxyModel *m_activeSortedMessagesModel;
229 QStackedWidget *m_sourceAndFormView;
230 QTabWidget *m_contextAndLabelView;
231 SourceCodeView *m_sourceCodeView;
232 QWidget *m_sourceCodeContainer;
233 QFrame *m_previewBanner;
234 QLabel *m_previewBannerLabel;
236 QString m_uiPreviewOnceFile;
237 QString m_qmlPreviewOnceFile;
243 QLabel *m_progressLabel;
244 QLabel *m_modifiedLabel;
246 QString m_phraseBookDir;
249 QList<PhraseBook *> m_phraseBooks;
250 QMap<QAction *, PhraseBook *> m_phraseBookMenu[3];
251#if QT_CONFIG(printsupport)
257 FindDialog::FindOptions m_findOptions;
258 int m_findStatusFilter = -1;
261 TranslateDialog *m_translateDialog;
262 QString m_latestFindText;
263 int m_latestCaseSensitivity;
264 QModelIndex m_searchIndex;
270 bool m_settingCurrentMessage;
271 std::optional<TranslationType> m_activeTranslationType;
272 int m_fileActiveModel;
273 int m_editActiveModel;
275 QDockWidget *m_contextAndLabelDock;
276 QDockWidget *m_messagesDock;
277 QDockWidget *m_phrasesDock;
278 QDockWidget *m_sourceAndFormDock;
279 QDockWidget *m_errorsDock;
283 RecentFiles m_recentFiles;
285 bool m_globalReadWrite =
true;
MainWindow(HelpClientType helpClientType)
static QString description()
void closeEvent(QCloseEvent *e) override
This event handler is called with the given event when Qt receives a window close request for a top-l...
bool openFiles(const QStringList &names)
bool eventFilter(QObject *obj, QEvent *ev) override
Filters events if this object has been installed as an event filter for the watched object.
Combined button and popup list for selecting options.
int main(int argc, char *argv[])
[ctor_close]