2023-11-01 21:11:11 +00:00
|
|
|
// This file Copyright © Mnemosyne LLC.
|
2022-02-07 16:25:02 +00:00
|
|
|
// It may be used under GPLv2 (SPDX: GPL-2.0-only), GPLv3 (SPDX: GPL-3.0-only),
|
2022-01-20 18:27:56 +00:00
|
|
|
// or any future license endorsed by Mnemosyne LLC.
|
|
|
|
// License text can be found in the licenses/ folder.
|
2007-02-19 22:09:05 +00:00
|
|
|
|
2022-12-26 21:13:21 +00:00
|
|
|
#include "PrefsDialog.h"
|
2021-10-18 20:22:31 +00:00
|
|
|
|
2021-11-01 00:11:23 +00:00
|
|
|
#include "FreeSpaceLabel.h"
|
2022-12-29 02:42:20 +00:00
|
|
|
#include "GtkCompat.h"
|
2022-10-08 22:50:03 +00:00
|
|
|
#include "PathButton.h"
|
2021-11-01 00:11:23 +00:00
|
|
|
#include "Prefs.h"
|
|
|
|
#include "Session.h"
|
2022-10-08 22:50:03 +00:00
|
|
|
#include "SystemTrayIcon.h"
|
2021-11-01 00:11:23 +00:00
|
|
|
#include "Utils.h"
|
2007-02-19 22:09:05 +00:00
|
|
|
|
2022-12-26 21:13:21 +00:00
|
|
|
#include <libtransmission/transmission.h>
|
|
|
|
#include <libtransmission/web-utils.h>
|
|
|
|
|
2022-12-27 01:43:20 +00:00
|
|
|
#include <glibmm/date.h>
|
2022-12-26 21:13:21 +00:00
|
|
|
#include <glibmm/i18n.h>
|
2022-12-27 01:43:20 +00:00
|
|
|
#include <glibmm/main.h>
|
|
|
|
#include <glibmm/timer.h>
|
|
|
|
#include <glibmm/ustring.h>
|
|
|
|
#include <gtkmm/adjustment.h>
|
|
|
|
#include <gtkmm/box.h>
|
|
|
|
#include <gtkmm/button.h>
|
|
|
|
#include <gtkmm/cellrenderertext.h>
|
|
|
|
#include <gtkmm/checkbutton.h>
|
|
|
|
#include <gtkmm/combobox.h>
|
|
|
|
#include <gtkmm/editable.h>
|
|
|
|
#include <gtkmm/entry.h>
|
|
|
|
#include <gtkmm/label.h>
|
|
|
|
#include <gtkmm/liststore.h>
|
|
|
|
#include <gtkmm/spinbutton.h>
|
|
|
|
#include <gtkmm/textview.h>
|
|
|
|
#include <gtkmm/treemodelcolumn.h>
|
|
|
|
#include <gtkmm/widget.h>
|
|
|
|
|
|
|
|
#if GTKMM_CHECK_VERSION(4, 0, 0)
|
|
|
|
#include <gtkmm/eventcontrollerfocus.h>
|
|
|
|
#endif
|
2022-12-26 21:13:21 +00:00
|
|
|
|
|
|
|
#include <fmt/core.h>
|
|
|
|
|
|
|
|
#include <limits>
|
|
|
|
#include <map>
|
|
|
|
#include <memory>
|
|
|
|
#include <sstream>
|
|
|
|
#include <string>
|
|
|
|
|
2023-11-16 04:15:40 +00:00
|
|
|
using namespace libtransmission::Values;
|
|
|
|
|
2013-02-09 04:05:03 +00:00
|
|
|
/**
|
|
|
|
***
|
|
|
|
**/
|
|
|
|
|
2021-10-18 20:22:31 +00:00
|
|
|
class PrefsDialog::Impl
|
2013-02-09 04:05:03 +00:00
|
|
|
{
|
2021-10-18 20:22:31 +00:00
|
|
|
public:
|
2022-09-07 22:25:04 +00:00
|
|
|
Impl(PrefsDialog& dialog, Glib::RefPtr<Gtk::Builder> const& builder, Glib::RefPtr<Session> const& core);
|
2022-11-13 17:36:16 +00:00
|
|
|
~Impl() = default;
|
2021-10-18 20:22:31 +00:00
|
|
|
|
2021-12-14 08:43:27 +00:00
|
|
|
TR_DISABLE_COPY_MOVE(Impl)
|
|
|
|
|
2021-10-18 20:22:31 +00:00
|
|
|
private:
|
|
|
|
void response_cb(int response);
|
2013-02-09 04:05:03 +00:00
|
|
|
|
2021-10-18 20:22:31 +00:00
|
|
|
private:
|
|
|
|
PrefsDialog& dialog_;
|
2021-11-01 00:11:23 +00:00
|
|
|
Glib::RefPtr<Session> const core_;
|
2013-02-09 04:05:03 +00:00
|
|
|
};
|
|
|
|
|
2007-09-27 20:57:58 +00:00
|
|
|
/**
|
|
|
|
***
|
|
|
|
**/
|
2007-02-19 22:09:05 +00:00
|
|
|
|
2021-10-18 20:22:31 +00:00
|
|
|
void PrefsDialog::Impl::response_cb(int response)
|
2007-02-19 22:09:05 +00:00
|
|
|
{
|
2022-09-10 13:19:54 +00:00
|
|
|
if (response == TR_GTK_RESPONSE_TYPE(HELP))
|
2008-09-23 19:11:04 +00:00
|
|
|
{
|
2021-10-18 20:22:31 +00:00
|
|
|
gtr_open_uri(gtr_get_help_uri() + "/html/preferences.html");
|
#963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of
#963 (gtk) for online help URLs, use branch names (1.2x) instead of specific version names (1.21) so that we don't have to add a URL for every release.
2008-05-22 17:39:20 +00:00
|
|
|
}
|
2008-05-09 03:20:34 +00:00
|
|
|
|
2022-09-10 13:19:54 +00:00
|
|
|
if (response == TR_GTK_RESPONSE_TYPE(CLOSE))
|
2017-04-19 12:04:45 +00:00
|
|
|
{
|
2022-10-08 22:50:03 +00:00
|
|
|
dialog_.close();
|
2017-04-19 12:04:45 +00:00
|
|
|
}
|
2007-02-19 22:09:05 +00:00
|
|
|
}
|
|
|
|
|
2021-10-18 20:22:31 +00:00
|
|
|
namespace
|
2007-02-19 22:09:05 +00:00
|
|
|
{
|
2008-09-23 19:11:04 +00:00
|
|
|
|
2022-11-13 17:36:16 +00:00
|
|
|
class PageBase : public Gtk::Box
|
|
|
|
{
|
|
|
|
public:
|
2022-12-12 15:00:33 +00:00
|
|
|
PageBase(BaseObjectType* cast_item, Glib::RefPtr<Gtk::Builder> const& builder, Glib::RefPtr<Session> const& core);
|
2022-11-13 17:36:16 +00:00
|
|
|
~PageBase() override;
|
|
|
|
|
|
|
|
TR_DISABLE_COPY_MOVE(PageBase)
|
|
|
|
|
2022-12-12 15:00:33 +00:00
|
|
|
Gtk::CheckButton* init_check_button(Glib::ustring const& name, tr_quark key);
|
|
|
|
Gtk::SpinButton* init_spin_button(Glib::ustring const& name, tr_quark key, int low, int high, int step);
|
|
|
|
Gtk::SpinButton* init_spin_button_double(Glib::ustring const& name, tr_quark key, double low, double high, double step);
|
|
|
|
Gtk::Entry* init_entry(Glib::ustring const& name, tr_quark key);
|
|
|
|
Gtk::TextView* init_text_view(Glib::ustring const& name, tr_quark key);
|
|
|
|
PathButton* init_chooser_button(Glib::ustring const& name, tr_quark key);
|
|
|
|
Gtk::ComboBox* init_encryption_combo(Glib::ustring const& name, tr_quark key);
|
|
|
|
Gtk::ComboBox* init_time_combo(Glib::ustring const& name, tr_quark key);
|
|
|
|
Gtk::ComboBox* init_week_combo(Glib::ustring const& name, tr_quark key);
|
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
T* get_widget(Glib::ustring const& name) const
|
|
|
|
{
|
|
|
|
return gtr_get_widget<T>(builder_, name);
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename T, typename... ArgTs>
|
|
|
|
T* get_widget_derived(Glib::ustring const& name, ArgTs&&... args) const
|
|
|
|
{
|
|
|
|
return gtr_get_widget_derived<T>(builder_, name, std::forward<ArgTs>(args)...);
|
|
|
|
}
|
2022-12-03 00:20:33 +00:00
|
|
|
|
|
|
|
template<typename T, typename... ArgTs>
|
|
|
|
static void localize_label(T& widget, ArgTs&&... args)
|
|
|
|
{
|
|
|
|
widget.set_label(fmt::format(widget.get_label().raw(), std::forward<ArgTs>(args)...));
|
|
|
|
}
|
2022-11-13 17:36:16 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
bool spun_cb_idle(Gtk::SpinButton& spin, tr_quark key, bool isDouble);
|
|
|
|
void spun_cb(Gtk::SpinButton& w, tr_quark key, bool isDouble);
|
|
|
|
|
|
|
|
void entry_changed_cb(Gtk::Entry& w, tr_quark key);
|
|
|
|
|
|
|
|
void chosen_cb(PathButton& w, tr_quark key);
|
|
|
|
|
|
|
|
void onIntComboChanged(Gtk::ComboBox& combo_box, tr_quark key);
|
|
|
|
|
|
|
|
static auto get_weekday_string(Glib::Date::Weekday weekday);
|
|
|
|
|
|
|
|
private:
|
2022-12-12 15:00:33 +00:00
|
|
|
Glib::RefPtr<Gtk::Builder> const builder_;
|
2022-11-13 17:36:16 +00:00
|
|
|
Glib::RefPtr<Session> const core_;
|
|
|
|
|
|
|
|
std::map<tr_quark, std::pair<std::unique_ptr<Glib::Timer>, sigc::connection>> spin_timers_;
|
|
|
|
};
|
|
|
|
|
2022-12-12 15:00:33 +00:00
|
|
|
PageBase::PageBase(BaseObjectType* cast_item, Glib::RefPtr<Gtk::Builder> const& builder, Glib::RefPtr<Session> const& core)
|
2022-11-13 17:36:16 +00:00
|
|
|
: Gtk::Box(cast_item)
|
2022-12-12 15:00:33 +00:00
|
|
|
, builder_(builder)
|
2022-11-13 17:36:16 +00:00
|
|
|
, core_(core)
|
2007-02-19 22:09:05 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2022-11-13 17:36:16 +00:00
|
|
|
PageBase::~PageBase()
|
|
|
|
{
|
|
|
|
for (auto& [key, info] : spin_timers_)
|
|
|
|
{
|
|
|
|
info.second.disconnect();
|
|
|
|
}
|
|
|
|
}
|
2008-09-03 16:29:59 +00:00
|
|
|
|
2022-12-12 15:00:33 +00:00
|
|
|
Gtk::CheckButton* PageBase::init_check_button(Glib::ustring const& name, tr_quark const key)
|
2008-09-03 16:29:59 +00:00
|
|
|
{
|
2022-12-12 15:00:33 +00:00
|
|
|
auto* button = get_widget<Gtk::CheckButton>(name);
|
2022-12-03 00:20:33 +00:00
|
|
|
button->set_active(gtr_pref_flag_get(key));
|
|
|
|
button->signal_toggled().connect([this, button, key]() { core_->set_pref(key, button->get_active()); });
|
|
|
|
return button;
|
2022-11-13 17:36:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool PageBase::spun_cb_idle(Gtk::SpinButton& spin, tr_quark const key, bool isDouble)
|
|
|
|
{
|
|
|
|
auto const last_change_it = spin_timers_.find(key);
|
|
|
|
g_assert(last_change_it != spin_timers_.end());
|
2008-09-03 16:29:59 +00:00
|
|
|
|
2008-09-03 20:00:27 +00:00
|
|
|
/* has the user stopped making changes? */
|
2022-11-13 17:36:16 +00:00
|
|
|
if (last_change_it->second.first->elapsed() < 0.33)
|
2008-09-03 16:29:59 +00:00
|
|
|
{
|
2022-11-13 17:36:16 +00:00
|
|
|
return true;
|
|
|
|
}
|
2008-09-03 16:29:59 +00:00
|
|
|
|
2022-11-13 17:36:16 +00:00
|
|
|
/* update the core */
|
|
|
|
if (isDouble)
|
|
|
|
{
|
|
|
|
core_->set_pref(key, spin.get_value());
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
core_->set_pref(key, spin.get_value_as_int());
|
2008-09-03 16:29:59 +00:00
|
|
|
}
|
|
|
|
|
2022-11-13 17:36:16 +00:00
|
|
|
/* cleanup */
|
|
|
|
spin_timers_.erase(last_change_it);
|
|
|
|
return false;
|
2008-09-03 16:29:59 +00:00
|
|
|
}
|
|
|
|
|
2022-11-13 17:36:16 +00:00
|
|
|
void PageBase::spun_cb(Gtk::SpinButton& w, tr_quark const key, bool isDouble)
|
2007-02-19 22:09:05 +00:00
|
|
|
{
|
2008-09-03 16:29:59 +00:00
|
|
|
/* user may be spinning through many values, so let's hold off
|
|
|
|
for a moment to keep from flooding the core with changes */
|
2022-11-13 17:36:16 +00:00
|
|
|
auto last_change_it = spin_timers_.find(key);
|
|
|
|
if (last_change_it == spin_timers_.end())
|
2008-09-03 16:29:59 +00:00
|
|
|
{
|
2022-11-13 17:36:16 +00:00
|
|
|
auto timeout_tag = Glib::signal_timeout().connect_seconds(
|
|
|
|
[this, &w, key, isDouble]() { return spun_cb_idle(w, key, isDouble); },
|
|
|
|
1);
|
|
|
|
last_change_it = spin_timers_.emplace(key, std::pair(std::make_unique<Glib::Timer>(), timeout_tag)).first;
|
2008-09-03 16:29:59 +00:00
|
|
|
}
|
2017-04-19 12:04:45 +00:00
|
|
|
|
2022-11-13 17:36:16 +00:00
|
|
|
last_change_it->second.first->start();
|
2007-02-19 22:09:05 +00:00
|
|
|
}
|
|
|
|
|
2022-12-12 15:00:33 +00:00
|
|
|
Gtk::SpinButton* PageBase::init_spin_button(Glib::ustring const& name, tr_quark const key, int low, int high, int step)
|
2009-02-13 18:23:56 +00:00
|
|
|
{
|
2022-12-12 15:00:33 +00:00
|
|
|
auto* button = get_widget<Gtk::SpinButton>(name);
|
2022-12-03 00:20:33 +00:00
|
|
|
button->set_adjustment(Gtk::Adjustment::create(gtr_pref_int_get(key), low, high, step));
|
|
|
|
button->set_digits(0);
|
|
|
|
button->signal_value_changed().connect([this, button, key]() { spun_cb(*button, key, false); });
|
|
|
|
return button;
|
2009-02-13 18:23:56 +00:00
|
|
|
}
|
|
|
|
|
2022-12-03 00:20:33 +00:00
|
|
|
Gtk::SpinButton* PageBase::init_spin_button_double(
|
|
|
|
Glib::ustring const& name,
|
|
|
|
tr_quark const key,
|
|
|
|
double low,
|
|
|
|
double high,
|
|
|
|
double step)
|
2009-02-13 18:23:56 +00:00
|
|
|
{
|
2022-12-12 15:00:33 +00:00
|
|
|
auto* button = get_widget<Gtk::SpinButton>(name);
|
2022-12-03 00:20:33 +00:00
|
|
|
button->set_adjustment(Gtk::Adjustment::create(gtr_pref_double_get(key), low, high, step));
|
|
|
|
button->set_digits(2);
|
|
|
|
button->signal_value_changed().connect([this, button, key]() { spun_cb(*button, key, true); });
|
|
|
|
return button;
|
2007-02-19 22:09:05 +00:00
|
|
|
}
|
|
|
|
|
2022-11-13 17:36:16 +00:00
|
|
|
void PageBase::entry_changed_cb(Gtk::Entry& w, tr_quark const key)
|
2008-06-02 21:02:38 +00:00
|
|
|
{
|
2022-11-13 17:36:16 +00:00
|
|
|
core_->set_pref(key, w.get_text());
|
2008-06-02 21:02:38 +00:00
|
|
|
}
|
|
|
|
|
2022-12-12 15:00:33 +00:00
|
|
|
Gtk::Entry* PageBase::init_entry(Glib::ustring const& name, tr_quark const key)
|
2008-06-02 21:02:38 +00:00
|
|
|
{
|
2022-12-12 15:00:33 +00:00
|
|
|
auto* const entry = get_widget<Gtk::Entry>(name);
|
2022-12-03 00:20:33 +00:00
|
|
|
|
2021-10-18 20:22:31 +00:00
|
|
|
if (auto const value = gtr_pref_string_get(key); !value.empty())
|
2017-04-19 12:04:45 +00:00
|
|
|
{
|
2022-12-03 00:20:33 +00:00
|
|
|
entry->set_text(value);
|
2017-04-19 12:04:45 +00:00
|
|
|
}
|
2012-12-22 20:35:19 +00:00
|
|
|
|
2022-12-03 00:20:33 +00:00
|
|
|
entry->signal_changed().connect([this, entry, key]() { entry_changed_cb(*entry, key); });
|
|
|
|
return entry;
|
2008-06-02 21:02:38 +00:00
|
|
|
}
|
|
|
|
|
2022-12-12 15:00:33 +00:00
|
|
|
Gtk::TextView* PageBase::init_text_view(Glib::ustring const& name, tr_quark const key)
|
2022-02-20 17:54:20 +00:00
|
|
|
{
|
2022-12-12 15:00:33 +00:00
|
|
|
auto* const view = get_widget<Gtk::TextView>(name);
|
2022-12-03 00:20:33 +00:00
|
|
|
|
|
|
|
auto buffer = view->get_buffer();
|
2022-02-20 17:54:20 +00:00
|
|
|
buffer->set_text(gtr_pref_string_get(key));
|
|
|
|
|
2022-11-13 17:36:16 +00:00
|
|
|
auto const save_buffer = [this, buffer, key]()
|
2022-10-08 22:50:03 +00:00
|
|
|
{
|
2022-11-13 17:36:16 +00:00
|
|
|
core_->set_pref(key, buffer->get_text());
|
2022-10-08 22:50:03 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#if GTKMM_CHECK_VERSION(4, 0, 0)
|
|
|
|
auto focus_controller = Gtk::EventControllerFocus::create();
|
|
|
|
focus_controller->signal_leave().connect(save_buffer);
|
2022-12-03 00:20:33 +00:00
|
|
|
view->add_controller(focus_controller);
|
2022-10-08 22:50:03 +00:00
|
|
|
#else
|
2022-12-03 00:20:33 +00:00
|
|
|
view->add_events(Gdk::FOCUS_CHANGE_MASK);
|
|
|
|
view->signal_focus_out_event().connect_notify(sigc::hide<0>(save_buffer));
|
2022-10-08 22:50:03 +00:00
|
|
|
#endif
|
2022-12-03 00:20:33 +00:00
|
|
|
|
|
|
|
return view;
|
2022-02-20 17:54:20 +00:00
|
|
|
}
|
|
|
|
|
2022-11-13 17:36:16 +00:00
|
|
|
void PageBase::chosen_cb(PathButton& w, tr_quark const key)
|
2007-02-19 22:09:05 +00:00
|
|
|
{
|
2022-11-13 17:36:16 +00:00
|
|
|
core_->set_pref(key, w.get_filename());
|
2007-02-19 22:09:05 +00:00
|
|
|
}
|
|
|
|
|
2022-12-12 15:00:33 +00:00
|
|
|
PathButton* PageBase::init_chooser_button(Glib::ustring const& name, tr_quark const key)
|
2010-05-08 22:42:28 +00:00
|
|
|
{
|
2022-12-12 15:00:33 +00:00
|
|
|
auto* const button = get_widget_derived<PathButton>(name);
|
2022-12-03 00:20:33 +00:00
|
|
|
|
2021-10-18 20:22:31 +00:00
|
|
|
if (auto const path = gtr_pref_string_get(key); !path.empty())
|
2017-04-19 12:04:45 +00:00
|
|
|
{
|
2022-12-03 00:20:33 +00:00
|
|
|
button->set_filename(path);
|
2017-04-19 12:04:45 +00:00
|
|
|
}
|
|
|
|
|
2022-12-03 00:20:33 +00:00
|
|
|
button->signal_selection_changed().connect([this, button, key]() { chosen_cb(*button, key); });
|
|
|
|
return button;
|
2007-02-19 22:09:05 +00:00
|
|
|
}
|
|
|
|
|
2022-11-13 17:36:16 +00:00
|
|
|
void PageBase::onIntComboChanged(Gtk::ComboBox& combo_box, tr_quark const key)
|
|
|
|
{
|
|
|
|
core_->set_pref(key, gtr_combo_box_get_active_enum(combo_box));
|
|
|
|
}
|
|
|
|
|
2022-12-12 15:00:33 +00:00
|
|
|
Gtk::ComboBox* PageBase::init_encryption_combo(Glib::ustring const& name, tr_quark const key)
|
2022-11-13 17:36:16 +00:00
|
|
|
{
|
2022-12-12 15:00:33 +00:00
|
|
|
auto* const combo = get_widget<Gtk::ComboBox>(name);
|
2022-11-13 17:36:16 +00:00
|
|
|
gtr_combo_box_set_enum(
|
2022-12-03 00:20:33 +00:00
|
|
|
*combo,
|
2022-11-13 17:36:16 +00:00
|
|
|
{
|
|
|
|
{ _("Allow encryption"), TR_CLEAR_PREFERRED },
|
|
|
|
{ _("Prefer encryption"), TR_ENCRYPTION_PREFERRED },
|
|
|
|
{ _("Require encryption"), TR_ENCRYPTION_REQUIRED },
|
|
|
|
});
|
2022-12-03 00:20:33 +00:00
|
|
|
gtr_combo_box_set_active_enum(*combo, gtr_pref_int_get(key));
|
|
|
|
combo->signal_changed().connect([this, combo, key]() { onIntComboChanged(*combo, key); });
|
|
|
|
return combo;
|
2022-11-13 17:36:16 +00:00
|
|
|
}
|
|
|
|
|
2022-12-12 15:00:33 +00:00
|
|
|
Gtk::ComboBox* PageBase::init_time_combo(Glib::ustring const& name, tr_quark const key)
|
2022-11-13 17:36:16 +00:00
|
|
|
{
|
|
|
|
class TimeModelColumns : public Gtk::TreeModelColumnRecord
|
|
|
|
{
|
|
|
|
public:
|
2022-11-15 00:53:12 +00:00
|
|
|
TimeModelColumns() noexcept
|
2022-11-13 17:36:16 +00:00
|
|
|
{
|
|
|
|
add(offset);
|
|
|
|
add(title);
|
|
|
|
}
|
|
|
|
|
|
|
|
Gtk::TreeModelColumn<int> offset;
|
|
|
|
Gtk::TreeModelColumn<Glib::ustring> title;
|
|
|
|
};
|
|
|
|
|
|
|
|
static TimeModelColumns const time_cols;
|
|
|
|
|
|
|
|
/* build a store at 15 minute intervals */
|
|
|
|
auto store = Gtk::ListStore::create(time_cols);
|
|
|
|
|
|
|
|
for (int i = 0; i < 60 * 24; i += 15)
|
|
|
|
{
|
|
|
|
auto const iter = store->append();
|
|
|
|
(*iter)[time_cols.offset] = i;
|
|
|
|
(*iter)[time_cols.title] = fmt::format("{:02}:{:02}", i / 60, i % 60);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* build the widget */
|
2022-12-12 15:00:33 +00:00
|
|
|
auto* const combo = get_widget<Gtk::ComboBox>(name);
|
2022-12-03 00:20:33 +00:00
|
|
|
combo->set_model(store);
|
2022-11-13 17:36:16 +00:00
|
|
|
auto* r = Gtk::make_managed<Gtk::CellRendererText>();
|
2022-12-03 00:20:33 +00:00
|
|
|
combo->pack_start(*r, true);
|
|
|
|
combo->add_attribute(r->property_text(), time_cols.title);
|
|
|
|
combo->set_active(gtr_pref_int_get(key) / 15);
|
|
|
|
combo->signal_changed().connect(
|
|
|
|
[this, combo, key]()
|
2022-11-13 17:36:16 +00:00
|
|
|
{
|
2022-12-03 00:20:33 +00:00
|
|
|
if (auto const iter = combo->get_active(); iter)
|
2022-11-13 17:36:16 +00:00
|
|
|
{
|
|
|
|
core_->set_pref(key, iter->get_value(time_cols.offset));
|
|
|
|
}
|
|
|
|
});
|
2022-12-03 00:20:33 +00:00
|
|
|
return combo;
|
2022-11-13 17:36:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
auto PageBase::get_weekday_string(Glib::Date::Weekday weekday)
|
|
|
|
{
|
|
|
|
auto date = Glib::Date{};
|
|
|
|
date.set_time_current();
|
|
|
|
date.add_days(static_cast<int>(weekday) - static_cast<int>(date.get_weekday()));
|
|
|
|
return date.format_string("%A");
|
|
|
|
}
|
|
|
|
|
2022-12-12 15:00:33 +00:00
|
|
|
Gtk::ComboBox* PageBase::init_week_combo(Glib::ustring const& name, tr_quark const key)
|
2022-11-13 17:36:16 +00:00
|
|
|
{
|
2022-12-12 15:00:33 +00:00
|
|
|
auto* const combo = get_widget<Gtk::ComboBox>(name);
|
2022-11-13 17:36:16 +00:00
|
|
|
gtr_combo_box_set_enum(
|
2022-12-03 00:20:33 +00:00
|
|
|
*combo,
|
2022-11-13 17:36:16 +00:00
|
|
|
{
|
|
|
|
{ _("Every Day"), TR_SCHED_ALL },
|
|
|
|
{ _("Weekdays"), TR_SCHED_WEEKDAY },
|
|
|
|
{ _("Weekends"), TR_SCHED_WEEKEND },
|
|
|
|
{ get_weekday_string(Glib::Date::Weekday::MONDAY), TR_SCHED_MON },
|
|
|
|
{ get_weekday_string(Glib::Date::Weekday::TUESDAY), TR_SCHED_TUES },
|
|
|
|
{ get_weekday_string(Glib::Date::Weekday::WEDNESDAY), TR_SCHED_WED },
|
|
|
|
{ get_weekday_string(Glib::Date::Weekday::THURSDAY), TR_SCHED_THURS },
|
|
|
|
{ get_weekday_string(Glib::Date::Weekday::FRIDAY), TR_SCHED_FRI },
|
|
|
|
{ get_weekday_string(Glib::Date::Weekday::SATURDAY), TR_SCHED_SAT },
|
|
|
|
{ get_weekday_string(Glib::Date::Weekday::SUNDAY), TR_SCHED_SUN },
|
|
|
|
});
|
2022-12-03 00:20:33 +00:00
|
|
|
gtr_combo_box_set_active_enum(*combo, gtr_pref_int_get(key));
|
|
|
|
combo->signal_changed().connect([this, combo, key]() { onIntComboChanged(*combo, key); });
|
|
|
|
return combo;
|
2022-11-13 17:36:16 +00:00
|
|
|
}
|
2021-10-18 20:22:31 +00:00
|
|
|
|
2011-08-01 22:24:24 +00:00
|
|
|
/****
|
|
|
|
***** Download Tab
|
|
|
|
****/
|
|
|
|
|
2022-11-13 17:36:16 +00:00
|
|
|
class DownloadingPage : public PageBase
|
2022-09-07 22:25:04 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
DownloadingPage(BaseObjectType* cast_item, Glib::RefPtr<Gtk::Builder> const& builder, Glib::RefPtr<Session> const& core);
|
2022-09-09 12:34:28 +00:00
|
|
|
~DownloadingPage() override;
|
2013-01-16 21:42:03 +00:00
|
|
|
|
2022-09-07 22:25:04 +00:00
|
|
|
TR_DISABLE_COPY_MOVE(DownloadingPage)
|
2013-01-16 21:42:03 +00:00
|
|
|
|
2022-09-07 22:25:04 +00:00
|
|
|
private:
|
2022-11-09 16:58:36 +00:00
|
|
|
void on_core_prefs_changed(tr_quark key);
|
2013-01-16 21:42:03 +00:00
|
|
|
|
2022-09-07 22:25:04 +00:00
|
|
|
private:
|
|
|
|
Glib::RefPtr<Session> const core_;
|
2011-08-01 22:24:24 +00:00
|
|
|
|
2022-09-07 22:25:04 +00:00
|
|
|
FreeSpaceLabel* freespace_label_ = nullptr;
|
2011-08-01 22:24:24 +00:00
|
|
|
|
2022-09-07 22:25:04 +00:00
|
|
|
sigc::connection core_prefs_tag_;
|
|
|
|
};
|
2013-02-09 04:05:03 +00:00
|
|
|
|
2022-09-07 22:25:04 +00:00
|
|
|
void DownloadingPage::on_core_prefs_changed(tr_quark const key)
|
|
|
|
{
|
|
|
|
if (key == TR_KEY_download_dir)
|
|
|
|
{
|
|
|
|
char const* downloadDir = tr_sessionGetDownloadDir(core_->get_session());
|
|
|
|
freespace_label_->set_dir(downloadDir);
|
|
|
|
}
|
|
|
|
}
|
2011-08-01 22:24:24 +00:00
|
|
|
|
2022-09-07 22:25:04 +00:00
|
|
|
DownloadingPage::~DownloadingPage()
|
|
|
|
{
|
2022-12-16 17:40:28 +00:00
|
|
|
core_prefs_tag_.disconnect();
|
2022-09-07 22:25:04 +00:00
|
|
|
}
|
2011-08-01 22:24:24 +00:00
|
|
|
|
2022-09-07 22:25:04 +00:00
|
|
|
DownloadingPage::DownloadingPage(
|
|
|
|
BaseObjectType* cast_item,
|
|
|
|
Glib::RefPtr<Gtk::Builder> const& builder,
|
|
|
|
Glib::RefPtr<Session> const& core)
|
2022-12-12 15:00:33 +00:00
|
|
|
: PageBase(cast_item, builder, core)
|
2022-09-07 22:25:04 +00:00
|
|
|
, core_(core)
|
2022-12-12 15:00:33 +00:00
|
|
|
, freespace_label_(get_widget_derived<FreeSpaceLabel>("download_dir_stats_label", core))
|
2022-09-07 22:25:04 +00:00
|
|
|
{
|
|
|
|
core_prefs_tag_ = core_->signal_prefs_changed().connect(sigc::mem_fun(*this, &DownloadingPage::on_core_prefs_changed));
|
2011-08-01 22:24:24 +00:00
|
|
|
|
2022-12-12 15:00:33 +00:00
|
|
|
init_check_button("watch_dir_check", TR_KEY_watch_dir_enabled);
|
|
|
|
init_chooser_button("watch_dir_chooser", TR_KEY_watch_dir);
|
|
|
|
init_check_button("show_options_dialog_check", TR_KEY_show_options_window);
|
|
|
|
init_check_button("start_on_add_check", TR_KEY_start_added_torrents);
|
|
|
|
init_check_button("trash_on_add_check", TR_KEY_trash_original_torrent_files);
|
|
|
|
init_chooser_button("download_dir_chooser", TR_KEY_download_dir);
|
|
|
|
init_spin_button("max_active_downloads_spin", TR_KEY_download_queue_size, 0, std::numeric_limits<int>::max(), 1);
|
|
|
|
init_spin_button("max_inactive_time_spin", TR_KEY_queue_stalled_minutes, 1, std::numeric_limits<int>::max(), 15);
|
|
|
|
init_check_button("append_suffix_to_incomplete_check", TR_KEY_rename_partial_files);
|
|
|
|
init_check_button("incomplete_dir_check", TR_KEY_incomplete_dir_enabled);
|
|
|
|
init_chooser_button("incomplete_dir_chooser", TR_KEY_incomplete_dir);
|
|
|
|
init_check_button("download_done_script_check", TR_KEY_script_torrent_done_enabled);
|
|
|
|
init_chooser_button("download_done_script_chooser", TR_KEY_script_torrent_done_filename);
|
2011-08-01 22:24:24 +00:00
|
|
|
|
2022-09-07 22:25:04 +00:00
|
|
|
on_core_prefs_changed(TR_KEY_download_dir);
|
2011-08-01 22:24:24 +00:00
|
|
|
}
|
|
|
|
|
2008-09-03 16:29:59 +00:00
|
|
|
/****
|
|
|
|
***** Torrent Tab
|
|
|
|
****/
|
2007-12-15 22:24:16 +00:00
|
|
|
|
2022-11-13 17:36:16 +00:00
|
|
|
class SeedingPage : public PageBase
|
2022-09-07 22:25:04 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
SeedingPage(BaseObjectType* cast_item, Glib::RefPtr<Gtk::Builder> const& builder, Glib::RefPtr<Session> const& core);
|
2022-11-13 17:36:16 +00:00
|
|
|
~SeedingPage() override = default;
|
2012-12-05 17:29:46 +00:00
|
|
|
|
2022-09-07 22:25:04 +00:00
|
|
|
TR_DISABLE_COPY_MOVE(SeedingPage)
|
|
|
|
};
|
|
|
|
|
|
|
|
SeedingPage::SeedingPage(
|
|
|
|
BaseObjectType* cast_item,
|
|
|
|
Glib::RefPtr<Gtk::Builder> const& builder,
|
|
|
|
Glib::RefPtr<Session> const& core)
|
2022-12-12 15:00:33 +00:00
|
|
|
: PageBase(cast_item, builder, core)
|
2022-09-07 22:25:04 +00:00
|
|
|
{
|
2022-12-12 15:00:33 +00:00
|
|
|
init_check_button("stop_seeding_ratio_check", TR_KEY_ratio_limit_enabled);
|
|
|
|
init_spin_button_double("stop_seeding_ratio_spin", TR_KEY_ratio_limit, 0, 1000, 0.05);
|
|
|
|
init_check_button("stop_seeding_timeout_check", TR_KEY_idle_seeding_limit_enabled);
|
|
|
|
init_spin_button("stop_seeding_timeout_spin", TR_KEY_idle_seeding_limit, 1, 40320, 5);
|
|
|
|
init_check_button("seeding_done_script_check", TR_KEY_script_torrent_done_seeding_enabled);
|
|
|
|
init_chooser_button("seeding_done_script_chooser", TR_KEY_script_torrent_done_seeding_filename);
|
2008-02-13 03:00:21 +00:00
|
|
|
}
|
|
|
|
|
2008-10-08 18:26:55 +00:00
|
|
|
/****
|
|
|
|
***** Desktop Tab
|
|
|
|
****/
|
|
|
|
|
2022-11-13 17:36:16 +00:00
|
|
|
class DesktopPage : public PageBase
|
2022-09-07 22:25:04 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
DesktopPage(BaseObjectType* cast_item, Glib::RefPtr<Gtk::Builder> const& builder, Glib::RefPtr<Session> const& core);
|
2022-11-13 17:36:16 +00:00
|
|
|
~DesktopPage() override = default;
|
2011-07-23 17:23:12 +00:00
|
|
|
|
2022-09-07 22:25:04 +00:00
|
|
|
TR_DISABLE_COPY_MOVE(DesktopPage)
|
|
|
|
};
|
2009-11-22 18:55:24 +00:00
|
|
|
|
2022-09-07 22:25:04 +00:00
|
|
|
DesktopPage::DesktopPage(
|
|
|
|
BaseObjectType* cast_item,
|
|
|
|
Glib::RefPtr<Gtk::Builder> const& builder,
|
|
|
|
Glib::RefPtr<Session> const& core)
|
2022-12-12 15:00:33 +00:00
|
|
|
: PageBase(cast_item, builder, core)
|
2022-09-07 22:25:04 +00:00
|
|
|
{
|
2022-12-12 15:00:33 +00:00
|
|
|
init_check_button("inhibit_hibernation_check", TR_KEY_inhibit_desktop_hibernation);
|
2022-09-07 22:25:04 +00:00
|
|
|
|
2022-12-03 00:20:33 +00:00
|
|
|
if (SystemTrayIcon::is_available())
|
2022-10-08 22:50:03 +00:00
|
|
|
{
|
2022-12-12 15:00:33 +00:00
|
|
|
init_check_button("show_systray_icon_check", TR_KEY_show_notification_area_icon);
|
2022-10-08 22:50:03 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-12-12 15:00:33 +00:00
|
|
|
get_widget<Gtk::CheckButton>("show_systray_icon_check")->hide();
|
2022-10-08 22:50:03 +00:00
|
|
|
}
|
2022-09-07 22:25:04 +00:00
|
|
|
|
2022-12-12 15:00:33 +00:00
|
|
|
init_check_button("notify_on_torrent_add_check", TR_KEY_torrent_added_notification_enabled);
|
|
|
|
init_check_button("notify_on_torrent_finish_check", TR_KEY_torrent_complete_notification_enabled);
|
|
|
|
init_check_button("ding_no_torrent_finish_check", TR_KEY_torrent_complete_sound_enabled);
|
2008-10-08 18:26:55 +00:00
|
|
|
}
|
|
|
|
|
2008-09-03 16:29:59 +00:00
|
|
|
/****
|
|
|
|
***** Peer Tab
|
|
|
|
****/
|
2008-03-30 00:21:46 +00:00
|
|
|
|
2022-11-13 17:36:16 +00:00
|
|
|
class PrivacyPage : public PageBase
|
2008-03-30 00:21:46 +00:00
|
|
|
{
|
2022-12-17 23:12:25 +00:00
|
|
|
static auto const BlocklistUpdateResultDisplayTimeoutInSeconds = 3U;
|
|
|
|
|
2022-09-07 22:25:04 +00:00
|
|
|
public:
|
|
|
|
PrivacyPage(BaseObjectType* cast_item, Glib::RefPtr<Gtk::Builder> const& builder, Glib::RefPtr<Session> const& core);
|
2022-09-09 12:34:28 +00:00
|
|
|
~PrivacyPage() override;
|
2022-09-07 22:25:04 +00:00
|
|
|
|
|
|
|
TR_DISABLE_COPY_MOVE(PrivacyPage)
|
|
|
|
|
|
|
|
private:
|
|
|
|
void updateBlocklistText();
|
2022-12-17 23:12:25 +00:00
|
|
|
void onBlocklistUpdated(bool success);
|
2022-09-07 22:25:04 +00:00
|
|
|
void onBlocklistUpdate();
|
|
|
|
void on_blocklist_url_changed(Gtk::Editable* e);
|
2022-11-09 16:58:36 +00:00
|
|
|
|
2022-09-07 22:25:04 +00:00
|
|
|
private:
|
|
|
|
Glib::RefPtr<Session> core_;
|
2021-10-18 20:22:31 +00:00
|
|
|
|
2022-09-07 22:25:04 +00:00
|
|
|
Gtk::Button* updateBlocklistButton_ = nullptr;
|
|
|
|
Gtk::Label* label_ = nullptr;
|
|
|
|
Gtk::CheckButton* check_ = nullptr;
|
2021-12-14 08:43:27 +00:00
|
|
|
|
2022-09-07 22:25:04 +00:00
|
|
|
sigc::connection updateBlocklistTag_;
|
2022-12-17 23:12:25 +00:00
|
|
|
sigc::connection blocklist_update_result_tag_;
|
2008-03-30 00:21:46 +00:00
|
|
|
};
|
|
|
|
|
2022-09-07 22:25:04 +00:00
|
|
|
void PrivacyPage::updateBlocklistText()
|
2008-04-01 16:57:48 +00:00
|
|
|
{
|
2022-09-07 22:25:04 +00:00
|
|
|
int const n = tr_blocklistGetRuleCount(core_->get_session());
|
2022-03-15 14:52:16 +00:00
|
|
|
auto const msg = fmt::format(
|
2022-04-07 13:23:04 +00:00
|
|
|
ngettext("Blocklist has {count:L} entry", "Blocklist has {count:L} entries", n),
|
2022-03-15 14:52:16 +00:00
|
|
|
fmt::arg("count", n));
|
2022-12-17 23:12:25 +00:00
|
|
|
label_->set_text(msg);
|
2008-04-01 16:57:48 +00:00
|
|
|
}
|
2008-03-30 00:21:46 +00:00
|
|
|
|
2009-04-07 20:13:08 +00:00
|
|
|
/* prefs dialog is being destroyed, so stop listening to blocklist updates */
|
2022-09-07 22:25:04 +00:00
|
|
|
PrivacyPage::~PrivacyPage()
|
2008-03-30 00:21:46 +00:00
|
|
|
{
|
2022-12-17 23:12:25 +00:00
|
|
|
blocklist_update_result_tag_.disconnect();
|
2022-09-07 22:25:04 +00:00
|
|
|
updateBlocklistTag_.disconnect();
|
2008-03-30 00:21:46 +00:00
|
|
|
}
|
|
|
|
|
2009-04-07 20:13:08 +00:00
|
|
|
/* core says the blocklist was updated */
|
2022-12-17 23:12:25 +00:00
|
|
|
void PrivacyPage::onBlocklistUpdated(bool success)
|
2008-03-30 00:21:46 +00:00
|
|
|
{
|
2022-09-07 22:25:04 +00:00
|
|
|
updateBlocklistButton_->set_sensitive(true);
|
2022-12-17 23:12:25 +00:00
|
|
|
label_->set_text(success ? _("Blocklist updated!") : _("Couldn't update blocklist"));
|
|
|
|
|
|
|
|
blocklist_update_result_tag_ = Glib::signal_timeout().connect_seconds(
|
|
|
|
sigc::bind_return(sigc::mem_fun(*this, &PrivacyPage::updateBlocklistText), false),
|
|
|
|
BlocklistUpdateResultDisplayTimeoutInSeconds);
|
2009-04-07 20:13:08 +00:00
|
|
|
}
|
2008-09-23 19:11:04 +00:00
|
|
|
|
2009-04-07 20:13:08 +00:00
|
|
|
/* user pushed a button to update the blocklist */
|
2022-09-07 22:25:04 +00:00
|
|
|
void PrivacyPage::onBlocklistUpdate()
|
2009-04-07 20:13:08 +00:00
|
|
|
{
|
2022-09-07 22:25:04 +00:00
|
|
|
updateBlocklistButton_->set_sensitive(false);
|
2022-12-17 23:12:25 +00:00
|
|
|
|
|
|
|
label_->set_text(_("Getting new blocklist…"));
|
|
|
|
blocklist_update_result_tag_.disconnect();
|
|
|
|
|
2022-09-07 22:25:04 +00:00
|
|
|
core_->blocklist_update();
|
2008-03-30 00:21:46 +00:00
|
|
|
}
|
|
|
|
|
2022-09-07 22:25:04 +00:00
|
|
|
void PrivacyPage::on_blocklist_url_changed(Gtk::Editable* e)
|
2011-02-19 09:02:39 +00:00
|
|
|
{
|
2021-10-18 20:22:31 +00:00
|
|
|
auto const url = e->get_chars(0, -1);
|
2022-09-07 22:25:04 +00:00
|
|
|
updateBlocklistButton_->set_sensitive(tr_urlIsValid(url.c_str()));
|
2011-02-19 09:02:39 +00:00
|
|
|
}
|
|
|
|
|
2022-09-07 22:25:04 +00:00
|
|
|
PrivacyPage::PrivacyPage(
|
|
|
|
BaseObjectType* cast_item,
|
|
|
|
Glib::RefPtr<Gtk::Builder> const& builder,
|
|
|
|
Glib::RefPtr<Session> const& core)
|
2022-12-12 15:00:33 +00:00
|
|
|
: PageBase(cast_item, builder, core)
|
2022-09-07 22:25:04 +00:00
|
|
|
, core_(core)
|
2022-12-12 15:00:33 +00:00
|
|
|
, updateBlocklistButton_(get_widget<Gtk::Button>("update_blocklist_button"))
|
|
|
|
, label_(get_widget<Gtk::Label>("blocklist_stats_label"))
|
|
|
|
, check_(init_check_button("blocklist_check", TR_KEY_blocklist_enabled))
|
2022-09-07 22:25:04 +00:00
|
|
|
{
|
2022-12-12 15:00:33 +00:00
|
|
|
init_encryption_combo("encryption_mode_combo", TR_KEY_encryption);
|
2022-09-07 22:25:04 +00:00
|
|
|
|
2022-12-12 15:00:33 +00:00
|
|
|
auto* const blocklist_url_entry = init_entry("blocklist_url_entry", TR_KEY_blocklist_url);
|
2022-09-07 22:25:04 +00:00
|
|
|
|
|
|
|
updateBlocklistText();
|
|
|
|
updateBlocklistButton_->signal_clicked().connect([this]() { onBlocklistUpdate(); });
|
2022-11-09 20:46:23 +00:00
|
|
|
updateBlocklistButton_->set_sensitive(check_->get_active());
|
2022-12-03 00:20:33 +00:00
|
|
|
blocklist_url_entry->signal_changed().connect([this, blocklist_url_entry]()
|
|
|
|
{ on_blocklist_url_changed(blocklist_url_entry); });
|
|
|
|
on_blocklist_url_changed(blocklist_url_entry);
|
2022-09-07 22:25:04 +00:00
|
|
|
|
2022-12-12 15:00:33 +00:00
|
|
|
init_check_button("blocklist_autoupdate_check", TR_KEY_blocklist_updates_enabled);
|
2022-12-17 23:12:25 +00:00
|
|
|
|
|
|
|
updateBlocklistTag_ = core_->signal_blocklist_updated().connect(sigc::mem_fun(*this, &PrivacyPage::onBlocklistUpdated));
|
2008-02-13 03:00:21 +00:00
|
|
|
}
|
|
|
|
|
2008-09-03 16:29:59 +00:00
|
|
|
/****
|
2013-01-16 21:42:03 +00:00
|
|
|
***** Remote Tab
|
2008-09-03 16:29:59 +00:00
|
|
|
****/
|
|
|
|
|
2022-11-13 17:36:16 +00:00
|
|
|
class RemotePage : public PageBase
|
2008-06-03 20:59:57 +00:00
|
|
|
{
|
2022-11-13 17:36:16 +00:00
|
|
|
class WhitelistModelColumns : public Gtk::TreeModelColumnRecord
|
2021-10-18 20:22:31 +00:00
|
|
|
{
|
2022-11-13 17:36:16 +00:00
|
|
|
public:
|
2022-11-15 00:53:12 +00:00
|
|
|
WhitelistModelColumns() noexcept
|
2017-04-19 12:04:45 +00:00
|
|
|
{
|
2022-11-13 17:36:16 +00:00
|
|
|
add(address);
|
2017-04-19 12:04:45 +00:00
|
|
|
}
|
|
|
|
|
2022-11-13 17:36:16 +00:00
|
|
|
Gtk::TreeModelColumn<Glib::ustring> address;
|
|
|
|
};
|
2008-06-04 19:46:37 +00:00
|
|
|
|
2022-11-13 17:36:16 +00:00
|
|
|
static WhitelistModelColumns const whitelist_cols;
|
2008-06-03 20:59:57 +00:00
|
|
|
|
2022-09-07 22:25:04 +00:00
|
|
|
public:
|
|
|
|
RemotePage(BaseObjectType* cast_item, Glib::RefPtr<Gtk::Builder> const& builder, Glib::RefPtr<Session> const& core);
|
2022-11-13 17:36:16 +00:00
|
|
|
~RemotePage() override = default;
|
2022-09-07 22:25:04 +00:00
|
|
|
|
|
|
|
TR_DISABLE_COPY_MOVE(RemotePage)
|
|
|
|
|
|
|
|
private:
|
|
|
|
void refreshWhitelist();
|
|
|
|
void onAddressEdited(Glib::ustring const& path, Glib::ustring const& address);
|
|
|
|
void onAddWhitelistClicked();
|
|
|
|
void onRemoveWhitelistClicked();
|
|
|
|
void refreshRPCSensitivity();
|
|
|
|
|
2022-11-13 17:36:16 +00:00
|
|
|
static void onLaunchClutchCB();
|
|
|
|
|
|
|
|
static Glib::RefPtr<Gtk::ListStore> whitelist_tree_model_new(std::string const& whitelist);
|
|
|
|
|
2022-09-07 22:25:04 +00:00
|
|
|
private:
|
|
|
|
Glib::RefPtr<Session> core_;
|
|
|
|
|
|
|
|
Gtk::TreeView* view_;
|
|
|
|
Gtk::Button* remove_button_;
|
|
|
|
Gtk::CheckButton* rpc_tb_;
|
|
|
|
Gtk::CheckButton* auth_tb_;
|
|
|
|
Gtk::CheckButton* whitelist_tb_;
|
|
|
|
|
|
|
|
Glib::RefPtr<Gtk::ListStore> store_;
|
|
|
|
std::vector<Gtk::Widget*> auth_widgets_;
|
|
|
|
std::vector<Gtk::Widget*> whitelist_widgets_;
|
2008-06-03 20:59:57 +00:00
|
|
|
};
|
|
|
|
|
2022-11-13 17:36:16 +00:00
|
|
|
RemotePage::WhitelistModelColumns const RemotePage::whitelist_cols;
|
|
|
|
|
|
|
|
Glib::RefPtr<Gtk::ListStore> RemotePage::whitelist_tree_model_new(std::string const& whitelist)
|
|
|
|
{
|
2022-11-13 20:50:07 +00:00
|
|
|
auto store = Gtk::ListStore::create(whitelist_cols);
|
2022-11-13 17:36:16 +00:00
|
|
|
|
|
|
|
std::istringstream stream(whitelist);
|
|
|
|
std::string s;
|
|
|
|
|
|
|
|
while (std::getline(stream, s, ','))
|
|
|
|
{
|
|
|
|
s = gtr_str_strip(s);
|
|
|
|
|
|
|
|
if (s.empty())
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
auto const iter = store->append();
|
|
|
|
(*iter)[whitelist_cols.address] = s;
|
|
|
|
}
|
|
|
|
|
|
|
|
return store;
|
|
|
|
}
|
|
|
|
|
2022-09-07 22:25:04 +00:00
|
|
|
void RemotePage::refreshWhitelist()
|
2008-06-03 20:59:57 +00:00
|
|
|
{
|
2021-10-18 20:22:31 +00:00
|
|
|
std::ostringstream gstr;
|
2008-06-04 19:46:37 +00:00
|
|
|
|
2022-09-07 22:25:04 +00:00
|
|
|
for (auto const& row : store_->children())
|
2011-04-13 22:16:50 +00:00
|
|
|
{
|
2021-10-18 20:22:31 +00:00
|
|
|
gstr << row.get_value(whitelist_cols.address) << ",";
|
2011-04-13 22:16:50 +00:00
|
|
|
}
|
2008-06-04 19:46:37 +00:00
|
|
|
|
2021-10-18 20:22:31 +00:00
|
|
|
auto str = gstr.str();
|
|
|
|
if (!str.empty())
|
|
|
|
{
|
|
|
|
str.resize(str.size() - 1); /* remove the trailing comma */
|
|
|
|
}
|
2008-06-04 19:46:37 +00:00
|
|
|
|
2022-09-07 22:25:04 +00:00
|
|
|
core_->set_pref(TR_KEY_rpc_whitelist, str);
|
2008-06-03 20:59:57 +00:00
|
|
|
}
|
|
|
|
|
2022-11-15 19:30:32 +00:00
|
|
|
// NOLINTNEXTLINE(bugprone-easily-swappable-parameters)
|
2022-09-07 22:25:04 +00:00
|
|
|
void RemotePage::onAddressEdited(Glib::ustring const& path, Glib::ustring const& address)
|
2008-06-03 20:59:57 +00:00
|
|
|
{
|
2022-09-07 22:25:04 +00:00
|
|
|
if (auto const iter = store_->get_iter(path); iter)
|
2017-04-19 12:04:45 +00:00
|
|
|
{
|
2021-10-18 20:22:31 +00:00
|
|
|
(*iter)[whitelist_cols.address] = address;
|
2017-04-19 12:04:45 +00:00
|
|
|
}
|
2008-06-03 20:59:57 +00:00
|
|
|
|
2022-09-07 22:25:04 +00:00
|
|
|
refreshWhitelist();
|
2008-06-03 20:59:57 +00:00
|
|
|
}
|
|
|
|
|
2022-09-07 22:25:04 +00:00
|
|
|
void RemotePage::onAddWhitelistClicked()
|
2008-06-03 20:59:57 +00:00
|
|
|
{
|
2022-09-07 22:25:04 +00:00
|
|
|
auto const iter = store_->append();
|
2021-10-18 20:22:31 +00:00
|
|
|
(*iter)[whitelist_cols.address] = "0.0.0.0";
|
2017-04-19 12:04:45 +00:00
|
|
|
|
2022-09-07 22:25:04 +00:00
|
|
|
view_->set_cursor(store_->get_path(iter), *view_->get_column(0), true);
|
2008-06-03 20:59:57 +00:00
|
|
|
}
|
|
|
|
|
2022-09-07 22:25:04 +00:00
|
|
|
void RemotePage::onRemoveWhitelistClicked()
|
2008-06-03 20:59:57 +00:00
|
|
|
{
|
2022-09-07 22:25:04 +00:00
|
|
|
auto const sel = view_->get_selection();
|
2020-08-18 10:36:10 +00:00
|
|
|
|
2021-10-18 20:22:31 +00:00
|
|
|
if (auto const iter = sel->get_selected(); iter)
|
2008-06-04 19:46:37 +00:00
|
|
|
{
|
2022-09-07 22:25:04 +00:00
|
|
|
store_->erase(iter);
|
|
|
|
refreshWhitelist();
|
2008-06-04 19:46:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-09-07 22:25:04 +00:00
|
|
|
void RemotePage::refreshRPCSensitivity()
|
2008-06-04 19:46:37 +00:00
|
|
|
{
|
2022-09-07 22:25:04 +00:00
|
|
|
bool const rpc_active = rpc_tb_->get_active();
|
|
|
|
bool const auth_active = auth_tb_->get_active();
|
|
|
|
bool const whitelist_active = whitelist_tb_->get_active();
|
|
|
|
auto const sel = view_->get_selection();
|
2021-10-18 20:22:31 +00:00
|
|
|
auto const have_addr = sel->get_selected();
|
2022-09-07 22:25:04 +00:00
|
|
|
auto const n_rules = store_->children().size();
|
2021-10-18 20:22:31 +00:00
|
|
|
|
2022-09-07 22:25:04 +00:00
|
|
|
for (auto* const widget : auth_widgets_)
|
2017-04-19 12:04:45 +00:00
|
|
|
{
|
2021-10-18 20:22:31 +00:00
|
|
|
widget->set_sensitive(rpc_active && auth_active);
|
2017-04-19 12:04:45 +00:00
|
|
|
}
|
2008-06-04 19:46:37 +00:00
|
|
|
|
2022-09-07 22:25:04 +00:00
|
|
|
for (auto* const widget : whitelist_widgets_)
|
2017-04-19 12:04:45 +00:00
|
|
|
{
|
2021-10-18 20:22:31 +00:00
|
|
|
widget->set_sensitive(rpc_active && whitelist_active);
|
2017-04-19 12:04:45 +00:00
|
|
|
}
|
2008-10-01 22:59:29 +00:00
|
|
|
|
2022-09-07 22:25:04 +00:00
|
|
|
remove_button_->set_sensitive(rpc_active && whitelist_active && have_addr && n_rules > 1);
|
2008-06-04 19:46:37 +00:00
|
|
|
}
|
2008-09-23 19:11:04 +00:00
|
|
|
|
2022-11-13 17:36:16 +00:00
|
|
|
void RemotePage::onLaunchClutchCB()
|
2008-06-04 19:46:37 +00:00
|
|
|
{
|
2022-10-15 16:13:50 +00:00
|
|
|
gtr_open_uri(fmt::format("http://localhost:{}/", gtr_pref_int_get(TR_KEY_rpc_port)));
|
2008-06-03 20:59:57 +00:00
|
|
|
}
|
|
|
|
|
2022-09-07 22:25:04 +00:00
|
|
|
RemotePage::RemotePage(BaseObjectType* cast_item, Glib::RefPtr<Gtk::Builder> const& builder, Glib::RefPtr<Session> const& core)
|
2022-12-12 15:00:33 +00:00
|
|
|
: PageBase(cast_item, builder, core)
|
2022-09-07 22:25:04 +00:00
|
|
|
, core_(core)
|
2022-12-12 15:00:33 +00:00
|
|
|
, view_(get_widget<Gtk::TreeView>("rpc_whitelist_view"))
|
|
|
|
, remove_button_(get_widget<Gtk::Button>("remove_from_rpc_whistlist_button"))
|
|
|
|
, rpc_tb_(init_check_button("enable_rpc_check", TR_KEY_rpc_enabled))
|
|
|
|
, auth_tb_(init_check_button("enable_rpc_auth_check", TR_KEY_rpc_authentication_required))
|
|
|
|
, whitelist_tb_(init_check_button("rpc_whitelist_check", TR_KEY_rpc_whitelist_enabled))
|
2008-06-02 21:02:38 +00:00
|
|
|
{
|
2022-10-08 22:50:03 +00:00
|
|
|
rpc_tb_->signal_toggled().connect([this]() { refreshRPCSensitivity(); });
|
2022-12-12 15:00:33 +00:00
|
|
|
auto* const open_button = get_widget<Gtk::Button>("open_web_client_button");
|
2022-11-13 17:36:16 +00:00
|
|
|
open_button->signal_clicked().connect(&RemotePage::onLaunchClutchCB);
|
2008-09-23 19:11:04 +00:00
|
|
|
|
2022-12-12 15:00:33 +00:00
|
|
|
init_spin_button("rpc_port_spin", TR_KEY_rpc_port, 0, std::numeric_limits<uint16_t>::max(), 1);
|
2008-10-01 22:59:29 +00:00
|
|
|
|
2022-10-08 22:50:03 +00:00
|
|
|
auth_tb_->signal_toggled().connect([this]() { refreshRPCSensitivity(); });
|
2008-09-23 19:11:04 +00:00
|
|
|
|
2022-12-12 15:00:33 +00:00
|
|
|
auto* const username_entry = init_entry("rpc_username_entry", TR_KEY_rpc_username);
|
2022-09-07 22:25:04 +00:00
|
|
|
auth_widgets_.push_back(username_entry);
|
2022-12-12 15:00:33 +00:00
|
|
|
auth_widgets_.push_back(get_widget<Gtk::Label>("rpc_username_label"));
|
2008-09-23 19:11:04 +00:00
|
|
|
|
2022-12-12 15:00:33 +00:00
|
|
|
auto* const password_entry = init_entry("rpc_password_entry", TR_KEY_rpc_password);
|
2022-09-07 22:25:04 +00:00
|
|
|
auth_widgets_.push_back(password_entry);
|
2022-12-12 15:00:33 +00:00
|
|
|
auth_widgets_.push_back(get_widget<Gtk::Label>("rpc_password_label"));
|
2008-09-23 19:11:04 +00:00
|
|
|
|
2022-10-08 22:50:03 +00:00
|
|
|
whitelist_tb_->signal_toggled().connect([this]() { refreshRPCSensitivity(); });
|
2008-09-23 19:11:04 +00:00
|
|
|
|
|
|
|
{
|
2022-09-07 22:25:04 +00:00
|
|
|
store_ = whitelist_tree_model_new(gtr_pref_string_get(TR_KEY_rpc_whitelist));
|
2021-10-18 20:22:31 +00:00
|
|
|
|
2022-09-07 22:25:04 +00:00
|
|
|
view_->set_model(store_);
|
2023-08-06 03:26:29 +00:00
|
|
|
setup_item_view_button_event_handling(
|
2022-10-08 22:50:03 +00:00
|
|
|
*view_,
|
|
|
|
{},
|
2023-08-06 03:26:29 +00:00
|
|
|
[this](double view_x, double view_y) { return on_item_view_button_released(*view_, view_x, view_y); });
|
2021-10-18 20:22:31 +00:00
|
|
|
|
2022-09-07 22:25:04 +00:00
|
|
|
whitelist_widgets_.push_back(view_);
|
|
|
|
auto const sel = view_->get_selection();
|
|
|
|
sel->signal_changed().connect([this]() { refreshRPCSensitivity(); });
|
2008-06-03 20:59:57 +00:00
|
|
|
|
2021-10-18 20:22:31 +00:00
|
|
|
auto* r = Gtk::make_managed<Gtk::CellRendererText>();
|
2022-11-15 19:30:32 +00:00
|
|
|
r->signal_edited().connect(sigc::mem_fun(*this, &RemotePage::onAddressEdited));
|
2021-10-18 20:22:31 +00:00
|
|
|
r->property_editable() = true;
|
|
|
|
auto* c = Gtk::make_managed<Gtk::TreeViewColumn>("", *r);
|
|
|
|
c->add_attribute(r->property_text(), whitelist_cols.address);
|
|
|
|
c->set_expand(true);
|
2022-09-07 22:25:04 +00:00
|
|
|
view_->append_column(*c);
|
|
|
|
|
2022-12-12 15:00:33 +00:00
|
|
|
whitelist_widgets_.push_back(get_widget<Gtk::Label>("rpc_whitelist_label"));
|
2022-09-07 22:25:04 +00:00
|
|
|
|
|
|
|
remove_button_->signal_clicked().connect([this]() { onRemoveWhitelistClicked(); });
|
|
|
|
refreshRPCSensitivity();
|
2022-12-12 15:00:33 +00:00
|
|
|
auto* add_button = get_widget<Gtk::Button>("add_to_rpc_whitelist_button");
|
2022-09-07 22:25:04 +00:00
|
|
|
whitelist_widgets_.push_back(add_button);
|
|
|
|
add_button->signal_clicked().connect([this]() { onAddWhitelistClicked(); });
|
2008-09-23 19:11:04 +00:00
|
|
|
}
|
2008-06-02 21:02:38 +00:00
|
|
|
|
2022-09-07 22:25:04 +00:00
|
|
|
refreshRPCSensitivity();
|
2008-06-02 21:02:38 +00:00
|
|
|
}
|
|
|
|
|
2008-09-03 16:29:59 +00:00
|
|
|
/****
|
|
|
|
***** Bandwidth Tab
|
|
|
|
****/
|
|
|
|
|
2022-11-13 17:36:16 +00:00
|
|
|
class SpeedPage : public PageBase
|
2008-09-01 04:47:02 +00:00
|
|
|
{
|
2022-09-07 22:25:04 +00:00
|
|
|
public:
|
|
|
|
SpeedPage(BaseObjectType* cast_item, Glib::RefPtr<Gtk::Builder> const& builder, Glib::RefPtr<Session> const& core);
|
2022-11-13 17:36:16 +00:00
|
|
|
~SpeedPage() override = default;
|
2022-09-07 22:25:04 +00:00
|
|
|
|
2022-09-09 12:34:28 +00:00
|
|
|
TR_DISABLE_COPY_MOVE(SpeedPage)
|
2008-09-01 04:47:02 +00:00
|
|
|
};
|
|
|
|
|
2022-09-07 22:25:04 +00:00
|
|
|
SpeedPage::SpeedPage(BaseObjectType* cast_item, Glib::RefPtr<Gtk::Builder> const& builder, Glib::RefPtr<Session> const& core)
|
2022-12-12 15:00:33 +00:00
|
|
|
: PageBase(cast_item, builder, core)
|
2008-07-15 01:03:03 +00:00
|
|
|
{
|
2023-11-16 04:15:40 +00:00
|
|
|
auto const speed_units_kbyps_str = Speed::units().display_name(Speed::Units::KByps);
|
|
|
|
|
2022-12-03 00:20:33 +00:00
|
|
|
localize_label(
|
2022-12-12 15:00:33 +00:00
|
|
|
*init_check_button("upload_limit_check", TR_KEY_speed_limit_up_enabled),
|
2023-11-16 04:15:40 +00:00
|
|
|
fmt::arg("speed_units", speed_units_kbyps_str));
|
2022-12-12 15:00:33 +00:00
|
|
|
init_spin_button("upload_limit_spin", TR_KEY_speed_limit_up, 0, std::numeric_limits<int>::max(), 5);
|
2022-09-07 22:25:04 +00:00
|
|
|
|
2022-12-03 00:20:33 +00:00
|
|
|
localize_label(
|
2022-12-12 15:00:33 +00:00
|
|
|
*init_check_button("download_limit_check", TR_KEY_speed_limit_down_enabled),
|
2023-11-16 04:15:40 +00:00
|
|
|
fmt::arg("speed_units", speed_units_kbyps_str));
|
2022-12-12 15:00:33 +00:00
|
|
|
init_spin_button("download_limit_spin", TR_KEY_speed_limit_down, 0, std::numeric_limits<int>::max(), 5);
|
2021-10-18 20:22:31 +00:00
|
|
|
|
2023-11-16 04:15:40 +00:00
|
|
|
localize_label(*get_widget<Gtk::Label>("alt_upload_limit_label"), fmt::arg("speed_units", speed_units_kbyps_str));
|
2022-12-12 15:00:33 +00:00
|
|
|
init_spin_button("alt_upload_limit_spin", TR_KEY_alt_speed_up, 0, std::numeric_limits<int>::max(), 5);
|
2022-09-07 22:25:04 +00:00
|
|
|
|
2023-11-16 04:15:40 +00:00
|
|
|
localize_label(*get_widget<Gtk::Label>("alt_download_limit_label"), fmt::arg("speed_units", speed_units_kbyps_str));
|
2022-12-12 15:00:33 +00:00
|
|
|
init_spin_button("alt_download_limit_spin", TR_KEY_alt_speed_down, 0, std::numeric_limits<int>::max(), 5);
|
2021-10-18 20:22:31 +00:00
|
|
|
|
2022-12-12 15:00:33 +00:00
|
|
|
init_time_combo("alt_speed_start_time_combo", TR_KEY_alt_speed_time_begin);
|
|
|
|
init_time_combo("alt_speed_end_time_combo", TR_KEY_alt_speed_time_end);
|
|
|
|
init_check_button("alt_schedule_time_check", TR_KEY_alt_speed_time_enabled);
|
|
|
|
init_week_combo("alt_speed_days_combo", TR_KEY_alt_speed_time_day);
|
2008-07-15 01:03:03 +00:00
|
|
|
}
|
|
|
|
|
2008-09-03 16:29:59 +00:00
|
|
|
/****
|
|
|
|
***** Network Tab
|
|
|
|
****/
|
|
|
|
|
2022-11-13 17:36:16 +00:00
|
|
|
class NetworkPage : public PageBase
|
2008-09-03 16:29:59 +00:00
|
|
|
{
|
2022-09-07 22:25:04 +00:00
|
|
|
public:
|
|
|
|
NetworkPage(BaseObjectType* cast_item, Glib::RefPtr<Gtk::Builder> const& builder, Glib::RefPtr<Session> const& core);
|
2022-09-09 12:34:28 +00:00
|
|
|
~NetworkPage() override;
|
2022-09-07 22:25:04 +00:00
|
|
|
|
2022-09-09 12:34:28 +00:00
|
|
|
TR_DISABLE_COPY_MOVE(NetworkPage)
|
2021-10-18 20:22:31 +00:00
|
|
|
|
2022-09-07 22:25:04 +00:00
|
|
|
private:
|
2022-11-09 16:58:36 +00:00
|
|
|
void onCorePrefsChanged(tr_quark key);
|
2022-09-07 22:25:04 +00:00
|
|
|
void onPortTested(bool isOpen);
|
|
|
|
void onPortTest();
|
2021-12-14 08:43:27 +00:00
|
|
|
|
2022-09-07 22:25:04 +00:00
|
|
|
private:
|
|
|
|
Glib::RefPtr<Session> core_;
|
|
|
|
|
|
|
|
Gtk::Label* portLabel_ = nullptr;
|
|
|
|
Gtk::Button* portButton_ = nullptr;
|
|
|
|
Gtk::SpinButton* portSpin_ = nullptr;
|
|
|
|
|
|
|
|
sigc::connection portTag_;
|
|
|
|
sigc::connection prefsTag_;
|
2008-09-03 16:29:59 +00:00
|
|
|
};
|
|
|
|
|
2022-09-07 22:25:04 +00:00
|
|
|
void NetworkPage::onCorePrefsChanged(tr_quark const key)
|
2008-09-03 16:29:59 +00:00
|
|
|
{
|
2017-04-19 12:04:45 +00:00
|
|
|
if (key == TR_KEY_peer_port)
|
2008-09-03 16:29:59 +00:00
|
|
|
{
|
2022-09-07 22:25:04 +00:00
|
|
|
gtr_label_set_text(*portLabel_, _("Status unknown"));
|
|
|
|
portButton_->set_sensitive(true);
|
|
|
|
portSpin_->set_sensitive(true);
|
2008-09-03 16:29:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-09-07 22:25:04 +00:00
|
|
|
NetworkPage::~NetworkPage()
|
2008-09-03 16:29:59 +00:00
|
|
|
{
|
2022-12-16 17:40:28 +00:00
|
|
|
prefsTag_.disconnect();
|
|
|
|
portTag_.disconnect();
|
2008-09-03 16:29:59 +00:00
|
|
|
}
|
|
|
|
|
2022-09-07 22:25:04 +00:00
|
|
|
void NetworkPage::onPortTested(bool isOpen)
|
2008-09-03 16:29:59 +00:00
|
|
|
{
|
2022-09-07 22:25:04 +00:00
|
|
|
portLabel_->set_markup(fmt::format(
|
2022-03-21 14:15:48 +00:00
|
|
|
isOpen ? _("Port is {markup_begin}open{markup_end}") : _("Port is {markup_begin}closed{markup_end}"),
|
|
|
|
fmt::arg("markup_begin", "<b>"),
|
|
|
|
fmt::arg("markup_end", "</b>")));
|
2022-09-07 22:25:04 +00:00
|
|
|
portButton_->set_sensitive(true);
|
|
|
|
portSpin_->set_sensitive(true);
|
2008-09-03 16:29:59 +00:00
|
|
|
}
|
|
|
|
|
2022-09-07 22:25:04 +00:00
|
|
|
void NetworkPage::onPortTest()
|
2008-09-03 16:29:59 +00:00
|
|
|
{
|
2022-09-07 22:25:04 +00:00
|
|
|
portButton_->set_sensitive(false);
|
|
|
|
portSpin_->set_sensitive(false);
|
|
|
|
portLabel_->set_text(_("Testing TCP port…"));
|
2020-08-18 10:36:10 +00:00
|
|
|
|
2022-09-07 22:25:04 +00:00
|
|
|
if (!portTag_.connected())
|
2017-04-19 12:04:45 +00:00
|
|
|
{
|
2022-09-07 22:25:04 +00:00
|
|
|
portTag_ = core_->signal_port_tested().connect([this](bool is_open) { onPortTested(is_open); });
|
2017-04-19 12:04:45 +00:00
|
|
|
}
|
|
|
|
|
2022-09-07 22:25:04 +00:00
|
|
|
core_->port_test();
|
2008-09-03 16:29:59 +00:00
|
|
|
}
|
|
|
|
|
2022-09-07 22:25:04 +00:00
|
|
|
NetworkPage::NetworkPage(
|
|
|
|
BaseObjectType* cast_item,
|
|
|
|
Glib::RefPtr<Gtk::Builder> const& builder,
|
|
|
|
Glib::RefPtr<Session> const& core)
|
2022-12-12 15:00:33 +00:00
|
|
|
: PageBase(cast_item, builder, core)
|
2022-09-07 22:25:04 +00:00
|
|
|
, core_(core)
|
2022-12-12 15:00:33 +00:00
|
|
|
, portLabel_(get_widget<Gtk::Label>("listening_port_status_label"))
|
|
|
|
, portButton_(get_widget<Gtk::Button>("test_listening_port_button"))
|
|
|
|
, portSpin_(init_spin_button("listening_port_spin", TR_KEY_peer_port, 1, std::numeric_limits<uint16_t>::max(), 1))
|
2008-09-03 16:29:59 +00:00
|
|
|
{
|
2022-09-07 22:25:04 +00:00
|
|
|
portButton_->signal_clicked().connect([this]() { onPortTest(); });
|
|
|
|
|
|
|
|
prefsTag_ = core_->signal_prefs_changed().connect([this](auto key) { onCorePrefsChanged(key); });
|
|
|
|
|
2022-12-12 15:00:33 +00:00
|
|
|
init_check_button("pick_random_listening_port_at_start_check", TR_KEY_peer_port_random_on_start);
|
|
|
|
init_check_button("enable_listening_port_forwarding_check", TR_KEY_port_forwarding_enabled);
|
|
|
|
init_spin_button("max_torrent_peers_spin", TR_KEY_peer_limit_per_torrent, 1, INT_MAX, 5);
|
|
|
|
init_spin_button("max_total_peers_spin", TR_KEY_peer_limit_global, 1, INT_MAX, 5);
|
2010-12-10 18:51:05 +00:00
|
|
|
|
2011-02-19 09:30:06 +00:00
|
|
|
#ifdef WITH_UTP
|
2022-12-12 15:00:33 +00:00
|
|
|
init_check_button("enable_utp_check", TR_KEY_utp_enabled);
|
2022-09-07 22:25:04 +00:00
|
|
|
#else
|
2022-12-12 15:00:33 +00:00
|
|
|
get_widget<Gtk::CheckButton>("enable_utp_check")->hide();
|
2011-02-18 22:22:02 +00:00
|
|
|
#endif
|
2011-02-18 00:33:29 +00:00
|
|
|
|
2022-12-12 15:00:33 +00:00
|
|
|
init_check_button("enable_pex_check", TR_KEY_pex_enabled);
|
|
|
|
init_check_button("enable_dht_check", TR_KEY_dht_enabled);
|
|
|
|
init_check_button("enable_lpd_check", TR_KEY_lpd_enabled);
|
|
|
|
init_text_view("default_trackers_view", TR_KEY_default_trackers);
|
2008-09-03 16:29:59 +00:00
|
|
|
}
|
|
|
|
|
2022-09-07 22:25:04 +00:00
|
|
|
} // namespace
|
|
|
|
|
2008-09-03 16:29:59 +00:00
|
|
|
/****
|
|
|
|
*****
|
|
|
|
****/
|
|
|
|
|
2021-11-01 00:11:23 +00:00
|
|
|
std::unique_ptr<PrefsDialog> PrefsDialog::create(Gtk::Window& parent, Glib::RefPtr<Session> const& core)
|
2021-10-18 20:22:31 +00:00
|
|
|
{
|
2022-09-07 22:25:04 +00:00
|
|
|
auto const builder = Gtk::Builder::create_from_resource(gtr_get_full_resource_path("PrefsDialog.ui"));
|
|
|
|
return std::unique_ptr<PrefsDialog>(gtr_get_widget_derived<PrefsDialog>(builder, "PrefsDialog", parent, core));
|
2021-10-18 20:22:31 +00:00
|
|
|
}
|
|
|
|
|
2022-09-07 22:25:04 +00:00
|
|
|
PrefsDialog::PrefsDialog(
|
|
|
|
BaseObjectType* cast_item,
|
|
|
|
Glib::RefPtr<Gtk::Builder> const& builder,
|
|
|
|
Gtk::Window& parent,
|
|
|
|
Glib::RefPtr<Session> const& core)
|
|
|
|
: Gtk::Dialog(cast_item)
|
|
|
|
, impl_(std::make_unique<Impl>(*this, builder, core))
|
2021-10-18 20:22:31 +00:00
|
|
|
{
|
2022-09-07 22:25:04 +00:00
|
|
|
set_transient_for(parent);
|
2021-10-18 20:22:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
PrefsDialog::~PrefsDialog() = default;
|
|
|
|
|
2022-09-07 22:25:04 +00:00
|
|
|
PrefsDialog::Impl::Impl(PrefsDialog& dialog, Glib::RefPtr<Gtk::Builder> const& builder, Glib::RefPtr<Session> const& core)
|
2021-10-18 20:22:31 +00:00
|
|
|
: dialog_(dialog)
|
|
|
|
, core_(core)
|
2008-02-13 03:00:21 +00:00
|
|
|
{
|
2022-09-07 22:25:04 +00:00
|
|
|
gtr_get_widget_derived<SpeedPage>(builder, "speed_page_layout", core_);
|
|
|
|
gtr_get_widget_derived<DownloadingPage>(builder, "downloading_page_layout", core_);
|
|
|
|
gtr_get_widget_derived<SeedingPage>(builder, "seeding_page_layout", core_);
|
|
|
|
gtr_get_widget_derived<PrivacyPage>(builder, "privacy_page_layout", core_);
|
|
|
|
gtr_get_widget_derived<NetworkPage>(builder, "network_page_layout", core_);
|
|
|
|
gtr_get_widget_derived<DesktopPage>(builder, "desktop_page_layout", core_);
|
|
|
|
gtr_get_widget_derived<RemotePage>(builder, "remote_page_layout", core_);
|
2008-09-23 19:11:04 +00:00
|
|
|
|
2021-11-12 09:12:50 +00:00
|
|
|
dialog_.signal_response().connect(sigc::mem_fun(*this, &Impl::response_cb));
|
2017-04-19 12:04:45 +00:00
|
|
|
}
|