Add buttons 'select all', 'select none' and 'invert selection' buttons to the rip cd dialog.

This commit is contained in:
Mattias Andersson 2014-01-26 19:12:05 +01:00
parent 96e6252fca
commit 27b1bf7014
3 changed files with 79 additions and 1 deletions

View File

@ -87,6 +87,10 @@ RipCD::RipCD(QWidget* parent) :
cancel_button_->hide();
ui_->progress_group->hide();
connect(ui_->select_all_button, SIGNAL(clicked()), SLOT(SelectAll()));
connect(ui_->select_none_button, SIGNAL(clicked()), SLOT(SelectNone()));
connect(ui_->invert_selection_button, SIGNAL(clicked()),
SLOT(InvertSelection()));
connect(rip_button_, SIGNAL(clicked()), SLOT(ClickedRipButton()));
connect(cancel_button_, SIGNAL(clicked()), SLOT(Cancel()));
connect(close_button_, SIGNAL(clicked()), SLOT(hide()));
@ -407,3 +411,25 @@ void RipCD::SetWorking(bool working) {
close_button_->setVisible(!working);
ui_->progress_group->setVisible(true);
}
void RipCD::SelectAll() {
foreach (QCheckBox* checkbox, checkboxes_) {
checkbox->setCheckState(Qt::Checked);
}
}
void RipCD::SelectNone() {
foreach (QCheckBox* checkbox, checkboxes_) {
checkbox->setCheckState(Qt::Unchecked);
}
}
void RipCD::InvertSelection() {
foreach (QCheckBox* checkbox, checkboxes_) {
if (checkbox->isChecked()) {
checkbox->setCheckState(Qt::Unchecked);
} else {
checkbox->setCheckState(Qt::Checked);
}
}
}

View File

@ -80,6 +80,9 @@ class RipCD: public QDialog {
void Options();
void AddDestination();
void Cancel();
void SelectAll();
void SelectNone();
void InvertSelection();
};
#endif // SRC_UI_RIPCD_H_

View File

@ -40,7 +40,7 @@
<property name="geometry">
<rect>
<x>10</x>
<y>197</y>
<y>210</y>
<width>571</width>
<height>101</height>
</rect>
@ -267,9 +267,58 @@
</property>
</widget>
</widget>
<widget class="QWidget" name="horizontalLayoutWidget">
<property name="geometry">
<rect>
<x>10</x>
<y>180</y>
<width>571</width>
<height>31</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="select_all_button">
<property name="text">
<string>Select All</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="select_none_button">
<property name="text">
<string>Select None</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="invert_selection_button">
<property name="text">
<string>Invert Selection</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
<tabstops>
<tabstop>tableWidget</tabstop>
<tabstop>select_all_button</tabstop>
<tabstop>select_none_button</tabstop>
<tabstop>invert_selection_button</tabstop>
<tabstop>albumLineEdit</tabstop>
<tabstop>artistLineEdit</tabstop>
<tabstop>genreLineEdit</tabstop>