Commit Graph

71 Commits

Author SHA1 Message Date
Martchus 4265a94a63 Apply clang-format 2024-01-27 02:56:53 +01:00
Martchus 5667aad412 Support Syncthing's shell completion
Syncthing added shell completion in v1.27.3-rc.1 (commit
78db3af8c5e8bd08a9773b0c4da233a52ed4cfe6). This change integrates
that shell completion with Syncthing Tray's long existing completion (which
only supports Bash so far).
2024-01-26 01:48:47 +01:00
Martchus 90a790d584 Improve CLI for running Syncthing itself
* Fix abbreviation
* Streamline with Syncthing itself so no arguments mean `serve` (and not
  `--help`)
2023-05-29 18:12:07 +02:00
Martchus b9853043fb Improve libsyncthing
* Do *not* build Syncthing in addition as standalone executalbe
* Explose instead all of Syncthing's commands via the library
  interface
* Make all of Syncthing's commands (including `serve`) accessible
  via Syncthing Tray's executable
* Remove copied code for directory creation and instead use
  upstream's code directly
2023-05-29 17:30:33 +02:00
Martchus 41b26d7f71 Avoid another warning about shadowing 2023-05-21 19:08:46 +02:00
Martchus 9f2e2819c6 Use generic `toInt()` function which relies less on compiler optimizations 2023-05-18 00:53:37 +02:00
Martchus d3a559446f Apply clang-format 2023-05-11 17:57:22 +02:00
Martchus e703ddd524 Allow overriding single instance ID via env variable 2023-05-03 21:18:03 +02:00
Martchus 884ead9760 Improve startup code further to fix problems showing expecially on Windows
* Avoid overriding argv/argc via `CMD_UTILS_CONVERT_ARGS_TO_UTF8` in
  Windows-specific code when processing arguments from a 2nd instance
* Move the other startup code to main as well as they are not needed when
  processing arguments from a 2nd instance
* Improve debug logging
* Use `waitForBytesWritten()` instead of `flush()` when passing args as
  recommended by the documentation
* Avoid use of `bytesAvailable()` as it doesn't work as expected in this
  situation on Windows (likely it doesn't really work reliably on all
  platforms); calling `readAll()` works and is simpler anyways
* Tested that `--replace` works as well; also the
  `waitUntilGone && QFile::exists(fullServerName)` block is entered and if
  the previous instance is taking some time it really waits until it is
  gone
2023-05-01 21:10:09 +02:00
Martchus c9cd81311d Improve startup/shutdown behavior; add `--replace` CLI option
* Make functions in `main.cpp` static as they are not used by
  other units
* Delete the `TrayIcon` via an extra parent object that is
  deleted before the `QNetworkAccessManager` is deleted; otherwise
  the destruction of `SyncthingConnection` (which aborts pending
  replies) might access dangling `QNetworkReply` objects
* Improve error handling in `SingleInstance` code
* Allow to replace the current instance via the new `--replace`
  argument; this may be useful when creating an installer/updater
2023-04-29 21:07:30 +02:00
Martchus 58b8a4e540 Allow showing Syncthing UI in Chromium-based browser in "app mode"
See https://github.com/Martchus/syncthingtray/issues/178
2023-03-27 20:28:52 +02:00
Martchus 9566623651 Apply Qt settings during runtime
It is no longer required to restart the application to change settings like
the widget style and palette.
2023-03-26 21:32:53 +02:00
Martchus 10c656cc5e Show error when settings cannot be restored or saved
* State the error type and location of the relevant file
* Help debugging problems related to settings
2023-02-17 19:20:10 +01:00
Martchus 243160d43a Don't hide `--show-wizard` argument anymore; it is no longer experimental 2023-02-11 17:37:49 +01:00
Martchus 4357c4b5f6 Avoid warning about shadowing 2022-10-30 21:26:12 +01:00
Martchus d82bc710fd Allow using system icons instead of ForkAwesome icons
* Allow using icons from freedesktop.org icon theme for most ForkAwesome
  icons if available
* Let's not use it for the nested list of details in the models for now
* See https://github.com/Martchus/syncthingtray/issues/121
2022-10-07 00:20:50 +02:00
Martchus 442aee992a Unify code for showing wizard 2022-10-01 20:25:21 +02:00
Martchus f290dec65c Develop wizard further 2022-10-01 18:11:48 +02:00
Martchus 800cbcc286 Add hidden flag to enable WIP features
Supposed to be used for the wizard while it is WIP.
2022-08-22 21:59:34 +02:00
Martchus 394af9bce7 Improve first launch message in preparation for adding a setup wizard 2022-08-06 21:08:55 +02:00
Martchus 04a4fe89ec Use `addSubArguments()` to set GUI sub arguments 2022-08-06 19:14:18 +02:00
Martchus bfb7af18fe Avoid conflict between Syncthing's CLI `--help` arg and own `--help` arg 2022-06-26 11:27:46 +02:00
Martchus a0923f8c1a Allow running Syncthing's CLI via Syncthing Tray when bundling libsyncthing 2022-06-26 02:25:23 +02:00
Martchus b709106d90 Use ConfigValueArgument and auto-syntax 2022-06-17 21:52:59 +02:00
Martchus dea8e5ae68 Fix single instance behavior if multiple users use syncthingtray in parallel
Create a distinct server for each user so they don't interfere with each
other. Otherwise the instance of the second user tries to connect to the
instance started by the first user which fails and therefore breaks the
single instance behavior for the second user.
2022-06-17 21:46:06 +02:00
Martchus 3bcbd2285d Allow avoiding a second tray icon via `--single-instance`
See https://github.com/Martchus/syncthingtray/issues/142
2022-06-16 17:37:49 +02:00
Martchus a90e79b78f Enable virtual terminal processing or disable ANSI escape codes
See https://github.com/Martchus/syncthingtray/issues/132
2022-06-07 16:52:17 +02:00
Martchus b7a8a73f2a Import static icon engine plugin 2021-09-16 21:33:46 +02:00
Martchus 975e86c895 Allow backend libraries to be used from other projects
So far the backend libraries' include paths were relative within this
repository. This means the header files could not be used at their
installed location.

This change replaces them with "<>" includes to fix that problem and adds
a new include directory so building everything at once still works.

With this change it should be easier to actually split some parts into
another repository if this one would become too big.
2021-01-25 19:48:11 +01:00
Martchus a4f6b62a62 Move code for passing args to already running instance into own function 2020-10-19 19:04:18 +02:00
Martchus 6122b54210 Add an opt-out for the single-process behavior
This would have been useful for testing multiple times and now even came up
in a forum discussion.
2020-10-19 19:03:42 +02:00
Martchus 7ada03b00b Apply clang-format 2020-10-19 18:33:28 +02:00
Martchus 37bbdd3258 Allow customizing config dir 2020-10-18 17:24:02 +02:00
Martchus 2c1dbff82b Allow specifiying multiple connection configurations 2020-10-18 16:28:17 +02:00
Martchus 32f78b74fd Overhaul systemd integration, support system-wide units
* Lazy initialize systemd interface and don't initialize it
  at all if the unit name is empty
* Allow to supervise/control system-wide units in addition to
  user units (see https://github.com/Martchus/syncthingtray/issues/61)
* Avoid redundant code
2019-12-18 00:18:46 +01:00
Martchus 27f17fc94c Use aboutToQuit() signal for cleanup-code
As recommended by the Qt documentation
2019-09-14 19:14:45 +02:00
Martchus 5d044a9645 Mention --wait in error message if tray not available 2019-08-10 00:20:38 +02:00
Martchus 1bdba31c70 Improve behavior under Wayland
* Add workaround for using QCursor::pos()
* Set window flags and parent of TrayMenu to it is shown
  like a context menu
2019-07-27 15:04:14 +02:00
Martchus ee6817187a Ensure Qt specific config is included 2019-06-16 15:57:03 +02:00
Martchus 64473df5ba Adapt to changes in c++utilities 2019-06-10 22:48:26 +02:00
Martchus d88df866d2 Adapt to c++utilities v5 2019-05-04 21:05:21 +02:00
Martchus 49b33e5afe Ensure errors on first connection after startup are handled 2018-05-15 22:01:03 +02:00
Martchus 0ceb8d5e79 Add high-level abstraction for launching Syncthing
Add new SyncthingLauncher class which lauches Syncthing
under the hood via external SyncthingProcess or using
libsyncthing.

Note: Launching via libsyncthing is still experimental.
2018-04-11 23:16:00 +02:00
Martchus 146d4870e4 Refactor preventing unwanted error messages
* See https://github.com/Martchus/syncthingtray/issues/15
* Not tested yet
2018-04-02 20:35:30 +02:00
Martchus b81c316d4a Improve message formatting in SingleInstance 2018-04-02 20:23:54 +02:00
Martchus 43b2f9ff22 Allow to disable formatting 2017-10-17 19:47:12 +02:00
Martchus 06f5364335 Use ArgumentParser::parseArgsOrExit() 2017-09-29 17:18:21 +02:00
Martchus 69ffaeb1f3 Apply tidy after updating to clang-format 5.0.0
The behavior of clang-format slightly changed in Clang 5.0.0:
http://releases.llvm.org/5.0.0/tools/clang/docs/ReleaseNotes.html#clang-format
2017-09-17 21:48:15 +02:00
Martchus 7b19be01f2 tray: Allow specifying name of initial connection via CLI
This includes refactoring TrayWidget::applySettings() which
is now a member function and only affects the current instance.

This prevents applying settings on every instance every time
a new tray widget is created.

To apply settings for all tray widgets, the static function
TrayWidget::applySettingsOnAllInstances() is used instead.
2017-08-09 01:11:47 +02:00
Martchus 732a5fdd8d Apply clang-format 2017-05-01 03:34:43 +02:00