Commit Graph

60 Commits

Author SHA1 Message Date
Martchus 843f164df1 Avoid potentially losing events
I have observed that Syncthing Tray can get stuck thinking a remote device
still needs data. Likely the update got lost. The code contains certain
conditions in which folder completion events and requesting completion are
supressed. Those conditions are based on timestamps. That is not ideal as
the accuracy is only one second (so different timestamps might be
considered equal as they are rounded to be the same). Additionally, it
makes no sense to assume a timestamp upon receiving a response as the
information might be older than the time it was received.

This change avoids those conditions. It rather uses the event ID to
decide what event/reply is newer.

This change also uses quint64 instead of int for event IDs to avoid running
into an overflow (or rather conversion error) when deserializing the ID
which might be bigger than int. (Not sure how big the ID can become; this
is to be on the safe side.)
2023-04-15 16:18:23 +02:00
Martchus 83225dbed6 Fix error when generating D-Bus properties interface header
Fixes the following error
```
qdbusxml2cpp: Got unknown type `a{sv}' processing '/build/static-compat-syncthingtray/src/syncthingtray/syncthingconnector/org.freedesktop.DBus.Properties.xml'
You should add <annotation name="org.qtproject.QtDBus.QtTypeName.Out1" value="<type>"/> to the XML description for 'changed_properties'
```
by following the suggestion of that error. Not sure why this
error occurs only now. Maybe `qdbusxml2cpp` changed in Qt 6.5.0.
2023-04-04 21:55:00 +02:00
Martchus 0f6ea4f88e Track "SubState" of systemd service correctly
Due to short-circuing the previous code might not have taken a
changed "SubState" into account. This change should fix it and
therefore might fix
https://github.com/Martchus/syncthingtray/issues/179.
2023-04-03 19:19:45 +02:00
Martchus 76209e2922 Improve handling changed properties in `SyncthingService`
* Check directly whether changed properties contain a property
  instead of checking indirectly whether the returned QVariant
  is invalid.
* Avoid copying the QVariant.
* Effectively this should not change anything; the code is just
  more readable and possibly more efficient.
2023-04-03 19:16:52 +02:00
Martchus f524a18b83 Fix condition for triggering connection once service is back
Skipping the connection attempt if the timer interval is lower
anyways only makes sense if the timer is also active.
2023-04-03 18:47:50 +02:00
Martchus 1d221120fe Apply clang-format 2023-03-31 22:46:48 +02:00
Martchus 033cd21d83 Improve lookup of Chromium-based browser binary
* Consider Edge and Chrome as well
* Read the binary path from the "Application Registration" under Windows
  (see https://learn.microsoft.com/en-us/windows/win32/shell/app-registration)
2023-03-28 22:32:03 +02:00
Martchus db657bb1aa Use QByteArrayLiteral for such literals 2023-03-28 17:20:59 +02:00
Martchus 57d826dfd5 Fix crashes in SyncthingProcess code with MSVC 2022 and Qt 6.5.0
Not sure why `QString::toStdWString()` doesn't work with this compiler and
the official Qt 6.5.0 build. However, instantiating an `std::wstring`
manually works so let's just use this as a workaround.

Note that with GCC/mingw-w64 and Qt 6.4.3 the `QString::toStdWString()`
function works just fine.
2023-03-28 00:02:35 +02:00
Martchus 96e92f13a3 Avoid relying on symlink for include directories
Symlinks aren't working very well with Git under Windows so better avoid
them.
2023-02-27 18:27:33 +01:00