diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml new file mode 100644 index 0000000000..af287cbebe --- /dev/null +++ b/.github/workflows/android.yml @@ -0,0 +1,24 @@ +name: Android CI + +on: + push: + branches: [ feature/android ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: set up JDK 1.8 + uses: actions/setup-java@v1 + with: + java-version: 1.8 + + - name: Make gradlew executable + run: chmod +x ./gradlew + + - name: Build with Gradle + run: ./gradlew build + diff --git a/Jamulus.pro b/Jamulus.pro index 2bd65c001a..55c979364d 100755 --- a/Jamulus.pro +++ b/Jamulus.pro @@ -47,6 +47,7 @@ DEFINES += APP_VERSION=\\\"$$VERSION\\\" \ USE_ALLOCA \ CUSTOM_MODES \ _REENTRANT +DEFINES += "BOOL_CLOSE_DIALOGS_ON_BACKBUTTON=0" # fixes android ui issue # some depreciated functions need to be kept for older versions to build # TODO as soon as we drop support for the old Qt version, remove the following line @@ -176,6 +177,9 @@ win32 { # enabled only for debugging on android devices DEFINES += ANDROIDDEBUG + DEFINES -= BOOL_CLOSE_DIALOGS_ON_BACKBUTTON=0 # fixes android ui issue + DEFINES += BOOL_CLOSE_DIALOGS_ON_BACKBUTTON=1 # fixes android ui issue + target.path = /tmp/your_executable # path on device INSTALLS += target diff --git a/src/analyzerconsole.cpp b/src/analyzerconsole.cpp index 469ac9560a..12f912293c 100644 --- a/src/analyzerconsole.cpp +++ b/src/analyzerconsole.cpp @@ -220,3 +220,13 @@ int CAnalyzerConsole::CalcYPosInGraph ( const double dAxisMin, return GraphGridFrame.y() + static_cast ( static_cast ( GraphGridFrame.height() ) * ( 1 - dYValNorm ) ); } + +void CAnalyzerConsole::keyPressEvent ( QKeyEvent *e ) +{ + if (BOOL_CLOSE_DIALOGS_ON_BACKBUTTON && ( e->key() == Qt::Key_Back )){ + this->close(); // otherwise, dialog does not show properly again in android + return; + }else{ + QDialog::keyPressEvent ( e ); + } +} diff --git a/src/analyzerconsole.h b/src/analyzerconsole.h index f5770da2a4..5a6a12a704 100644 --- a/src/analyzerconsole.h +++ b/src/analyzerconsole.h @@ -31,6 +31,7 @@ #include #include #include +#include #include "client.h" @@ -87,4 +88,6 @@ class CAnalyzerConsole : public QDialog public slots: void OnTimerErrRateUpdate(); + + void keyPressEvent ( QKeyEvent *e ); }; diff --git a/src/chatdlg.cpp b/src/chatdlg.cpp index 9664794bbc..403a348a8a 100755 --- a/src/chatdlg.cpp +++ b/src/chatdlg.cpp @@ -140,3 +140,16 @@ void CChatDlg::OnAnchorClicked ( const QUrl& Url ) } } } + +void CChatDlg::keyPressEvent ( QKeyEvent *e ) // block escape key & fix android back key +{ + if ( e->key() == Qt::Key_Escape ){ + ; // ignore escape key + }else if (BOOL_CLOSE_DIALOGS_ON_BACKBUTTON && ( e->key() == Qt::Key_Back )){ + this->close(); // otherwise, dialog does not show properly again in android + return; + }else{ + QDialog::keyPressEvent ( e ); + } +} + diff --git a/src/chatdlg.h b/src/chatdlg.h index 8ce46ff4e3..48315a9c08 100755 --- a/src/chatdlg.h +++ b/src/chatdlg.h @@ -54,8 +54,7 @@ public slots: void OnClearChatHistory(); void OnAnchorClicked ( const QUrl& Url ); - void keyPressEvent ( QKeyEvent *e ) // block escape key - { if ( e->key() != Qt::Key_Escape ) QDialog::keyPressEvent ( e ); } + void keyPressEvent ( QKeyEvent *e ); signals: void NewLocalInputText ( QString strNewText ); diff --git a/src/clientdlg.cpp b/src/clientdlg.cpp index df2468cf7f..b110ccae75 100755 --- a/src/clientdlg.cpp +++ b/src/clientdlg.cpp @@ -1354,3 +1354,15 @@ rbtReverbSelR->setStyleSheet ( "" ); // also apply GUI design to child GUI controls MainMixerBoard->SetGUIDesign ( eNewDesign ); } + +void CClientDlg::keyPressEvent ( QKeyEvent *e ) // block escape key & fix android back key +{ + if ( e->key() == Qt::Key_Escape ){ + ; // ignore escape key + }else if (BOOL_CLOSE_DIALOGS_ON_BACKBUTTON && ( e->key() == Qt::Key_Back )){ + this->close(); // otherwise, dialog does not show properly again in android + return; + }else{ + QDialog::keyPressEvent ( e ); + } +} diff --git a/src/clientdlg.h b/src/clientdlg.h index b58c1e967e..7d9c5c8421 100755 --- a/src/clientdlg.h +++ b/src/clientdlg.h @@ -238,6 +238,5 @@ public slots: void accept() { close(); } // introduced by pljones - void keyPressEvent ( QKeyEvent *e ) // block escape key - { if ( e->key() != Qt::Key_Escape ) QDialog::keyPressEvent ( e ); } + void keyPressEvent ( QKeyEvent *e ); }; diff --git a/src/clientsettingsdlg.cpp b/src/clientsettingsdlg.cpp index c697682227..a8fe1095f9 100755 --- a/src/clientsettingsdlg.cpp +++ b/src/clientsettingsdlg.cpp @@ -754,3 +754,13 @@ void CClientSettingsDlg::UpdateCustomCentralServerComboBox() } } } + +void CClientSettingsDlg::keyPressEvent ( QKeyEvent *e ) // block escape key & fix android back key +{ + if (BOOL_CLOSE_DIALOGS_ON_BACKBUTTON && ( e->key() == Qt::Key_Back )){ + this->close(); // otherwise, dialog does not show properly again in android + return; + }else{ + QDialog::keyPressEvent ( e ); + } +} diff --git a/src/clientsettingsdlg.h b/src/clientsettingsdlg.h index 78f17b80ed..b355ae30ca 100755 --- a/src/clientsettingsdlg.h +++ b/src/clientsettingsdlg.h @@ -37,6 +37,7 @@ #include #include #include +#include #include "global.h" #include "client.h" #include "settings.h" @@ -107,6 +108,7 @@ public slots: void OnGUIDesignActivated ( int iDesignIdx ); void OnDriverSetupClicked(); void OnLanguageChanged ( QString strLanguage ) { pSettings->strLanguage = strLanguage; } + void keyPressEvent ( QKeyEvent *e ); signals: void GUIDesignChanged(); diff --git a/src/connectdlg.cpp b/src/connectdlg.cpp index b714f2f8cb..19575ce0fb 100755 --- a/src/connectdlg.cpp +++ b/src/connectdlg.cpp @@ -921,3 +921,13 @@ void CConnectDlg::DeleteAllListViewItemChilds ( QTreeWidgetItem* pItem ) delete pCurChildItem; } } + +void CConnectDlg::keyPressEvent ( QKeyEvent *e ) +{ + if (BOOL_CLOSE_DIALOGS_ON_BACKBUTTON && ( e->key() == Qt::Key_Back )){ + this->close(); // otherwise, dialog does not show properly again in android + return; + }else{ + QDialog::keyPressEvent ( e ); + } +} diff --git a/src/connectdlg.h b/src/connectdlg.h index 5c15f3011a..e6e9b9f854 100755 --- a/src/connectdlg.h +++ b/src/connectdlg.h @@ -31,6 +31,7 @@ #include #include #include +#include #include "global.h" #include "settings.h" #include "multicolorled.h" @@ -109,6 +110,8 @@ public slots: void OnTimerPing(); void OnTimerReRequestServList(); + void keyPressEvent ( QKeyEvent *e ); + signals: void ReqServerListQuery ( CHostAddress InetAddr ); void CreateCLServerListPingMes ( CHostAddress InetAddr ); diff --git a/src/serverdlg.cpp b/src/serverdlg.cpp index 22d86e0a06..fff43c65a5 100755 --- a/src/serverdlg.cpp +++ b/src/serverdlg.cpp @@ -834,3 +834,15 @@ void CServerDlg::changeEvent ( QEvent* pEvent ) } } } + +void CServerDlg::keyPressEvent ( QKeyEvent *e ) // block escape key & fix android back key +{ + if ( e->key() == Qt::Key_Escape ){ + ; // ignore escape key + }else if (BOOL_CLOSE_DIALOGS_ON_BACKBUTTON && ( e->key() == Qt::Key_Back )){ + this->close(); // otherwise, dialog does not show properly again in android + return; + }else{ + QDialog::keyPressEvent ( e ); + } +} diff --git a/src/serverdlg.h b/src/serverdlg.h index 399b4b98e9..463ac5b312 100755 --- a/src/serverdlg.h +++ b/src/serverdlg.h @@ -114,8 +114,7 @@ public slots: void OnSysTrayActivated ( QSystemTrayIcon::ActivationReason ActReason ); void OnWelcomeMessageChanged() { pServer->SetWelcomeMessage ( tedWelcomeMessage->toPlainText() ); } - void keyPressEvent ( QKeyEvent *e ) // block escape key - { if ( e->key() != Qt::Key_Escape ) QDialog::keyPressEvent ( e ); } + void keyPressEvent ( QKeyEvent *e ); void OnLanguageChanged ( QString strLanguage ) { pSettings->strLanguage = strLanguage; } void OnNewRecordingClicked() { pServer->RequestNewRecording(); } diff --git a/src/util.cpp b/src/util.cpp index 89fd36a0a5..4e737e5c96 100755 --- a/src/util.cpp +++ b/src/util.cpp @@ -848,6 +848,16 @@ void CMusProfDlg::OnSkillActivated ( int iCntryListItem ) pClient->SetRemoteInfo(); } +void CMusProfDlg::keyPressEvent ( QKeyEvent *e ) +{ + if (BOOL_CLOSE_DIALOGS_ON_BACKBUTTON && ( e->key() == Qt::Key_Back )){ + this->close(); // otherwise, dialog does not show properly again in android + return; + }else{ + QDialog::keyPressEvent ( e ); + } +} + // Help menu ------------------------------------------------------------------- CHelpMenu::CHelpMenu ( const bool bIsClient, QWidget* parent ) : QMenu ( tr ( "&Help" ), parent ) diff --git a/src/util.h b/src/util.h index d8a7485dc2..8df9f95cbe 100755 --- a/src/util.h +++ b/src/util.h @@ -38,6 +38,7 @@ # include # include # include +# include # include "ui_aboutdlgbase.h" #endif #include @@ -420,6 +421,8 @@ public slots: void OnCountryActivated ( int iCntryListItem ); void OnCityTextChanged ( const QString& strNewName ); void OnSkillActivated ( int iCntryListItem ); + + void keyPressEvent ( QKeyEvent *e ); };