| 1 | // SPDX-FileCopyrightText: 2020 - 2022 UnionTech Software Technology Co., Ltd. |
| 2 | // |
| 3 | // SPDX-License-Identifier: GPL-3.0-only |
| 4 | |
| 5 | #include "qtinstallerfactory.h" |
| 6 | |
| 7 | #if defined(Q_PROCESSOR_X86) |
| 8 | #include "qtX86Installer.h" |
| 9 | #elif defined(Q_PROCESSOR_MIPS) |
| 10 | #include "qtmipsinstaller.h" |
| 11 | #elif defined(Q_PROCESSOR_ARM) |
| 12 | #include "qtarminstaller.h" |
| 13 | #elif defined(__sw_64__) |
| 14 | #include "qtswinstaller.h" |
| 15 | #else |
| 16 | #include "qtotherinstaller.h" |
| 17 | #endif |
| 18 | |
| 19 | #include <QDebug> |
| 20 | |
| 21 | QtInstallerFactory* QtInstallerFactory::m_pSelf = nullptr; |
| 22 | |
| 23 | QtInstallerFactory* QtInstallerFactory::getInstance() |
| 24 | { |
| 25 | if (nullptr == m_pSelf) { |
| 26 | m_pSelf = new QtInstallerFactory; |
| 27 | } |
| 28 | |
| 29 | return m_pSelf; |
| 30 | } |
| 31 | |
| 32 | QtBaseInstaller* QtInstallerFactory::createInstaller() |
| 33 | { |
| 34 | QtBaseInstaller* pInstaller = nullptr; |
| 35 | |
| 36 | #if defined(Q_PROCESSOR_X86) |
| 37 | qDebug() << "Architecture:X86_64"; |
| 38 | pInstaller = new QtX86Installer(); |
| 39 | #elif defined(Q_PROCESSOR_MIPS) |
| 40 | qDebug() << "Architecture:MIPS"; |
| 41 | pInstaller = new QtMipsInstaller; |
| 42 | #elif defined(Q_PROCESSOR_ARM) |
| 43 | qDebug() << "Architecture:ARM"; |
| 44 | pInstaller = new QtArmInstaller; |
| 45 | #elif defined(__sw_64__) |
| 46 | qDebug() << "Architecture:SW"; |
| 47 | pInstaller = new QtSwInstaller; |
| 48 | #else |
| 49 | qDebug() << "Architecture:Other"; |
| 50 | pInstaller = new QtOtherInstaller; |
| 51 | #endif |
| 52 | |
| 53 | return pInstaller; |
| 54 | } |
| 55 | |
| 56 | QtInstallerFactory::QtInstallerFactory(QObject *parent) : QObject(parent) |
| 57 | { |
| 58 | |
| 59 | } |