mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 15:24:05 +00:00
15dfdee49f
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 58e41fe3ce
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.
62 lines
1.3 KiB
C++
62 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 helpRequested();
|
|
void closeHelp();
|
|
};
|
|
|
|
#endif
|
|
|