mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 19:24:08 +00:00
added "remove all groups" button to Groups dialog
This commit is contained in:
parent
67b34fd3e0
commit
8a7367ebfc
|
@ -29,6 +29,8 @@ Groups::Groups( QWidget * parent,
|
||||||
this, SLOT( renameCurrent() ) );
|
this, SLOT( renameCurrent() ) );
|
||||||
connect( ui.removeGroup, SIGNAL( clicked() ),
|
connect( ui.removeGroup, SIGNAL( clicked() ),
|
||||||
this, SLOT( removeCurrent() ) );
|
this, SLOT( removeCurrent() ) );
|
||||||
|
connect( ui.removeAllGroups, SIGNAL( clicked() ),
|
||||||
|
this, SLOT( removeAll() ) );
|
||||||
|
|
||||||
countChanged();
|
countChanged();
|
||||||
}
|
}
|
||||||
|
@ -44,6 +46,7 @@ void Groups::countChanged()
|
||||||
|
|
||||||
ui.renameGroup->setEnabled( en );
|
ui.renameGroup->setEnabled( en );
|
||||||
ui.removeGroup->setEnabled( en );
|
ui.removeGroup->setEnabled( en );
|
||||||
|
ui.removeAllGroups->setEnabled( en );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Groups::addNew()
|
void Groups::addNew()
|
||||||
|
@ -90,3 +93,17 @@ void Groups::removeCurrent()
|
||||||
countChanged();
|
countChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Groups::removeAll()
|
||||||
|
{
|
||||||
|
int current = ui.groups->currentIndex();
|
||||||
|
|
||||||
|
if ( current >= 0 && QMessageBox::question( this, tr( "Remove all groups" ),
|
||||||
|
tr( "Are you sure you want to remove all the groups?" ),
|
||||||
|
QMessageBox::Yes, QMessageBox::Cancel ) == QMessageBox::Yes )
|
||||||
|
{
|
||||||
|
ui.groups->removeAllGroups();
|
||||||
|
countChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,10 +30,10 @@ private:
|
||||||
void countChanged();
|
void countChanged();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
void addNew();
|
void addNew();
|
||||||
void renameCurrent();
|
void renameCurrent();
|
||||||
void removeCurrent();
|
void removeCurrent();
|
||||||
|
void removeAll();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>Groups</class>
|
<class>Groups</class>
|
||||||
<widget class="QDialog" name="Groups">
|
<widget class="QDialog" name="Groups">
|
||||||
|
@ -60,6 +61,9 @@
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="addGroup">
|
<widget class="QPushButton" name="addGroup">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Create new dictionary group</string>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Add group</string>
|
<string>&Add group</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -67,6 +71,9 @@
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="renameGroup">
|
<widget class="QPushButton" name="renameGroup">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Rename current dictionary group</string>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Re&name group</string>
|
<string>Re&name group</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -74,11 +81,24 @@
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="removeGroup">
|
<widget class="QPushButton" name="removeGroup">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Remove current dictionary group</string>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Remove group</string>
|
<string>&Remove group</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="removeAllGroups">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Remove all dictionary groups</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Remove all groups</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
|
|
@ -330,3 +330,14 @@ void DictGroupsWidget::removeCurrentGroup()
|
||||||
delete w;
|
delete w;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void DictGroupsWidget::removeAllGroups()
|
||||||
|
{
|
||||||
|
while ( count() )
|
||||||
|
{
|
||||||
|
QWidget * w = widget( 0 );
|
||||||
|
removeTab( 0 );
|
||||||
|
delete w;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -120,6 +120,9 @@ public:
|
||||||
/// Removes the currently chosen group, if any
|
/// Removes the currently chosen group, if any
|
||||||
void removeCurrentGroup();
|
void removeCurrentGroup();
|
||||||
|
|
||||||
|
/// Removes all the groups
|
||||||
|
void removeAllGroups();
|
||||||
|
|
||||||
/// Creates groups from what is currently set up
|
/// Creates groups from what is currently set up
|
||||||
Config::Groups makeGroups() const;
|
Config::Groups makeGroups() const;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue