From 79ed60ff7201730ff933ce1cd67484e0cc28b65b Mon Sep 17 00:00:00 2001 From: Julien Wadel Date: Fri, 7 Feb 2020 09:25:16 +0100 Subject: [PATCH] Remove some macro, debug on qml image loads, order of headers --- CMakeLists.txt | 33 +++++++++++++++++++ build_all_win.bat | 19 ++++++----- src/app/App.cpp | 11 +++---- src/app/main.cpp | 5 ++- src/app/providers/ImageProvider.cpp | 6 ++-- .../single-application/SingleApplication.cpp | 16 +++++---- .../SingleApplicationPrivate.hpp | 2 +- src/components/call/CallModel.cpp | 18 ++++++---- src/components/call/CallModel.hpp | 3 +- .../desktop-tools/DesktopToolsWindows.cpp | 3 +- src/utils/QExifImageHeader.cpp | 9 ++--- 11 files changed, 84 insertions(+), 41 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5646aabf6..1dee0d6dd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,6 +36,29 @@ set(ASSETS_DIR "assets") option(ENABLE_UPDATE_CHECK "Enable update check." NO) +option(ENABLE_GPL_THIRD_PARTIES "" YES) +option(ENABLE_NON_FREE_CODECS "Allow inclusion of non-free codecs in the build." YES) +option(ENABLE_AMRNB "" YES) +option(ENABLE_AMRWB "" YES) +option(ENABLE_BV16 "Build mediastreamer2 with the BV16 codec." YES) +option(ENABLE_G729 "Build mediastreamer2 with the G726 codec." YES) +#option(ENABLE_G729B_CNG "Build mediastreamer2 with G729 annex B cng." NO) +option(ENABLE_GSM "Build mediastreamer2 with the GSM codec." YES) +option(ENABLE_ILBC "" YES) +option(ENABLE_ISAC "" YES) +option(ENABLE_OPUS "Build mediastreamer2 with the OPUS codec." YES) +option(ENABLE_SILK "" YES) +#option(ENABLE_SPEEX "" YES) +option(ENABLE_SPEEX_CODEC "Build mediastreamer2 with the SPEEX codec." YES) +option(ENABLE_SPEEX_DSP "Build mediastreamer2 with the SPEEX DSP support." YES) +option(ENABLE_FFMPEG "Build mediastreamer2 with ffmpeg video support." YES) +option(ENABLE_H263 "" YES) +option(ENABLE_H263P "" YES) +option(ENABLE_MPEG4 "" YES) +option(ENABLE_OPENH264 "Embedded OpenH264" YES) +option(ENABLE_VPX "Build mediastreamer2 with VPX codec." YES) +option(ENABLE_MKV "Enable support of MKV files reading and writing." YES) + include(GNUInstallDirs) include(CheckCXXCompilerFlag) @@ -72,6 +95,8 @@ if (NOT WIN32) if (SUGGEST_OVERRIDE) set(CUSTOM_FLAGS "${CUSTOM_FLAGS} -Wsuggest-override -Werror=suggest-override") endif () +elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang") + set(CUSTOM_FLAGS "${CUSTOM_FLAGS} -Wno-switch") endif () set(CUSTOM_FLAGS "${CUSTOM_FLAGS} -DQT_NO_EXCEPTIONS") @@ -327,6 +352,14 @@ execute_process(COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/.git/hooks/pre-commit" ) +set(_QML_IMPORT_PATHS "") +list(APPEND _QML_IMPORT_PATHS "${CMAKE_CURRENT_SOURCE_DIR}/ui/modules") +list(APPEND _QML_IMPORT_PATHS "${CMAKE_CURRENT_SOURCE_DIR}/ui/dev-modules") +list(APPEND _QML_IMPORT_PATHS "${CMAKE_CURRENT_SOURCE_DIR}/ui/scripts") +list(APPEND _QML_IMPORT_PATHS "${CMAKE_CURRENT_SOURCE_DIR}/ui/views") + +set(QML_IMPORT_PATH ${_QML_IMPORT_PATHS} CACHE STRING "Path used to locate CMake modules by Qt Creator" FORCE) + # ------------------------------------------------------------------------------ # Create config.h file # ------------------------------------------------------------------------------ diff --git a/build_all_win.bat b/build_all_win.bat index 7c7959707..907659e97 100644 --- a/build_all_win.bat +++ b/build_all_win.bat @@ -8,24 +8,25 @@ IF NOT EXIST build-minizip mkdir build-minizip cd ../../.. :: SDK Building -cd linphone-sdk/build-sdk -cmake .. -DLINPHONESDK_PLATFORM=Desktop -DENABLE_CSHARP_WRAPPER=YES -DCMAKE_BUILD_TYPE=Debug -DENABLE_VPX=ON -A Win32 +cd linphone-sdk/build-sdk +cmake .. -DLINPHONESDK_PLATFORM=Desktop -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_VPX=YES -A Win32 -DENABLE_GPL_THIRD_PARTIES=YES -DENABLE_NON_FREE_CODECS=YES -DENABLE_AMRNB=YES -DENABLE_AMRWB=YES -DENABLE_G729=YES -DENABLE_GSM=YES -DENABLE_ILBC=YES -DENABLE_ISAC=YES -DENABLE_OPUS=YES -DENABLE_SILK=YES -DENABLE_SPEEX=YES -DENABLE_H263=YES -DENABLE_H263P=YES -DENABLE_MPEG4=YES -DENABLE_OPENH264=YES -DENABLE_FFMPEG=YES -DENABLE_VIDEO=YES -DENABLE_GL=YES +::cmake .. -DLINPHONESDK_PLATFORM=Desktop -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_VPX=YES -A Win32 -DENABLE_VIDEO=YES -DENABLE_GL=YES if %errorlevel% neq 0 exit /b %errorlevel% -cmake --build . --target sdk --parallel 5 +cmake --build . --target sdk --config RelWithDebInfo --parallel 5 if %errorlevel% neq 0 exit /b %errorlevel% robocopy linphone-sdk\desktop ..\..\build-desktop\OUTPUT /e /njh /njs /ndl /nc /ns cd ../.. :: Minizip Submodule Building cd submodules/externals/minizip/build-minizip -cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=../../build-desktop/OUTPUT -DCMAKE_PREFIX_PATH="../../../linphone-sdk/build-sdk/linphone-sdk/desktop" -A Win32 -cmake --build . --target all_build --config Debug -- /maxcpucount /nodeReuse:true /p:TrackFileAccess=false -cmake --build . --target install --config Debug -- /maxcpucount /nodeReuse:true /p:TrackFileAccess=false +cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=../../../../build-desktop/OUTPUT -DCMAKE_PREFIX_PATH="../../../linphone-sdk/build-sdk/linphone-sdk/desktop" -A Win32 +cmake --build . --target all_build --config RelWithDebInfo -- /maxcpucount /nodeReuse:true /p:TrackFileAccess=false +cmake --build . --target install --config RelWithDebInfo -- /maxcpucount /nodeReuse:true /p:TrackFileAccess=false cd ../../../.. :: Desktop Building cd build-desktop -cmake .. -DENABLE_CSHARP_WRAPPER=YES -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=OUTPUT -DCMAKE_PREFIX_PATH="linphone-sdk/build-sdk/linphone-sdk/desktop;submodules/externals/minizip/build-minizip/OUTPUT" -A Win32 +cmake .. -DENABLE_CSHARP_WRAPPER=YES -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=OUTPUT -DCMAKE_PREFIX_PATH="linphone-sdk/build-sdk/linphone-sdk/desktop" -A Win32 if %errorlevel% neq 0 exit /b %errorlevel% -cmake --build . --target all_build --config Debug -- /maxcpucount /nodeReuse:true /p:TrackFileAccess=false -cmake --build . --target install --config Debug -- /maxcpucount /nodeReuse:true /p:TrackFileAccess=false +cmake --build . --target all_build --config RelWithDebInfo --parallel 5 -- /maxcpucount /nodeReuse:true /p:TrackFileAccess=false +cmake --build . --target install --config RelWithDebInfo -- /maxcpucount /nodeReuse:true /p:TrackFileAccess=false diff --git a/src/app/App.cpp b/src/app/App.cpp index 72886dbbe..da1f33687 100644 --- a/src/app/App.cpp +++ b/src/app/App.cpp @@ -19,7 +19,11 @@ * Created on: February 2, 2017 * Author: Ronan Abhamon */ +#include "App.hpp" +#ifdef Q_OS_WIN + #include +#endif // ifdef Q_OS_WIN #include #include #include @@ -31,12 +35,7 @@ #include #include -#ifdef Q_OS_WIN - #include -#endif // ifdef Q_OS_WIN - #include "config.h" - #include "cli/Cli.hpp" #include "components/Components.hpp" #include "logger/Logger.hpp" @@ -48,8 +47,6 @@ #include "utils/LinphoneUtils.hpp" #include "utils/Utils.hpp" -#include "App.hpp" - // ============================================================================= using namespace std; diff --git a/src/app/main.cpp b/src/app/main.cpp index 5719f2f33..3414711d5 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -21,11 +21,14 @@ */ #include "AppController.hpp" - +#include // ============================================================================= int main (int argc, char *argv[]) { + QApplication::setOrganizationName("Belledonne-Communications"); + QApplication::setOrganizationDomain("linphone.org"); AppController controller(argc, argv); + //QLoggingCategory::setFilterRules("*.debug=true;qml=false"); App *app = controller.getApp(); if (app->isSecondary()) { diff --git a/src/app/providers/ImageProvider.cpp b/src/app/providers/ImageProvider.cpp index 5364b3d31..f5c3b5a28 100644 --- a/src/app/providers/ImageProvider.cpp +++ b/src/app/providers/ImageProvider.cpp @@ -247,8 +247,8 @@ ImageProvider::ImageProvider () : QQuickImageProvider( QImage ImageProvider::requestImage (const QString &id, QSize *size, const QSize &requestedSize) { const QString path = QStringLiteral(":%1").arg(id); - qDebug() << QStringLiteral("Image `%1` requested with size: (%2, %3).") - .arg(path).arg(requestedSize.width()).arg(requestedSize.height()); +// qDebug() << QStringLiteral("Image `%1` requested with size: (%2, %3).") +// .arg(path).arg(requestedSize.width()).arg(requestedSize.height()); QElapsedTimer timer; timer.start(); @@ -298,7 +298,7 @@ QImage ImageProvider::requestImage (const QString &id, QSize *size, const QSize QPainter painter(&image); renderer.render(&painter); - qDebug() << QStringLiteral("Image `%1` loaded in %2 milliseconds.").arg(path).arg(timer.elapsed()); +// qDebug() << QStringLiteral("Image `%1` loaded in %2 milliseconds.").arg(path).arg(timer.elapsed()); return image; } diff --git a/src/app/single-application/SingleApplication.cpp b/src/app/single-application/SingleApplication.cpp index 38a5f4465..195f64837 100644 --- a/src/app/single-application/SingleApplication.cpp +++ b/src/app/single-application/SingleApplication.cpp @@ -38,16 +38,16 @@ #include #endif // ifdef Q_OS_UNIX -#ifdef Q_OS_WIN - #include - #include -#endif // ifdef Q_OS_WIN #include "utils/Utils.hpp" #include "SingleApplication.hpp" #include "SingleApplicationPrivate.hpp" +#ifdef Q_OS_WIN + #include + #include +#endif // ifdef Q_OS_WIN // ============================================================================= using namespace std; @@ -61,7 +61,7 @@ namespace { // ----------------------------------------------------------------------------- -SingleApplicationPrivate::SingleApplicationPrivate (SingleApplication *q_ptr) : q_ptr(q_ptr) { +SingleApplicationPrivate::SingleApplicationPrivate (SingleApplication *p_ptr) : q_ptr(p_ptr) { server = nullptr; socket = nullptr; } @@ -104,7 +104,7 @@ void SingleApplicationPrivate::genBlockServerName (int timeout) { // User level block requires a user specific data in the hash if (options & SingleApplication::Mode::User) { #ifdef Q_OS_WIN - Q_UNUSED(timeout); + Q_UNUSED(timeout) wchar_t username[UNLEN + 1]; // Specifies size of the buffer on input DWORD usernameLength = UNLEN + 1; @@ -265,7 +265,9 @@ void SingleApplicationPrivate::slotConnectionEstablished () { tmp = nextConnSocket->read(checksum.length()); if (checksum == tmp) break; // Otherwise set to invalid connection (next line) - } UTILS_NO_BREAK; + connectionType = InvalidConnection; + break; + } default: connectionType = InvalidConnection; } diff --git a/src/app/single-application/SingleApplicationPrivate.hpp b/src/app/single-application/SingleApplicationPrivate.hpp index c7ffe1ea2..fa0b3ca49 100644 --- a/src/app/single-application/SingleApplicationPrivate.hpp +++ b/src/app/single-application/SingleApplicationPrivate.hpp @@ -44,7 +44,7 @@ struct InstancesInfo { bool primary; quint32 secondary; - quint64 primaryId; + qint64 primaryId; }; class SingleApplicationPrivate : public QObject { diff --git a/src/components/call/CallModel.cpp b/src/components/call/CallModel.cpp index f98b7adce..eb7b0a427 100644 --- a/src/components/call/CallModel.cpp +++ b/src/components/call/CallModel.cpp @@ -19,6 +19,7 @@ * Created on: February 2, 2017 * Author: Ronan Abhamon */ +#include "CallModel.hpp" #include #include @@ -36,7 +37,7 @@ #include "utils/MediastreamerUtils.hpp" #include "utils/Utils.hpp" -#include "CallModel.hpp" + // ============================================================================= @@ -282,11 +283,14 @@ void CallModel::handleCallStateChanged (const shared_ptr &call, mPausedByRemote = false; break; - case linphone::Call::State::StreamsRunning: + case linphone::Call::State::StreamsRunning: { if (!mWasConnected && CoreManager::getInstance()->getSettingsModel()->getAutomaticallyRecordCalls()) { startRecording(); mWasConnected = true; - } UTILS_NO_BREAK; + } + mPausedByRemote = false; + break; + } case linphone::Call::State::Connected: case linphone::Call::State::Referred: case linphone::Call::State::Released: @@ -703,8 +707,8 @@ void CallModel::updateStats (const shared_ptr &callSt statsList << createStat(tr("callStatsDownloadBandwidth"), QStringLiteral("%1 kbits/s").arg(int(callStats->getDownloadBandwidth()))); statsList << createStat(tr("callStatsIceState"), iceStateToString(callStats->getIceState())); statsList << createStat(tr("callStatsIpFamily"), family); - statsList << createStat(tr("callStatsSenderLossRate"), QStringLiteral("%1 %").arg(callStats->getSenderLossRate())); - statsList << createStat(tr("callStatsReceiverLossRate"), QStringLiteral("%1 %").arg(callStats->getReceiverLossRate())); + statsList << createStat(tr("callStatsSenderLossRate"), QStringLiteral("%1 %").arg(static_cast(callStats->getSenderLossRate()))); + statsList << createStat(tr("callStatsReceiverLossRate"), QStringLiteral("%1 %").arg(static_cast(callStats->getReceiverLossRate()))); switch (callStats->getType()) { case linphone::StreamType::Audio: @@ -730,8 +734,8 @@ void CallModel::updateStats (const shared_ptr &callSt ? receivedVideoDefinition : QString("%1 (%2)").arg(receivedVideoDefinition).arg(receivedVideoDefinitionName)); - statsList << createStat(tr("callStatsReceivedFramerate"), QStringLiteral("%1 FPS").arg(params->getReceivedFramerate())); - statsList << createStat(tr("callStatsSentFramerate"), QStringLiteral("%1 FPS").arg(params->getSentFramerate())); + statsList << createStat(tr("callStatsReceivedFramerate"), QStringLiteral("%1 FPS").arg(static_cast(params->getReceivedFramerate()))); + statsList << createStat(tr("callStatsSentFramerate"), QStringLiteral("%1 FPS").arg(static_cast(params->getSentFramerate()))); } break; default: diff --git a/src/components/call/CallModel.hpp b/src/components/call/CallModel.hpp index a8b394349..2ddbbf413 100644 --- a/src/components/call/CallModel.hpp +++ b/src/components/call/CallModel.hpp @@ -23,8 +23,9 @@ #ifndef CALL_MODEL_H_ #define CALL_MODEL_H_ -#include #include +#include + // ============================================================================= diff --git a/src/components/other/desktop-tools/DesktopToolsWindows.cpp b/src/components/other/desktop-tools/DesktopToolsWindows.cpp index 64c6c574e..4d308f743 100644 --- a/src/components/other/desktop-tools/DesktopToolsWindows.cpp +++ b/src/components/other/desktop-tools/DesktopToolsWindows.cpp @@ -20,10 +20,11 @@ * Author: Ronan Abhamon */ -#include + #include "DesktopToolsWindows.hpp" +#include // ============================================================================= DesktopTools::DesktopTools (QObject *parent) : QObject(parent) {} diff --git a/src/utils/QExifImageHeader.cpp b/src/utils/QExifImageHeader.cpp index fc799f7c2..c9b8de7dc 100644 --- a/src/utils/QExifImageHeader.cpp +++ b/src/utils/QExifImageHeader.cpp @@ -120,7 +120,7 @@ public: QExifByteValuePrivate (const QVector &v) : QExifValuePrivate(QExifValue::Byte, v.size()), value(v) {} - + ~QExifByteValuePrivate(){} QVector value; }; @@ -491,13 +491,15 @@ QString QExifValue::toString () const { QTextCodec *codec = QTextCodec::codecForName("UTF-16"); if (codec) return codec->toUnicode(string); - } UTILS_NO_BREAK; + return QString::fromLocal8Bit(string.constData(), string.length()); + } case UndefinedEncoding: return QString::fromLocal8Bit(string.constData(), string.length()); default: break; } - } UTILS_NO_BREAK; + return QString(); + } default: return QString(); } @@ -1391,7 +1393,6 @@ QExifValue QExifImageHeader::readIfdValue (QDataStream &stream, int startPos, co } return QExifValue(value); } - break; case QExifValue::Rational: { QVector value(int(header.count));