mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-24 16:54:08 +00:00
Merge branch 'staged' into dev
This commit is contained in:
commit
0e7b49b006
|
@ -1,29 +1,65 @@
|
||||||
# Format Style Options - Created with Clang Power Tools
|
# Format Style Options - Created with Clang Power Tools
|
||||||
---
|
---
|
||||||
AlignAfterOpenBracket: Align
|
AccessModifierOffset: -1
|
||||||
AlignConsecutiveAssignments: AcrossComments
|
AlignAfterOpenBracket: DontAlign
|
||||||
|
AlignConsecutiveAssignments: Consecutive
|
||||||
AlignEscapedNewlines: Left
|
AlignEscapedNewlines: Left
|
||||||
AlignOperands: Align
|
AlignOperands: DontAlign
|
||||||
|
AlignTrailingComments: false
|
||||||
AllowAllArgumentsOnNextLine: false
|
AllowAllArgumentsOnNextLine: false
|
||||||
AllowShortBlocksOnASingleLine: false
|
AllowShortBlocksOnASingleLine: Empty
|
||||||
AllowShortFunctionsOnASingleLine: None
|
AllowShortLambdasOnASingleLine: None
|
||||||
AllowShortIfStatementsOnASingleLine: Never
|
AllowShortEnumsOnASingleLine: false
|
||||||
|
AlwaysBreakBeforeMultilineStrings: true
|
||||||
BasedOnStyle: LLVM
|
BasedOnStyle: LLVM
|
||||||
BinPackArguments: false
|
BinPackArguments: false
|
||||||
BinPackParameters: false
|
BinPackParameters: false
|
||||||
|
BraceWrapping:
|
||||||
|
AfterCaseLabel: false
|
||||||
|
AfterClass: true
|
||||||
|
AfterControlStatement: true
|
||||||
|
AfterEnum: false
|
||||||
|
AfterFunction: true
|
||||||
|
AfterNamespace: false
|
||||||
|
AfterObjCDeclaration: false
|
||||||
|
AfterStruct: true
|
||||||
|
AfterUnion: true
|
||||||
|
AfterExternBlock: false
|
||||||
|
BeforeCatch: false
|
||||||
|
BeforeElse: true
|
||||||
|
IndentBraces: false
|
||||||
|
SplitEmptyFunction: true
|
||||||
|
SplitEmptyRecord: false
|
||||||
|
SplitEmptyNamespace: false
|
||||||
|
BeforeLambdaBody: false
|
||||||
|
BeforeWhile: false
|
||||||
BreakBeforeBinaryOperators: NonAssignment
|
BreakBeforeBinaryOperators: NonAssignment
|
||||||
BreakBeforeBraces: Allman
|
BreakBeforeBraces: Custom
|
||||||
|
BreakBeforeTernaryOperators: false
|
||||||
BreakConstructorInitializers: AfterColon
|
BreakConstructorInitializers: AfterColon
|
||||||
|
BreakStringLiterals: false
|
||||||
ColumnLimit: 120
|
ColumnLimit: 120
|
||||||
ConstructorInitializerAllOnOneLineOrOnePerLine: true
|
ConstructorInitializerAllOnOneLineOrOnePerLine: true
|
||||||
ConstructorInitializerIndentWidth : 2
|
|
||||||
ContinuationIndentWidth: 2
|
ContinuationIndentWidth: 2
|
||||||
MaxEmptyLinesToKeep: 1
|
DeriveLineEnding: false
|
||||||
|
EmptyLineBeforeAccessModifier: Leave
|
||||||
|
ExperimentalAutoDetectBinPacking: true
|
||||||
|
FixNamespaceComments: false
|
||||||
|
IncludeBlocks: Regroup
|
||||||
|
IndentCaseLabels: true
|
||||||
|
IndentPPDirectives: BeforeHash
|
||||||
|
MaxEmptyLinesToKeep: 2
|
||||||
|
NamespaceIndentation: Inner
|
||||||
PointerAlignment: Middle
|
PointerAlignment: Middle
|
||||||
|
ReflowComments: false
|
||||||
SortIncludes: false
|
SortIncludes: false
|
||||||
SortUsingDeclarations: false
|
SortUsingDeclarations: false
|
||||||
|
SpaceAfterCStyleCast: true
|
||||||
|
SpaceBeforeCtorInitializerColon: false
|
||||||
|
SpaceBeforeInheritanceColon: false
|
||||||
SpaceBeforeParens: Never
|
SpaceBeforeParens: Never
|
||||||
SpacesInAngles: true
|
SpacesInAngles: true
|
||||||
|
SpacesInConditionalStatement: true
|
||||||
SpacesInParentheses: true
|
SpacesInParentheses: true
|
||||||
SpacesInSquareBrackets: true
|
SpacesInSquareBrackets: true
|
||||||
UseTab: Never
|
UseTab: Never
|
||||||
|
|
|
@ -429,9 +429,10 @@ ArticleRequest::ArticleRequest(
|
||||||
data.resize( header.size() );
|
data.resize( header.size() );
|
||||||
memcpy( &data.front(), header.data(), header.size() );
|
memcpy( &data.front(), header.data(), header.size() );
|
||||||
|
|
||||||
// Accumulate main forms
|
//clear founded dicts.
|
||||||
emit GlobalBroadcaster::instance()->dictionaryClear( ActiveDictIds{word} );
|
emit GlobalBroadcaster::instance()->dictionaryClear( ActiveDictIds{word} );
|
||||||
|
|
||||||
|
// Accumulate main forms
|
||||||
for( unsigned x = 0; x < activeDicts.size(); ++x )
|
for( unsigned x = 0; x < activeDicts.size(); ++x )
|
||||||
{
|
{
|
||||||
sptr< Dictionary::WordSearchRequest > s = activeDicts[ x ]->findHeadwordsForSynonym( gd::toWString( word ) );
|
sptr< Dictionary::WordSearchRequest > s = activeDicts[ x ]->findHeadwordsForSynonym( gd::toWString( word ) );
|
||||||
|
|
|
@ -401,6 +401,9 @@ void ArticleView::showDefinition( Config::InputPhrase const & phrase, unsigned g
|
||||||
Contexts const & contexts_ )
|
Contexts const & contexts_ )
|
||||||
{
|
{
|
||||||
currentWord = phrase.phrase.trimmed();
|
currentWord = phrase.phrase.trimmed();
|
||||||
|
if( currentWord.isEmpty() )
|
||||||
|
return;
|
||||||
|
historyMode = false;
|
||||||
currentActiveDictIds.clear();
|
currentActiveDictIds.clear();
|
||||||
// first, let's stop the player
|
// first, let's stop the player
|
||||||
audioPlayer->stop();
|
audioPlayer->stop();
|
||||||
|
@ -484,6 +487,9 @@ void ArticleView::showDefinition( QString const & word, QStringList const & dict
|
||||||
if( dictIDs.isEmpty() )
|
if( dictIDs.isEmpty() )
|
||||||
return;
|
return;
|
||||||
currentWord = word.trimmed();
|
currentWord = word.trimmed();
|
||||||
|
if( currentWord.isEmpty() )
|
||||||
|
return;
|
||||||
|
historyMode = false;
|
||||||
// first, let's stop the player
|
// first, let's stop the player
|
||||||
audioPlayer->stop();
|
audioPlayer->stop();
|
||||||
|
|
||||||
|
@ -1623,6 +1629,8 @@ void ArticleView::back()
|
||||||
if ( canGoBack() )
|
if ( canGoBack() )
|
||||||
{
|
{
|
||||||
saveHistoryUserData();
|
saveHistoryUserData();
|
||||||
|
currentActiveDictIds.clear();
|
||||||
|
historyMode = true;
|
||||||
ui.definition->back();
|
ui.definition->back();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1630,6 +1638,8 @@ void ArticleView::back()
|
||||||
void ArticleView::forward()
|
void ArticleView::forward()
|
||||||
{
|
{
|
||||||
saveHistoryUserData();
|
saveHistoryUserData();
|
||||||
|
currentActiveDictIds.clear();
|
||||||
|
historyMode = true;
|
||||||
ui.definition->forward();
|
ui.definition->forward();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2078,7 +2088,7 @@ void ArticleView::resourceDownloadFinished()
|
||||||
{
|
{
|
||||||
if ( (*i)->isFinished() )
|
if ( (*i)->isFinished() )
|
||||||
{
|
{
|
||||||
if ( (*i)->dataSize() > 0 )
|
if ( (*i)->dataSize() >= 0 )
|
||||||
{
|
{
|
||||||
// Ok, got one finished, all others are irrelevant now
|
// Ok, got one finished, all others are irrelevant now
|
||||||
|
|
||||||
|
@ -2619,7 +2629,7 @@ void ArticleView::highlightAllFtsOccurences( QWebEnginePage::FindFlags flags )
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArticleView::setActiveDictIds(ActiveDictIds ad) {
|
void ArticleView::setActiveDictIds(ActiveDictIds ad) {
|
||||||
if (ad.word == currentWord) {
|
if (ad.word == currentWord || historyMode) {
|
||||||
// ignore all other signals.
|
// ignore all other signals.
|
||||||
qDebug() << "receive dicts, current word:" << currentWord << ad.word << ":" << ad.dictIds;
|
qDebug() << "receive dicts, current word:" << currentWord << ad.word << ":" << ad.dictIds;
|
||||||
currentActiveDictIds << ad.dictIds;
|
currentActiveDictIds << ad.dictIds;
|
||||||
|
@ -2712,10 +2722,6 @@ void ArticleView::performFtsFindOperation( bool backwards )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ui.ftsSearchStatusLabel->setText( searchStatusMessage( ftsPosition + 1, allMatches.size() ) );
|
ui.ftsSearchStatusLabel->setText( searchStatusMessage( ftsPosition + 1, allMatches.size() ) );
|
||||||
// Store new highlighted selection
|
|
||||||
// ui.definition->page()->
|
|
||||||
// runJavaScript( QString( "%1=window.getSelection().getRangeAt(0);_=0;" )
|
|
||||||
// .arg( rangeVarName ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArticleView::on_ftsSearchPrevious_clicked()
|
void ArticleView::on_ftsSearchPrevious_clicked()
|
||||||
|
@ -2759,7 +2765,7 @@ void ResourceToSaveHandler::downloadFinished()
|
||||||
{
|
{
|
||||||
if ( (*i)->isFinished() )
|
if ( (*i)->isFinished() )
|
||||||
{
|
{
|
||||||
if ( (*i)->dataSize() > 0 && !alreadyDone )
|
if ( (*i)->dataSize() >= 0 && !alreadyDone )
|
||||||
{
|
{
|
||||||
QByteArray resourceData;
|
QByteArray resourceData;
|
||||||
vector< char > const & data = (*i)->getFullData();
|
vector< char > const & data = (*i)->getFullData();
|
||||||
|
|
|
@ -70,6 +70,8 @@ class ArticleView: public QFrame
|
||||||
/// current active dict id list;
|
/// current active dict id list;
|
||||||
QStringList currentActiveDictIds;
|
QStringList currentActiveDictIds;
|
||||||
|
|
||||||
|
bool historyMode=false;
|
||||||
|
|
||||||
//current active dictionary id;
|
//current active dictionary id;
|
||||||
QString activeDictId;
|
QString activeDictId;
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,7 @@ DictionaryBar::DictionaryBar( QWidget * parent,
|
||||||
mutedDictionaries( 0 ),
|
mutedDictionaries( 0 ),
|
||||||
configEvents( events ),
|
configEvents( events ),
|
||||||
editDictionaryCommand( _editDictionaryCommand ),
|
editDictionaryCommand( _editDictionaryCommand ),
|
||||||
maxDictionaryRefsInContextMenu(maxDictionaryRefsInContextMenu_),
|
maxDictionaryRefsInContextMenu(maxDictionaryRefsInContextMenu_)
|
||||||
timerId( 0 )
|
|
||||||
{
|
{
|
||||||
setObjectName( "dictionaryBar" );
|
setObjectName( "dictionaryBar" );
|
||||||
|
|
||||||
|
@ -28,8 +27,6 @@ DictionaryBar::DictionaryBar( QWidget * parent,
|
||||||
|
|
||||||
connect( this, SIGNAL(actionTriggered(QAction*)),
|
connect( this, SIGNAL(actionTriggered(QAction*)),
|
||||||
this, SLOT(actionWasTriggered(QAction*)) );
|
this, SLOT(actionWasTriggered(QAction*)) );
|
||||||
|
|
||||||
installEventFilter( this );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static QString elideDictName( QString const & name )
|
static QString elideDictName( QString const & name )
|
||||||
|
@ -352,42 +349,3 @@ void DictionaryBar::dictsPaneClicked( const QString & id )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DictionaryBar::eventFilter( QObject * obj, QEvent * ev )
|
|
||||||
{
|
|
||||||
if(obj == this && !isFloating() )
|
|
||||||
{
|
|
||||||
QPoint pt = parentWidget()->mapFromGlobal( QCursor::pos() );
|
|
||||||
switch( ev->type() )
|
|
||||||
{
|
|
||||||
case QEvent::Leave : if( geometry().contains( pt ) )
|
|
||||||
{
|
|
||||||
if( timerId )
|
|
||||||
killTimer( timerId );
|
|
||||||
timerId = startTimer( 500 );
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case QEvent::Enter : if( timerId != 0)
|
|
||||||
{
|
|
||||||
killTimer( timerId );
|
|
||||||
timerId = 0;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case QEvent::Timer: if( static_cast< QTimerEvent * >( ev )->timerId() == timerId )
|
|
||||||
{
|
|
||||||
if( !geometry().contains( pt ) )
|
|
||||||
{
|
|
||||||
killTimer( timerId );
|
|
||||||
timerId = 0;
|
|
||||||
QEvent event( QEvent::Leave );
|
|
||||||
QApplication::sendEvent( this, &event );
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default: break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
|
@ -61,10 +61,6 @@ private:
|
||||||
QList< QAction * > dictActions;
|
QList< QAction * > dictActions;
|
||||||
QAction * maxDictionaryRefsAction;
|
QAction * maxDictionaryRefsAction;
|
||||||
|
|
||||||
int timerId;
|
|
||||||
|
|
||||||
virtual bool eventFilter( QObject *, QEvent * );
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
void contextMenuEvent( QContextMenuEvent * event );
|
void contextMenuEvent( QContextMenuEvent * event );
|
||||||
|
|
|
@ -226,8 +226,7 @@ mac {
|
||||||
LIBS += -L/opt/homebrew/lib -L/usr/local/lib -framework AppKit -framework Carbon
|
LIBS += -L/opt/homebrew/lib -L/usr/local/lib -framework AppKit -framework Carbon
|
||||||
}
|
}
|
||||||
|
|
||||||
OBJECTIVE_SOURCES += lionsupport.mm \
|
OBJECTIVE_SOURCES += machotkeywrapper.mm \
|
||||||
machotkeywrapper.mm \
|
|
||||||
macmouseover.mm \
|
macmouseover.mm \
|
||||||
speechclient_mac.mm
|
speechclient_mac.mm
|
||||||
ICON = icons/macicon.icns
|
ICON = icons/macicon.icns
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
#ifndef LIONSUPPORT_H
|
|
||||||
#define LIONSUPPORT_H
|
|
||||||
|
|
||||||
#include "mainwindow.hh"
|
|
||||||
|
|
||||||
class LionSupport
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
* Returns whether the current system is Lion.
|
|
||||||
*/
|
|
||||||
static bool isLion();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds fullscreen button to window for Lion.
|
|
||||||
*/
|
|
||||||
static void addFullscreen(MainWindow *window);
|
|
||||||
|
|
||||||
//Check for retina display
|
|
||||||
static bool isRetinaDisplay();
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // LIONSUPPORT_H
|
|
|
@ -1,34 +0,0 @@
|
||||||
#include <AppKit/NSWindow.h>
|
|
||||||
#include <AppKit/NSScreen.h>
|
|
||||||
#include "lionsupport.h"
|
|
||||||
|
|
||||||
bool LionSupport::isLion()
|
|
||||||
{
|
|
||||||
NSString *string = [NSString string];
|
|
||||||
// this selector was added only in Lion. so we can check if it's responding, we are on Lion
|
|
||||||
return [string respondsToSelector:@selector(linguisticTagsInRange:scheme:options:orthography:tokenRanges:)];
|
|
||||||
}
|
|
||||||
|
|
||||||
void LionSupport::addFullscreen(MainWindow *window)
|
|
||||||
{
|
|
||||||
#if defined(MAC_OS_X_VERSION_10_7) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
|
|
||||||
if (isLion()) // checks if lion is running
|
|
||||||
{
|
|
||||||
NSView *nsview = (NSView *) window->winId();
|
|
||||||
NSWindow *nswindow = [nsview window];
|
|
||||||
[nswindow setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
#warning No fullscreen support will be included in this build
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
bool LionSupport::isRetinaDisplay()
|
|
||||||
{
|
|
||||||
#if defined(MAC_OS_X_VERSION_10_7) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
|
|
||||||
return( [ [ NSScreen mainScreen ] respondsToSelector:@selector( backingScaleFactor ) ]
|
|
||||||
&& [ [ NSScreen mainScreen ] backingScaleFactor ] > 1.5 );
|
|
||||||
#else
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
}
|
|
|
@ -50,7 +50,6 @@
|
||||||
#include "resourceschemehandler.h"
|
#include "resourceschemehandler.h"
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
#include "lionsupport.h"
|
|
||||||
#include "macmouseover.hh"
|
#include "macmouseover.hh"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -907,10 +906,6 @@ MainWindow::MainWindow( Config::Class & cfg_ ):
|
||||||
|
|
||||||
history.setSaveInterval( cfg.preferences.historyStoreInterval );
|
history.setSaveInterval( cfg.preferences.historyStoreInterval );
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
|
||||||
LionSupport::addFullscreen(this);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ui.centralWidget->grabGesture( Gestures::GDPinchGestureType );
|
ui.centralWidget->grabGesture( Gestures::GDPinchGestureType );
|
||||||
ui.centralWidget->grabGesture( Gestures::GDSwipeGestureType );
|
ui.centralWidget->grabGesture( Gestures::GDSwipeGestureType );
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue