1/****************************************************************************
2**
3** Copyright (C) 2016 The Qt Company Ltd.
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the Qt Linguist of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:GPL-EXCEPT$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU
19** General Public License version 3 as published by the Free Software
20** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
21** included in the packaging of this file. Please review the following
22** information to ensure the GNU General Public License requirements will
23** be met: https://www.gnu.org/licenses/gpl-3.0.html.
24**
25** $QT_END_LICENSE$
26**
27****************************************************************************/
28
29#ifndef FORMPREVIEWVIEW_H
30#define FORMPREVIEWVIEW_H
31
32#include <private/quiloader_p.h>
33
34#include <QtCore/QHash>
35#include <QtCore/QList>
36
37#include <QtWidgets/QMainWindow>
38
39QT_BEGIN_NAMESPACE
40
41class MultiDataModel;
42class FormFrame;
43class MessageItem;
44
45class QComboBox;
46class QListWidgetItem;
47class QGridLayout;
48class QMdiArea;
49class QMdiSubWindow;
50class QToolBox;
51class QTableWidgetItem;
52class QTreeWidgetItem;
53
54enum TranslatableEntryType {
55 TranslatableProperty,
56 TranslatableToolItemText,
57 TranslatableToolItemToolTip,
58 TranslatableTabPageText,
59 TranslatableTabPageToolTip,
60 TranslatableTabPageWhatsThis,
61 TranslatableListWidgetItem,
62 TranslatableTableWidgetItem,
63 TranslatableTreeWidgetItem,
64 TranslatableComboBoxItem
65};
66
67struct TranslatableEntry {
68 TranslatableEntryType type;
69 union {
70 QObject *object;
71 QComboBox *comboBox;
72 QTabWidget *tabWidget;
73 QToolBox *toolBox;
74 QListWidgetItem *listWidgetItem;
75 QTableWidgetItem *tableWidgetItem;
76 QTreeWidgetItem *treeWidgetItem;
77 } target;
78 union {
79 char *name;
80 int index;
81 struct {
82 short index; // Known to be below 1000
83 short column;
84 } treeIndex;
85 } prop;
86};
87
88typedef QHash<QUiTranslatableStringValue, QList<TranslatableEntry> > TargetsHash;
89
90class FormPreviewView : public QMainWindow
91{
92 Q_OBJECT
93public:
94 FormPreviewView(QWidget *parent, MultiDataModel *dataModel);
95
96 void setSourceContext(int model, MessageItem *messageItem);
97
98private:
99 bool m_isActive;
100 QString m_currentFileName;
101 QMdiArea *m_mdiArea;
102 QMdiSubWindow *m_mdiSubWindow;
103 QWidget *m_form;
104 TargetsHash m_targets;
105 QList<TranslatableEntry> m_highlights;
106 MultiDataModel *m_dataModel;
107
108 QString m_lastFormName;
109 QString m_lastClassName;
110 int m_lastModel;
111};
112
113QT_END_NAMESPACE
114
115#endif // FORMPREVIEWVIEW_H
116

source code of qttools/src/linguist/linguist/formpreviewview.h