Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pause on metered networks #231

Closed
1 of 6 tasks
xgdgsc opened this issue Feb 15, 2024 · 16 comments
Closed
1 of 6 tasks

pause on metered networks #231

xgdgsc opened this issue Feb 15, 2024 · 16 comments

Comments

@xgdgsc
Copy link

xgdgsc commented Feb 15, 2024

Please read the following points before filing an issue but remove them before
filing the issue:

Relevant components

  • Standalone tray application (based on Qt Widgets)
  • Plasmoid/applet for Plasma desktop
  • Dolphin integration
  • Command line tool (syncthingctl)
  • Integrated Syncthing instance (libsyncthing)
  • Backend libraries

Is your feature request specific to a certain platform/environment? Please specify.
metered networks
Is your feature request related to a problem? Please describe.
pause devices on metered networks

Describe the solution you'd like
Like https://github.com/canton7/SyncTrayzor can do.

@Martchus
Copy link
Owner

pause devices on metered networks

Ok, so this should just pause devices - and not stop Syncthing completely?

And I assume devices should be resumed automatically once the network is not metered anymore?

Martchus added a commit that referenced this issue Feb 15, 2024
* Allow to pause all devices on metered network connections (devices will
  be automatically resumed when network is no longer metered)
* Allow to stop Syncthing when it was started via the built-in launcher
  on metered network connections (it will be automatically started again
  when the network connection is no longer metered)
* See #231
@Martchus
Copy link
Owner

Ok, so this should just pause devices - and not stop Syncthing completely?

I implemented both. You can select in the connection options to pause devices and you can select in the launcher options to stop Syncthing completely.

Note that this only works in environments where Qt provides a backend for determining whether the network connection is metered (see https://doc.qt.io/qt-6/qnetworkinformation.html#loadDefaultBackend for a list of backends). This requires Qt 6.4 or newer. You can see whether it works in your environment by hovering over the checkbox in the settings. The tooltip will tell you whether the connection is currently considered metered or whether the detection is not supported.

@xgdgsc
Copy link
Author

xgdgsc commented Feb 16, 2024

Nice. Able to stop it completely is much better. Is there a pre release that I can test or I have to build manually?

@Martchus
Copy link
Owner

Martchus commented Feb 16, 2024

I created a development build. You can find it on https://martchus.no-ip.biz/repo/arch/ownstuff-experimental/os/x86_64. (Extract the archive with e.g. bsdtar and use the "static" executables.) I haven't tested it myself yet under Windows (only GNU/Linux with NetworkManager) so help with testing is appreciated.

Of course you're also welcome to do you own build, even under Windows it is kind of straight forward these days with MSYS2 (see https://github.com/Martchus/cpp-utilities#remarks-for-building-on-windows).

@Martchus
Copy link
Owner

You don't have to try. This version is crashing under Windows. It may be already fixed on master but I still have to make a new Windows build.

@Martchus
Copy link
Owner

Providing this feature on Windows build is problematic. It worked in my tests using MSVC but my release builds are done using mingw-w64 which lacks cppwinrt and thus Qt cannot use certain APIs and monitoring whether the network is metered is not available. Maybe I'll have to switch to ucrt-based mingw-w64 builds. This is definitely quite some effort so don't expect that this feature will be actually available in Windows builds soon. (Of course you can always do your own builds. With MSVC it works but you cannot have the built-in Syncthing library with it. It possibly also works with mingw-w64-ucrt64 packages from MSYS2 but I haven't tested it yet.)

@Martchus
Copy link
Owner

I was able to compile and use cppwinrt with mingw-w64 (not the ucrt-based version) after all. The fact that MSYS2 only has mingw-w64-ucrt-cppwinrt (and not mingw-w64-cppwinrt) and that https://github.com/Yuubi-san/YoloRT/tree/master exist does luckily not mean using cppwinrt is not possible with plain old mingw-w64. So this feature can be enabled in the next release also on Windows. (I guess I still have to sort out some general bugs, though.)

@Martchus
Copy link
Owner

By the way, the build on https://martchus.no-ip.biz/repo/arch/ownstuff-experimental/os/x86_64 has been updated. It generally works but as I mentioned I still need to sort out some bugs.

Just for the record, building Qt 6 against mingw-w64 with cpp_winrt support enabled required some additional modifications to Qt's build system: Martchus/PKGBUILDs@64ce42f

@xgdgsc
Copy link
Author

xgdgsc commented Feb 19, 2024

Thanks. The pause/stop options doesn't seem working here on windows 11. And there are some weired size UI buttons.
image

@Martchus
Copy link
Owner

I haven't tested it yet under Windows 11 and I currently don't have such a system to test.

So also stopping from the launcher options doesn't work at all? That part should have been working. What does the tooltip of the options say in the settings? Is it correctly stating whether the network is metered?

Not sure about the icons. That may be a regression of Qt 6.6.2 which I have updated to that only occurs under Windows 11 or when scaling is enabled. Do you use a scaling factor in Window's display settings?

@xgdgsc
Copy link
Author

xgdgsc commented Feb 20, 2024

I think the meter option works now after a system reboot. I' m on 2 monitors ,with one 2k 12 inch at 200% scaling factor and another with 1080p 24inch at 100% scaling factor ( as main ).

@Martchus
Copy link
Owner

I think the meter option works now after a system reboot.

Good, although it is a bit weird that a reboot was required.

I' m on 2 monitors ,with one 2k 12 inch at 200% scaling factor and another with 1080p 24inch at 100% scaling factor ( as main ).

Ah, it breaks indeed if the screen with 100 % scaling is the main one. However, it looks like is also the case with the latest release; so not a regression.

@Martchus
Copy link
Owner

The wrong icons sizes should be fixed via Martchus/qtforkawesome@bb2030c, at least with that it looks good in the configurations I tried. With 43caad8 the icons should also always stay sharp after moving the window between screens or changing the scale factor.

@xgdgsc
Copy link
Author

xgdgsc commented Feb 22, 2024

Thanks.

@xgdgsc xgdgsc closed this as completed Feb 22, 2024
@Martchus
Copy link
Owner

If you want to try it out, I made a new development build today. You can download it from https://martchus.no-ip.biz/repo/arch/ownstuff-experimental/os/x86_64 (same URL as before, the previous archive was overridden).

@xgdgsc
Copy link
Author

xgdgsc commented Feb 23, 2024

Thanks. The icons are fine now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants