Commit Graph

442 Commits

Author SHA1 Message Date
Martchus 8052d04252 Avoid using deprecated `folderID` 2022-06-06 11:30:35 +02:00
Martchus 3b50d78f1e Use resource lock to avoid concurrent execution of tests requiring Syncthing test instance
This is likely the cleaner approach compared to just enforcing a serial run
for the CLI test.
2021-10-13 00:14:35 +02:00
Martchus 1f74a82ecb Adapt test for loading self-signed certificate 2021-10-12 23:55:17 +02:00
Martchus 77f0a8d5ae Update translations 2021-10-09 01:15:49 +02:00
Martchus c63719e2d1 Check whether loaded certificate is not null 2021-10-09 01:14:54 +02:00
Martchus 3c6716ebb9 Expect more TLS error types to support Schannel backend
Apparently the Schannel backend also produces
`QSslError::CertificateUntrusted` errors. Also adding
`QSslError::CertificateRejected` to be sure.
2021-10-09 01:14:54 +02:00
Martchus ab605049aa Improve TLS error messages
* Add fallback to .toPem() when .toText() is not implemented by the TLS
  plugin
* Add error number (Qt's enum value)
* Remove leftover cerr logging
2021-10-09 01:14:54 +02:00
Martchus c3182ff256 Apply cmake-format 2021-10-07 18:28:13 +02:00
Martchus 8b273b6945 Improve messages for TLS errors
Before one only gets the generic error "TLS handshake failed". Now one gets
more details error messages plus the problematic certificate. This should
be helpful for debugging.
2021-10-07 18:22:41 +02:00
Julianne420 ddefa35daa Add zh_CN translation 2021-10-07 01:20:24 +08:00
Martchus 8261a161ab Set default re-connect interval back to 30 seconds
See https://github.com/Martchus/syncthingtray/issues/16#issuecomment-932986686
2021-10-03 23:05:49 +02:00
Hannah Rittich 2968898195 Allow finding of packages in namespaces 2021-10-03 02:07:18 +02:00
Martchus 239d751342 Avoid an unhandled exception when local setup is incorrect
Apparently Boost.Process relies on the setup to be correct so the
configured locale actually needs to be available.
2021-09-30 23:41:27 +02:00
Martchus 8d6a9a042e Adapt config parser tests to changed GUI address 2021-08-25 21:48:33 +02:00
Martchus b828d7c274 Fix launching Syncthing with program/args containing non-ASCII characters
* Pass program/args for Syncthing launcher using UTF-16 under Windows
* See https://github.com/Martchus/syncthingtray/issues/107
2021-08-25 00:15:00 +02:00
Martchus 6aac7b0eae Suppress console Window under Windows
See https://github.com/Martchus/syncthingtray/issues/108
2021-08-24 23:50:28 +02:00
Martchus 7e7eab9eb8 Hardcode `127.0.0.1` in test setup instead of relying on DNS resolution of `localhost`
This should not be necessary but apparently helps with test failures
reported in https://github.com/Martchus/syncthingtray/issues/105.
2021-08-09 13:05:12 +02:00
Martchus f2db5e737c Fix typo in logging of tests 2021-08-07 16:03:57 +02:00
Martchus a1fddfcb07 Apply clang-format/cmake-format 2021-08-03 14:06:17 +02:00
Martchus 4c6315b450 Terminate Syncthing gracefully via REST-API on non-UNIX platforms (2)
A follow up to 0faacaa7c8 to cover the stop button within the launcher
and terminating Syncthing on shutdown/exit. To find the relevant connection
the connection settings are searched for a local URL where the port matches
the port from the Syncthing process log.
2021-07-15 02:38:26 +02:00
Martchus 0ef3b80447 Fix typos found via `codespell --skip .git -w` 2021-07-03 19:29:49 +02:00
Martchus 9f7a19eabc Update translations 2021-07-03 18:50:59 +02:00
Martchus 1acfb8c896 Consider directories still out-of-sync if there are pull errors
Syncthing can report an "idle" status despite pull errors. This still means
the directory is out-of-sync. With this change the out-of-sync status is
only cleared when reading a "FolderSummary" event without pull errors (or
temporarily if the directory is e.g. scanning).
2021-07-01 17:40:23 +02:00
Martchus fdc73bed60 Query only one event at the beginning (to find the ID of the latest event)
Syncthing's official web UI also does the first query for events like this.
This should make loading times a bit faster and removes the possibility of
picking-up obsolete events (which was always problematic).
2021-07-01 17:37:47 +02:00
Martchus 6cfa8a96b6 Do not buffer further output when `readData()` is called on empty buffer
See comment; otherwise calls to `readAll()` with no `bytesAvailable()`
like done in the `syncthingctl` tests fail sporadically as async read
operations are started concurrently.
2021-07-01 17:32:49 +02:00
Martchus 7508e59379 Update translations 2021-06-27 18:59:26 +02:00
Martchus 17f394c118 Add missing library ws2_32 required by Boost.Asio under Windows 2021-06-27 18:54:43 +02:00
Martchus 0faacaa7c8 Terminate Syncthing gracefully via REST-API on non-UNIX platforms
If there's a configured and local Syncthing connection and we're on a
non-UNIX platform which doesn't support SIGTERM (basically Windows) it
makes sense to use the REST-API instead. That's likely better than just
terminating the process forcefully.

This doesn't cover the stop button within the launcher settings yet because
from this context is isn't clear which connection is relevant as there can
be multiple tray icons/widgets but only one settings page.
2021-06-21 23:18:51 +02:00
Martchus 04c82e3ec4 Make logging of process exit an info message 2021-06-21 22:32:51 +02:00
Martchus 900dac793d Silence clazy warnings
For some reason clazy thinks `QIODevice::aboutToClose()` is not a signal.
2021-06-21 22:30:26 +02:00
Martchus 765a323b47 Use a queued connection to handle SyncthingProcess::finished 2021-06-21 22:23:18 +02:00
Martchus eac3b31727 Link against threading library when using Boost.Process 2021-06-21 17:44:43 +02:00
Martchus d91448dfb4 Avoid using `QProcess::ProcessError` to avoid `QMetaMethod::invoke` error
Otherwise `QMetaMethod::invoke` wouldn't be able to handle it:
```
QMetaMethod::invoke: Unable to handle unregistered datatype 'QProcess::ProcessError'
```
2021-06-17 21:17:21 +02:00
Martchus 1bc52ebb0f Improve Boost.Process-based SyncthingProcess
* Implement member functions required to run tests
* Add documentation
* Add minor tweaks
2021-06-17 20:32:40 +02:00
Martchus 9ce9b11ba4 Use Boost.Process for launcher to cope with further sub processes
* Use a process group / job object via Boost.Process to be able to
  terminate sub processes as well
* Do not try to stop the process gracefully under Windows by posting
  WM_CLOSE because this has no effect on Syncthing anyways
* See https://github.com/Martchus/syncthingtray/issues/94
2021-06-16 22:44:48 +02:00
Martchus 7f55afc51c Update translations 2021-06-04 16:26:35 +02:00
Martchus 986959c8b2 Avoid reading reply data if the reply isn't open
This might be the case when the request has been aborted. Reading from the
reply in this case would result in an unwanted log message from Qt.
2021-06-04 16:26:09 +02:00
Martchus 93f59ebf8a Apply clang-format 2021-05-27 18:16:56 +02:00
Martchus 0c475f5b7e Update translations 2021-05-27 18:16:22 +02:00
Martchus 7ad82c9dfe Emit time stamp parsing errors like other parsing errors 2021-05-21 22:34:42 +02:00
Martchus 62e7797558 Allow enabling logging of libsyncthingconnector at runtime
* Remove compile-time switches to enable logging
* Enable logging if certain environment variables are set
* Allow logging all API responses
2021-05-18 18:21:48 +02:00
Martchus fbb7685f4b Fix warnings about detatching Qt container via for loop 2021-05-18 00:08:21 +02:00
Martchus 239f750028 Improve timestamp parsing/handling
* Use local time consistently for timestamps which might get displayed
  within the UI, e.g. the dir status was in one case set to the local time
  and in other cases GMT was used which could lead to discarding status
  updates
* Print warning when timestamp parsing fails (instead of ignoring it
  silently)
* Set directory status from folder status response even when parsing the
  timestamp fails
* Catch possible exception when printing log timestamps in syncthingctl
2021-05-18 00:08:21 +02:00
Martchus b5aa29c98b Update translations 2021-04-07 20:01:07 +02:00
Martchus 46099abc0c Assign empty completion when receiving 404 response 2021-04-07 19:55:47 +02:00
Martchus 9ae7f4a265 Avoid requesting completion for paused devs/dirs after remote index changed 2021-04-07 19:53:16 +02:00
Martchus a5f629d710 Avoid crash when start time can not be parsed 2021-04-07 19:42:07 +02:00
Martchus 31ad8b979c Do not request completion for paused directories
See https://github.com/Martchus/PKGBUILDs/issues/132
2021-04-07 15:12:28 +02:00
Martchus f75966aadc Fix warnings 2021-03-20 22:39:40 +01:00
Martchus 6c12f18eaf Update translations 2021-03-06 16:26:23 +01:00
Martchus 851edeaafc Never consider the own device as paused 2021-02-12 19:44:27 +01:00
Martchus 1cfd067abd Do not accept "lastSeen" timestamps older or equal to the UNIX epoch
The UNIX epoch seems to be the "null-value" provided by Syncthing's API
when there's no "lastSeen" timestamp, e.g. when it is the own device.
2021-02-12 17:55:38 +01:00
Martchus bdf00a9889 Never consider the own device as paused 2021-02-12 12:51:18 +01:00
Martchus 76407c1f1e Consider process initially stopped so the disconnect notification is correctly suppressed 2021-01-06 17:51:21 +01:00
Martchus 4c4fc676e6 Update translations 2021-01-01 21:22:15 +01:00
Martchus ed495ec667 Add UI to configure what information should be considered to compute overall status
* See https://github.com/Martchus/syncthingtray/issues/74
* See https://github.com/Martchus/syncthingtray/issues/76
2021-01-01 20:55:18 +01:00
Martchus b2ba8c01ea Use header-only target of qtutilities
See the commit message of the corresponding commit in c++utilities
(9fb3bbe179698fb10339d4911b98531b0847cfa1) and also the related commit in
reflective-rapidjson (5c49a438ade5ae4253ae978e3a22cf88bd7cb2e2).
2021-01-01 18:50:46 +01:00
Martchus da911c6350 Refactor overall status compution
* Allow configuring the information to consider for computing the overall
  status via SyncthingStatusComputionFlags
    * Add flag to allow considering the status of remote devices for
      https://github.com/Martchus/syncthingtray/issues/74
    * Show only plain "idle" status when no flags are present for
      https://github.com/Martchus/syncthingtray/issues/76
* Set the default flags to keep the default behavior as-is
2020-12-31 02:48:18 +01:00
Martchus 392eb70b12 Remove uses of SyncthingStatus::OutOfSync which is never actually set 2020-12-31 02:33:20 +01:00
Martchus f7c3ceaece Improve documentation of connector library 2020-12-31 02:30:05 +01:00
Martchus 41e0934cd8 Don't call recalculateStatus() in emitNotifications()
because notifications have nothing to do with the status and it should not
make a difference since the status would not change. The UI is supposed to
rely only on newNotification().
2020-12-31 02:28:11 +01:00
Martchus b8f3b664e0 Use CPP_UTILITIES_MARK_FLAG_ENUM_CLASS for SyncthingHighLevelNotification 2020-12-31 02:17:25 +01:00
Martchus c827907ea6 Update SyncthingDirStatus enum to new states from syncthing/lib/model/folderstate.go 2020-12-31 02:13:32 +01:00
Martchus 64686caee6 Avoid detaching Qt container in SyncthingConnection::abortAllRequests()
* See https://doc.qt.io/qt-5/qtglobal.html#qAsConst
* Using std::as_const() instead of qAsConst() to keep support for Qt 5.6
2020-12-31 02:11:35 +01:00
Martchus 1bf58bf38d Apply cmake-format and clang-format 2020-12-17 17:52:02 +01:00
Martchus a069fa954b Apply clang-format 2020-11-03 18:28:31 +01:00
Martchus bacca0241a Fix build with Qt 6 (beta1) 2020-10-23 17:04:35 +02:00
Martchus 49bbebd1ad Allow configuring package suffix for qtutilities individually 2020-10-23 17:03:57 +02:00
Martchus c9a56da42c Fix compilation of mocked configuration 2020-10-07 21:42:50 +02:00
Martchus 0b5fb14931 Remove overspecification of Qt version in documentation and comments 2020-09-04 01:13:46 +02:00
Martchus 3b49e9e312 Support Qt 6 (commit 174154b) 2020-09-04 01:09:18 +02:00
Martchus 1d0888a621 Reformat CMakeLists.txt with cmake-format 0.6.11 2020-08-11 23:15:41 +02:00
Martchus e44a523e3a Update translations 2020-05-05 19:02:30 +02:00
Martchus 364326ddf6 Add missing includes in some header files
See https://github.com/Martchus/syncthingtray/issues/64
2020-04-27 23:08:41 +02:00
Martchus f14a34b877 Apply clang-format 2020-03-17 18:56:59 +01:00
Martchus ccb2ac3144 Clear recent changes when re-connecting (to other instance) 2020-03-17 18:55:50 +01:00
Martchus 395a3503d7 Apply clang-format 2020-03-05 19:17:55 +01:00
Martchus db65957154 Start a few queries before testing to disconnect 2020-03-05 19:17:42 +01:00
Martchus 6010bf72c9 Stop auto-reconnect timer when disconnecting 2020-03-05 19:16:26 +01:00
Martchus c152152b67 Improve comments in build scripts 2020-03-05 19:04:55 +01:00
Martchus b8f19b5cc1 Improve code to avoid multiple completion requests 2020-03-02 18:20:48 +01:00
Martchus 7ad623d660 Increase the timeout for disconnect in tests 2020-03-02 18:19:47 +01:00
Martchus c797850563 Fix missing QHash include required with older Qt versions 2020-03-02 16:00:16 +01:00
Martchus 28dc0bb825 Fix duplicated 'eventType == ' 2020-03-02 15:51:14 +01:00
Martchus cb0d414018 Use std::unordered_map consistently and support legacy Qt 2020-03-02 15:38:38 +01:00
Martchus 5227a7961e Use queued connection for "other replies"
so the handler is not called while looping through the
list of these replies to abort them. The handler must
not be called in that situation because it mutates the
list.
2020-03-01 23:40:27 +01:00
Martchus 11834f89d4 Stop polling timers when reconnecting/disconnecting 2020-03-01 23:20:30 +01:00
Martchus fb86ee7bf9 Avoid unnecessary completion queries
* Ensure the completion for the same dev/dir is not requested
  twice
* Prevent completion query if (no longer) polling for events
2020-03-01 23:06:02 +01:00
Martchus b8edea29f9 Update translations 2020-03-01 22:06:18 +01:00
Martchus bafdb22c47 Compute the sync state for remote devices
See https://github.com/Martchus/syncthingtray/issues/62
2020-03-01 22:04:30 +01:00
Martchus 5a93e5e8dd Update translations 2020-02-18 20:50:53 +01:00
Martchus 94753de797 Fix start/stop button tooltip for system-wide systemd service 2020-02-02 19:51:16 +01:00
Martchus a9abeea8e3 Apply cmake-format 0.6.8 2020-02-02 19:50:35 +01:00
Martchus 133dbacb5d Use consistent order for visibility attribute 2020-01-29 18:51:10 +01:00
Martchus 309ff054a0 Add option to connect automatically on startup 2020-01-23 19:09:51 +01:00
Martchus f9100bb0b4 Don't record file changes on dir level by default 2020-01-18 16:57:03 +01:00
Martchus dab3fd7e31 Update translations 2020-01-18 16:47:51 +01:00
Martchus 7edaacc677 Apply clang-format 2020-01-18 16:43:13 +01:00
Martchus 6026339c83 Show recent changes 2020-01-18 16:43:13 +01:00
Martchus 2d704cf765 Fix missing export macros 2020-01-10 18:01:37 +01:00