Skip to content

Commit

Permalink
Merge pull request #78 from xiaoyifang/staged
Browse files Browse the repository at this point in the history
routine merge.
  • Loading branch information
xiaoyifang authored May 26, 2022
2 parents 49fab23 + 96347be commit 83684c2
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 501 deletions.
6 changes: 2 additions & 4 deletions about.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@ About::About( QWidget * parent ): QDialog( parent )
ui.version->setText( version );

#if defined (_MSC_VER)
QString compilerVersion = QString( "Visual C++ %1.%2.%3" )
.arg( GD_CXX_MSVC_MAJOR )
.arg( GD_CXX_MSVC_MINOR )
.arg( GD_CXX_MSVC_BUILD );
QString compilerVersion = QString( "Visual C++ Compiler: %1" )
.arg( _MSC_FULL_VER );
#elif defined (__clang__) && defined (__clang_version__)
QString compilerVersion = QLatin1String( "Clang " ) + QLatin1String( __clang_version__ );
#else
Expand Down
14 changes: 0 additions & 14 deletions about.hh
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,6 @@
#include "ui_about.h"
#include <QDialog>

// Microsoft Visual C++ version
#if defined (_MSC_VER)
// how many digits does the build number have?
# if _MSC_FULL_VER / 10000 == _MSC_VER
# define GD_CXX_MSVC_BUILD (_MSC_FULL_VER % 10000) // four digits
# elif _MSC_FULL_VER / 100000 == _MSC_VER
# define GD_CXX_MSVC_BUILD (_MSC_FULL_VER % 100000) // five digits
# else
# define GD_CXX_MSVC_BUILD 0
# endif
# define GD_CXX_MSVC_MAJOR (_MSC_VER/100-6)
# define GD_CXX_MSVC_MINOR (_MSC_VER%100)
#endif

