2012-02-20 21:47:14 +00:00
|
|
|
/* This file is (c) 2008-2012 Konstantin Isakov <ikm@goldendict.org>
|
2009-01-28 20:55:45 +00:00
|
|
|
* Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */
|
|
|
|
|
|
|
|
#ifndef __MAINWINDOW_HH_INCLUDED__
|
|
|
|
#define __MAINWINDOW_HH_INCLUDED__
|
|
|
|
|
|
|
|
#include <QMainWindow>
|
|
|
|
#include <QThread>
|
|
|
|
#include <QToolButton>
|
2009-02-05 20:55:00 +00:00
|
|
|
#include <QSystemTrayIcon>
|
2009-03-26 19:00:08 +00:00
|
|
|
#include <QNetworkAccessManager>
|
2013-05-27 11:18:13 +00:00
|
|
|
#include <QProgressDialog>
|
2009-01-28 20:55:45 +00:00
|
|
|
#include "ui_mainwindow.h"
|
|
|
|
#include "folding.hh"
|
|
|
|
#include "config.hh"
|
|
|
|
#include "dictionary.hh"
|
|
|
|
#include "article_netmgr.hh"
|
2018-03-21 17:49:34 +00:00
|
|
|
#include "audioplayerfactory.hh"
|
2009-01-28 20:55:45 +00:00
|
|
|
#include "instances.hh"
|
|
|
|
#include "article_maker.hh"
|
|
|
|
#include "scanpopup.hh"
|
|
|
|
#include "articleview.hh"
|
2009-01-29 19:16:25 +00:00
|
|
|
#include "wordfinder.hh"
|
2009-09-21 17:50:03 +00:00
|
|
|
#include "dictionarybar.hh"
|
2009-10-21 19:37:07 +00:00
|
|
|
#include "history.hh"
|
2011-06-27 18:54:15 +00:00
|
|
|
#include "mainstatusbar.hh"
|
2011-11-02 23:37:50 +00:00
|
|
|
#include "mruqmenu.hh"
|
2012-12-24 11:30:03 +00:00
|
|
|
#include "translatebox.hh"
|
2013-01-25 15:42:44 +00:00
|
|
|
#include "wordlist.hh"
|
2014-03-03 13:46:41 +00:00
|
|
|
#include "dictheadwords.hh"
|
2014-04-16 16:18:28 +00:00
|
|
|
#include "fulltextsearch.hh"
|
2014-06-23 15:11:15 +00:00
|
|
|
#include "helpwindow.hh"
|
2009-01-28 20:55:45 +00:00
|
|
|
|
2019-01-28 13:27:48 +00:00
|
|
|
#include "hotkeywrapper.hh"
|
2021-12-11 16:34:37 +00:00
|
|
|
#include "weburlrequestinterceptor.h"
|
2022-01-09 01:52:40 +00:00
|
|
|
#include "resourceschemehandler.h"
|
2022-05-13 16:00:23 +00:00
|
|
|
#include "iframeschemehandler.h"
|
2013-05-31 05:28:36 +00:00
|
|
|
#ifdef HAVE_X11
|
2011-06-09 07:29:21 +00:00
|
|
|
#include <fixx11h.h>
|
|
|
|
#endif
|
|
|
|
|
2009-01-28 20:55:45 +00:00
|
|
|
using std::string;
|
|
|
|
using std::vector;
|
|
|
|
|
2010-06-28 15:14:07 +00:00
|
|
|
class MainWindow: public QMainWindow, public DataCommitter
|
2009-01-28 20:55:45 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
2009-04-12 20:46:25 +00:00
|
|
|
MainWindow( Config::Class & cfg );
|
2009-02-06 17:04:11 +00:00
|
|
|
~MainWindow();
|
2009-01-28 20:55:45 +00:00
|
|
|
|
2010-06-28 15:14:07 +00:00
|
|
|
virtual void commitData( QSessionManager & );
|
|
|
|
|
2014-06-24 13:55:06 +00:00
|
|
|
void showGDHelpForID( QString const & id );
|
|
|
|
void closeGDHelp();
|
2016-04-24 19:04:22 +00:00
|
|
|
QString getTranslateLineText() const
|
|
|
|
{ return translateLine->text(); }
|
2014-06-24 13:55:06 +00:00
|
|
|
|
2017-03-10 13:29:23 +00:00
|
|
|
/// Set group for main/popup window
|
|
|
|
void setGroupByName( QString const & name, bool main_window );
|
|
|
|
|
2010-11-20 13:43:55 +00:00
|
|
|
public slots:
|
|
|
|
|
|
|
|
void messageFromAnotherInstanceReceived( QString const & );
|
2011-07-14 20:11:57 +00:00
|
|
|
void showStatusBarMessage ( QString const &, int, QPixmap const & );
|
2021-06-10 16:13:11 +00:00
|
|
|
void phraseReceived( Config::InputPhrase const & );
|
2011-11-16 12:52:25 +00:00
|
|
|
void wordReceived( QString const & );
|
2014-11-17 14:37:19 +00:00
|
|
|
void headwordReceived( QString const &, QString const & );
|
2012-09-16 10:19:47 +00:00
|
|
|
void setExpandMode( bool expand );
|
2017-05-05 14:39:51 +00:00
|
|
|
void headwordFromFavorites( QString const &, QString const & );
|
2018-03-27 14:46:03 +00:00
|
|
|
void quitApp();
|
2010-11-20 13:43:55 +00:00
|
|
|
|
2009-01-28 20:55:45 +00:00
|
|
|
private:
|
2014-05-11 11:52:25 +00:00
|
|
|
void addGlobalAction( QAction * action, const char * slot );
|
|
|
|
void addGlobalActionsToDialog( QDialog * dialog );
|
2019-07-09 15:00:23 +00:00
|
|
|
void addGroupComboBoxActionsToDialog( QDialog * dialog, GroupComboBox * pGroupComboBox );
|
|
|
|
void removeGroupComboBoxActionsFromDialog( QDialog * dialog, GroupComboBox * pGroupComboBox );
|
2009-01-28 20:55:45 +00:00
|
|
|
|
2018-03-27 18:01:33 +00:00
|
|
|
void commitData();
|
2010-06-28 15:14:07 +00:00
|
|
|
|
2009-02-05 20:55:00 +00:00
|
|
|
QSystemTrayIcon * trayIcon;
|
|
|
|
|
2022-08-09 12:29:59 +00:00
|
|
|
QScopedPointer< ArticleInspector > inspector;
|
2022-05-20 09:18:38 +00:00
|
|
|
|
2021-12-11 16:34:37 +00:00
|
|
|
WebUrlRequestInterceptor *wuri;
|
|
|
|
|
2009-01-28 20:55:45 +00:00
|
|
|
Ui::MainWindow ui;
|
2009-04-20 14:13:39 +00:00
|
|
|
|
|
|
|
/// This widget is used as a title bar for the searchPane dock, and
|
|
|
|
/// incorporates the next three objects inside
|
|
|
|
QWidget searchPaneTitleBar;
|
|
|
|
QHBoxLayout searchPaneTitleBarLayout;
|
|
|
|
QLabel groupLabel;
|
2012-12-24 11:30:03 +00:00
|
|
|
GroupComboBox * groupList, * groupListInToolbar, * groupListInDock;
|
|
|
|
|
2013-02-07 15:24:24 +00:00
|
|
|
// Needed to be able to show/hide the translate box in the toolbar, since hiding
|
2012-12-24 11:30:03 +00:00
|
|
|
// the list expilictily doesn't work, see docs for QToolBar::addWidget().
|
2013-02-07 15:24:24 +00:00
|
|
|
QAction * translateBoxToolBarAction;
|
2009-04-20 14:13:39 +00:00
|
|
|
|
2011-06-05 11:49:50 +00:00
|
|
|
QWidget dictsPaneTitleBar;
|
|
|
|
QHBoxLayout dictsPaneTitleBarLayout;
|
|
|
|
QLabel foundInDictsLabel;
|
|
|
|
|
2012-12-24 11:30:03 +00:00
|
|
|
TranslateBox * translateBox;
|
|
|
|
|
2010-07-02 11:19:02 +00:00
|
|
|
/// Fonts saved before words zooming is in effect, so it could be reset back.
|
2019-01-26 19:11:27 +00:00
|
|
|
QFont wordListDefaultFont, translateLineDefaultFont, groupListDefaultFont;
|
2010-07-02 11:19:02 +00:00
|
|
|
|
2013-01-22 21:04:45 +00:00
|
|
|
QAction escAction, focusTranslateLineAction, addTabAction, closeCurrentTabAction,
|
2010-09-16 18:52:40 +00:00
|
|
|
closeAllTabAction, closeRestTabAction,
|
2011-06-26 11:53:28 +00:00
|
|
|
switchToNextTabAction, switchToPrevTabAction,
|
2014-03-04 16:58:51 +00:00
|
|
|
showDictBarNamesAction, useSmallIconsInToolbarsAction, toggleMenuBarAction,
|
2017-11-07 14:45:21 +00:00
|
|
|
switchExpandModeAction, focusHeadwordsDlgAction, focusArticleViewAction,
|
|
|
|
addAllTabToFavoritesAction;
|
2009-01-28 20:55:45 +00:00
|
|
|
QToolBar * navToolbar;
|
2011-06-27 18:54:15 +00:00
|
|
|
MainStatusBar * mainStatusBar;
|
2012-12-26 13:46:04 +00:00
|
|
|
QAction * navBack, * navForward, * navPronounce, * enableScanPopup;
|
2022-06-24 13:20:16 +00:00
|
|
|
QAction * actTrackingClipboard;
|
2012-12-29 18:46:43 +00:00
|
|
|
QAction * beforeScanPopupSeparator, * afterScanPopupSeparator, * beforeOptionsSeparator;
|
2009-04-30 19:57:25 +00:00
|
|
|
QAction * zoomIn, * zoomOut, * zoomBase;
|
2010-07-02 11:19:02 +00:00
|
|
|
QAction * wordsZoomIn, * wordsZoomOut, * wordsZoomBase;
|
2017-05-05 14:39:51 +00:00
|
|
|
QAction * addToFavorites, * beforeAddToFavoritesSeparator;
|
2009-02-08 20:20:02 +00:00
|
|
|
QMenu trayIconMenu;
|
2012-12-29 18:46:43 +00:00
|
|
|
QMenu * tabMenu;
|
|
|
|
QAction * menuButtonAction;
|
2013-01-23 13:40:49 +00:00
|
|
|
QToolButton * menuButton;
|
2011-11-02 23:37:50 +00:00
|
|
|
MRUQMenu *tabListMenu;
|
|
|
|
//List that contains indexes of tabs arranged in a most-recently-used order
|
|
|
|
QList<QWidget*> mruList;
|
2010-09-16 18:52:40 +00:00
|
|
|
QToolButton addTab, *tabListButton;
|
2009-04-12 20:46:25 +00:00
|
|
|
Config::Class & cfg;
|
2009-09-21 17:50:03 +00:00
|
|
|
Config::Events configEvents;
|
2009-10-21 19:37:07 +00:00
|
|
|
History history;
|
2009-09-21 17:50:03 +00:00
|
|
|
DictionaryBar dictionaryBar;
|
2009-01-28 20:55:45 +00:00
|
|
|
vector< sptr< Dictionary::Class > > dictionaries;
|
2022-03-13 16:17:34 +00:00
|
|
|
QMap<std::string, sptr< Dictionary::Class > > dictMap;
|
2009-09-23 18:44:38 +00:00
|
|
|
/// Here we store unmuted dictionaries when the dictionary bar is active
|
|
|
|
vector< sptr< Dictionary::Class > > dictionariesUnmuted;
|
2009-05-14 19:27:19 +00:00
|
|
|
Instances::Groups groupInstances;
|
2009-01-28 20:55:45 +00:00
|
|
|
ArticleMaker articleMaker;
|
|
|
|
ArticleNetworkAccessManager articleNetMgr;
|
2009-03-26 19:00:08 +00:00
|
|
|
QNetworkAccessManager dictNetMgr; // We give dictionaries a separate manager,
|
|
|
|
// since their requests can be destroyed
|
|
|
|
// in a separate thread
|
2018-03-21 17:49:34 +00:00
|
|
|
AudioPlayerFactory audioPlayerFactory;
|
2009-01-28 20:55:45 +00:00
|
|
|
|
2013-01-25 15:42:44 +00:00
|
|
|
WordList * wordList;
|
2012-12-24 11:30:03 +00:00
|
|
|
QLineEdit * translateLine;
|
2021-06-10 16:13:11 +00:00
|
|
|
QString translateBoxSuffix; ///< A punctuation suffix that corresponds to translateLine's text.
|
2012-12-24 11:30:03 +00:00
|
|
|
|
2009-01-29 19:16:25 +00:00
|
|
|
WordFinder wordFinder;
|
2009-01-28 20:55:45 +00:00
|
|
|
|
2009-02-01 00:08:08 +00:00
|
|
|
sptr< ScanPopup > scanPopup;
|
2009-01-28 20:55:45 +00:00
|
|
|
|
2009-04-21 18:27:26 +00:00
|
|
|
sptr< HotkeyWrapper > hotkeyWrapper;
|
2009-04-19 21:32:18 +00:00
|
|
|
|
2009-04-20 19:54:34 +00:00
|
|
|
QTimer newReleaseCheckTimer; // Countdown to a check for the new program
|
|
|
|
// release, if enabled
|
2013-06-07 12:59:18 +00:00
|
|
|
QNetworkReply *latestReleaseReply;
|
2009-04-20 19:54:34 +00:00
|
|
|
|
2009-11-11 09:40:32 +00:00
|
|
|
sptr< QPrinter > printer; // The printer we use for all printing operations
|
2010-09-16 18:52:40 +00:00
|
|
|
|
2012-11-25 11:37:57 +00:00
|
|
|
bool wordListSelChanged;
|
|
|
|
|
2013-01-23 20:36:53 +00:00
|
|
|
bool wasMaximized; // Window state before minimization
|
|
|
|
|
2013-01-31 13:01:08 +00:00
|
|
|
bool blockUpdateWindowTitle;
|
|
|
|
|
2009-11-11 09:40:32 +00:00
|
|
|
QPrinter & getPrinter(); // Creates a printer if it's not there and returns it
|
|
|
|
|
2014-03-03 13:46:41 +00:00
|
|
|
DictHeadwords * headwordsDlg;
|
|
|
|
|
2014-04-16 16:18:28 +00:00
|
|
|
FTS::FtsIndexing ftsIndexing;
|
|
|
|
|
|
|
|
FTS::FullTextSearchDialog * ftsDlg;
|
|
|
|
|
2014-06-23 15:11:15 +00:00
|
|
|
Help::HelpWindow * helpWindow;
|
|
|
|
|
2017-10-23 14:21:43 +00:00
|
|
|
QIcon starIcon, blueStarIcon;
|
|
|
|
|
2022-05-13 16:00:23 +00:00
|
|
|
LocalSchemeHandler * localSchemeHandler;
|
|
|
|
IframeSchemeHandler * iframeSchemeHandler;
|
|
|
|
ResourceSchemeHandler * resourceSchemeHandler;
|
2022-01-09 01:52:40 +00:00
|
|
|
|
2009-05-16 18:04:21 +00:00
|
|
|
/// Applies the qt's stylesheet, given the style's name.
|
2012-12-10 14:14:13 +00:00
|
|
|
void applyQtStyleSheet( QString const & displayStyle, QString const & addonStyle );
|
2009-05-16 18:04:21 +00:00
|
|
|
|
2009-02-05 20:55:00 +00:00
|
|
|
/// Creates, destroys or otherwise updates tray icon, according to the
|
|
|
|
/// current configuration and situation.
|
|
|
|
void updateTrayIcon();
|
|
|
|
|
2013-01-01 23:05:29 +00:00
|
|
|
void wheelEvent( QWheelEvent * );
|
2009-02-05 20:55:00 +00:00
|
|
|
void closeEvent( QCloseEvent * );
|
|
|
|
|
2009-04-03 17:10:27 +00:00
|
|
|
void applyProxySettings();
|
2020-11-12 15:57:10 +00:00
|
|
|
void setupNetworkCache( int maxSize );
|
2009-01-28 20:55:45 +00:00
|
|
|
void makeDictionaries();
|
|
|
|
void updateStatusLine();
|
|
|
|
void updateGroupList();
|
2009-09-21 17:50:03 +00:00
|
|
|
void updateDictionaryBar();
|
2009-02-01 00:08:08 +00:00
|
|
|
void makeScanPopup();
|
2009-01-28 20:55:45 +00:00
|
|
|
|
2009-04-10 21:07:03 +00:00
|
|
|
void updatePronounceAvailability();
|
|
|
|
|
2011-06-07 11:27:19 +00:00
|
|
|
void updateBackForwardButtons();
|
|
|
|
|
2011-06-25 07:53:45 +00:00
|
|
|
void updateWindowTitle();
|
|
|
|
|
2009-09-23 18:44:38 +00:00
|
|
|
/// Updates word search request and active article view in response to
|
|
|
|
/// muting or unmuting dictionaries, or showing/hiding dictionary bar.
|
|
|
|
void applyMutedDictionariesState();
|
|
|
|
|
2009-03-29 17:38:54 +00:00
|
|
|
virtual bool eventFilter( QObject *, QEvent * );
|
|
|
|
|
2009-01-28 20:55:45 +00:00
|
|
|
/// Returns the reference to dictionaries stored in the currently active
|
|
|
|
/// group, or to all dictionaries if there are no groups.
|
|
|
|
vector< sptr< Dictionary::Class > > const & getActiveDicts();
|
|
|
|
|
2009-04-20 12:25:26 +00:00
|
|
|
/// Brings the main window to front if it's not currently, or hides it
|
|
|
|
/// otherwise. The hiding part is omitted if onlyShow is true.
|
2013-05-31 05:28:36 +00:00
|
|
|
#ifdef HAVE_X11
|
2013-03-11 12:56:26 +00:00
|
|
|
void toggleMainWindow( bool onlyShow = false, bool byIconClick = false );
|
|
|
|
#else
|
2009-04-20 12:25:26 +00:00
|
|
|
void toggleMainWindow( bool onlyShow = false );
|
2013-03-11 12:56:26 +00:00
|
|
|
#endif
|
2009-04-20 12:25:26 +00:00
|
|
|
|
2009-04-21 18:27:26 +00:00
|
|
|
/// Creates hotkeyWrapper and hooks the currently set keys for it
|
|
|
|
void installHotKeys();
|
|
|
|
|
2009-04-30 19:57:25 +00:00
|
|
|
void applyZoomFactor();
|
2019-01-31 12:45:30 +00:00
|
|
|
void adjustCurrentZoomFactor();
|
2009-04-30 19:57:25 +00:00
|
|
|
|
2009-07-31 11:40:54 +00:00
|
|
|
void mousePressEvent ( QMouseEvent * event );
|
|
|
|
|
2010-11-15 15:22:35 +00:00
|
|
|
void updateCurrentGroupProperty();
|
|
|
|
|
2011-06-07 08:26:49 +00:00
|
|
|
/// Handles backward and forward mouse buttons and
|
|
|
|
/// returns true if the event is handled.
|
|
|
|
bool handleBackForwardMouseButtons(QMouseEvent *ev);
|
2010-11-15 15:22:35 +00:00
|
|
|
|
2011-07-01 19:22:40 +00:00
|
|
|
ArticleView * getCurrentArticleView();
|
2011-11-02 23:37:50 +00:00
|
|
|
void ctrlTabPressed();
|
2011-07-01 19:22:40 +00:00
|
|
|
|
2012-09-10 16:23:58 +00:00
|
|
|
void fillWordListFromHistory();
|
|
|
|
|
2015-03-23 15:58:49 +00:00
|
|
|
void showDictionaryHeadwords( QWidget * owner, Dictionary::Class * dict );
|
2014-03-01 13:11:14 +00:00
|
|
|
|
2017-11-07 14:46:59 +00:00
|
|
|
QString unescapeTabHeader( QString const & header );
|
|
|
|
|
2021-06-10 16:13:11 +00:00
|
|
|
void respondToTranslationRequest( Config::InputPhrase const & phrase,
|
2021-06-29 08:59:16 +00:00
|
|
|
bool checkModifiers, QString const & scrollTo = QString() );
|
2021-06-10 16:13:11 +00:00
|
|
|
|
|
|
|
void updateSuggestionList();
|
|
|
|
void updateSuggestionList( QString const & text );
|
|
|
|
|
2021-06-30 16:49:58 +00:00
|
|
|
enum WildcardPolicy { EscapeWildcards, WildcardsAreAlreadyEscaped };
|
2021-06-10 16:13:11 +00:00
|
|
|
enum TranslateBoxPopup { NoPopupChange, EnablePopup, DisablePopup };
|
2021-06-30 16:49:58 +00:00
|
|
|
void setTranslateBoxTextAndKeepSuffix( QString text, WildcardPolicy wildcardPolicy,
|
|
|
|
TranslateBoxPopup popupAction );
|
|
|
|
void setTranslateBoxTextAndClearSuffix( QString const & text, WildcardPolicy wildcardPolicy,
|
|
|
|
TranslateBoxPopup popupAction );
|
2022-05-23 12:14:26 +00:00
|
|
|
void changeWebEngineViewFont();
|
|
|
|
|
2009-04-21 18:27:26 +00:00
|
|
|
private slots:
|
|
|
|
|
|
|
|
void hotKeyActivated( int );
|
|
|
|
|
2009-04-20 19:54:34 +00:00
|
|
|
/// If new release checks are on, santizies the next check time and starts
|
|
|
|
/// the timer. Does nothing otherwise.
|
|
|
|
void prepareNewReleaseChecks();
|
|
|
|
|
2022-01-09 04:54:50 +00:00
|
|
|
void updateFoundInDictsList();
|
2009-04-20 19:54:34 +00:00
|
|
|
|
|
|
|
/// Does the new release check.
|
|
|
|
void checkForNewRelease();
|
|
|
|
|
|
|
|
/// Signalled when the lastestReleaseReply is finished()
|
|
|
|
void latestReleaseReplyReady();
|
|
|
|
|
2012-09-19 12:44:36 +00:00
|
|
|
/// Receive click on "Found in:" pane
|
2012-09-24 12:51:51 +00:00
|
|
|
void foundDictsPaneClicked( QListWidgetItem * item );
|
|
|
|
|
|
|
|
/// Receive right click on "Found in:" pane
|
|
|
|
void foundDictsContextMenuRequested( const QPoint & pos );
|
2012-09-19 12:44:36 +00:00
|
|
|
|
2012-09-25 13:13:35 +00:00
|
|
|
void showDictionaryInfo( QString const & id );
|
|
|
|
|
2014-03-01 13:11:14 +00:00
|
|
|
void showDictionaryHeadwords( QString const & id );
|
|
|
|
|
2013-06-09 13:31:57 +00:00
|
|
|
void openDictionaryFolder( QString const & id );
|
|
|
|
|
2013-06-11 19:31:58 +00:00
|
|
|
void editDictionary ( Dictionary::Class * dict );
|
2013-06-11 15:40:45 +00:00
|
|
|
|
2015-11-01 12:22:18 +00:00
|
|
|
void showFTSIndexingName( QString const & name );
|
|
|
|
|
2017-12-07 15:47:53 +00:00
|
|
|
void handleAddToFavoritesButton();
|
|
|
|
|
2017-05-05 14:39:51 +00:00
|
|
|
void addCurrentTabToFavorites();
|
|
|
|
|
2017-11-07 14:45:21 +00:00
|
|
|
void addAllTabsToFavorites();
|
|
|
|
|
2009-01-28 20:55:45 +00:00
|
|
|
private slots:
|
|
|
|
|
|
|
|
// Executed in response to a user click on an 'add tab' tool button
|
|
|
|
void addNewTab();
|
|
|
|
// Executed in response to a user click on an 'close' button on a tab
|
|
|
|
void tabCloseRequested( int );
|
2009-04-09 22:11:38 +00:00
|
|
|
// Closes current tab.
|
|
|
|
void closeCurrentTab();
|
2010-09-16 18:52:40 +00:00
|
|
|
void closeAllTabs();
|
|
|
|
void closeRestTabs();
|
2009-04-09 22:11:38 +00:00
|
|
|
void switchToNextTab();
|
|
|
|
void switchToPrevTab();
|
2011-11-02 23:37:50 +00:00
|
|
|
void ctrlReleased();
|
2009-01-28 20:55:45 +00:00
|
|
|
|
2012-09-16 10:19:47 +00:00
|
|
|
// Switch optional parts expand mode for current tab
|
|
|
|
void switchExpandOptionalPartsMode();
|
|
|
|
|
2010-09-16 18:52:40 +00:00
|
|
|
// Handling of active tab list
|
|
|
|
void createTabList();
|
|
|
|
void fillWindowsMenu();
|
|
|
|
void switchToWindow(QAction *act);
|
|
|
|
|
2009-01-28 20:55:45 +00:00
|
|
|
/// Triggered by the actions in the nav toolbar
|
|
|
|
void backClicked();
|
|
|
|
void forwardClicked();
|
|
|
|
|
|
|
|
/// ArticleView's title has changed
|
|
|
|
void titleChanged( ArticleView *, QString const & );
|
|
|
|
/// ArticleView's icon has changed
|
|
|
|
void iconChanged( ArticleView *, QIcon const & );
|
|
|
|
|
2009-05-14 19:27:19 +00:00
|
|
|
void pageLoaded( ArticleView * );
|
2009-04-10 21:07:03 +00:00
|
|
|
void tabSwitched( int );
|
2010-09-16 18:52:40 +00:00
|
|
|
void tabMenuRequested(QPoint pos);
|
2009-04-10 21:07:03 +00:00
|
|
|
|
2009-09-23 18:44:38 +00:00
|
|
|
void dictionaryBarToggled( bool checked );
|
|
|
|
|
2009-04-10 21:07:03 +00:00
|
|
|
/// Pronounces the currently displayed word by playing its first audio
|
|
|
|
/// reference, if it has any.
|
2009-05-14 19:27:19 +00:00
|
|
|
/// If view is 0, the operation is done for the currently open tab.
|
|
|
|
void pronounce( ArticleView * view = 0 );
|
2009-04-10 21:07:03 +00:00
|
|
|
|
2009-04-30 19:57:25 +00:00
|
|
|
void zoomin();
|
|
|
|
void zoomout();
|
|
|
|
void unzoom();
|
|
|
|
|
2019-01-31 12:45:30 +00:00
|
|
|
void scaleArticlesByCurrentZoomFactor();
|
|
|
|
|
2010-07-02 11:19:02 +00:00
|
|
|
void doWordsZoomIn();
|
|
|
|
void doWordsZoomOut();
|
|
|
|
void doWordsZoomBase();
|
|
|
|
|
|
|
|
void applyWordsZoomLevel();
|
|
|
|
|
2010-05-08 14:01:59 +00:00
|
|
|
/// If editDictionaryGroup is specified, the dialog positions on that group
|
|
|
|
/// initially.
|
|
|
|
void editDictionaries( unsigned editDictionaryGroup = Instances::Group::NoGroupId );
|
|
|
|
/// Edits current group when triggered from the dictionary bar.
|
|
|
|
void editCurrentGroup();
|
2009-02-05 20:55:00 +00:00
|
|
|
void editPreferences();
|
2009-01-28 20:55:45 +00:00
|
|
|
|
2022-02-27 06:26:49 +00:00
|
|
|
void currentGroupChanged( int );
|
2009-01-28 20:55:45 +00:00
|
|
|
void translateInputChanged( QString const & );
|
2021-06-10 16:13:11 +00:00
|
|
|
void translateInputFinished( bool checkModifiers = true );
|
2009-03-26 19:00:08 +00:00
|
|
|
|
2011-05-07 13:42:49 +00:00
|
|
|
/// Closes any opened search in the article view, and focuses the translateLine/close main window to tray.
|
2010-04-27 07:49:37 +00:00
|
|
|
void handleEsc();
|
|
|
|
|
2009-04-12 22:36:47 +00:00
|
|
|
/// Gives the keyboard focus to the translateLine and selects all the text
|
|
|
|
/// it has.
|
|
|
|
void focusTranslateLine();
|
2009-04-08 22:25:46 +00:00
|
|
|
|
2009-01-28 20:55:45 +00:00
|
|
|
void wordListItemActivated( QListWidgetItem * );
|
2009-02-08 14:02:27 +00:00
|
|
|
void wordListSelectionChanged();
|
2009-01-28 20:55:45 +00:00
|
|
|
|
2011-06-05 11:49:50 +00:00
|
|
|
void dictsListItemActivated( QListWidgetItem * );
|
|
|
|
void dictsListSelectionChanged();
|
|
|
|
|
2013-06-28 16:00:13 +00:00
|
|
|
void jumpToDictionary( QListWidgetItem *, bool force = false );
|
|
|
|
|
2011-07-31 00:11:07 +00:00
|
|
|
void showDictsPane( );
|
2011-06-05 11:49:50 +00:00
|
|
|
void dictsPaneVisibilityChanged ( bool );
|
|
|
|
|
2009-04-13 12:51:25 +00:00
|
|
|
/// Creates a new tab, which is to be populated then with some content.
|
|
|
|
ArticleView * createNewTab( bool switchToIt,
|
|
|
|
QString const & name );
|
|
|
|
|
2009-05-29 19:48:50 +00:00
|
|
|
void openLinkInNewTab( QUrl const &, QUrl const &, QString const &,
|
|
|
|
ArticleView::Contexts const & contexts );
|
2009-05-11 19:14:28 +00:00
|
|
|
void showDefinitionInNewTab( QString const & word, unsigned group,
|
2009-05-29 19:48:50 +00:00
|
|
|
QString const & fromArticle,
|
|
|
|
ArticleView::Contexts const & contexts );
|
2009-05-12 13:25:18 +00:00
|
|
|
void typingEvent( QString const & );
|
2009-04-18 18:47:01 +00:00
|
|
|
|
2014-02-09 15:00:48 +00:00
|
|
|
void activeArticleChanged( ArticleView const *, QString const & id );
|
2011-07-03 12:27:08 +00:00
|
|
|
|
2009-09-23 18:44:38 +00:00
|
|
|
void mutedDictionariesChanged();
|
|
|
|
|
2021-06-10 16:13:11 +00:00
|
|
|
void showTranslationFor( Config::InputPhrase const &, unsigned inGroup = 0,
|
2021-06-29 08:59:16 +00:00
|
|
|
QString const & scrollTo = QString() );
|
2021-06-10 16:13:11 +00:00
|
|
|
void showTranslationFor( QString const & );
|
2009-02-05 20:55:00 +00:00
|
|
|
|
2014-04-22 13:47:02 +00:00
|
|
|
void showTranslationFor( QString const &, QStringList const & dictIDs,
|
2018-04-10 14:49:52 +00:00
|
|
|
QRegExp const & searchRegExp, bool ignoreDiacritics );
|
2014-04-16 16:18:28 +00:00
|
|
|
|
2013-01-17 09:08:53 +00:00
|
|
|
void showHistoryItem( QString const & );
|
|
|
|
|
2009-02-05 20:55:00 +00:00
|
|
|
void trayIconActivated( QSystemTrayIcon::ActivationReason );
|
2009-02-08 14:02:27 +00:00
|
|
|
|
2009-02-08 20:20:02 +00:00
|
|
|
void scanEnableToggled( bool );
|
|
|
|
|
2009-04-18 18:47:01 +00:00
|
|
|
void setAutostart( bool );
|
|
|
|
|
2009-02-08 20:20:02 +00:00
|
|
|
void showMainWindow();
|
2009-04-18 18:47:01 +00:00
|
|
|
|
2022-06-24 13:20:16 +00:00
|
|
|
void trackingClipboard(bool);
|
|
|
|
|
2009-02-08 14:02:27 +00:00
|
|
|
void visitHomepage();
|
|
|
|
void visitForum();
|
2011-07-10 07:36:43 +00:00
|
|
|
void openConfigFolder();
|
2009-02-08 14:02:27 +00:00
|
|
|
void showAbout();
|
2009-04-18 18:47:01 +00:00
|
|
|
|
2009-10-12 12:41:20 +00:00
|
|
|
void showDictBarNamesTriggered();
|
2011-05-22 02:42:05 +00:00
|
|
|
void useSmallIconsInToolbarsTriggered();
|
2011-06-26 11:53:28 +00:00
|
|
|
void toggleMenuBarTriggered( bool announce = true );
|
2009-10-12 12:41:20 +00:00
|
|
|
|
2012-12-03 21:57:00 +00:00
|
|
|
void on_clearHistory_triggered();
|
2009-10-21 19:37:07 +00:00
|
|
|
|
2012-12-03 21:57:00 +00:00
|
|
|
void on_newTab_triggered();
|
2011-06-25 07:34:28 +00:00
|
|
|
|
2012-12-03 21:57:00 +00:00
|
|
|
void on_actionCloseToTray_triggered();
|
2010-09-16 18:52:40 +00:00
|
|
|
|
2012-12-03 21:57:00 +00:00
|
|
|
void on_pageSetup_triggered();
|
|
|
|
void on_printPreview_triggered();
|
|
|
|
void on_print_triggered();
|
2009-05-01 12:20:33 +00:00
|
|
|
void printPreviewPaintRequested( QPrinter * );
|
2010-09-16 18:52:40 +00:00
|
|
|
|
2012-12-03 21:57:00 +00:00
|
|
|
void on_saveArticle_triggered();
|
2009-05-08 10:47:34 +00:00
|
|
|
|
2012-12-03 21:57:00 +00:00
|
|
|
void on_rescanFiles_triggered();
|
2012-02-16 14:56:25 +00:00
|
|
|
|
2017-05-05 14:39:51 +00:00
|
|
|
void on_showHideFavorites_triggered();
|
2012-12-03 21:57:00 +00:00
|
|
|
void on_showHideHistory_triggered();
|
|
|
|
void on_exportHistory_triggered();
|
|
|
|
void on_importHistory_triggered();
|
2012-12-29 11:19:49 +00:00
|
|
|
void on_alwaysOnTop_triggered( bool checked );
|
2012-09-12 12:32:29 +00:00
|
|
|
void focusWordList();
|
2012-09-12 14:11:30 +00:00
|
|
|
|
2017-05-05 14:39:51 +00:00
|
|
|
void on_exportFavorites_triggered();
|
|
|
|
void on_importFavorites_triggered();
|
|
|
|
void on_ExportFavoritesToList_triggered();
|
|
|
|
|
2013-01-05 11:26:55 +00:00
|
|
|
void updateSearchPaneAndBar( bool searchInDock );
|
2012-12-24 11:30:03 +00:00
|
|
|
|
2017-05-05 14:39:51 +00:00
|
|
|
void updateFavoritesMenu();
|
2013-01-17 09:08:53 +00:00
|
|
|
void updateHistoryMenu();
|
|
|
|
|
2012-11-12 13:52:54 +00:00
|
|
|
/// Add word to history
|
|
|
|
void addWordToHistory( const QString & word );
|
2012-09-12 14:11:30 +00:00
|
|
|
/// Add word to history even if history is disabled in options
|
|
|
|
void forceAddWordToHistory( const QString & word);
|
2012-09-16 10:19:47 +00:00
|
|
|
|
2017-05-15 15:08:06 +00:00
|
|
|
void addWordToFavorites( QString const & word, unsigned groupId );
|
|
|
|
|
2022-06-01 15:11:41 +00:00
|
|
|
void addBookmarkToFavorite( QString const & text );
|
|
|
|
|
2017-10-23 14:21:43 +00:00
|
|
|
bool isWordPresentedInFavorites( QString const & word, unsigned groupId );
|
|
|
|
|
2012-11-26 13:13:13 +00:00
|
|
|
void sendWordToInputLine( QString const & word );
|
|
|
|
|
2013-02-22 12:44:23 +00:00
|
|
|
void storeResourceSavePath( QString const & );
|
|
|
|
|
2014-03-03 13:46:41 +00:00
|
|
|
void closeHeadwordsDialog();
|
|
|
|
|
2014-03-04 16:58:51 +00:00
|
|
|
void focusHeadwordsDialog();
|
|
|
|
|
2014-05-11 11:52:25 +00:00
|
|
|
void focusArticleView();
|
|
|
|
|
2014-04-03 14:21:02 +00:00
|
|
|
void proxyAuthentication( const QNetworkProxy & proxy, QAuthenticator * authenticator );
|
|
|
|
|
2014-04-16 16:18:28 +00:00
|
|
|
void showFullTextSearchDialog();
|
|
|
|
void closeFullTextSearchDialog();
|
|
|
|
|
2014-06-23 15:11:15 +00:00
|
|
|
void showGDHelp();
|
|
|
|
void hideGDHelp();
|
|
|
|
|
2022-08-02 14:27:14 +00:00
|
|
|
void clipboardChange( QClipboard::Mode mode );
|
|
|
|
|
2012-09-16 10:19:47 +00:00
|
|
|
signals:
|
|
|
|
/// Set optional parts expand mode for all tabs
|
|
|
|
void setExpandOptionalParts( bool expand );
|
2012-09-18 23:01:31 +00:00
|
|
|
|
2012-09-19 12:44:36 +00:00
|
|
|
/// Retranslate Ctrl(Shift) + Click on dictionary pane to dictionary toolbar
|
|
|
|
void clickOnDictPane( QString const & id );
|
|
|
|
|
2017-03-10 13:29:23 +00:00
|
|
|
/// Set group for popup window
|
|
|
|
void setPopupGroupByName( QString const & name );
|
|
|
|
|
2012-09-18 23:01:31 +00:00
|
|
|
#ifdef Q_OS_WIN32
|
|
|
|
/// For receiving message from scan libraries
|
|
|
|
protected:
|
|
|
|
unsigned gdAskMessage;
|
2014-03-17 14:53:47 +00:00
|
|
|
public:
|
2012-09-24 13:20:58 +00:00
|
|
|
|
|
|
|
private slots:
|
|
|
|
/// Return true while scanning GoldenDict window
|
|
|
|
bool isGoldenDictWindow( HWND hwnd );
|
2012-09-18 23:01:31 +00:00
|
|
|
#endif
|
2009-01-28 20:55:45 +00:00
|
|
|
};
|
|
|
|
|
2013-05-27 11:18:13 +00:00
|
|
|
class ArticleSaveProgressDialog : public QProgressDialog
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2022-01-08 13:16:22 +00:00
|
|
|
explicit ArticleSaveProgressDialog( QWidget * parent = 0, Qt::WindowFlags f = Qt::Widget ):
|
2013-05-27 11:18:13 +00:00
|
|
|
QProgressDialog( parent, f )
|
|
|
|
{
|
|
|
|
setAutoReset( false );
|
|
|
|
setAutoClose( false );
|
|
|
|
}
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
void perform()
|
|
|
|
{
|
|
|
|
int progress = value() + 1;
|
|
|
|
if ( progress == maximum() )
|
|
|
|
{
|
|
|
|
emit close();
|
|
|
|
deleteLater();
|
|
|
|
}
|
|
|
|
setValue( progress );
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2009-01-28 20:55:45 +00:00
|
|
|
#endif
|