mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 19:24:08 +00:00
fix mergeconflict when merge upstream
This commit is contained in:
commit
949ad6de57
|
@ -435,8 +435,7 @@ void ArticleView::showDefinition( Config::InputPhrase const & phrase, unsigned g
|
||||||
if ( mutedDicts.size() )
|
if ( mutedDicts.size() )
|
||||||
Utils::Url::addQueryItem( req, "muted", mutedDicts );
|
Utils::Url::addQueryItem( req, "muted", mutedDicts );
|
||||||
|
|
||||||
// Update both histories (pages history and headwords history)
|
// Update headwords history
|
||||||
saveHistoryUserData();
|
|
||||||
emit sendWordToHistory( phrase.phrase );
|
emit sendWordToHistory( phrase.phrase );
|
||||||
|
|
||||||
// Any search opened is probably irrelevant now
|
// Any search opened is probably irrelevant now
|
||||||
|
@ -447,7 +446,7 @@ void ArticleView::showDefinition( Config::InputPhrase const & phrase, unsigned g
|
||||||
|
|
||||||
emit setExpandMode( expandOptionalParts );
|
emit setExpandMode( expandOptionalParts );
|
||||||
|
|
||||||
ui.definition->load( req );
|
load( req );
|
||||||
|
|
||||||
//QApplication::setOverrideCursor( Qt::WaitCursor );
|
//QApplication::setOverrideCursor( Qt::WaitCursor );
|
||||||
ui.definition->setCursor( Qt::WaitCursor );
|
ui.definition->setCursor( Qt::WaitCursor );
|
||||||
|
@ -485,8 +484,7 @@ void ArticleView::showDefinition( QString const & word, QStringList const & dict
|
||||||
if( ignoreDiacritics )
|
if( ignoreDiacritics )
|
||||||
Utils::Url::addQueryItem( req, "ignore_diacritics", "1" );
|
Utils::Url::addQueryItem( req, "ignore_diacritics", "1" );
|
||||||
|
|
||||||
// Update both histories (pages history and headwords history)
|
// Update headwords history
|
||||||
saveHistoryUserData();
|
|
||||||
emit sendWordToHistory( word );
|
emit sendWordToHistory( word );
|
||||||
|
|
||||||
// Any search opened is probably irrelevant now
|
// Any search opened is probably irrelevant now
|
||||||
|
@ -497,7 +495,7 @@ void ArticleView::showDefinition( QString const & word, QStringList const & dict
|
||||||
|
|
||||||
emit setExpandMode( expandOptionalParts );
|
emit setExpandMode( expandOptionalParts );
|
||||||
|
|
||||||
ui.definition->load( req );
|
load( req );
|
||||||
|
|
||||||
ui.definition->setCursor( Qt::WaitCursor );
|
ui.definition->setCursor( Qt::WaitCursor );
|
||||||
}
|
}
|
||||||
|
@ -728,6 +726,12 @@ void ArticleView::saveHistoryUserData()
|
||||||
ui.definition->setProperty("sy", ui.definition->page()->scrollPosition().y());
|
ui.definition->setProperty("sy", ui.definition->page()->scrollPosition().y());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ArticleView::load( QUrl const & url )
|
||||||
|
{
|
||||||
|
saveHistoryUserData();
|
||||||
|
ui.definition->load( url );
|
||||||
|
}
|
||||||
|
|
||||||
void ArticleView::cleanupTemp()
|
void ArticleView::cleanupTemp()
|
||||||
{
|
{
|
||||||
QSet< QString >::iterator it = desktopOpenedTempFiles.begin();
|
QSet< QString >::iterator it = desktopOpenedTempFiles.begin();
|
||||||
|
@ -1123,7 +1127,7 @@ void ArticleView::openLink( QUrl const & url, QUrl const & ref,
|
||||||
Contexts contexts( contexts_ );
|
Contexts contexts( contexts_ );
|
||||||
|
|
||||||
if( url.scheme().compare( "gdpicture" ) == 0 )
|
if( url.scheme().compare( "gdpicture" ) == 0 )
|
||||||
ui.definition->load( url );
|
load( url );
|
||||||
else
|
else
|
||||||
if ( url.scheme().compare( "bword" ) == 0 || url.scheme().compare( "entry" ) == 0 )
|
if ( url.scheme().compare( "bword" ) == 0 || url.scheme().compare( "entry" ) == 0 )
|
||||||
{
|
{
|
||||||
|
@ -1571,9 +1575,7 @@ void ArticleView::updateMutedContents()
|
||||||
if ( mutedDicts.size() )
|
if ( mutedDicts.size() )
|
||||||
Utils::Url::addQueryItem( currentUrl, "muted", mutedDicts );
|
Utils::Url::addQueryItem( currentUrl, "muted", mutedDicts );
|
||||||
|
|
||||||
saveHistoryUserData();
|
load( currentUrl );
|
||||||
|
|
||||||
ui.definition->load( currentUrl );
|
|
||||||
|
|
||||||
//QApplication::setOverrideCursor( Qt::WaitCursor );
|
//QApplication::setOverrideCursor( Qt::WaitCursor );
|
||||||
ui.definition->setCursor( Qt::WaitCursor );
|
ui.definition->setCursor( Qt::WaitCursor );
|
||||||
|
@ -1619,6 +1621,25 @@ void ArticleView::forward()
|
||||||
ui.definition->forward();
|
ui.definition->forward();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ArticleView::reload()
|
||||||
|
{
|
||||||
|
QMap< QString, QVariant > userData = ui.definition->history()->currentItem().userData().toMap();
|
||||||
|
|
||||||
|
// Save current article, which can be empty
|
||||||
|
userData[ "currentArticle" ] = getCurrentArticle();
|
||||||
|
|
||||||
|
// Remove saved window position. Reloading occurs in response to changes that
|
||||||
|
// may affect content height, so restoring the current window position can cause
|
||||||
|
// uncontrolled jumps. Scrolling to the current article (i.e. jumping to the top
|
||||||
|
// of it) is simple, reliable and predictable, if not ideal.
|
||||||
|
userData[ "sx" ].clear();
|
||||||
|
userData[ "sy" ].clear();
|
||||||
|
|
||||||
|
ui.definition->history()->currentItem().setUserData( userData );
|
||||||
|
|
||||||
|
ui.definition->reload();
|
||||||
|
}
|
||||||
|
|
||||||
void ArticleView::hasSound( const std::function< void( bool ) > & callback )
|
void ArticleView::hasSound( const std::function< void( bool ) > & callback )
|
||||||
{
|
{
|
||||||
ui.definition->page()->runJavaScript( "gdAudioLinks.first",
|
ui.definition->page()->runJavaScript( "gdAudioLinks.first",
|
||||||
|
@ -2458,25 +2479,12 @@ void ArticleView::showEvent( QShowEvent * ev )
|
||||||
void ArticleView::receiveExpandOptionalParts( bool expand )
|
void ArticleView::receiveExpandOptionalParts( bool expand )
|
||||||
{
|
{
|
||||||
if( expandOptionalParts != expand )
|
if( expandOptionalParts != expand )
|
||||||
{
|
switchExpandOptionalParts();
|
||||||
int n = getArticlesList().indexOf( getActiveArticleId() );
|
|
||||||
if( n > 0 )
|
|
||||||
articleToJump = getCurrentArticle();
|
|
||||||
|
|
||||||
emit setExpandMode( expand );
|
|
||||||
expandOptionalParts = expand;
|
|
||||||
reload();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArticleView::switchExpandOptionalParts()
|
void ArticleView::switchExpandOptionalParts()
|
||||||
{
|
{
|
||||||
expandOptionalParts = !expandOptionalParts;
|
expandOptionalParts = !expandOptionalParts;
|
||||||
|
|
||||||
int n = getArticlesList().indexOf( getActiveArticleId() );
|
|
||||||
if( n > 0 )
|
|
||||||
articleToJump = getCurrentArticle();
|
|
||||||
|
|
||||||
emit setExpandMode( expandOptionalParts );
|
emit setExpandMode( expandOptionalParts );
|
||||||
reload();
|
reload();
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,6 @@ class ArticleView: public QFrame
|
||||||
QAction & openSearchAction;
|
QAction & openSearchAction;
|
||||||
bool searchIsOpened;
|
bool searchIsOpened;
|
||||||
bool expandOptionalParts;
|
bool expandOptionalParts;
|
||||||
QString articleToJump;
|
|
||||||
QString rangeVarName;
|
QString rangeVarName;
|
||||||
|
|
||||||
/// Any resource we've decided to download off the dictionary gets stored here.
|
/// Any resource we've decided to download off the dictionary gets stored here.
|
||||||
|
@ -176,8 +175,7 @@ public slots:
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/// Reloads the view
|
/// Reloads the view
|
||||||
void reload()
|
void reload();
|
||||||
{ ui.definition->reload(); }
|
|
||||||
|
|
||||||
/// Returns true if there's an audio reference on the page, false otherwise.
|
/// Returns true if there's an audio reference on the page, false otherwise.
|
||||||
void hasSound( const std::function< void( bool has ) > & callback );
|
void hasSound( const std::function< void( bool has ) > & callback );
|
||||||
|
@ -394,6 +392,9 @@ private:
|
||||||
/// Should be used when leaving the page.
|
/// Should be used when leaving the page.
|
||||||
void saveHistoryUserData();
|
void saveHistoryUserData();
|
||||||
|
|
||||||
|
/// Loads a page at @p url into view.
|
||||||
|
void load( QUrl const & url );
|
||||||
|
|
||||||
/// Attempts removing last temporary file created.
|
/// Attempts removing last temporary file created.
|
||||||
void cleanupTemp();
|
void cleanupTemp();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue