diff --git a/.github/workflows/autobuild.yml b/.github/workflows/autobuild.yml index 9d0e600596..d2b879c77e 100644 --- a/.github/workflows/autobuild.yml +++ b/.github/workflows/autobuild.yml @@ -92,26 +92,26 @@ jobs: fail-fast: false matrix: # Think of this like a foreach loop. Basically runs the steps with every combination of the contents of this. More info: https://docs.github.com/en/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix config: - - config_name: AndroidAPK (artifact+codeQL) - target_os: android - building_on_os: ubuntu-20.04 - cmd1_prebuild: "sh ./autobuild/android/autobuild_apk_1_prepare.sh" # this step needs sh instead of bash for permissions - cmd2_build: "./autobuild/android/autobuild_apk_2_build.sh" - cmd3_postbuild: "./autobuild/android/autobuild_apk_3_copy_files.sh" - uses_codeql: true - - - config_name: Linux (artifacts+codeQL) - target_os: linux - building_on_os: ubuntu-18.04 - cmd1_prebuild: "sh ./autobuild/linux/autobuild_deb_1_prepare.sh" # this step needs sh instead of bash for permissions - cmd2_build: "./autobuild/linux/autobuild_deb_2_build.sh" - cmd3_postbuild: "./autobuild/linux/autobuild_deb_3_copy_files.sh" - uses_codeql: true + # - config_name: AndroidAPK (artifact+codeQL) + # target_os: android + # building_on_os: ubuntu-20.04 + # cmd1_prebuild: "sh ./autobuild/android/autobuild_apk_1_prepare.sh" # this step needs sh instead of bash for permissions + # cmd2_build: "./autobuild/android/autobuild_apk_2_build.sh" + # cmd3_postbuild: "./autobuild/android/autobuild_apk_3_copy_files.sh" + # uses_codeql: true +# +# - config_name: Linux (artifacts+codeQL) +# target_os: linux +# building_on_os: ubuntu-20.04 +# cmd1_prebuild: "sh ./autobuild/linux/autobuild_deb_1_prepare.sh" # this step needs sh instead of bash for permissions +# cmd2_build: "./autobuild/linux/autobuild_deb_2_build.sh" +# cmd3_postbuild: "./autobuild/linux/autobuild_deb_3_copy_files.sh" +# uses_codeql: true - config_name: MacOS (codeQL) target_os: macos building_on_os: macos-10.15 - cmd1_prebuild: "./autobuild/mac/codeQL/autobuild_mac_1_prepare.sh 5.15.2" + cmd1_prebuild: "./autobuild/mac/codeQL/autobuild_mac_1_prepare.sh 6.1.0" cmd2_build: "./autobuild/mac/codeQL/autobuild_mac_2_build.sh" cmd3_postbuild: false uses_codeql: true @@ -119,18 +119,20 @@ jobs: - config_name: MacOS (artifacts) target_os: macos building_on_os: macos-10.15 - cmd1_prebuild: "./autobuild/mac/artifacts/autobuild_mac_1_prepare.sh 5.15.2" - cmd2_build: "./autobuild/mac/artifacts/autobuild_mac_2_build.sh sign_if_possible" + + cmd1_prebuild: "./autobuild/mac/artifacts/autobuild_mac_1_prepare.sh 6.1.0" + cmd2_build: "./autobuild/mac/artifacts/autobuild_mac_2_build.sh" cmd3_postbuild: "./autobuild/mac/artifacts/autobuild_mac_3_copy_files.sh" uses_codeql: false - - config_name: MacOS Legacy (artifacts) - target_os: macos - building_on_os: macos-10.15 - cmd1_prebuild: "./autobuild/mac/artifacts/autobuild_mac_1_prepare.sh 5.9.9" - cmd2_build: "./autobuild/mac/artifacts/autobuild_mac_2_build.sh do_not_sign" - cmd3_postbuild: "./autobuild/mac/artifacts/autobuild_mac_3_copy_files.sh legacy" - uses_codeql: false +# - config_name: MacOS Legacy (artifacts) +# target_os: macos +# building_on_os: macos-10.15 +# cmd1_prebuild: "./autobuild/mac/artifacts/autobuild_mac_1_prepare.sh 5.9.9" +# cmd2_build: "./autobuild/mac/artifacts/autobuild_mac_2_build.sh" +# cmd3_postbuild: "./autobuild/mac/artifacts/autobuild_mac_3_copy_files.sh legacy" +# uses_codeql: false + - config_name: Windows (artifact+codeQL) target_os: windows @@ -153,11 +155,11 @@ jobs: # For Qt5 on Mac, we need to ensure SDK 10.15 is used, and not SDK 11.x # This is done by selecting Xcode 11.7 instead of the latest default of 12.x - - name: Select Xcode version for Mac - if: ${{ matrix.config.target_os == 'macos' }} - uses: maxim-lobanov/setup-xcode@v1 - with: - xcode-version: '11.7' + # - name: Select Xcode version for Mac + # if: ${{ matrix.config.target_os == 'macos' }} + # uses: maxim-lobanov/setup-xcode@v1 + # with: + # xcode-version: '11.7' # Checkout code - name: Checkout code diff --git a/Jamulus.pro b/Jamulus.pro index 9778b3daf2..3fe16353c4 100644 --- a/Jamulus.pro +++ b/Jamulus.pro @@ -123,6 +123,52 @@ win32 { LIBS += "$${programfilesdir}/JACK2/lib/$${libjackname}" } +} else:win64 { + DEFINES -= UNICODE # fixes issue with ASIO SDK (asiolist.cpp is not unicode compatible) + DEFINES += NOMINMAX # solves a compiler error in qdatetime.h (Qt5) + HEADERS += windows/sound.h + SOURCES += windows/sound.cpp \ + windows/ASIOSDK2/common/asio.cpp \ + windows/ASIOSDK2/host/asiodrivers.cpp \ + windows/ASIOSDK2/host/pc/asiolist.cpp + RC_FILE = windows/mainicon.rc + INCLUDEPATH += windows/ASIOSDK2/common \ + windows/ASIOSDK2/host \ + windows/ASIOSDK2/host/pc + mingw* { + LIBS += -lole64 \ + -luser64 \ + -ladvapi64 \ + -lwinmm \ + -lws2_64 + } else { + QMAKE_LFLAGS += /DYNAMICBASE:NO # fixes crash with libjack64.dll, see https://github.com/jamulussoftware/jamulus/issues/93 + LIBS += ole64.lib \ + user64.lib \ + advapi64.lib \ + winmm.lib \ + ws2_64.lib + } + + # replace ASIO with jack if requested + contains(CONFIG, "jackonwindows") { + message(Using Jack instead of ASIO.) + + !exists("C:/Program Files (x86)/Jack/includes/jack/jack.h") { + message(Warning: jack.h was not found at the usual place, maybe jack is not installed) + } + + HEADERS -= windows/sound.h + SOURCES -= windows/sound.cpp + HEADERS += linux/sound.h + SOURCES += linux/sound.cpp + DEFINES += WITH_JACK + DEFINES += JACK_REPLACES_ASIO + DEFINES += _STDINT_H # supposed to solve compilation error in systemdeps.h + INCLUDEPATH += "C:/Program Files (x86)/Jack/includes" + LIBS += "C:/Program Files (x86)/Jack/lib/libjack64.lib" + } + } else:macx { contains(CONFIG, "server_bundle") { message(The generated application bundle will run a server instance.) @@ -136,7 +182,7 @@ win32 { RC_FILE = mac/mainicon.icns } - QT += macextras + #QT += macextras HEADERS += mac/sound.h SOURCES += mac/sound.cpp HEADERS += mac/activity.h diff --git a/autobuild/windows/autobuild_windowsinstaller_1_prepare.ps1 b/autobuild/windows/autobuild_windowsinstaller_1_prepare.ps1 index d4f837b52b..fddb657b07 100644 --- a/autobuild/windows/autobuild_windowsinstaller_1_prepare.ps1 +++ b/autobuild/windows/autobuild_windowsinstaller_1_prepare.ps1 @@ -22,11 +22,12 @@ echo "Install Qt..." pip install aqtinstall echo "Get Qt 64 bit..." # intermediate solution if the main server is down: append e.g. " -b https://mirrors.ocf.berkeley.edu/qt/" to the "aqt"-line below -aqt install --outputdir C:\Qt 5.15.2 windows desktop win64_msvc2019_64 +aqt install --outputdir C:\Qt 6.1.0 windows desktop win64_msvc2019_64 echo "Get Qt 32 bit..." # intermediate solution if the main server is down: append e.g. " -b https://mirrors.ocf.berkeley.edu/qt/" to the "aqt"-line below -aqt install --outputdir C:\Qt 5.15.2 windows desktop win32_msvc2019 + +aqt install --outputdir C:\Qt 6.1.0 windows desktop win32_msvc2019 ################################# @@ -44,3 +45,4 @@ if ($BuildOption -Eq "jackonwindows") choco install --no-progress -y -f --forcex86 jack } + diff --git a/autobuild/windows/autobuild_windowsinstaller_2_build.ps1 b/autobuild/windows/autobuild_windowsinstaller_2_build.ps1 index 84493d7823..93a454c1c9 100644 --- a/autobuild/windows/autobuild_windowsinstaller_2_build.ps1 +++ b/autobuild/windows/autobuild_windowsinstaller_2_build.ps1 @@ -28,11 +28,6 @@ if (("$jamulus_project_path" -eq $null) -or ("$jamulus_project_path" -eq "")) { echo "Build installer..." # Build the installer -if ($BuildOption -ne "") -{ - powershell "$jamulus_project_path\windows\deploy_windows.ps1" "C:\Qt\5.15.2" -BuildOption $BuildOption -} -else -{ - powershell "$jamulus_project_path\windows\deploy_windows.ps1" "C:\Qt\5.15.2" -} + +powershell "$jamulus_project_path\windows\deploy_windows.ps1" "C:\Qt\6.1.0" + diff --git a/src/audiomixerboard.cpp b/src/audiomixerboard.cpp index 58a652e3bc..6e802118d9 100644 --- a/src/audiomixerboard.cpp +++ b/src/audiomixerboard.cpp @@ -706,8 +706,13 @@ void CChannelFader::SetChannelInfos ( const CChannelInfo& cChanInfo ) // Country flag icon ------------------------------------------------------- if ( cChanInfo.eCountry != QLocale::AnyCountry ) { +#if QT_VERSION >= 0x060000 + QLocale::Country eC = CLocale::LocaleQt5toQt6 ( cChanInfo.eCountry ); +#else + QLocale::Country eC = cChanInfo.eCountry; +#endif // try to load the country flag icon - QPixmap CountryFlagPixmap ( CLocale::GetCountryFlagIconsResourceReference ( cChanInfo.eCountry ) ); + QPixmap CountryFlagPixmap ( CLocale::GetCountryFlagIconsResourceReference ( eC ) ); // first check if resource reference was valid if ( CountryFlagPixmap.isNull() ) @@ -719,7 +724,7 @@ void CChannelFader::SetChannelInfos ( const CChannelInfo& cChanInfo ) { // set correct picture plblCountryFlag->setPixmap ( CountryFlagPixmap ); - eTTCountry = cChanInfo.eCountry; + eTTCountry = eC; // enable country flag plblCountryFlag->setVisible ( true ); diff --git a/src/chatdlg.cpp b/src/chatdlg.cpp index b6968a863b..f1260fc5cd 100644 --- a/src/chatdlg.cpp +++ b/src/chatdlg.cpp @@ -23,6 +23,7 @@ \******************************************************************************/ #include "chatdlg.h" +#include /* Implementation *************************************************************/ CChatDlg::CChatDlg ( QWidget* parent ) : CBaseDlg ( parent, Qt::Window ) // use Qt::Window to get min/max window buttons @@ -114,11 +115,11 @@ void CChatDlg::AddChatText ( QString strChatText ) // analyze strChatText to check if hyperlink (limit ourselves to http(s)://) but do not // replace the hyperlinks if any HTML code for a hyperlink was found (the user has done the HTML // coding hisself and we should not mess with that) - if ( !strChatText.contains ( QRegExp ( "href\\s*=|src\\s*=" ) ) ) + if ( !strChatText.contains ( QRegularExpression ( "href\\s*=|src\\s*=" ) ) ) { // searches for all occurrences of http(s) and cuts until a space (\S matches any non-white-space // character and the + means that matches the previous element one or more times.) - strChatText.replace ( QRegExp ( "(https?://\\S+)" ), "\\1" ); + strChatText.replace ( QRegularExpression ( "(https?://\\S+)" ), "\\1" ); } // add new text in chat window diff --git a/src/clientdlg.cpp b/src/clientdlg.cpp index 9de0b354f0..e19edbabf9 100644 --- a/src/clientdlg.cpp +++ b/src/clientdlg.cpp @@ -23,6 +23,7 @@ \******************************************************************************/ #include "clientdlg.h" +#include /* Implementation *************************************************************/ CClientDlg::CClientDlg ( CClient* pNCliP, @@ -918,24 +919,25 @@ void CClientDlg::SetMyWindowTitle ( const int iNumClients ) } setWindowTitle ( strWinTitle ); - -#if defined( Q_OS_MACX ) - // for MacOS only we show the number of connected clients as a - // badge label text if more than one user is connected - // (only available in Qt5.2) -# if QT_VERSION >= QT_VERSION_CHECK( 5, 2, 0 ) - if ( iNumClients > 1 ) - { - // show the number of connected clients - QtMac::setBadgeLabelText ( QString ( "%1" ).arg ( iNumClients ) ); - } - else - { - // clear the text (apply an empty string) - QtMac::setBadgeLabelText ( "" ); - } -# endif -#endif + /*** + #if defined( Q_OS_MACX ) + // for MacOS only we show the number of connected clients as a + // badge label text if more than one user is connected + // (only available in Qt5.2) + # if QT_VERSION >= QT_VERSION_CHECK( 5, 2, 0 ) + if ( iNumClients > 1 ) + { + // show the number of connected clients + NSApp.dockTile.badgeLabel ( QString ( "%1" ).arg ( iNumClients ) ); + } + else + { + // clear the text (apply an empty string) + NSApp.dockTile.badgeLabel ( "" ); + } + # endif + #endif + ***/ } void CClientDlg::ShowConnectionSetupDialog() diff --git a/src/clientdlg.h b/src/clientdlg.h index 5437fb8b2a..a8ce768b65 100644 --- a/src/clientdlg.h +++ b/src/clientdlg.h @@ -51,11 +51,6 @@ #include "connectdlg.h" #include "analyzerconsole.h" #include "ui_clientdlgbase.h" -#if defined( __APPLE__ ) || defined( __MACOSX ) -# if QT_VERSION >= QT_VERSION_CHECK( 5, 2, 0 ) -# include -# endif -#endif /* Definitions ****************************************************************/ // update time for GUI controls diff --git a/src/connectdlg.cpp b/src/connectdlg.cpp index 0f2b37db24..2f84636182 100644 --- a/src/connectdlg.cpp +++ b/src/connectdlg.cpp @@ -400,8 +400,11 @@ void CConnectDlg::SetServerList ( const CHostAddress& InetAddr, const CVector= 0x060000 + QString strCountryToString = QLocale::countryToString ( CLocale::LocaleQt5toQt6 ( vecServerInfo[iIdx].eCountry ) ); +#else QString strCountryToString = QLocale::countryToString ( vecServerInfo[iIdx].eCountry ); - +#endif // Qt countryToString does not use spaces in between country name // parts but they use upper case letters which we can detect and // insert spaces as a post processing @@ -476,8 +479,11 @@ void CConnectDlg::SetConnClientsList ( const CHostAddress& InetAddr, const CVect if ( vecChanInfo[i].eCountry != QLocale::AnyCountry ) { // try to load the country flag icon +#if QT_VERSION >= 0x060000 + QPixmap CountryFlagPixmap ( CLocale::GetCountryFlagIconsResourceReference ( CLocale::LocaleQt5toQt6 ( vecChanInfo[i].eCountry ) ) ); +#else QPixmap CountryFlagPixmap ( CLocale::GetCountryFlagIconsResourceReference ( vecChanInfo[i].eCountry ) ); - +#endif // first check if resource reference was valid if ( !CountryFlagPixmap.isNull() ) { @@ -739,7 +745,11 @@ void CConnectDlg::OnTimerPing() bEnableIPv6 ) ) { // if address is valid, send ping message using a new thread +#if QT_VERSION >= 0x060000 + QtConcurrent::run ( &CConnectDlg::EmitCLServerListPingMes, this, CurServerAddress ); +#else QtConcurrent::run ( this, &CConnectDlg::EmitCLServerListPingMes, CurServerAddress ); +#endif } } } diff --git a/src/levelmeter.cpp b/src/levelmeter.cpp index 271e10aabe..a2e0b2a41a 100644 --- a/src/levelmeter.cpp +++ b/src/levelmeter.cpp @@ -34,7 +34,7 @@ CLevelMeter::CLevelMeter ( QWidget* parent ) : QWidget ( parent ), eLevelMeterTy QWidget* pLEDMeter = new QWidget(); QVBoxLayout* pLEDLayout = new QVBoxLayout ( pLEDMeter ); pLEDLayout->setAlignment ( Qt::AlignHCenter ); - pLEDLayout->setMargin ( 0 ); + pLEDLayout->setContentsMargins ( 0, 0, 0, 0 ); pLEDLayout->setSpacing ( 0 ); // create LEDs plus the clip LED diff --git a/src/main.cpp b/src/main.cpp index 1205aa44b0..d4f990fc92 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -21,6 +21,9 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * \******************************************************************************/ +#ifdef _MSC_VER +# pragma comment( linker, "/subsystem:windows /ENTRY:mainCRTStartup" ) +#endif #include #include diff --git a/src/recorder/creaperproject.cpp b/src/recorder/creaperproject.cpp index 1c03cdf9c6..b8af8d9713 100644 --- a/src/recorder/creaperproject.cpp +++ b/src/recorder/creaperproject.cpp @@ -62,19 +62,19 @@ CReaperItem::CReaperItem ( const QString& name, const STrackItem& trackItem, con QTextStream sOut ( &out ); - sOut << " " << endl; + sOut << " " << Qt::endl; sOut << " >"; @@ -91,14 +91,14 @@ CReaperTrack::CReaperTrack ( QString name, qint32& iid, QList items, { QTextStream sOut ( &out ); - sOut << " > tracks, int fr { QTextStream sOut ( &out ); - sOut << ""; diff --git a/src/recorder/cwavestream.h b/src/recorder/cwavestream.h index 6f2d69a0ca..c9cf5e0e99 100644 --- a/src/recorder/cwavestream.h +++ b/src/recorder/cwavestream.h @@ -25,6 +25,8 @@ #pragma once #include +#include +#include namespace recorder { diff --git a/src/recorder/jamcontroller.cpp b/src/recorder/jamcontroller.cpp index 11ea775d47..3c450591bb 100644 --- a/src/recorder/jamcontroller.cpp +++ b/src/recorder/jamcontroller.cpp @@ -91,7 +91,7 @@ void CJamController::SetRecordingDir ( QString newRecordingDir, int iServerFrame { pJamRecorder = new recorder::CJamRecorder ( newRecordingDir, iServerFrameSizeSamples ); strRecorderErrMsg = pJamRecorder->Init(); - bRecorderInitialised = ( strRecorderErrMsg == QString::null ); + bRecorderInitialised = ( strRecorderErrMsg == QString() ); bEnableRecording = bRecorderInitialised && !bDisableRecording; qInfo() << qUtf8Printable ( QString ( "Recording state: %1" ).arg ( bEnableRecording ? "enabled" : "disabled" ) ); @@ -99,7 +99,7 @@ void CJamController::SetRecordingDir ( QString newRecordingDir, int iServerFrame else { // This is the only time this is ever true - UI needs to handle it - strRecorderErrMsg = QString::null; + strRecorderErrMsg = QString(); bRecorderInitialised = false; bEnableRecording = false; diff --git a/src/recorder/jamrecorder.cpp b/src/recorder/jamrecorder.cpp index 373c596d30..3743814d42 100644 --- a/src/recorder/jamrecorder.cpp +++ b/src/recorder/jamrecorder.cpp @@ -359,11 +359,11 @@ QMap> CJamSession::TracksFromSessionDir ( const QStri /** * @brief CJamRecorder::Init Create recording directory, if necessary, and connect signal handlers * @param server Server object emitting signals - * @return QString::null on success else the failure reason + * @return QString::null (Qt6 QString() )on success else the failure reason */ QString CJamRecorder::Init() { - QString errmsg = QString::null; + QString errmsg = QString(); QFileInfo fi ( recordBaseDir.absolutePath() ); fi.setCaching ( false ); @@ -479,7 +479,7 @@ void CJamRecorder::ReaperProjectFromCurrentSession() if ( outf.open ( QFile::WriteOnly ) ) { QTextStream out ( &outf ); - out << CReaperProject ( currentSession->Tracks(), iServerFrameSizeSamples ).toString() << endl; + out << CReaperProject ( currentSession->Tracks(), iServerFrameSizeSamples ).toString() << Qt::endl; qDebug() << "Session RPP:" << reaperProjectFileName; } else @@ -511,7 +511,7 @@ void CJamRecorder::AudacityLofFromCurrentSession() { QFileInfo fi ( item.fileName ); sOut << "file " << '"' << fi.fileName() << '"'; - sOut << " offset " << secondsAt48K ( item.startFrame, iServerFrameSizeSamples ) << endl; + sOut << " offset " << secondsAt48K ( item.startFrame, iServerFrameSizeSamples ) << Qt::endl; } } @@ -556,7 +556,7 @@ void CJamRecorder::SessionDirToReaper ( QString& strSessionDirName, int serverFr out << CReaperProject ( CJamSession::TracksFromSessionDir ( fiSessionDir.absoluteFilePath(), serverFrameSizeSamples ), serverFrameSizeSamples ) .toString() - << endl; + << Qt::endl; qDebug() << "Session RPP:" << reaperProjectFileName; } diff --git a/src/server.h b/src/server.h index 1f10747b00..435b7d9cee 100644 --- a/src/server.h +++ b/src/server.h @@ -29,7 +29,7 @@ #include #include #include -#include +//#include #include #ifdef USE_OPUS_SHARED_LIB # include "opus/opus_custom.h" diff --git a/src/serverdlg.cpp b/src/serverdlg.cpp index cf2bcf2604..fbb0313a85 100644 --- a/src/serverdlg.cpp +++ b/src/serverdlg.cpp @@ -319,7 +319,7 @@ lvwClients->setMinimumHeight ( 140 ); edtRecordingDir->setText ( pServer->GetRecordingDir() ); tbtClearRecordingDir->setText ( u8"\u232B" ); - UpdateRecorderStatus ( QString::null ); + UpdateRecorderStatus ( QString() ); // language combo box (corrects the setting if language not found) cbxLanguage->Init ( pSettings->strLanguage ); @@ -543,19 +543,19 @@ void CServerDlg::OnCentServAddrTypeActivated ( int iTypeIdx ) void CServerDlg::OnServerStarted() { UpdateSystemTrayIcon ( true ); - UpdateRecorderStatus ( QString::null ); + UpdateRecorderStatus ( QString() ); } void CServerDlg::OnServerStopped() { UpdateSystemTrayIcon ( false ); - UpdateRecorderStatus ( QString::null ); + UpdateRecorderStatus ( QString() ); } void CServerDlg::OnStopRecorder() { - UpdateRecorderStatus ( QString::null ); - if ( pServer->GetRecorderErrMsg() != QString::null ) + UpdateRecorderStatus ( QString() ); + if ( pServer->GetRecorderErrMsg() != QString() ) { QMessageBox::warning ( this, APP_NAME, @@ -578,16 +578,16 @@ void CServerDlg::OnRecordingDirClicked() if ( newRecordingDir != currentValue ) { pServer->SetRecordingDir ( newRecordingDir ); - UpdateRecorderStatus ( QString::null ); + UpdateRecorderStatus ( QString() ); } } void CServerDlg::OnClearRecordingDirClicked() { - if ( pServer->GetRecorderErrMsg() != QString::null || pServer->GetRecordingDir() != "" ) + if ( pServer->GetRecorderErrMsg() != QString() || pServer->GetRecordingDir() != "" ) { pServer->SetRecordingDir ( "" ); - UpdateRecorderStatus ( QString::null ); + UpdateRecorderStatus ( QString() ); } } @@ -681,15 +681,15 @@ void CServerDlg::UpdateGUIDependencies() switch ( eSvrRegStatus ) { - case SRS_BAD_ADDRESS: - case SRS_TIME_OUT: - case SRS_CENTRAL_SVR_FULL: - case SRS_VERSION_TOO_OLD: - case SRS_NOT_FULFILL_REQUIREMENTS: + case ESvrRegStatus::SRS_BAD_ADDRESS: + case ESvrRegStatus::SRS_TIME_OUT: + case ESvrRegStatus::SRS_CENTRAL_SVR_FULL: + case ESvrRegStatus::SRS_VERSION_TOO_OLD: + case ESvrRegStatus::SRS_NOT_FULFILL_REQUIREMENTS: strStatus = "" + strStatus + ""; break; - case SRS_REGISTERED: + case ESvrRegStatus::SRS_REGISTERED: strStatus = "" + strStatus + ""; break; @@ -769,7 +769,7 @@ void CServerDlg::UpdateRecorderStatus ( QString sessionDir ) { if ( pServer->IsRunning() ) { - edtCurrentSessionDir->setText ( sessionDir != QString::null ? sessionDir : "" ); + edtCurrentSessionDir->setText ( sessionDir != QString() ? sessionDir : "" ); strRecorderStatus = SREC_RECORDING; bIsRecording = true; @@ -788,7 +788,7 @@ void CServerDlg::UpdateRecorderStatus ( QString sessionDir ) { strRecordingDir = pServer->GetRecorderErrMsg(); - if ( strRecordingDir == QString::null ) + if ( strRecordingDir == QString() ) { strRecordingDir = pServer->GetRecordingDir(); } diff --git a/src/serverlist.cpp b/src/serverlist.cpp index 1807905c1d..9355d7f568 100644 --- a/src/serverlist.cpp +++ b/src/serverlist.cpp @@ -102,10 +102,12 @@ CServerListManager::CServerListManager ( const quint16 iNPortNum, const bool bNEnableIPv6, CProtocol* pNConLProt ) : eCentralServerAddressType ( AT_CUSTOM ), // must be AT_CUSTOM for the "no GUI" case + bEnableIPv6 ( bNEnableIPv6 ), eSvrRegStatus ( SRS_UNREGISTERED ), strMinServerVersion ( "" ), // disable version check with empty version pConnLessProtocol ( pNConLProt ), + iSvrRegRetries ( 0 ) { // set the directory server address (also bIsCentralServer) @@ -254,7 +256,7 @@ void CServerListManager::SetCentralServerAddress ( const QString sNCentServAddr } // if we are registered to a custom directory server, unregister before updating the name - if ( eCentralServerAddressType == AT_CUSTOM && GetSvrRegStatus() == SRS_REGISTERED ) + if ( eCentralServerAddressType == AT_CUSTOM && GetSvrRegStatus() == ESvrRegStatus::SRS_REGISTERED ) { SlaveServerUnregister(); } @@ -270,7 +272,7 @@ void CServerListManager::SetCentralServerAddress ( const QString sNCentServAddr void CServerListManager::SetCentralServerAddressType ( const ECSAddType eNCSAT ) { // if the type is changing, unregister before updating - if ( eNCSAT != eCentralServerAddressType && GetSvrRegStatus() == SRS_REGISTERED ) + if ( eNCSAT != eCentralServerAddressType && GetSvrRegStatus() == ESvrRegStatus::SRS_REGISTERED ) { SlaveServerUnregister(); } @@ -714,13 +716,13 @@ void CServerListManager::OnTimerCLRegisterServerResp() { QMutexLocker locker ( &Mutex ); - if ( eSvrRegStatus == SRS_REQUESTED ) + if ( eSvrRegStatus == ESvrRegStatus::SRS_REQUESTED ) { iSvrRegRetries++; if ( iSvrRegRetries >= REGISTER_SERVER_RETRY_LIMIT ) { - SetSvrRegStatus ( SRS_TIME_OUT ); + SetSvrRegStatus ( ESvrRegStatus::SRS_TIME_OUT ); } else { @@ -758,21 +760,21 @@ void CServerListManager::SlaveServerRegisterServer ( const bool bIsRegister ) if ( bIsRegister ) { // register server - SetSvrRegStatus ( SRS_REQUESTED ); + SetSvrRegStatus ( ESvrRegStatus::SRS_REQUESTED ); pConnLessProtocol->CreateCLRegisterServerExMes ( SlaveCurCentServerHostAddress, SlaveCurLocalHostAddress, ServerList[0] ); } else { // unregister server - SetSvrRegStatus ( SRS_UNREGISTERED ); + SetSvrRegStatus ( ESvrRegStatus::SRS_UNREGISTERED ); pConnLessProtocol->CreateCLUnregisterServerMes ( SlaveCurCentServerHostAddress ); } } else { - SetSvrRegStatus ( SRS_BAD_ADDRESS ); + SetSvrRegStatus ( ESvrRegStatus::SRS_BAD_ADDRESS ); } } diff --git a/src/serverlogging.cpp b/src/serverlogging.cpp index 094f236c04..88685e2098 100644 --- a/src/serverlogging.cpp +++ b/src/serverlogging.cpp @@ -70,7 +70,7 @@ void CServerLogging::operator<< ( const QString& sNewStr ) { // append new line in logging file QTextStream out ( &File ); - out << sNewStr << endl; + out << sNewStr << Qt::endl; File.flush(); } } diff --git a/src/util.cpp b/src/util.cpp index 5302e9fd03..7e9dfcd4d5 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -24,6 +24,7 @@ #include "util.h" #include "client.h" +#include /* Implementation *************************************************************/ // Input level meter implementation -------------------------------------------- @@ -1140,6 +1141,10 @@ CInstPictures::EInstCategory CInstPictures::GetCategory ( const int iInstrument } // Locale management class ----------------------------------------------------- +#if QT_VERSION >= 0x060000 +QLocale::Country CLocale::LocaleQt5toQt6 ( const QLocale::Country eCountry ) { return ( (QLocale::Country) slocaletab[(int) eCountry].Qt5toQt6 ); }; +QLocale::Country CLocale::LocaleQt6toQt5 ( const QLocale::Country eCountry ) { return ( (QLocale::Country) slocaletab[(int) eCountry].Qt6toQt5 ); }; +#endif QString CLocale::GetCountryFlagIconsResourceReference ( const QLocale::Country eCountry ) { QString strReturn = ""; @@ -1158,6 +1163,9 @@ QString CLocale::GetCountryFlagIconsResourceReference ( const QLocale::Country e // the new code. // COMPATIBLE FOR OLD QT VERSIONS -> use a table: QString strISO3166 = ""; +#if QT_VERSION >= 0x060000 + strISO3166 = QString ( slocaletab[(int) eCountry].flagQt6 ); +#else switch ( static_cast ( eCountry ) ) { case 1: @@ -1707,6 +1715,7 @@ QString CLocale::GetCountryFlagIconsResourceReference ( const QLocale::Country e strISO3166 = "ax"; break; } +#endif strReturn = ":/png/flags/res/flags/" + strISO3166 + ".png"; // check if file actually exists, if not then invalidate reference diff --git a/src/util.h b/src/util.h index 8ab704a163..f1447f3069 100644 --- a/src/util.h +++ b/src/util.h @@ -573,7 +573,7 @@ inline QString csCentServAddrTypeToString ( ECSAddType eAddrType ) } // Slave server registration state --------------------------------------------- -enum ESvrRegStatus +enum class ESvrRegStatus { SRS_UNREGISTERED, SRS_BAD_ADDRESS, @@ -590,35 +590,36 @@ inline QString svrRegStatusToString ( ESvrRegStatus eSvrRegStatus ) { switch ( eSvrRegStatus ) { - case SRS_UNREGISTERED: + case ESvrRegStatus::SRS_UNREGISTERED: return QCoreApplication::translate ( "CServerDlg", "Unregistered" ); - case SRS_BAD_ADDRESS: + case ESvrRegStatus::SRS_BAD_ADDRESS: return QCoreApplication::translate ( "CServerDlg", "Bad address" ); - case SRS_REQUESTED: + case ESvrRegStatus::SRS_REQUESTED: return QCoreApplication::translate ( "CServerDlg", "Registration requested" ); - case SRS_TIME_OUT: + case ESvrRegStatus::SRS_TIME_OUT: return QCoreApplication::translate ( "CServerDlg", "Registration failed" ); - case SRS_UNKNOWN_RESP: + case ESvrRegStatus::SRS_UNKNOWN_RESP: return QCoreApplication::translate ( "CServerDlg", "Check server version" ); - case SRS_REGISTERED: + case ESvrRegStatus::SRS_REGISTERED: return QCoreApplication::translate ( "CServerDlg", "Registered" ); - case SRS_CENTRAL_SVR_FULL: + case ESvrRegStatus::SRS_CENTRAL_SVR_FULL: return QCoreApplication::translate ( "CServerDlg", "Directory Server full" ); - case SRS_VERSION_TOO_OLD: + case ESvrRegStatus::SRS_VERSION_TOO_OLD: return QCoreApplication::translate ( "CServerDlg", "Your server version is too old" ); - case SRS_NOT_FULFILL_REQUIREMENTS: + case ESvrRegStatus::SRS_NOT_FULFILL_REQUIREMENTS: return QCoreApplication::translate ( "CServerDlg", "Requirements not fulfilled" ); } - return QString ( QCoreApplication::translate ( "CServerDlg", "Unknown value " ) ).append ( eSvrRegStatus ); + return QString ( QCoreApplication::translate ( "CServerDlg", "Unknown value " ) ); + // return QString ( QCoreApplication::translate ( "CServerDlg", "Unknown value " ) ).append ( eSvrRegStatus ); } // Directory server registration outcome --------------------------------------- @@ -806,6 +807,55 @@ class CLocale static QMap GetAvailableTranslations(); static QPair FindSysLangTransFileName ( const QMap& TranslMap ); static void LoadTranslation ( const QString strLanguage, QCoreApplication* pApp ); +#if QT_VERSION >= 0x060000 + static QLocale::Country LocaleQt5toQt6 ( const QLocale::Country eCountry ); + static QLocale::Country LocaleQt6toQt5 ( const QLocale::Country eCountry ); + struct slocalestruct + { + int Qt5toQt6; + int Qt6toQt5; + char flagQt6[3]; + }; + constexpr struct slocalestruct const static slocaletab[262] = { + { 0, 0, "." }, { 1, 1, "af" }, { 3, 248, "ax" }, { 4, 2, "al" }, { 5, 3, "dz" }, { 6, 4, "." }, { 7, 5, "ad" }, + { 8, 6, "ao" }, { 9, 7, "." }, { 10, 8, "." }, { 11, 9, "." }, { 12, 10, "ar" }, { 13, 11, "am" }, { 15, 12, "aw" }, + { 16, 247, "." }, { 17, 13, "au" }, { 18, 14, "at" }, { 19, 15, "az" }, { 20, 16, "." }, { 21, 17, "bh" }, { 22, 18, "bd" }, + { 23, 19, "." }, { 24, 20, "by" }, { 25, 21, "be" }, { 26, 22, "." }, { 27, 23, "bj" }, { 28, 24, "." }, { 29, 25, "bt" }, + { 30, 26, "bo" }, { 31, 27, "ba" }, { 32, 28, "bw" }, { 33, 29, "." }, { 35, 30, "br" }, { 36, 31, "." }, { 37, 233, "." }, + { 38, 32, "bn" }, { 39, 33, "bg" }, { 40, 34, "bf" }, { 41, 35, "bi" }, { 43, 36, "kh" }, { 45, 37, "cm" }, { 46, 38, "ca" }, + { 48, 238, "." }, { 49, 39, "cv" }, { 50, 255, "." }, { 51, 40, "." }, { 53, 41, "cf" }, { 54, 250, "." }, { 55, 42, "td" }, + { 57, 43, "cl" }, { 56, 44, "cn" }, { 58, 45, "." }, { 59, 241, "." }, { 118, 46, "." }, { 60, 47, "co" }, { 61, 48, "km" }, + { 63, 50, "cd" }, { 64, 49, "cg" }, { 65, 51, "." }, { 67, 52, "cr" }, { 68, 54, "hr" }, { 69, 55, "cu" }, { 232, 152, "." }, + { 70, 56, "cy" }, { 71, 57, "cz" }, { 72, 58, "dk" }, { 73, 249, "." }, { 74, 59, "dj" }, { 75, 60, "." }, { 77, 61, "do" }, + { 80, 63, "ec" }, { 81, 64, "eg" }, { 82, 65, "sv" }, { 83, 66, "gq" }, { 84, 67, "er" }, { 100, 68, "ee" }, { 85, 204, "sz" }, + { 86, 69, "et" }, { 87, 261, "." }, { 88, 258, "." }, { 89, 70, "." }, { 90, 71, "fo" }, { 91, 72, "." }, { 92, 73, "fi" }, + { 93, 74, "fr" }, { 94, 76, "gf" }, { 95, 77, "pf" }, { 96, 78, "." }, { 97, 79, "ga" }, { 98, 80, "." }, { 99, 81, "ge" }, + { 102, 82, "de" }, { 101, 83, "gh" }, { 103, 84, "." }, { 104, 85, "gr" }, { 105, 86, "gl" }, { 106, 87, "." }, { 107, 88, "gp" }, + { 108, 89, "." }, { 109, 90, "gt" }, { 110, 75, "." }, { 111, 92, "gw" }, { 112, 91, "gn" }, { 113, 93, "gy" }, { 114, 94, "." }, + { 116, 95, "." }, { 117, 96, "hn" }, { 119, 97, "hk" }, { 120, 98, "hu" }, { 122, 99, "is" }, { 123, 100, "in" }, { 124, 101, "id" }, + { 125, 102, "ir" }, { 174, 103, "iq" }, { 218, 104, "ie" }, { 127, 251, "." }, { 128, 105, "il" }, { 129, 106, "it" }, { 131, 53, "ci" }, + { 132, 107, "." }, { 133, 108, "jp" }, { 134, 252, "." }, { 135, 109, "jo" }, { 136, 110, "kz" }, { 137, 111, "ke" }, { 138, 112, "." }, + { 139, 257, "." }, { 140, 115, "kw" }, { 141, 116, "kg" }, { 142, 117, "la" }, { 143, 246, "." }, { 144, 118, "lv" }, { 145, 119, "lb" }, + { 146, 120, "ls" }, { 147, 121, "." }, { 148, 122, "ly" }, { 149, 123, "li" }, { 150, 124, "lt" }, { 151, 125, "lu" }, { 152, 126, "mo" }, + { 153, 127, "mk" }, { 154, 128, "mg" }, { 155, 129, "." }, { 156, 130, "my" }, { 158, 131, "." }, { 159, 132, "ml" }, { 160, 133, "mt" }, + { 161, 134, "." }, { 162, 135, "mq" }, { 163, 136, "mr" }, { 164, 137, "mu" }, { 165, 138, "yt" }, { 62, 139, "mx" }, { 166, 140, "." }, + { 167, 141, "md" }, { 168, 142, "mc" }, { 170, 143, "mn" }, { 169, 242, "me" }, { 171, 144, "." }, { 172, 145, "ma" }, { 173, 146, "mz" }, + { 175, 147, "mm" }, { 176, 148, "na" }, { 178, 149, "." }, { 179, 150, "np" }, { 180, 151, "nl" }, { 181, 153, "nc" }, { 182, 154, "nz" }, + { 183, 155, "ni" }, { 184, 157, "ng" }, { 185, 156, "ne" }, { 186, 158, "." }, { 187, 159, "." }, { 188, 160, "." }, { 189, 113, "kp" }, + { 190, 161, "no" }, { 191, 162, "om" }, { 192, 259, "." }, { 193, 163, "pk" }, { 194, 164, "." }, { 197, 165, "ps" }, { 198, 166, "pa" }, + { 201, 167, "pg" }, { 202, 168, "py" }, { 203, 169, "pe" }, { 204, 170, "ph" }, { 205, 171, "." }, { 206, 172, "pl" }, { 208, 173, "pt" }, + { 209, 174, "pr" }, { 210, 175, "qa" }, { 212, 176, "re" }, { 213, 177, "ro" }, { 214, 178, "ru" }, { 215, 179, "rw" }, { 216, 244, "." }, + { 217, 199, "." }, { 220, 180, "." }, { 221, 181, "." }, { 196, 245, "." }, { 200, 200, "." }, { 222, 182, "." }, { 223, 183, "." }, + { 224, 184, "sm" }, { 76, 185, "st" }, { 225, 186, "sa" }, { 226, 187, "sn" }, { 227, 243, "rs" }, { 228, 188, "sc" }, { 229, 189, "sl" }, + { 230, 190, "sg" }, { 231, 256, "." }, { 233, 191, "sk" }, { 234, 192, "si" }, { 235, 193, "." }, { 236, 194, "so" }, { 238, 195, "za" }, + { 239, 196, "." }, { 240, 114, "kr" }, { 241, 254, "." }, { 242, 197, "es" }, { 243, 198, "lk" }, { 244, 201, "sd" }, { 245, 202, "sr" }, + { 246, 203, "." }, { 248, 205, "se" }, { 247, 206, "ch" }, { 250, 207, "sy" }, { 251, 208, "tw" }, { 252, 209, "tj" }, { 253, 210, "tz" }, + { 254, 211, "th" }, { 255, 62, "tl" }, { 34, 212, "tg" }, { 249, 213, "." }, { 256, 214, "to" }, { 257, 215, "." }, { 259, 253, "." }, + { 42, 216, "tn" }, { 260, 217, "tr" }, { 261, 218, "." }, { 52, 219, "." }, { 157, 220, "." }, { 207, 221, "ug" }, { 195, 222, "ua" }, + { 199, 223, "ae" }, { 130, 224, "gb" }, { 14, 226, "." }, { 2, 225, "us" }, { 66, 234, "." }, { 47, 227, "uy" }, { 115, 228, "uz" }, + { 121, 229, "." }, { 237, 230, "." }, { 219, 231, "ve" }, { 44, 232, "vn" }, { 211, 235, "." }, { 126, 236, "eh" }, { 79, 260, "." }, + { 177, 237, "ye" }, { 258, 239, "zm" }, { 78, 240, "." } }; +#endif }; // Info of a channel ----------------------------------------------------------- @@ -1202,7 +1252,7 @@ class CTimingMeas for ( int i = 0; i < iNumMeas; i++ ) { // convert ns in ms and store the value - streamFile << i << " " << static_cast ( vElapsedTimes[i] ) / 1000000 << endl; + streamFile << i << " " << static_cast ( vElapsedTimes[i] ) / 1000000 << Qt::endl; } } }