mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 19:24:08 +00:00
1
This commit is contained in:
parent
5ef4190b75
commit
5954a5ce2a
|
@ -648,6 +648,7 @@ int DictGroupsWidget::addNewGroup( QString const & name )
|
||||||
Config::Group newGroup;
|
Config::Group newGroup;
|
||||||
|
|
||||||
newGroup.id = nextId++;
|
newGroup.id = nextId++;
|
||||||
|
newGroup.name = name;
|
||||||
|
|
||||||
const auto gr = new DictGroupWidget( this, *allDicts, newGroup );
|
const auto gr = new DictGroupWidget( this, *allDicts, newGroup );
|
||||||
const int idx = insertTab( currentIndex() + 1, gr, Utils::escapeAmps( name ) );
|
const int idx = insertTab( currentIndex() + 1, gr, Utils::escapeAmps( name ) );
|
||||||
|
@ -909,15 +910,13 @@ void DictGroupsWidget::groupsByMetadata()
|
||||||
addGroupBasedOnMap( groupToDicts );
|
addGroupBasedOnMap( groupToDicts );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QString DictGroupsWidget::getCurrentGroupName() const
|
QString DictGroupsWidget::getCurrentGroupName() const
|
||||||
{
|
{
|
||||||
const int current = currentIndex();
|
const int current = currentIndex();
|
||||||
|
|
||||||
if ( current >= 0 ) {
|
if ( current >= 0 ) {
|
||||||
auto w = dynamic_cast< DictGroupWidget & >( *widget( current ) );
|
auto * w = dynamic_cast< DictGroupWidget * >( widget( current ) );
|
||||||
|
return w->name();
|
||||||
return w.name();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
|
@ -928,7 +927,7 @@ void DictGroupsWidget::renameCurrentGroup( QString const & name )
|
||||||
const int current = currentIndex();
|
const int current = currentIndex();
|
||||||
|
|
||||||
if ( current >= 0 ) {
|
if ( current >= 0 ) {
|
||||||
auto w = dynamic_cast< DictGroupWidget & >( *widget( current ) );
|
auto * w = dynamic_cast< DictGroupWidget * >( widget( current ) );
|
||||||
w->setName( name );
|
w->setName( name );
|
||||||
setTabText( current, Utils::escapeAmps( name ) );
|
setTabText( current, Utils::escapeAmps( name ) );
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,9 +121,6 @@ class DictGroupWidget: public QWidget
|
||||||
public:
|
public:
|
||||||
DictGroupWidget( QWidget * parent, std::vector< sptr< Dictionary::Class > > const &, Config::Group const & );
|
DictGroupWidget( QWidget * parent, std::vector< sptr< Dictionary::Class > > const &, Config::Group const & );
|
||||||
|
|
||||||
/// Makes the group's configuration out of the data currently held.
|
|
||||||
/// Since the group's name is not part of the widget by design right now
|
|
||||||
/// (it is known by the containing tab widget only), it is returned as empty.
|
|
||||||
Config::Group makeGroup() const;
|
Config::Group makeGroup() const;
|
||||||
|
|
||||||
DictListModel * getModel() const
|
DictListModel * getModel() const
|
||||||
|
|
Loading…
Reference in a new issue