File indexing completed on 2025-01-05 04:26:49

0001 /*
0002  * Replacement fot QT Bindings that were removed from QT5
0003  * Copyright (C) 2020  Pedro de Carvalho Gomes <pedrogomes81@gmail.com>
0004  *
0005  * This program is free software: you can redistribute it and/or modify
0006  * it under the terms of the GNU General Public License as published by
0007  * the Free Software Foundation, either version 3 of the License, or
0008  * (at your option) any later version.
0009  *
0010  * This program is distributed in the hope that it will be useful,
0011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0013  * GNU General Public License for more details.
0014  *
0015  * You should have received a copy of the GNU General Public License
0016  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
0017  */
0018 
0019 #ifndef CORETRANSLATOR_H
0020 #define CORETRANSLATOR_H
0021 
0022 #include "QtBinding.h"
0023 
0024 #include <QTranslator>
0025 
0026 namespace QtBindings
0027 {
0028     namespace Core
0029     {
0030         class Translator : public QTranslator, public QtBindings::Base<Translator>
0031         {
0032         Q_OBJECT
0033 
0034         public:
0035             Q_INVOKABLE Translator(QObject *parent = Q_NULLPTR);
0036             Q_INVOKABLE Translator(const Translator &other);
0037             Translator &operator=(const Translator& other);
0038         public slots:
0039             virtual QString translate(const char *context, const char *sourceText, const char *disambiguation = Q_NULLPTR, int n = -1) const override ;
0040             virtual bool isEmpty() const override;
0041             bool load(const QString & filename, const QString & directory = QString(), const QString & search_delimiters = QString(), const QString & suffix = QString());
0042             bool load(const QLocale & locale, const QString & filename, const QString & prefix = QString(), const QString & directory = QString(), const QString & suffix = QString());
0043             bool load(const uchar *data, int len, const QString &directory = QString());
0044         };
0045     }
0046 }
0047 Q_DECLARE_METATYPE(QtBindings::Core::Translator)
0048 #endif //CORETRANSLATOR_H