mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 23:34:06 +00:00
Add maxDictionaryRefsInContextMenu to config file to allow to change number of dictionaries in the context menu (Right-click on the definitions frame). Default to 20.
This commit is contained in:
parent
d9450efd57
commit
207b780304
|
@ -971,7 +971,7 @@ void ArticleView::contextMenuRequested( QPoint const & pos )
|
||||||
for( QStringList::const_iterator i = ids.constBegin(); i != ids.constEnd();
|
for( QStringList::const_iterator i = ids.constBegin(); i != ids.constEnd();
|
||||||
++i, ++refsAdded )
|
++i, ++refsAdded )
|
||||||
{
|
{
|
||||||
if ( refsAdded == 20 )
|
if ( refsAdded == cfg.maxDictionaryRefsInContextMenu )
|
||||||
{
|
{
|
||||||
// Enough! Or the menu would become too large.
|
// Enough! Or the menu would become too large.
|
||||||
menu.addAction( new QAction( ".........", &menu ) );
|
menu.addAction( new QAction( ".........", &menu ) );
|
||||||
|
|
|
@ -666,6 +666,9 @@ Class load() throw( exError )
|
||||||
|
|
||||||
c.usingSmallIconsInToolbars = ( root.namedItem( "usingSmallIconsInToolbars" ).toElement().text() == "1" );
|
c.usingSmallIconsInToolbars = ( root.namedItem( "usingSmallIconsInToolbars" ).toElement().text() == "1" );
|
||||||
|
|
||||||
|
if ( !root.namedItem( "maxDictionaryRefsInContextMenu" ).isNull() )
|
||||||
|
c.maxDictionaryRefsInContextMenu = root.namedItem( "maxDictionaryRefsInContextMenu" ).toElement().text().toUShort();
|
||||||
|
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1196,6 +1199,10 @@ void save( Class const & c ) throw( exError )
|
||||||
opt = dd.createElement( "usingSmallIconsInToolbars" );
|
opt = dd.createElement( "usingSmallIconsInToolbars" );
|
||||||
opt.appendChild( dd.createTextNode( c.usingSmallIconsInToolbars ? "1" : "0" ) );
|
opt.appendChild( dd.createTextNode( c.usingSmallIconsInToolbars ? "1" : "0" ) );
|
||||||
root.appendChild( opt );
|
root.appendChild( opt );
|
||||||
|
|
||||||
|
opt = dd.createElement( "maxDictionaryRefsInContextMenu" );
|
||||||
|
opt.appendChild( dd.createTextNode( QString::number( c.maxDictionaryRefsInContextMenu ) ) );
|
||||||
|
root.appendChild( opt );
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray result( dd.toByteArray() );
|
QByteArray result( dd.toByteArray() );
|
||||||
|
|
|
@ -377,8 +377,11 @@ struct Class
|
||||||
|
|
||||||
bool usingSmallIconsInToolbars;
|
bool usingSmallIconsInToolbars;
|
||||||
|
|
||||||
|
unsigned short maxDictionaryRefsInContextMenu;
|
||||||
|
|
||||||
Class(): lastMainGroupId( 0 ), lastPopupGroupId( 0 ),
|
Class(): lastMainGroupId( 0 ), lastPopupGroupId( 0 ),
|
||||||
pinPopupWindow( false ), showingDictBarNames( false ), usingSmallIconsInToolbars( false )
|
pinPopupWindow( false ), showingDictBarNames( false ),
|
||||||
|
usingSmallIconsInToolbars( false ), maxDictionaryRefsInContextMenu( 20 )
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue