Browse Source

Add header to differentiate settings

adaptive-webui-19844
Chocobo1 9 years ago
parent
commit
a26d48082d
  1. 66
      src/gui/advancedsettings.cpp
  2. 2
      src/gui/advancedsettings.h

66
src/gui/advancedsettings.cpp

@ -27,6 +27,7 @@
*/ */
#include "advancedsettings.h" #include "advancedsettings.h"
#include <QFont>
#include <QHeaderView> #include <QHeaderView>
#include <QHostAddress> #include <QHostAddress>
#include <QNetworkInterface> #include <QNetworkInterface>
@ -35,37 +36,52 @@
enum AdvSettingsCols enum AdvSettingsCols
{ {
PROPERTY, PROPERTY,
VALUE VALUE,
COL_COUNT
}; };
enum AdvSettingsRows enum AdvSettingsRows
{ {
DISK_CACHE, // qBittorrent section
DISK_CACHE_TTL, QBITTORRENT_HEADER,
OS_CACHE, // network interface
SAVE_RESUME_DATA_INTERVAL,
OUTGOING_PORT_MIN,
OUTGOING_PORT_MAX,
RECHECK_COMPLETED,
LIST_REFRESH,
RESOLVE_COUNTRIES,
RESOLVE_HOSTS,
MAX_HALF_OPEN,
SUPER_SEEDING,
NETWORK_IFACE, NETWORK_IFACE,
NETWORK_LISTEN_IPV6, NETWORK_LISTEN_IPV6,
NETWORK_ADDRESS, // behavior
PROGRAM_NOTIFICATIONS, SAVE_RESUME_DATA_INTERVAL,
TRACKER_STATUS, CONFIRM_RECHECK_TORRENT,
TRACKER_PORT, RECHECK_COMPLETED,
#if defined(Q_OS_WIN) || defined(Q_OS_MAC) #if defined(Q_OS_WIN) || defined(Q_OS_MAC)
UPDATE_CHECK, UPDATE_CHECK,
#endif #endif
// UI related
LIST_REFRESH,
RESOLVE_HOSTS,
RESOLVE_COUNTRIES,
PROGRAM_NOTIFICATIONS,
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC)) #if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC))
USE_ICON_THEME, USE_ICON_THEME,
#endif #endif
CONFIRM_RECHECK_TORRENT,
// libtorrent section
LIBTORRENT_HEADER,
// cache
DISK_CACHE,
DISK_CACHE_TTL,
OS_CACHE,
// ports
MAX_HALF_OPEN,
OUTGOING_PORT_MIN,
OUTGOING_PORT_MAX,
// embedded tracker
TRACKER_STATUS,
TRACKER_PORT,
// seeding
SUPER_SEEDING,
// tracker
TRACKER_EXCHANGE, TRACKER_EXCHANGE,
ANNOUNCE_ALL_TRACKERS, ANNOUNCE_ALL_TRACKERS,
NETWORK_ADDRESS,
ROW_COUNT ROW_COUNT
}; };
@ -73,7 +89,7 @@ AdvancedSettings::AdvancedSettings(QWidget *parent)
: QTableWidget(parent) : QTableWidget(parent)
{ {
// column // column
setColumnCount(2); setColumnCount(COL_COUNT);
QStringList header = { tr("Setting"), tr("Value", "Value set for this setting") }; QStringList header = { tr("Setting"), tr("Value", "Value set for this setting") };
setHorizontalHeaderLabels(header); setHorizontalHeaderLabels(header);
// row // row
@ -161,6 +177,18 @@ void AdvancedSettings::updateCacheSpinSuffix(int value)
void AdvancedSettings::loadAdvancedSettings() void AdvancedSettings::loadAdvancedSettings()
{ {
const Preferences* const pref = Preferences::instance(); const Preferences* const pref = Preferences::instance();
// add section headers
QFont boldFont;
boldFont.setBold(true);
addRow(QBITTORRENT_HEADER, tr("qBittorrent Section"), &labelQbtLink);
item(QBITTORRENT_HEADER, PROPERTY)->setFont(boldFont);
labelQbtLink.setText(QString("<a href=\"%1\">%2</a>").arg("https://github.com/qbittorrent/qBittorrent/wiki/Explanation-of-Options-in-qBittorrent#Advanced").arg(tr("Open documentation")));
labelQbtLink.setOpenExternalLinks(true);
addRow(LIBTORRENT_HEADER, tr("libtorrent Section"), &labelLibtorrentLink);
item(LIBTORRENT_HEADER, PROPERTY)->setFont(boldFont);
labelLibtorrentLink.setText(QString("<a href=\"%1\">%2</a>").arg("http://www.libtorrent.org/reference.html").arg(tr("Open documentation")));
labelLibtorrentLink.setOpenExternalLinks(true);
// Disk write cache // Disk write cache
spin_cache.setMinimum(0); spin_cache.setMinimum(0);
// When build as 32bit binary, set the maximum at less than 2GB to prevent crashes. // When build as 32bit binary, set the maximum at less than 2GB to prevent crashes.

2
src/gui/advancedsettings.h

@ -29,6 +29,7 @@
#ifndef ADVANCEDSETTINGS_H #ifndef ADVANCEDSETTINGS_H
#define ADVANCEDSETTINGS_H #define ADVANCEDSETTINGS_H
#include <QLabel>
#include <QSpinBox> #include <QSpinBox>
#include <QCheckBox> #include <QCheckBox>
#include <QLineEdit> #include <QLineEdit>
@ -56,6 +57,7 @@ private:
void loadAdvancedSettings(); void loadAdvancedSettings();
template <typename T> void addRow(int row, const QString &rowText, T* widget); template <typename T> void addRow(int row, const QString &rowText, T* widget);
QLabel labelQbtLink, labelLibtorrentLink;
QSpinBox spin_cache, spin_save_resume_data_interval, outgoing_ports_min, outgoing_ports_max, spin_list_refresh, spin_maxhalfopen, spin_tracker_port, spin_cache_ttl; QSpinBox spin_cache, spin_save_resume_data_interval, outgoing_ports_min, outgoing_ports_max, spin_list_refresh, spin_maxhalfopen, spin_tracker_port, spin_cache_ttl;
QCheckBox cb_os_cache, cb_recheck_completed, cb_resolve_countries, cb_resolve_hosts, QCheckBox cb_os_cache, cb_recheck_completed, cb_resolve_countries, cb_resolve_hosts,
cb_super_seeding, cb_program_notifications, cb_tracker_status, cb_super_seeding, cb_program_notifications, cb_tracker_status,

Loading…
Cancel
Save