mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-24 00:14:06 +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
|
||||||
|
|
336
src/groups.ui
336
src/groups.ui
|
@ -1,158 +1,178 @@
|
||||||
<ui version="4.0" >
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<class>Groups</class>
|
<ui version="4.0">
|
||||||
<widget class="QDialog" name="Groups" >
|
<class>Groups</class>
|
||||||
<property name="windowModality" >
|
<widget class="QDialog" name="Groups">
|
||||||
<enum>Qt::WindowModal</enum>
|
<property name="windowModality">
|
||||||
</property>
|
<enum>Qt::WindowModal</enum>
|
||||||
<property name="geometry" >
|
</property>
|
||||||
<rect>
|
<property name="geometry">
|
||||||
<x>0</x>
|
<rect>
|
||||||
<y>0</y>
|
<x>0</x>
|
||||||
<width>726</width>
|
<y>0</y>
|
||||||
<height>535</height>
|
<width>726</width>
|
||||||
</rect>
|
<height>535</height>
|
||||||
</property>
|
</rect>
|
||||||
<property name="windowTitle" >
|
</property>
|
||||||
<string>Groups</string>
|
<property name="windowTitle">
|
||||||
</property>
|
<string>Groups</string>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2" >
|
</property>
|
||||||
<item>
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2" >
|
<item>
|
||||||
<item>
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3" >
|
<item>
|
||||||
<item>
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
<widget class="QLabel" name="label_2" >
|
<item>
|
||||||
<property name="text" >
|
<widget class="QLabel" name="label_2">
|
||||||
<string>Dictionaries available:</string>
|
<property name="text">
|
||||||
</property>
|
<string>Dictionaries available:</string>
|
||||||
</widget>
|
</property>
|
||||||
</item>
|
</widget>
|
||||||
<item>
|
</item>
|
||||||
<widget class="DictListWidget" name="dictionaries" />
|
<item>
|
||||||
</item>
|
<widget class="DictListWidget" name="dictionaries"/>
|
||||||
</layout>
|
</item>
|
||||||
</item>
|
</layout>
|
||||||
<item>
|
</item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout" >
|
<item>
|
||||||
<item>
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<widget class="QLabel" name="label_3" >
|
<item>
|
||||||
<property name="text" >
|
<widget class="QLabel" name="label_3">
|
||||||
<string>Groups:</string>
|
<property name="text">
|
||||||
</property>
|
<string>Groups:</string>
|
||||||
</widget>
|
</property>
|
||||||
</item>
|
</widget>
|
||||||
<item>
|
</item>
|
||||||
<widget class="DictGroupsWidget" name="groups" >
|
<item>
|
||||||
<property name="tabPosition" >
|
<widget class="DictGroupsWidget" name="groups">
|
||||||
<enum>QTabWidget::North</enum>
|
<property name="tabPosition">
|
||||||
</property>
|
<enum>QTabWidget::North</enum>
|
||||||
<property name="elideMode" >
|
</property>
|
||||||
<enum>Qt::ElideRight</enum>
|
<property name="elideMode">
|
||||||
</property>
|
<enum>Qt::ElideRight</enum>
|
||||||
<widget class="QWidget" name="tab_4" >
|
</property>
|
||||||
<attribute name="title" >
|
<widget class="QWidget" name="tab_4">
|
||||||
<string>Tab 2</string>
|
<attribute name="title">
|
||||||
</attribute>
|
<string>Tab 2</string>
|
||||||
</widget>
|
</attribute>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</widget>
|
||||||
<item>
|
</item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout" >
|
<item>
|
||||||
<item>
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<widget class="QPushButton" name="addGroup" >
|
<item>
|
||||||
<property name="text" >
|
<widget class="QPushButton" name="addGroup">
|
||||||
<string>&Add group</string>
|
<property name="toolTip">
|
||||||
</property>
|
<string>Create new dictionary group</string>
|
||||||
</widget>
|
</property>
|
||||||
</item>
|
<property name="text">
|
||||||
<item>
|
<string>&Add group</string>
|
||||||
<widget class="QPushButton" name="renameGroup" >
|
</property>
|
||||||
<property name="text" >
|
</widget>
|
||||||
<string>Re&name group</string>
|
</item>
|
||||||
</property>
|
<item>
|
||||||
</widget>
|
<widget class="QPushButton" name="renameGroup">
|
||||||
</item>
|
<property name="toolTip">
|
||||||
<item>
|
<string>Rename current dictionary group</string>
|
||||||
<widget class="QPushButton" name="removeGroup" >
|
</property>
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>&Remove group</string>
|
<string>Re&name group</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
<item>
|
||||||
</item>
|
<widget class="QPushButton" name="removeGroup">
|
||||||
</layout>
|
<property name="toolTip">
|
||||||
</item>
|
<string>Remove current dictionary group</string>
|
||||||
</layout>
|
</property>
|
||||||
</item>
|
<property name="text">
|
||||||
<item>
|
<string>&Remove group</string>
|
||||||
<widget class="QLabel" name="label_4" >
|
</property>
|
||||||
<property name="text" >
|
</widget>
|
||||||
<string>Drag&drop dictionaries to and from the groups, move them inside the groups, reorder the groups using your mouse.</string>
|
</item>
|
||||||
</property>
|
<item>
|
||||||
<property name="wordWrap" >
|
<widget class="QPushButton" name="removeAllGroups">
|
||||||
<bool>true</bool>
|
<property name="toolTip">
|
||||||
</property>
|
<string>Remove all dictionary groups</string>
|
||||||
</widget>
|
</property>
|
||||||
</item>
|
<property name="text">
|
||||||
<item>
|
<string>Remove all groups</string>
|
||||||
<widget class="QDialogButtonBox" name="buttons" >
|
</property>
|
||||||
<property name="orientation" >
|
</widget>
|
||||||
<enum>Qt::Horizontal</enum>
|
</item>
|
||||||
</property>
|
</layout>
|
||||||
<property name="standardButtons" >
|
</item>
|
||||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
</layout>
|
||||||
</property>
|
</item>
|
||||||
</widget>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
<item>
|
||||||
</widget>
|
<widget class="QLabel" name="label_4">
|
||||||
<customwidgets>
|
<property name="text">
|
||||||
<customwidget>
|
<string>Drag&drop dictionaries to and from the groups, move them inside the groups, reorder the groups using your mouse.</string>
|
||||||
<class>DictListWidget</class>
|
</property>
|
||||||
<extends>QListWidget</extends>
|
<property name="wordWrap">
|
||||||
<header>groups_widgets.hh</header>
|
<bool>true</bool>
|
||||||
</customwidget>
|
</property>
|
||||||
<customwidget>
|
</widget>
|
||||||
<class>DictGroupsWidget</class>
|
</item>
|
||||||
<extends>QTabWidget</extends>
|
<item>
|
||||||
<header>groups_widgets.hh</header>
|
<widget class="QDialogButtonBox" name="buttons">
|
||||||
<container>1</container>
|
<property name="orientation">
|
||||||
</customwidget>
|
<enum>Qt::Horizontal</enum>
|
||||||
</customwidgets>
|
</property>
|
||||||
<resources/>
|
<property name="standardButtons">
|
||||||
<connections>
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||||
<connection>
|
</property>
|
||||||
<sender>buttons</sender>
|
</widget>
|
||||||
<signal>accepted()</signal>
|
</item>
|
||||||
<receiver>Groups</receiver>
|
</layout>
|
||||||
<slot>accept()</slot>
|
</widget>
|
||||||
<hints>
|
<customwidgets>
|
||||||
<hint type="sourcelabel" >
|
<customwidget>
|
||||||
<x>248</x>
|
<class>DictListWidget</class>
|
||||||
<y>254</y>
|
<extends>QListWidget</extends>
|
||||||
</hint>
|
<header>groups_widgets.hh</header>
|
||||||
<hint type="destinationlabel" >
|
</customwidget>
|
||||||
<x>157</x>
|
<customwidget>
|
||||||
<y>274</y>
|
<class>DictGroupsWidget</class>
|
||||||
</hint>
|
<extends>QTabWidget</extends>
|
||||||
</hints>
|
<header>groups_widgets.hh</header>
|
||||||
</connection>
|
<container>1</container>
|
||||||
<connection>
|
</customwidget>
|
||||||
<sender>buttons</sender>
|
</customwidgets>
|
||||||
<signal>rejected()</signal>
|
<resources/>
|
||||||
<receiver>Groups</receiver>
|
<connections>
|
||||||
<slot>reject()</slot>
|
<connection>
|
||||||
<hints>
|
<sender>buttons</sender>
|
||||||
<hint type="sourcelabel" >
|
<signal>accepted()</signal>
|
||||||
<x>316</x>
|
<receiver>Groups</receiver>
|
||||||
<y>260</y>
|
<slot>accept()</slot>
|
||||||
</hint>
|
<hints>
|
||||||
<hint type="destinationlabel" >
|
<hint type="sourcelabel">
|
||||||
<x>286</x>
|
<x>248</x>
|
||||||
<y>274</y>
|
<y>254</y>
|
||||||
</hint>
|
</hint>
|
||||||
</hints>
|
<hint type="destinationlabel">
|
||||||
</connection>
|
<x>157</x>
|
||||||
</connections>
|
<y>274</y>
|
||||||
</ui>
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>buttons</sender>
|
||||||
|
<signal>rejected()</signal>
|
||||||
|
<receiver>Groups</receiver>
|
||||||
|
<slot>reject()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>316</x>
|
||||||
|
<y>260</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>286</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
|
</ui>
|
||||||
|
|
|
@ -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