Improved design of category selection in SelectProductDialog.
This commit is contained in:
@@ -39,14 +39,17 @@ SelectProductDialog::SelectProductDialog( QWidget *parent )
|
||||
pageSizeUsCheck->setChecked( Settings::searchUsPaperSizes() );
|
||||
pageSizeOtherCheck->setChecked( Settings::searchOtherPaperSizes() );
|
||||
|
||||
anyCategoryCheck->setChecked( Settings::searchAllCategories() );
|
||||
allCategoriesRadio->setChecked( Settings::searchAllCategories() );
|
||||
selectedCategoriesRadio->setChecked( !Settings::searchAllCategories() );
|
||||
|
||||
categoriesCheckContainer->setEnabled( !Settings::searchAllCategories() );
|
||||
mCategoryIdList = Settings::searchCategoryList();
|
||||
|
||||
QList<glabels::Category*> categories = glabels::Db::categories();
|
||||
foreach ( glabels::Category *category, categories )
|
||||
{
|
||||
QCheckBox* check = new QCheckBox( category->name() );
|
||||
check->setChecked( mCategoryIdList.contains( category->id() ) || anyCategoryCheck->isChecked() );
|
||||
check->setChecked( mCategoryIdList.contains( category->id() ) );
|
||||
categoriesLayout->addWidget( check );
|
||||
|
||||
mCheckToCategoryMap[check] = category->id();
|
||||
@@ -61,7 +64,7 @@ SelectProductDialog::SelectProductDialog( QWidget *parent )
|
||||
pageSizeIsoCheck->isChecked(),
|
||||
pageSizeUsCheck->isChecked(),
|
||||
pageSizeOtherCheck->isChecked(),
|
||||
anyCategoryCheck->isChecked(),
|
||||
allCategoriesRadio->isChecked(),
|
||||
mCategoryIdList );
|
||||
}
|
||||
|
||||
@@ -90,7 +93,7 @@ void SelectProductDialog::onSearchEntryTextChanged()
|
||||
pageSizeIsoCheck->isChecked(),
|
||||
pageSizeUsCheck->isChecked(),
|
||||
pageSizeOtherCheck->isChecked(),
|
||||
anyCategoryCheck->isChecked(),
|
||||
allCategoriesRadio->isChecked(),
|
||||
mCategoryIdList );
|
||||
}
|
||||
|
||||
@@ -117,32 +120,27 @@ void SelectProductDialog::onPageSizeCheckClicked()
|
||||
pageSizeIsoCheck->isChecked(),
|
||||
pageSizeUsCheck->isChecked(),
|
||||
pageSizeOtherCheck->isChecked(),
|
||||
anyCategoryCheck->isChecked(),
|
||||
allCategoriesRadio->isChecked(),
|
||||
mCategoryIdList );
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Any category Check Clicked Slot
|
||||
/// Category Radio Clicked Slot
|
||||
///
|
||||
void SelectProductDialog::onAnyCategoryCheckClicked()
|
||||
void SelectProductDialog::onCategoryRadioClicked()
|
||||
{
|
||||
if ( anyCategoryCheck->isChecked() )
|
||||
{
|
||||
foreach( QCheckBox* check, mCheckToCategoryMap.keys() )
|
||||
{
|
||||
check->setChecked( true );
|
||||
}
|
||||
}
|
||||
|
||||
categoriesCheckContainer->setEnabled( selectedCategoriesRadio->isChecked() );
|
||||
loadCategoryList();
|
||||
|
||||
templatePicker->applyFilter( searchEntry->text(),
|
||||
pageSizeIsoCheck->isChecked(),
|
||||
pageSizeUsCheck->isChecked(),
|
||||
pageSizeOtherCheck->isChecked(),
|
||||
anyCategoryCheck->isChecked(),
|
||||
allCategoriesRadio->isChecked(),
|
||||
mCategoryIdList );
|
||||
|
||||
Settings::setSearchAllCategories( allCategoriesRadio->isChecked() );
|
||||
}
|
||||
|
||||
|
||||
@@ -151,21 +149,17 @@ void SelectProductDialog::onAnyCategoryCheckClicked()
|
||||
///
|
||||
void SelectProductDialog::onCategoryCheckClicked()
|
||||
{
|
||||
bool allFlag = true;
|
||||
foreach( QCheckBox* check, mCheckToCategoryMap.keys() )
|
||||
{
|
||||
allFlag = allFlag && check->isChecked();
|
||||
}
|
||||
anyCategoryCheck->setChecked( allFlag );
|
||||
|
||||
loadCategoryList();
|
||||
|
||||
templatePicker->applyFilter( searchEntry->text(),
|
||||
pageSizeIsoCheck->isChecked(),
|
||||
pageSizeUsCheck->isChecked(),
|
||||
pageSizeOtherCheck->isChecked(),
|
||||
anyCategoryCheck->isChecked(),
|
||||
allCategoriesRadio->isChecked(),
|
||||
mCategoryIdList );
|
||||
|
||||
|
||||
Settings::setSearchCategoryList( mCategoryIdList );
|
||||
}
|
||||
|
||||
|
||||
@@ -213,7 +207,4 @@ void SelectProductDialog::loadCategoryList()
|
||||
mCategoryIdList.append( mCheckToCategoryMap[check] );
|
||||
}
|
||||
}
|
||||
|
||||
Settings::setSearchAllCategories( anyCategoryCheck->isChecked() );
|
||||
Settings::setSearchCategoryList( mCategoryIdList );
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ private slots:
|
||||
void onSearchEntryTextChanged();
|
||||
void onSearchClearButtonClicked();
|
||||
void onPageSizeCheckClicked();
|
||||
void onAnyCategoryCheckClicked();
|
||||
void onCategoryRadioClicked();
|
||||
void onCategoryCheckClicked();
|
||||
void onTemplatePickerSelectionChanged();
|
||||
void onCancelButtonClicked();
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>967</width>
|
||||
<height>660</height>
|
||||
<width>987</width>
|
||||
<height>661</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -34,6 +34,12 @@
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>180</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>Search</string>
|
||||
</property>
|
||||
@@ -94,6 +100,9 @@
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<property name="spacing">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="pageSizeIsoCheck">
|
||||
<property name="text">
|
||||
@@ -123,27 +132,49 @@
|
||||
<property name="title">
|
||||
<string>Filter by category</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="0" rowspan="2">
|
||||
<layout class="QVBoxLayout" name="categoriesLayout">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="anyCategoryCheck">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<property name="spacing">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="allCategoriesRadio">
|
||||
<property name="text">
|
||||
<string>All categories</string>
|
||||
<string>All</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="selectedCategoriesRadio">
|
||||
<property name="text">
|
||||
<string>Selected</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="categoriesCheckContainer" native="true">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<layout class="QVBoxLayout" name="categoriesLayout">
|
||||
<property name="spacing">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>20</number>
|
||||
</property>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
@@ -320,18 +351,34 @@
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>anyCategoryCheck</sender>
|
||||
<sender>allCategoriesRadio</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>SelectProductDialog</receiver>
|
||||
<slot>onAnyCategoryCheckClicked()</slot>
|
||||
<slot>onCategoryRadioClicked()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>31</x>
|
||||
<y>234</y>
|
||||
<x>36</x>
|
||||
<y>226</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>-7</x>
|
||||
<y>240</y>
|
||||
<x>-5</x>
|
||||
<y>223</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>selectedCategoriesRadio</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>SelectProductDialog</receiver>
|
||||
<slot>onCategoryRadioClicked()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>32</x>
|
||||
<y>246</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>1</x>
|
||||
<y>252</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
@@ -344,6 +391,6 @@
|
||||
<slot>onCancelButtonClicked()</slot>
|
||||
<slot>onSelectButtonClicked()</slot>
|
||||
<slot>onPageSizeCheckClicked()</slot>
|
||||
<slot>onAnyCategoryCheckClicked()</slot>
|
||||
<slot>onCategoryRadioClicked()</slot>
|
||||
</slots>
|
||||
</ui>
|
||||
|
||||
Reference in New Issue
Block a user