goldendict-ng/preferences.hh

59 lines
1.2 KiB
C++
Raw Normal View History

#ifndef __PREFERENCES_HH_INCLUDED__
#define __PREFERENCES_HH_INCLUDED__
#include <QDialog>
#include "config.hh"
2014-06-24 13:55:06 +00:00
#include "helpwindow.hh"
#include "ui_preferences.h"
/// Preferences dialog -- allows changing various program options.
class Preferences: public QDialog
{
Q_OBJECT
int prevInterfaceLanguage;
QString prevWebFontFamily;
2014-06-24 13:55:06 +00:00
Help::HelpWindow * helpWindow;
Config::Class & cfg;
QAction helpAction;
public:
2014-06-24 13:55:06 +00:00
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 );
Allow customizing unpinned scan popup window flags on X11 with Qt5 My tests in many desktop environments and window managers indicate that no single configuration works perfectly in all environments. There are also behavior differences between Qt::Popup and Qt::Tool flags, which are not exactly bugs, so I suppose users might subjectively prefer different options. Customizing the flags allows the user to prevent unpinned scan popup window flickering with Qt5 on Linux. In a way adding these options fixes issue #645, which is: the scan popup window blinks rapidly, barely noticeably in some applications, such as Calibre ebook-viewer and Chromium. In this case the scan popup window usually ends up hidden when selection ends, unless it was finished with a jerk. I have tested the new options in 9 desktop environments and window managers: at least one configuration for each eliminates #645 and makes the scan popup window work the same as with Qt4 in this regard: the popup window remains visible, text in the popup's translation line keeps up with the text selection in the external application, and the selected text is being translated on the fly. Moreover, for each tested DE/WM, at least one configuration makes the scan popup window work perfectly as far as I am concerned. This issue was partially worked around with a 200ms scan popup delay timer in the recent commit 58e41fe3ceb769cab37608e36637044e597ba1f8 for the duplicate issue #854. However the timer solution is incomplete because it requires the user to select text quickly and without delays. If global mouse selection does not change for 200ms while the left mouse button is held down, the user will likely not see the scan popup when (s)he finishes selection, and will have to try selecting again - hopefully faster this time. The 200ms delay is no longer critically important after this commit, but it is still beneficial: the lookup query changes less often, which in turn reduces article definition update frequency. So the delay improves the UI (perhaps subjectively) and performance.
2018-04-09 17:50:23 +00:00
void on_scanPopupUnpinnedWindowFlags_currentIndexChanged( int index );
void on_enableMainWindowHotkey_toggled( bool checked );
void on_enableClipboardHotkey_toggled( bool checked );
void on_buttonBox_accepted();
void on_useExternalPlayer_toggled( bool enabled );
2014-04-01 17:00:13 +00:00
void customProxyToggled( bool );
void on_maxNetworkCacheSize_valueChanged( int value );
2014-06-24 13:55:06 +00:00
void on_collapseBigArticles_toggled( bool checked );
void on_limitInputPhraseLength_toggled( bool checked );
2014-06-24 13:55:06 +00:00
void helpRequested();
void closeHelp();
};
#endif