From 1ac8cd9ba30d810b0df290afe99413b9253de196 Mon Sep 17 00:00:00 2001 From: tianduanrui <2407223896@qq.com> Date: Sun, 12 Nov 2017 22:44:16 +0800 Subject: [PATCH] update support ios --- QQt.pro | 2 + examples/qqtprintsupportexample/main.cpp | 11 +++ .../qqtprintsupportexample/mainwindow.cpp | 14 ++++ examples/qqtprintsupportexample/mainwindow.h | 22 +++++ examples/qqtprintsupportexample/mainwindow.ui | 21 +++++ .../qqtprintsupportexample.pro | 80 +++++++++++++++++++ src/qqt-qt.h | 4 +- src/qqt_header.pri | 36 ++++++--- src/qqt_install.pri | 4 +- src/qqt_kit.pri | 2 +- src/qqt_source.pri | 39 ++++----- src/widgets/qqtapplication.cpp | 12 ++- 12 files changed, 213 insertions(+), 34 deletions(-) create mode 100644 examples/qqtprintsupportexample/main.cpp create mode 100644 examples/qqtprintsupportexample/mainwindow.cpp create mode 100644 examples/qqtprintsupportexample/mainwindow.h create mode 100644 examples/qqtprintsupportexample/mainwindow.ui create mode 100644 examples/qqtprintsupportexample/qqtprintsupportexample.pro diff --git a/QQt.pro b/QQt.pro index aa603240..2e867d33 100644 --- a/QQt.pro +++ b/QQt.pro @@ -23,6 +23,8 @@ SUBDIRS += examples/exquisite #----------------------------------------------------------------- #SUBDIRS += examples/qqtframe3 #SUBDIRS += examples/VegeTablesPrice +#can't support ios +#SUBDIRS += examples/qqtprintsupportexample #----------------------------------------------------------------- #need vlcQt libvlc library diff --git a/examples/qqtprintsupportexample/main.cpp b/examples/qqtprintsupportexample/main.cpp new file mode 100644 index 00000000..b48f94ec --- /dev/null +++ b/examples/qqtprintsupportexample/main.cpp @@ -0,0 +1,11 @@ +#include "mainwindow.h" +#include + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + MainWindow w; + w.show(); + + return a.exec(); +} diff --git a/examples/qqtprintsupportexample/mainwindow.cpp b/examples/qqtprintsupportexample/mainwindow.cpp new file mode 100644 index 00000000..49d64fce --- /dev/null +++ b/examples/qqtprintsupportexample/mainwindow.cpp @@ -0,0 +1,14 @@ +#include "mainwindow.h" +#include "ui_mainwindow.h" + +MainWindow::MainWindow(QWidget *parent) : + QMainWindow(parent), + ui(new Ui::MainWindow) +{ + ui->setupUi(this); +} + +MainWindow::~MainWindow() +{ + delete ui; +} diff --git a/examples/qqtprintsupportexample/mainwindow.h b/examples/qqtprintsupportexample/mainwindow.h new file mode 100644 index 00000000..a3948a91 --- /dev/null +++ b/examples/qqtprintsupportexample/mainwindow.h @@ -0,0 +1,22 @@ +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include + +namespace Ui { +class MainWindow; +} + +class MainWindow : public QMainWindow +{ + Q_OBJECT + +public: + explicit MainWindow(QWidget *parent = 0); + ~MainWindow(); + +private: + Ui::MainWindow *ui; +}; + +#endif // MAINWINDOW_H diff --git a/examples/qqtprintsupportexample/mainwindow.ui b/examples/qqtprintsupportexample/mainwindow.ui new file mode 100644 index 00000000..7ebf8731 --- /dev/null +++ b/examples/qqtprintsupportexample/mainwindow.ui @@ -0,0 +1,21 @@ + + MainWindow + + + + 0 + 0 + 800 + 480 + + + + MainWindow + + + + + + + + diff --git a/examples/qqtprintsupportexample/qqtprintsupportexample.pro b/examples/qqtprintsupportexample/qqtprintsupportexample.pro new file mode 100644 index 00000000..ad1b0a93 --- /dev/null +++ b/examples/qqtprintsupportexample/qqtprintsupportexample.pro @@ -0,0 +1,80 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2017-11-12T21:59:07 +# +#------------------------------------------------- + +QT += core gui + +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets + +TARGET = qqtprintsupportexample +TEMPLATE = app + +# The following define makes your compiler emit warnings if you use +# any feature of Qt which has been marked as deprecated (the exact warnings +# depend on your compiler). Please consult the documentation of the +# deprecated API in order to know how to port your code away from it. +DEFINES += QT_DEPRECATED_WARNINGS + +# You can also make your code fail to compile if you use deprecated APIs. +# In order to do so, uncomment the following line. +# You can also select to disable deprecated APIs only up to a certain version of Qt. +#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 + + +SOURCES += \ + main.cpp \ + mainwindow.cpp + +HEADERS += \ + mainwindow.h + +FORMS += \ + mainwindow.ui + +CONFIG += mobility +MOBILITY = + +#------------------------------------------------- +#link qqt library +#if you link a library to your app, on android you must select the running kit to the app, not LibQQt e.g. +#------------------------------------------------- +include(../qqtframe2/link_qqt_library.pri) + +#------------------------------------------------- +#install +#------------------------------------------------- +#CONFIG += can_install +can_install:equals(QKIT_PRIVATE, EMBEDDED) { + target.path = /Application + INSTALLS += target +} else: unix { + equals(QKIT_PRIVATE, macOS) { + target.path = /Applications + INSTALLS += target + } +} + +#------------------------------------------------- +##project environ +#------------------------------------------------- +#default +message ($${TARGET} config $${CONFIG}) +message ($${TARGET} define $${DEFINES}) + +contains(QKIT_PRIVATE, ANDROID|ANDROIDX86) { + CONFIG += mobility + MOBILITY = + DISTFILES += \ + android/AndroidManifest.xml \ + android/gradle/wrapper/gradle-wrapper.jar \ + android/gradlew \ + android/res/values/libs.xml \ + android/build.gradle \ + android/gradle/wrapper/gradle-wrapper.properties \ + android/gradlew.bat + + ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android +} + diff --git a/src/qqt-qt.h b/src/qqt-qt.h index 1d703797..863ab677 100644 --- a/src/qqt-qt.h +++ b/src/qqt-qt.h @@ -39,8 +39,6 @@ #ifdef __PRINTSUPPORT__ #include -#include -#include #endif #include @@ -88,6 +86,8 @@ #include #include +#ifdef __PROCESSMODULE__ #include +#endif #endif // QQTGUIQT_H diff --git a/src/qqt_header.pri b/src/qqt_header.pri index 943c77de..592be8fa 100644 --- a/src/qqt_header.pri +++ b/src/qqt_header.pri @@ -76,6 +76,7 @@ contains (DEFINES, __QEXTSERIALPORT__) { win32:DEFINES += _TTY_WIN_ #message ( __QEXTSERIALPORT__ Defined in $${TARGET}) } else { + #message ( __QSERIALPORT__ Defined in $${TARGET}) greaterThan(QT_MAJOR_VERSION, 4): QT += serialport lessThan(QT_MAJOR_VERSION, 5): CONFIG += serialport unix { @@ -118,21 +119,38 @@ contains (DEFINES, __CPP11__) { #lambda also need c++11 } +##################DeviceWatcher Module############################### +#used in windows linux e-linux android, mac ios not support exactly +#if you use DeviceWatcher , open this annotation +DEFINES += __PLUGINWATCHER__ +contains(QKIT_PRIVATE, iOS||iOSSimulator||macOS) { + DEFINES -= __PLUGINWATCHER__ +} + +##################Process Module############################### +#if you use qprocess , open this annotation +DEFINES += __PROCESSMODULE__ +#ios has no backend process +contains(QKIT_PRIVATE, iOS||iOSSimulator) { + DEFINES -= __PROCESSMODULE__ +} + ##################PrintSupport Module############################### #if you use printsupport , open this annotation DEFINES += __PRINTSUPPORT__ -#ios can't support this feature -contains(QKIT_PRIVATE, iOS||iOSSimulator) { - #DEFINES -= __PRINTSUPPORT__ - qtHaveModule(printsupport) : message(ios have printsupport) -} -#Qt5.9.1, ios android can't support this feature +#Qt5.9.1, ios android can't support this feature. +#Qt5.9.1, broken equals(QT_VERSION, 5.9.1) { - contains(QKIT_PRIVATE, ANDROID||ANDROIDX86) { + contains(QKIT_PRIVATE, iOS||iOSSimulator||ANDROID||ANDROIDX86) { DEFINES -= __PRINTSUPPORT__ } } +#ios can't use printsupport +contains(QKIT_PRIVATE, iOS||iOSSimulator) { + DEFINES -= __PRINTSUPPORT__ +} contains (DEFINES, __PRINTSUPPORT__) { + #qtHaveModule(printsupport) : message(qqt use module printsupport) greaterThan(QT_MAJOR_VERSION, 4): QT += printsupport #if you use qcustomplot, open this annotation DEFINES += __CUSTOMPLOT__ @@ -189,8 +207,8 @@ win32 { #LIBS += -F$${MACOSXSDK}/System/Library/Frameworks #LIBS += -L$${MACOSXSDK}/usr/lib LIBS += -framework DiskArbitration -framework Cocoa -framework IOKit - } else:contains(QKIT_PRIVATE, iOS|iOSSimulator) { - LIBS += -l DiskArbitration -l Cocoa -l IOKit + }else:contains(QKIT_PRIVATE, iOS|iOSSimulator){ + QMAKE_LFLAGS += -ObjC -lsqlite3 -lz -framework "AddressBook" -framework "AssetsLibrary" -framework "CoreFoundation" -framework "CoreGraphics" -framework "CoreLocation" -framework "CoreMotion" -framework "MessageUI" -framework "SystemConfiguration" } } ################################################################## diff --git a/src/qqt_install.pri b/src/qqt_install.pri index a29c748d..da8cc65f 100644 --- a/src/qqt_install.pri +++ b/src/qqt_install.pri @@ -256,7 +256,7 @@ contains(CONFIG, qqt_create_sdk){ post_link += $$create_dir_struct() contains(QKIT_PRIVATE, macOS) { - message(create QQt mac bundle framework) + #message(create QQt mac bundle framework) post_link += $$MK_DIR lib/$${MODULE_NAME}.framework $$CMD_SEP post_link += $$CD lib/$${MODULE_NAME}.framework $$CMD_SEP post_link += $$create_mac_sdk() $$CMD_SEP @@ -264,7 +264,7 @@ contains(CONFIG, qqt_create_sdk){ #create prl post_link += $$COPY $$QQT_BUILD_DIR/$${MODULE_NAME}.framework/$${MODULE_NAME}.prl lib/$${MODULE_NAME}.framework/$${MODULE_NAME}.prl $$CMD_SEP } else { - message(create QQt linux struct library) + #message(create QQt linux struct library) post_link += $$create_linux_sdk() $$CMD_SEP post_link += $$COPY $$QQT_BUILD_DIR/*.prl lib $$CMD_SEP } diff --git a/src/qqt_kit.pri b/src/qqt_kit.pri index 23160729..800ed222 100644 --- a/src/qqt_kit.pri +++ b/src/qqt_kit.pri @@ -42,11 +42,11 @@ equals(QKIT_PRIVATE, EMBEDDED) { DEFINES += __IOS__ } else:equals(QKIT_PRIVATE, iOSSimulator) { DEFINES += __IOS__ + #TODO:no customplot word printer process } else:equals(QKIT_PRIVATE, ANDROID) { DEFINES += __ANDROID__ } else:equals(QKIT_PRIVATE, ANDROIDX86) { DEFINES += __ANDROID__ - #todo:no customplot word printer } #QMAKESPEC_NAME = $${QMAKESPEC} diff --git a/src/qqt_source.pri b/src/qqt_source.pri index e5768115..283bddc2 100644 --- a/src/qqt_source.pri +++ b/src/qqt_source.pri @@ -126,32 +126,33 @@ FORMS += \ #multimedia #arm mips #TODO: +wince +android +ios +macOS +win +linux -SOURCES += $$PWD/multimedia/qqtmplayer.cpp -HEADERS += $$PWD/multimedia/qqtmplayer.h +contains (DEFINES, __PROCESSMODULE__) { + SOURCES += $$PWD/multimedia/qqtmplayer.cpp + HEADERS += $$PWD/multimedia/qqtmplayer.h +} #pluginwatcher #TODO: macOS dump -win32 { - contains (DEFINES, QQT_LIBRARY) { - DEFINES += BUILD_QDEVICEWATCHER_LIB - } else: contains (DEFINES, QQT_STATIC_LIBRARY) { - DEFINES += BUILD_QDEVICEWATCHER_STATIC - } - wince*: SOURCES += $$PWD/pluginwatcher/qdevicewatcher_wince.cpp - else: SOURCES += $$PWD/pluginwatcher/qdevicewatcher_win32.cpp -} -unix { - mac* { +contains(DEFINES, __PLUGINWATCHER__) { + contains(QKIT_PRIVATE, WIN32|WIN64) { + contains (DEFINES, QQT_LIBRARY) { + DEFINES += BUILD_QDEVICEWATCHER_LIB + } else: contains (DEFINES, QQT_STATIC_LIBRARY) { + DEFINES += BUILD_QDEVICEWATCHER_STATIC + } + wince*: SOURCES += $$PWD/pluginwatcher/qdevicewatcher_wince.cpp + else: SOURCES += $$PWD/pluginwatcher/qdevicewatcher_win32.cpp + }else:contains(QKIT_PRIVATE, macOS) { SOURCES += $$PWD/pluginwatcher/qdevicewatcher_mac.cpp - } else { + }else { SOURCES += $$PWD/pluginwatcher/qdevicewatcher_linux.cpp } + SOURCES += $$PWD/pluginwatcher/qdevicewatcher.cpp \ + $$PWD/pluginwatcher/qqtpluginwatcher.cpp + HEADERS += $$PWD/pluginwatcher/qqtpluginwatcher.h \ + $$PWD/pluginwatcher/qdevicewatcher.h \ + $$PWD/pluginwatcher/qdevicewatcher_p.h } -SOURCES += $$PWD/pluginwatcher/qdevicewatcher.cpp \ - $$PWD/pluginwatcher/qqtpluginwatcher.cpp -HEADERS += $$PWD/pluginwatcher/qqtpluginwatcher.h \ - $$PWD/pluginwatcher/qdevicewatcher.h \ - $$PWD/pluginwatcher/qdevicewatcher_p.h #printsupport #DEFINES += __PRINTSUPPORT__ diff --git a/src/widgets/qqtapplication.cpp b/src/widgets/qqtapplication.cpp index dd099187..09ff6beb 100644 --- a/src/widgets/qqtapplication.cpp +++ b/src/widgets/qqtapplication.cpp @@ -1,5 +1,7 @@ #include "qqtapplication.h" +#ifdef __PLUGINWATCHER__ #include "qqtpluginwatcher.h" +#endif #include #include #include @@ -10,7 +12,9 @@ #include #include #include +#ifdef __PROCESSMODULE__ #include +#endif QQtApplication::QQtApplication(int& argc, char** argv) : QApplication(argc, argv), @@ -56,7 +60,7 @@ QQtApplication::QQtApplication(int& argc, char** argv) : QQTInput::Instance()->Init("min", "control", "QQT", 14, 14); #endif -#if ( !defined (__DARWIN__) && !defined(__IOS__) ) +#ifdef __PLUGINWATCHER__ QObject::connect(QQTPluginWatcher::Instance(), SIGNAL(storageChanged(int)), this, SLOT(slotUPanAutoRun(int))); #endif @@ -93,6 +97,7 @@ void QQtApplication::slotUPanAutoRun(int status) if (!bUPanAutoRun) return; +#ifdef __PLUGINWATCHER__ if (QQTPluginWatcher::E_ADD == status) { QString mP = QQTPluginWatcher::Instance()->upanMountPath(); @@ -109,10 +114,15 @@ void QQtApplication::slotUPanAutoRun(int status) { return; } +#ifdef __PROCESSMODULE__ QProcess* p = new QProcess(this); p->setWorkingDirectory(mP); p->start(app); +#else + //TODO: +#endif } +#endif }