diff --git a/src/app_deploy.pri b/src/app_deploy.pri index c4032395..8edaac8e 100644 --- a/src/app_deploy.pri +++ b/src/app_deploy.pri @@ -52,7 +52,7 @@ defineReplace(deploy_app_on_linux) { return ($$command) } -defineReplace(deploy_app_for_android) { +defineReplace(deploy_app_on_android) { #need QQT_BUILD_PWD command = @@ -106,7 +106,7 @@ contains(CONFIG, deploy_app) { } else: contains(QKIT_PRIVATE, macOS) { QMAKE_POST_LINK += $$deploy_app_on_mac() } else: contains(QKIT_PRIVATE, ANDROID||ANDROIDX86) { - QMAKE_POST_LINK += $$deploy_app_on_android() + #QMAKE_POST_LINK += $$deploy_app_on_android() } else { QMAKE_POST_LINK += $$deploy_app_on_linux() } diff --git a/src/app_deploy_config.pri b/src/app_deploy_config.pri index 988d3101..f02357eb 100644 --- a/src/app_deploy_config.pri +++ b/src/app_deploy_config.pri @@ -62,6 +62,8 @@ contains(CONFIG, app_copy_config) { QMAKE_POST_LINK += $$copy_config("$${APP_CONFIG_PWD}\\*") } else: contains(QKIT_PRIVATE, macOS) { QMAKE_POST_LINK += $$copy_config_on_mac("$${APP_CONFIG_PWD}/*") + } else: contains(QKIT_PRIVATE, ANDROID||ANDROIDX86) { + #QMAKE_POST_LINK += $$deploy_app_on_android() } else { QMAKE_POST_LINK += $$copy_config("$${APP_CONFIG_PWD}/*") } diff --git a/src/exquisite/gifwidgets/qqtgiflabel.cpp b/src/exquisite/gifwidgets/qqtgiflabel.cpp index b874362f..d81b05d6 100644 --- a/src/exquisite/gifwidgets/qqtgiflabel.cpp +++ b/src/exquisite/gifwidgets/qqtgiflabel.cpp @@ -8,6 +8,8 @@ QQtGifLabel::QQtGifLabel ( QWidget* parent ) : QQtLabel ( parent ) void QQtGifLabel::setGifFile ( QString gifFile ) { + m_movie->stop(); + m_movie->setFileName ( gifFile ); m_movie->start(); } diff --git a/src/exquisite/gifwidgets/qqtgifwidget.cpp b/src/exquisite/gifwidgets/qqtgifwidget.cpp index 065a6fd4..587cd7c2 100644 --- a/src/exquisite/gifwidgets/qqtgifwidget.cpp +++ b/src/exquisite/gifwidgets/qqtgifwidget.cpp @@ -11,6 +11,8 @@ QQtGifWidget::QQtGifWidget ( QWidget* parent ) : QQtWidget ( parent ) void QQtGifWidget::setGifFile ( QString gifFile ) { + m_movie->stop(); + m_movie->setFileName ( gifFile ); m_movie->start(); m_frameTimer->setInterval ( m_movie->speed() ); diff --git a/src/frame/qqtframe.h b/src/frame/qqtframe.h index d58fdbed..a7c80a47 100644 --- a/src/frame/qqtframe.h +++ b/src/frame/qqtframe.h @@ -117,6 +117,7 @@ enum #define CONFIG_PATH "./conf" #define LOG_PATH "./log" #define AV_PATH "./res" +#define SKIN_PATH "./skin" #define TABLE_LIBRARY "Library" #define TABLE_METHOD "Method" diff --git a/src/widgets/qqtwidgets.cpp b/src/widgets/qqtwidgets.cpp index f5a6a998..20e0bf97 100644 --- a/src/widgets/qqtwidgets.cpp +++ b/src/widgets/qqtwidgets.cpp @@ -17,85 +17,92 @@ tagBtnIconTable::tagBtnIconTable() pixmap[BTN_DISABLE] = "./skin/default/bt_bt_disable.png"; } -QString tagBtnIconTable::pixMap(int index) +QString tagBtnIconTable::pixMap ( int index ) { - if (index < 0 || index + 1 > BTN_MAX) + if ( index < 0 || index + 1 > BTN_MAX ) return pixmap[BTN_NORMAL]; return pixmap[index]; } -void tagBtnIconTable::setPixMap(int index, QString pix) +void tagBtnIconTable::setPixMap ( int index, QString pix ) { - if (index < 0 || index + 1 > BTN_MAX) + if ( index < 0 || index + 1 > BTN_MAX ) return; pixmap[index] = pix; } -void tagBtnIconTable::initNormal(QString normal, QString press) +void tagBtnIconTable::initNormal ( QString normal, QString press ) { - if (!normal.isEmpty()) + if ( !normal.isEmpty() ) pixmap[BTN_NORMAL] = normal; - if (!press.isEmpty()) + if ( !press.isEmpty() ) pixmap[BTN_PRESS] = press; } -void tagBtnIconTable::initCheck(QString uncheck, QString check) +void tagBtnIconTable::initCheck ( QString uncheck, QString check ) { - if (!uncheck.isEmpty()) + if ( !uncheck.isEmpty() ) pixmap[BTN_UNCHECK] = uncheck; - if (!check.isEmpty()) + if ( !check.isEmpty() ) pixmap[BTN_CHECK] = check; } -void tagBtnIconTable::initOther(QString hover, QString disable) +void tagBtnIconTable::initOther ( QString hover, QString disable ) { - if (!hover.isEmpty()) + if ( !hover.isEmpty() ) pixmap[BTN_HOVER] = hover; - if (!disable.isEmpty()) + if ( !disable.isEmpty() ) pixmap[BTN_DISABLE] = disable; } -QString& tagBtnIconTable::operator [](int index) +QString& tagBtnIconTable::operator [] ( int index ) { - if (index < 0 || index >= BTN_MAX) + if ( index < 0 || index >= BTN_MAX ) return pixmap[0]; return pixmap[index]; } -const QString& tagBtnIconTable::operator[](int index) const +const QString& tagBtnIconTable::operator[] ( int index ) const { - if (index < 0 || index >= BTN_MAX) + if ( index < 0 || index >= BTN_MAX ) return pixmap[0]; return pixmap[index]; } -void moveCenter(QWidget* w) +void moveCenter ( QWidget* w ) { int x1 = 0, y1 = 0; - x1 = (QApplication::desktop()->availableGeometry().width() - - w->width()) / 2; - y1 = (QApplication::desktop()->availableGeometry().height() - - w->height()) / 2; + x1 = ( QApplication::desktop()->availableGeometry().width() + - w->width() ) / 2; + y1 = ( QApplication::desktop()->availableGeometry().height() + - w->height() ) / 2; - w->move(x1, y1); + w->move ( x1, y1 ); return; } -void moveRight(QWidget* w) +void moveRight ( QWidget* w ) { - w->move((QApplication::desktop()->width() - w->width()), 0); + w->move ( ( QApplication::desktop()->width() - w->width() ), 0 ); } + +void moveFull ( QWidget* w ) +{ + QRect rect0 = QApplication::desktop()->availableGeometry(); + w->setGeometry ( rect0 ); + w->move ( rect0.left(), rect0.top() ); +} diff --git a/src/widgets/qqtwidgets.h b/src/widgets/qqtwidgets.h index 5e8a17bf..8dcfeef8 100644 --- a/src/widgets/qqtwidgets.h +++ b/src/widgets/qqtwidgets.h @@ -41,19 +41,19 @@ typedef struct QQTSHARED_EXPORT tagBtnIconTable QString pixmap[BTN_MAX]; tagBtnIconTable(); - QString pixMap(int index); - void setPixMap(int index, QString pix); - void initNormal(QString normal, QString press); - void initCheck(QString uncheck, QString check); - void initOther(QString hover, QString disable); - const QString& operator[](int index) const; - QString& operator [](int index); + QString pixMap ( int index ); + void setPixMap ( int index, QString pix ); + void initNormal ( QString normal, QString press ); + void initCheck ( QString uncheck, QString check ); + void initOther ( QString hover, QString disable ); + const QString& operator[] ( int index ) const; + QString& operator [] ( int index ); } TBtnIconTable; -QQTSHARED_EXPORT void moveCenter(QWidget* w); - -QQTSHARED_EXPORT void moveRight(QWidget* w); +QQTSHARED_EXPORT void moveCenter ( QWidget* w ); +QQTSHARED_EXPORT void moveRight ( QWidget* w ); +QQTSHARED_EXPORT void moveFull ( QWidget* w ); diff --git a/test/giftest/android/AndroidManifest.xml b/test/giftest/android/AndroidManifest.xml new file mode 100644 index 00000000..beff98c4 --- /dev/null +++ b/test/giftest/android/AndroidManifest.xml @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/giftest/android/assets/waiting.gif b/test/giftest/android/assets/waiting.gif new file mode 100644 index 00000000..71f359aa Binary files /dev/null and b/test/giftest/android/assets/waiting.gif differ diff --git a/test/giftest/android/assets/yun.png b/test/giftest/android/assets/yun.png new file mode 100644 index 00000000..531755da Binary files /dev/null and b/test/giftest/android/assets/yun.png differ diff --git a/test/giftest/android/res/drawable-hdpi/icon.png b/test/giftest/android/res/drawable-hdpi/icon.png new file mode 100644 index 00000000..c214b280 Binary files /dev/null and b/test/giftest/android/res/drawable-hdpi/icon.png differ diff --git a/test/giftest/android/res/drawable-ldpi/icon.png b/test/giftest/android/res/drawable-ldpi/icon.png new file mode 100644 index 00000000..e21e1c98 Binary files /dev/null and b/test/giftest/android/res/drawable-ldpi/icon.png differ diff --git a/test/giftest/android/res/drawable-mdpi/icon.png b/test/giftest/android/res/drawable-mdpi/icon.png new file mode 100644 index 00000000..24680bc7 Binary files /dev/null and b/test/giftest/android/res/drawable-mdpi/icon.png differ diff --git a/test/giftest/android/res/values/libs.xml b/test/giftest/android/res/values/libs.xml new file mode 100644 index 00000000..4009a778 --- /dev/null +++ b/test/giftest/android/res/values/libs.xml @@ -0,0 +1,25 @@ + + + + https://download.qt.io/ministro/android/qt5/qt-5.9 + + + + + + + + + + + + + + + + + + + + diff --git a/test/giftest/giftest.pro b/test/giftest/giftest.pro index 13329795..62fb4f63 100644 --- a/test/giftest/giftest.pro +++ b/test/giftest/giftest.pro @@ -33,9 +33,6 @@ HEADERS += \ FORMS += \ giftestdialog.ui -CONFIG += mobility -MOBILITY = - #促使qqt_deploy_config配置执行,没有这个变量不执行。 APP_CONFIG_PWD = $${PWD}/AppRoot win32 { @@ -45,3 +42,15 @@ win32 { #促使编译源代码,qmake pri配置里面的QMAKE_XX_LINK命令就会执行。 system("touch main.cpp") include(../../src/app_base_manager.pri) + +contains(QKIT_PRIVATE, ANDROID||ANDROIDX86) { + CONFIG += mobility + MOBILITY = + DISTFILES += \ + $${PWD}/android/AndroidManifest.xml + + ANDROID_PACKAGE_SOURCE_DIR = $${PWD}/android +} + +RESOURCES += \ + giftest.qrc diff --git a/test/giftest/giftest.qrc b/test/giftest/giftest.qrc new file mode 100644 index 00000000..0085a1b1 --- /dev/null +++ b/test/giftest/giftest.qrc @@ -0,0 +1,6 @@ + + + AppRoot/waiting.gif + AppRoot/yun.png + + diff --git a/test/giftest/giftestdialog.cpp b/test/giftest/giftestdialog.cpp index 4d7100f4..b00bce97 100644 --- a/test/giftest/giftestdialog.cpp +++ b/test/giftest/giftestdialog.cpp @@ -1,14 +1,43 @@ #include "giftestdialog.h" #include "ui_giftestdialog.h" +#if defined (__ANDROID__) || defined (__ANDROIDX86__) +#define res(file) QString("%1/%2").arg("://AppRoot").arg(file) +#else +#define res(file) QString("%1/%2").arg(".").arg(file) +#endif + GifTestDialog::GifTestDialog ( QWidget* parent ) : QDialog ( parent ), ui ( new Ui::GifTestDialog ) { ui->setupUi ( this ); + + //使用res函数以前,代码量如此巨大。 +#if defined (__ANDROID__) || defined (__ANDROIDX86__) +#if 0 + //如果apk文件被删除了呢? + ui->labelGif->setGifFile ( "assets:/waiting.gif" ); + ui->widgetGif->setGifFile ( "assets:/waiting.gif" ); + ui->widgetQQt->setPixmap ( "assets:/yun.png" ); +#else + ui->labelGif->setGifFile ( "://AppRoot/waiting.gif" ); + ui->widgetGif->setGifFile ( "://AppRoot/waiting.gif" ); + ui->widgetQQt->setPixmap ( "://AppRoot/yun.png" ); +#endif +#else + //不兼容android.... ui->labelGif->setGifFile ( "./waiting.gif" ); ui->widgetGif->setGifFile ( "./waiting.gif" ); ui->widgetQQt->setPixmap ( "./yun.png" ); +#endif + + //使用了res函数以后 代码得到了极大简化 + pline() << res ( "waiting.gif" ); + ui->labelGif->setGifFile ( res ( "waiting.gif" ) ); + ui->widgetGif->setGifFile ( res ( "waiting.gif" ) ); + ui->widgetQQt->setPixmap ( res ( "yun.png" ) ); + pline() << QMovie::supportedFormats(); } diff --git a/test/giftest/giftestdialog.ui b/test/giftest/giftestdialog.ui index b4119050..274bd4bc 100644 --- a/test/giftest/giftestdialog.ui +++ b/test/giftest/giftestdialog.ui @@ -6,8 +6,8 @@ 0 0 - 948 - 650 + 698 + 330 diff --git a/test/giftest/main.cpp b/test/giftest/main.cpp index dbbd5501..4124e4f1 100644 --- a/test/giftest/main.cpp +++ b/test/giftest/main.cpp @@ -1,5 +1,7 @@ #include "giftestdialog.h" #include +#include "qqtcore.h" +#include "qqtwidgets.h" int main ( int argc, char* argv[] ) { @@ -8,6 +10,7 @@ int main ( int argc, char* argv[] ) GifTestDialog w; w.show(); + moveFull ( &w ); return a.exec(); }