blob: b7b029bb0a7b7d1ac1b361e9ebb2d08714dfa1d7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#ifndef LANGUAGECHOOSER_H
#define LANGUAGECHOOSER_H
#include <QDialog>
#include <QHash>
#include <QStringList>
QT_BEGIN_NAMESPACE
class QAbstractButton;
class QCheckBox;
class QDialogButtonBox;
class QGroupBox;
QT_END_NAMESPACE
class MainWindow;
class LanguageChooser : public QDialog
{
Q_OBJECT
public:
explicit LanguageChooser(const QString &defaultLang = QString(), QWidget *parent = nullptr);
protected:
bool eventFilter(QObject *object, QEvent *event) override;
void closeEvent(QCloseEvent *event) override;
private slots:
void checkBoxToggled();
void showAll();
void hideAll();
private:
static QStringList findQmFiles();
static QString languageName(const QString &qmFile);
static QColor colorForLanguage(const QString &language);
static bool languageMatch(QStringView lang, QStringView qmFile);
QGroupBox *groupBox;
QDialogButtonBox *buttonBox;
QAbstractButton *showAllButton;
QAbstractButton *hideAllButton;
QHash<QCheckBox *, QString> qmFileForCheckBoxMap;
QHash<QCheckBox *, MainWindow *> mainWindowForCheckBoxMap;
};
#endif
|