File indexing completed on 2025-01-19 04:25:14
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 CORECOREAPPLICATION_H 0020 #define CORECOREAPPLICATION_H 0021 0022 #include "QtBinding.h" 0023 #include "CoreTranslator.h" 0024 #include <QObject> 0025 0026 class QJSEngine; 0027 0028 namespace QtBindings 0029 { 0030 namespace Core 0031 { 0032 /* This class exceptionally does not inherit from its QT respective 0033 * because its a singleton. 0034 * */ 0035 class CoreApplication : public QObject, public QtBindings::Base<CoreApplication> 0036 { 0037 Q_OBJECT 0038 public: 0039 Q_INVOKABLE CoreApplication(); 0040 Q_INVOKABLE CoreApplication(const CoreApplication& other); 0041 Q_INVOKABLE static bool installTranslator(Translator *messageFile); 0042 Q_INVOKABLE static QString translate(QString context, QString key); 0043 CoreApplication &operator=(const CoreApplication &other); 0044 }; 0045 } 0046 } 0047 Q_DECLARE_METATYPE(QtBindings::Core::CoreApplication) 0048 #endif //CORECOREAPPLICATION_H