diff --git a/connector/syncthingnotifier.cpp b/connector/syncthingnotifier.cpp index cda588c..3eae9a6 100644 --- a/connector/syncthingnotifier.cpp +++ b/connector/syncthingnotifier.cpp @@ -124,7 +124,7 @@ bool SyncthingNotifier::isDisconnectRelevant() const #ifdef LIB_SYNCTHING_CONNECTOR_SUPPORT_SYSTEMD && ((m_service && m_service->isSystemdAvailable() && !m_service->isActiveWithoutSleepFor(m_process->activeSince(), m_ignoreInavailabilityAfterStart)) - || !m_process->isActiveFor(m_ignoreInavailabilityAfterStart)) + || !m_process->isActiveFor(m_ignoreInavailabilityAfterStart)) #else && !m_process->isActiveFor(m_ignoreInavailabilityAfterStart) #endif diff --git a/connector/syncthingservice.cpp b/connector/syncthingservice.cpp index 28bb8d7..850b29c 100644 --- a/connector/syncthingservice.cpp +++ b/connector/syncthingservice.cpp @@ -227,7 +227,7 @@ void SyncthingService::handlePropertiesChanged( if (handlePropertyChanged( m_activeState, &SyncthingService::activeStateChanged, QStringLiteral("ActiveState"), changedProperties, invalidatedProperties) | handlePropertyChanged( - m_subState, &SyncthingService::subStateChanged, QStringLiteral("SubState"), changedProperties, invalidatedProperties)) { + m_subState, &SyncthingService::subStateChanged, QStringLiteral("SubState"), changedProperties, invalidatedProperties)) { emit stateChanged(m_activeState, m_subState, m_activeSince); } const bool currentlyRunning = isRunning(); diff --git a/fileitemactionplugin/CMakeLists.txt b/fileitemactionplugin/CMakeLists.txt index 874d7fe..987dd0a 100644 --- a/fileitemactionplugin/CMakeLists.txt +++ b/fileitemactionplugin/CMakeLists.txt @@ -38,12 +38,7 @@ use_syncthingmodel() # link also explicitely against the following Qt and KF modules list(APPEND ADDITIONAL_QT_MODULES Network) list(APPEND ADDITIONAL_KF_MODULES KIO) -set(KIO_MODULE_TARGETS - KF5::KIOCore - KF5::KIOFileWidgets - KF5::KIOWidgets - KF5::KIONTLM -) +set(KIO_MODULE_TARGETS KF5::KIOCore KF5::KIOFileWidgets KF5::KIOWidgets KF5::KIONTLM) # include modules to apply configuration include(BasicConfig) diff --git a/libsyncthing/CMakeLists.txt b/libsyncthing/CMakeLists.txt index 6ae6b92..f4320de 100644 --- a/libsyncthing/CMakeLists.txt +++ b/libsyncthing/CMakeLists.txt @@ -8,134 +8,110 @@ set(META_APP_DESCRIPTION "Syncthing itself, built as a shared or static library" set(META_PROJECT_VARNAME_UPPER LIB_SYNCTHING) # add project files -set(HEADER_FILES - interface.h -) -set(SRC_FILES - "${CMAKE_CURRENT_BINARY_DIR}/libsyncthinginternal.h" - interface.cpp -) +set(HEADER_FILES interface.h) +set(SRC_FILES "${CMAKE_CURRENT_BINARY_DIR}/libsyncthinginternal.h" interface.cpp) -set(TEST_HEADER_FILES -) -set(TEST_SRC_FILES - tests/interfacetests.cpp -) +set(TEST_HEADER_FILES) +set(TEST_SRC_FILES tests/interfacetests.cpp) # find the go binary find_program(GO_BIN go) -if(NOT GO_BIN) +if (NOT GO_BIN) message(FATAL_ERROR "The go binary could not be located.") -endif() +endif () # determine GOARCH for target set(GO_TARGET_ARCH_OVERRIDE "" CACHE STRING "overrides the 'GOARCH' variable") -if(GO_TARGET_ARCH_OVERRIDE) +if (GO_TARGET_ARCH_OVERRIDE) set(GO_TARGET_ARCH "${GO_TARGET_ARCH_OVERRIDE}") -elseif(NOT CMAKE_CROSSCOMPILING) +elseif (NOT CMAKE_CROSSCOMPILING) set(GO_TARGET_ARCH "") -elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") +elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") set(GO_TARGET_ARCH "amd64") -elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "i[3-6]86") +elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "i[3-6]86") set(GO_TARGET_ARCH "386") -elseif(CMAKE_SYSTEM_NAME MATCHES "(ppc64|ppc64le|arm|arm64|s390x)") +elseif (CMAKE_SYSTEM_NAME MATCHES "(ppc64|ppc64le|arm|arm64|s390x)") set(GO_TARGET_ARCH "${CMAKE_SYSTEM_NAME}") -else() +else () message(FATAL_ERROR "Unable to auto-determine GOARCH. Please set GO_TARGET_ARCH_OVERRIDE manually.") -endif() +endif () # determine GOOS for target set(GO_TARGET_OS_OVERRIDE "" CACHE STRING "overrides the 'GOOS' variable") -if(GO_TARGET_OS_OVERRIDE) +if (GO_TARGET_OS_OVERRIDE) set(GO_TARGET_OS "${GO_TARGET_OS_OVERRIDE}") -elseif(NOT CMAKE_CROSSCOMPILING) +elseif (NOT CMAKE_CROSSCOMPILING) set(GO_TARGET_OS "") -elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux") +elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux") set(GO_TARGET_OS "linux") -elseif(CMAKE_SYSTEM_NAME STREQUAL "Android") +elseif (CMAKE_SYSTEM_NAME STREQUAL "Android") set(GO_TARGET_OS "android") -elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows") +elseif (CMAKE_SYSTEM_NAME STREQUAL "Windows") set(GO_TARGET_OS "windows") -elseif(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") +elseif (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") set(GO_TARGET_OS "freebsd") -elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin") +elseif (CMAKE_SYSTEM_NAME STREQUAL "Darwin") set(GO_TARGET_OS "darwin") -else() +else () message(FATAL_ERROR "Unable to auto-determine GOOS. Please set GO_TARGET_OS_OVERRIDE manually.") -endif() +endif () message(STATUS "Using GOOS=${GO_TARGET_OS} and GOARCH=${GO_TARGET_ARCH}") # locate the Syncthing checkout set(GO_DEVELOPMENT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/go" CACHE PATH "the 'GOPATH'") -set(SYNCTHING_PATH "${CMAKE_CURRENT_SOURCE_DIR}/go/src/github.com/syncthing/syncthing" CACHE PATH "path of Syncthing checkout") +set(SYNCTHING_PATH "${CMAKE_CURRENT_SOURCE_DIR}/go/src/github.com/syncthing/syncthing" + CACHE PATH "path of Syncthing checkout") -# find Syncthing's assets -# caveat: newly added assets will not cause CMake to automatically regenerate -file(GLOB_RECURSE SRC_FILES_SYNCTHING_ASSETS - LIST_DIRECTORIES false - RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" - "${SYNCTHING_PATH}/gui/*" -) -if(NOT SRC_FILES_SYNCTHING_ASSETS) - message(FATAL_ERROR "No asset files found in Syncthing checkout \"${CMAKE_CURRENT_SOURCE_DIR}/go/src/github.com/syncthing/syncthing\".") -endif() +# find Syncthing's assets caveat: newly added assets will not cause CMake to automatically regenerate +file(GLOB_RECURSE SRC_FILES_SYNCTHING_ASSETS LIST_DIRECTORIES false + RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "${SYNCTHING_PATH}/gui/*") +if (NOT SRC_FILES_SYNCTHING_ASSETS) + message( + FATAL_ERROR + "No asset files found in Syncthing checkout \"${CMAKE_CURRENT_SOURCE_DIR}/go/src/github.com/syncthing/syncthing\"." + ) +endif () -# find Syncthing's source code -# caveat: newly added files will not cause CMake to automatically regenerate -file(GLOB_RECURSE SRC_FILES_SYNCTHING - LIST_DIRECTORIES false - RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" - "${SYNCTHING_PATH}/cmd/*.go" - "${SYNCTHING_PATH}/cmd/*.h" - "${SYNCTHING_PATH}/cmd/*.c" -) -if(NOT SRC_FILES_SYNCTHING) - message(FATAL_ERROR "No *.go files found in Syncthing checkout \"${CMAKE_CURRENT_SOURCE_DIR}/go/src/github.com/syncthing/syncthing\".") -endif() +# find Syncthing's source code caveat: newly added files will not cause CMake to automatically regenerate +file(GLOB_RECURSE SRC_FILES_SYNCTHING LIST_DIRECTORIES false + RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" + "${SYNCTHING_PATH}/cmd/*.go" + "${SYNCTHING_PATH}/cmd/*.h" + "${SYNCTHING_PATH}/cmd/*.c") +if (NOT SRC_FILES_SYNCTHING) + message( + FATAL_ERROR + "No *.go files found in Syncthing checkout \"${CMAKE_CURRENT_SOURCE_DIR}/go/src/github.com/syncthing/syncthing\"." + ) +endif () list(APPEND SRC_FILES_SYNCTHING "${SYNCTHING_PATH}/lib/auto/gui.files.go") message(STATUS "Syncthing's go files: ${SRC_FILES_SYNCTHING}") # generate Syncthing's assets: don't set GOARCH/GOOS here, this is supposed to run on the host -add_custom_command( - OUTPUT - "${SYNCTHING_PATH}/lib/auto/gui.files.go" - COMMAND - "GOPATH=${GO_DEVELOPMENT_PATH}" - "${GO_BIN}" run ./script/genassets.go gui > lib/auto/gui.files.go - DEPENDS ${SRC_FILES_SYNCTHING_ASSETS} - WORKING_DIRECTORY "${SYNCTHING_PATH}" - COMMENT "Building Syncthing's assets" -) +add_custom_command(OUTPUT "${SYNCTHING_PATH}/lib/auto/gui.files.go" + COMMAND "GOPATH=${GO_DEVELOPMENT_PATH}" "${GO_BIN}" run ./script/genassets.go gui > lib/auto/gui.files.go + DEPENDS ${SRC_FILES_SYNCTHING_ASSETS} + WORKING_DIRECTORY "${SYNCTHING_PATH}" + COMMENT "Building Syncthing's assets") # compile Syncthing as static library -add_custom_command( - OUTPUT - "${CMAKE_CURRENT_BINARY_DIR}/libsyncthinginternal.a" - "${CMAKE_CURRENT_BINARY_DIR}/libsyncthinginternal.h" - COMMAND - "CC=${CMAKE_C_COMPILER}" - "CXX=${CMAKE_CXX_COMPILER}" - "AR=${CMAKE_C_COMPILER_AR}" - "GOOS=${GO_TARGET_OS}" - "GOARCH=${GO_TARGET_ARCH}" - "CGO_ENABLED=1" - "GOPATH=${GO_DEVELOPMENT_PATH}" - "${GO_BIN}" build -v -buildmode c-archive - -o "${CMAKE_CURRENT_BINARY_DIR}/libsyncthinginternal.a" - ./cmd/syncthing - && "${CMAKE_RANLIB}" "${CMAKE_CURRENT_BINARY_DIR}/libsyncthinginternal.a" - DEPENDS ${SRC_FILES_SYNCTHING} - WORKING_DIRECTORY "${SYNCTHING_PATH}" - COMMENT "Building Syncthing itself" -) +add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/libsyncthinginternal.a" + "${CMAKE_CURRENT_BINARY_DIR}/libsyncthinginternal.h" + COMMAND "CC=${CMAKE_C_COMPILER}" "CXX=${CMAKE_CXX_COMPILER}" "AR=${CMAKE_C_COMPILER_AR}" + "GOOS=${GO_TARGET_OS}" "GOARCH=${GO_TARGET_ARCH}" "CGO_ENABLED=1" "GOPATH=${GO_DEVELOPMENT_PATH}" + "${GO_BIN}" build -v -buildmode c-archive -o "${CMAKE_CURRENT_BINARY_DIR}/libsyncthinginternal.a" + ./cmd/syncthing && "${CMAKE_RANLIB}" "${CMAKE_CURRENT_BINARY_DIR}/libsyncthinginternal.a" + DEPENDS ${SRC_FILES_SYNCTHING} + WORKING_DIRECTORY "${SYNCTHING_PATH}" + COMMENT "Building Syncthing itself") # do not use this library directly but depend on it list(APPEND PRIVATE_LIBRARIES "${CMAKE_CURRENT_BINARY_DIR}/libsyncthinginternal.a") # add additional libraries (not sure if go build could provide this list somehow to make this more generic) -if(WIN32) +if (WIN32) list(APPEND PRIVATE_LIBRARIES -lws2_32 -lwinmm) -elseif(UNIX) +elseif (UNIX) list(APPEND PRIVATE_LIBRARIES -lpthread) -endif() +endif () # ensure we can find libsyncthing.h from Syncthing's source tree when building the interface list(APPEND PRIVATE_INCLUDE_DIRS "${SYNCTHING_PATH}/cmd/syncthing") @@ -155,10 +131,8 @@ include(Doxygen) include(ConfigHeader) # create install target for static libsyncthinginternal.a if we're also creating a static libsyncthing.a -if(BUILD_STATIC_LIBS AND NOT META_NO_INSTALL_TARGETS AND ENABLE_INSTALL_TARGETS) - install( - FILES "${CMAKE_CURRENT_BINARY_DIR}/libsyncthinginternal.a" - DESTINATION "lib${SELECTED_LIB_SUFFIX}" - COMPONENT binary - ) -endif() +if (BUILD_STATIC_LIBS AND NOT META_NO_INSTALL_TARGETS AND ENABLE_INSTALL_TARGETS) + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libsyncthinginternal.a" + DESTINATION "lib${SELECTED_LIB_SUFFIX}" + COMPONENT binary) +endif () diff --git a/model/syncthingdevicemodel.cpp b/model/syncthingdevicemodel.cpp index f5e12a9..0b0eb48 100644 --- a/model/syncthingdevicemodel.cpp +++ b/model/syncthingdevicemodel.cpp @@ -306,7 +306,10 @@ QVariant SyncthingDeviceModel::data(const QModelIndex &index, int role) const bool SyncthingDeviceModel::setData(const QModelIndex &index, const QVariant &value, int role) { - Q_UNUSED(index) Q_UNUSED(value) Q_UNUSED(role) return false; + Q_UNUSED(index) + Q_UNUSED(value) + Q_UNUSED(role) + return false; } int SyncthingDeviceModel::rowCount(const QModelIndex &parent) const diff --git a/model/syncthingdirectorymodel.cpp b/model/syncthingdirectorymodel.cpp index 0cf0741..17dd861 100644 --- a/model/syncthingdirectorymodel.cpp +++ b/model/syncthingdirectorymodel.cpp @@ -364,7 +364,10 @@ QVariant SyncthingDirectoryModel::data(const QModelIndex &index, int role) const bool SyncthingDirectoryModel::setData(const QModelIndex &index, const QVariant &value, int role) { - Q_UNUSED(index) Q_UNUSED(value) Q_UNUSED(role) return false; + Q_UNUSED(index) + Q_UNUSED(value) + Q_UNUSED(role) + return false; } int SyncthingDirectoryModel::rowCount(const QModelIndex &parent) const diff --git a/model/syncthingdownloadmodel.cpp b/model/syncthingdownloadmodel.cpp index 4c73bdc..de2aa1b 100644 --- a/model/syncthingdownloadmodel.cpp +++ b/model/syncthingdownloadmodel.cpp @@ -189,7 +189,10 @@ QVariant SyncthingDownloadModel::data(const QModelIndex &index, int role) const bool SyncthingDownloadModel::setData(const QModelIndex &index, const QVariant &value, int role) { - Q_UNUSED(index) Q_UNUSED(value) Q_UNUSED(role) return false; + Q_UNUSED(index) + Q_UNUSED(value) + Q_UNUSED(role) + return false; } int SyncthingDownloadModel::rowCount(const QModelIndex &parent) const diff --git a/testhelper/helper.h b/testhelper/helper.h index 2c90ab5..9e973c7 100644 --- a/testhelper/helper.h +++ b/testhelper/helper.h @@ -161,7 +161,8 @@ public: #endif } // register own handler to detect whether signal has been emitted - m_emittedConnection = QObject::connect(sender, signal, sender, [this] { m_signalEmitted = true; }, Qt::DirectConnection); + m_emittedConnection = QObject::connect( + sender, signal, sender, [this] { m_signalEmitted = true; }, Qt::DirectConnection); #ifndef SYNCTHINGTESTHELPER_FOR_CLI if (!m_emittedConnection) { CPPUNIT_FAIL(argsToString("Unable to connect signal ", signalName().data(), " to check for signal emmitation")); diff --git a/widgets/misc/internalerror.cpp b/widgets/misc/internalerror.cpp index 9ab09ec..445d6ff 100644 --- a/widgets/misc/internalerror.cpp +++ b/widgets/misc/internalerror.cpp @@ -54,7 +54,7 @@ bool InternalError::isRelevant(const SyncthingConnection &connection, SyncthingE #ifdef LIB_SYNCTHING_CONNECTOR_SUPPORT_SYSTEMD && ((service && service->isSystemdAvailable() && !service->isActiveWithoutSleepFor(launcher->activeSince(), settings.ignoreInavailabilityAfterStart)) - || !launcher->isActiveFor(settings.ignoreInavailabilityAfterStart)) + || !launcher->isActiveFor(settings.ignoreInavailabilityAfterStart)) #else && !launcher->isActiveFor(settings.ignoreInavailabilityAfterStart) #endif