goldendict-ng/preferences.hh
Igor Kushnir 193aa4e31d Set up network disk cache for articleNetMgr
When a Wikipedia article is already cached, this change reduces the
amount of sent and received network data almost tenfold.

Setting up a network disk cache in the same way for dictNetMgr does not
noticeably impact the amount of network traffic. Either this network
access manager sends and receives very little data or the data is never
the same. So dictNetMgr does not need a disk cache.

Use QNetworkDiskCache's default maximum size of 50 MiB as the default
network cache size. This size is large enough to accommodate tens of
huge MediaWiki articles. It is also small enough that the user is
unlikely to run out of disk space because of the cache.

Clear network cache on exit by default because most users probably
don't load the same online articles after restarting GoldenDict. Plus
storing the network cache on disk indefinitely by default would be a new
and unexpected to the users privacy risk.

Nikita Moor came up with the idea and wrote an initial network disk
cache implementation in #1310.
2020-11-18 19:04:28 +02:00

63 lines
1.3 KiB
C++

#ifndef __PREFERENCES_HH_INCLUDED__
#define __PREFERENCES_HH_INCLUDED__
#include <QDialog>
#include "config.hh"
#include "helpwindow.hh"
#include "ui_preferences.h"
/// Preferences dialog -- allows changing various program options.
class Preferences: public QDialog
{
Q_OBJECT
int prevInterfaceLanguage;
Help::HelpWindow * helpWindow;
Config::Class & cfg;
QAction helpAction;
public:
Preferences( QWidget * parent, Config::Class & cfg_ );
~Preferences()
{ if( helpWindow ) delete helpWindow; }
Config::Preferences getPreferences();
private:
Ui::Preferences ui;
private slots:
void enableScanPopupToggled( bool );
void enableScanPopupModifiersToggled( bool );
void showScanFlagToggled( bool b );
void on_scanPopupUnpinnedWindowFlags_currentIndexChanged( int index );
void wholeAltClicked( bool );
void wholeCtrlClicked( bool );
void wholeShiftClicked( bool );
void sideAltClicked( bool );
void sideCtrlClicked( bool );
void sideShiftClicked( bool );
void on_enableMainWindowHotkey_toggled( bool checked );
void on_enableClipboardHotkey_toggled( bool checked );
void on_buttonBox_accepted();
void on_useExternalPlayer_toggled( bool enabled );
void customProxyToggled( bool );
void on_maxNetworkCacheSize_valueChanged( int value );
void helpRequested();
void closeHelp();
};
#endif