OpenClonk
C4ConsoleQtLocalizeOverview.h
Go to the documentation of this file.
1 /*
2 * OpenClonk, http://www.openclonk.org
3 *
4 * Copyright (c) 2001-2009, RedWolf Design GmbH, http://www.clonk.de/
5 * Copyright (c) 2013, The OpenClonk Team and contributors
6 *
7 * Distributed under the terms of the ISC license; see accompanying file
8 * "COPYING" for details.
9 *
10 * "Clonk" is a registered trademark of Matthes Bender, used with permission.
11 * See accompanying file "TRADEMARK" for details.
12 *
13 * To redistribute this file separately, substitute the full license texts
14 * for the above references.
15 */
16 
17 /* String localization editor */
18 
19 #ifndef INC_C4ConsoleQtLocalizeOverview
20 #define INC_C4ConsoleQtLocalizeOverview
21 #ifdef WITH_QT_EDITOR
22 
23 #include "C4Include.h" // needed for automoc
24 #include "editor/C4ConsoleGUI.h" // for OpenGL
25 #include "editor/C4ConsoleQt.h"
26 #include "editor/C4PropertyPath.h"
27 #include "ui_C4ConsoleQtLocalizeOverview.h"
28 
29 class C4ConsoleQtLocalizeOverviewDlg : public QDialog
30 {
31  Q_OBJECT
32 
33  Ui::LocalizeOverviewDialog ui;
34  std::vector<C4PropertyCollection::Entry> lang_strings;
35  std::map<QString, int32_t> lang2col; // Language-to-column lookup
36  std::vector<QString> col2lang; // Column-to-language loopup
37  bool is_refreshing{ false };
38 
39  enum TableItemType
40  {
41  TIT_Header, // Top row
42  TIT_Info, // Name+Path columns
43  TIT_Entry, // Editable string entry
44  };
45 
46 public:
47  C4ConsoleQtLocalizeOverviewDlg(class QMainWindow *parent_window);
48 
49 private:
50  int32_t GetColumnByLanguage(const char *lang) const;
51  int32_t AddLanguageColumn(const char *lang_id, const char *lang_name);
52  void SetTableItem(int32_t row, int32_t col, TableItemType item_type, const QString &text);
53  void reject() override;
54  void ClearTable();
55 
56 public slots:
57  void Refresh();
58  void OnTableItemChanged(QTableWidgetItem *item);
59 };
60 
61 #endif // WITH_QT_EDITOR
62 #endif // INC_C4ConsoleQtLocalizeOverview