class About: public QDialog
{
Q_OBJECT
Expand Down
9 changes: 0 additions & 9 deletions article-style.css
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,6 @@ div.xdxf
left: 0px;
width: 0px;
background-color: white;
background-color: Window;
border-style: solid;
border-color: #AAAAAA;
border-width: 1px;
Expand All @@ -934,22 +933,14 @@ div.xdxf
.mwiki td.os-suggest-result, .mwiki td.os-suggest-result-hl {
white-space: nowrap;
background-color: white;
background-color: Window;
color: black;
color: WindowText;
padding: 2px;
}
.mwiki td.os-suggest-result-hl,
.mwiki td.os-suggest-result-hl-webkit {
background-color: #4C59A6;
color: white;
}
.mwiki td.os-suggest-result-hl {
/* System colors are misimplemented in Safari 3.0 and earlier,
making highlighted text illegible... */
background-color: Highlight;
color: HighlightText;
}

.mwiki .os-suggest-toggle {
position: relative;
Expand Down
11 changes: 7 additions & 4 deletions articleview.cc
Original file line number Diff line number Diff line change
Expand Up @@ -325,13 +325,15 @@ ArticleView::ArticleView( QWidget * parent, ArticleNetworkAccessManager & nm, Au
settings->defaultSettings()->setAttribute( QWebEngineSettings::PluginsEnabled, cfg.preferences.enableWebPlugins );
settings->defaultSettings()->setAttribute( QWebEngineSettings::PlaybackRequiresUserGesture, false );
settings->defaultSettings()->setAttribute( QWebEngineSettings::JavascriptCanAccessClipboard, true );
settings->defaultSettings()->setAttribute( QWebEngineSettings::PrintElementBackgrounds, false );
#else
settings->setAttribute( QWebEngineSettings::LocalContentCanAccessRemoteUrls, true );
settings->setAttribute( QWebEngineSettings::LocalContentCanAccessFileUrls, true );
settings->setAttribute( QWebEngineSettings::ErrorPageEnabled, false );
settings->setAttribute( QWebEngineSettings::PluginsEnabled, cfg.preferences.enableWebPlugins );
settings->setAttribute( QWebEngineSettings::PlaybackRequiresUserGesture, false );
settings->setAttribute( QWebEngineSettings::JavascriptCanAccessClipboard, true );
settings->setAttribute( QWebEngineSettings::PrintElementBackgrounds, false );
#endif

expandOptionalParts = cfg.preferences.alwaysExpandOptionalParts;
Expand Down Expand Up @@ -650,25 +652,26 @@ void ArticleView::jumpToDictionary( QString const & id, bool force )
}
}

void ArticleView::setCurrentArticle( QString const & id, bool moveToIt )
bool ArticleView::setCurrentArticle( QString const & id, bool moveToIt )
{
if ( !isScrollTo( id ) )
return; // Incorrect id
return false; // Incorrect id

if ( !ui.definition->isVisible() )
return; // No action on background page, scrollIntoView there don't work
return false; // No action on background page, scrollIntoView there don't work

if(moveToIt){
QString dictId = id.mid( 7 );
if( dictId.isEmpty() )
return;
return false;
QString script = QString( "var elem=document.getElementById('%1'); "
"if(elem!=undefined){elem.scrollIntoView(true);} gdMakeArticleActive('%2',true);" )
.arg( id, dictId );
onJsActiveArticleChanged( id );
ui.definition->page()->runJavaScript( script );
setActiveArticleId( dictId );
}
return true;
}

void ArticleView::selectCurrentArticle()
Expand Down
3 changes: 2 additions & 1 deletion articleview.hh
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,8 @@ private:

/// Sets the current article by executing a javascript code.
/// If moveToIt is true, it moves the focus to it as well.
void setCurrentArticle( QString const &, bool moveToIt = false );
/// Returns true in case of success, false otherwise.
bool setCurrentArticle( QString const &, bool moveToIt = false );

/// Checks if the given article in form of "gdfrom-xxx" is inside a "website"
/// frame.
Expand Down
2 changes: 1 addition & 1 deletion epwing.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ namespace {
enum
{
Signature = 0x58575045, // EPWX on little-endian, XWPE on big-endian
CurrentFormatVersion = 5 + BtreeIndexing::FormatVersion + Folding::Version
CurrentFormatVersion = 6 + BtreeIndexing::FormatVersion + Folding::Version
};

struct IdxHeader
Expand Down
7 changes: 2 additions & 5 deletions goldendict.pro
Original file line number Diff line number Diff line change
Expand Up @@ -481,14 +481,11 @@ SOURCES += folding.cc \

win32 {
FORMS += texttospeechsource.ui
SOURCES += wordbyauto.cc \
guids.c \
SOURCES += guids.c \
speechclient_win.cc \
texttospeechsource.cc \
speechhlp.cc
HEADERS += wordbyauto.hh \
uiauto.hh \
texttospeechsource.hh \
HEADERS += texttospeechsource.hh \
sapi.hh \
sphelper.hh \
speechclient.hh \
Expand Down
21 changes: 12 additions & 9 deletions mainwindow.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2813,10 +2813,6 @@ void MainWindow::showTranslationFor( Config::InputPhrase const & phrase,

view->showDefinition( phrase, group, scrollTo );

updatePronounceAvailability();
updateFoundInDictsList();

updateBackForwardButtons();

//ui.tabWidget->setTabText( ui.tabWidget->indexOf(ui.tab), inWord.trimmed() );
}
Expand All @@ -2838,11 +2834,6 @@ void MainWindow::showTranslationFor( QString const & inWord,
view->showDefinition( inWord, dictIDs, searchRegExp,
groupInstances[ groupList->currentIndex() ].id,
ignoreDiacritics );

updatePronounceAvailability();
updateFoundInDictsList();

updateBackForwardButtons();
}

#ifdef HAVE_X11
Expand Down Expand Up @@ -2989,7 +2980,19 @@ void MainWindow::hotKeyActivated( int hk )
toggleMainWindow();
else
if ( scanPopup.get() )
{
#ifdef HAVE_X11
// When the user requests translation with the Ctrl+C+C hotkey in certain apps
// on some GNU/Linux systems, GoldenDict appears to handle Ctrl+C+C before the
// active application finishes handling Ctrl+C. As a result, GoldenDict finds
// the clipboard empty, silently cancels the translation request, and users report
// that Ctrl+C+C is broken in these apps. Slightly delay handling the clipboard
// hotkey to give the active application more time and thus work around the issue.
QTimer::singleShot( 10, scanPopup.get(), SLOT( translateWordFromClipboard() ) );
#else
scanPopup->translateWordFromClipboard();
#endif
}
}

void MainWindow::prepareNewReleaseChecks()
Expand Down
Loading

0 comments on commit 83684c2

Please sign in to comment.