Tweaking of new label dialog.
This commit is contained in:
+50
-42
@@ -32,41 +32,29 @@ namespace glabels
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
NewLabelDialog::NewLabelDialog( QWidget *parent = 0 )
|
||||
NewLabelDialog::NewLabelDialog( QWidget *parent )
|
||||
: QDialog(parent), mCanceled(false)
|
||||
{
|
||||
setupUi( this );
|
||||
|
||||
// TODO: Set default based on locale and/or saved preferences
|
||||
// Perhaps move to checkboxes
|
||||
pageSizeIsoRadio->setChecked( true );
|
||||
pageSizeIsoCheck->setChecked( false );
|
||||
pageSizeUsCheck->setChecked( true );
|
||||
pageSizeOtherCheck->setChecked( true );
|
||||
|
||||
QList<libglabels::Template*> tmplates = libglabels::Db::templates();
|
||||
templatePicker->setTemplates( tmplates );
|
||||
|
||||
templatePicker->applyFilter( searchEntry->text(),
|
||||
pageSizeIsoRadio->isChecked(),
|
||||
pageSizeUsRadio->isChecked(),
|
||||
pageSizeOtherRadio->isChecked() );
|
||||
pageSizeIsoCheck->isChecked(),
|
||||
pageSizeUsCheck->isChecked(),
|
||||
pageSizeOtherCheck->isChecked() );
|
||||
|
||||
similarBrowser->setAttribute(Qt::WA_TranslucentBackground);
|
||||
similarBrowser->viewport()->setAutoFillBackground(false);
|
||||
|
||||
selectionStackedWidget->setCurrentIndex( 0 );
|
||||
|
||||
connect( searchEntry, SIGNAL(textChanged(const QString &)),
|
||||
this, SLOT(searchEntryTextChanged(const QString &)) );
|
||||
|
||||
connect( pageSizeIsoRadio, SIGNAL(toggled(bool)), this, SLOT(pageSizeRadioToggled(bool)) );
|
||||
connect( pageSizeUsRadio, SIGNAL(toggled(bool)), this, SLOT(pageSizeRadioToggled(bool)) );
|
||||
connect( pageSizeOtherRadio, SIGNAL(toggled(bool)), this, SLOT(pageSizeRadioToggled(bool)) );
|
||||
|
||||
connect( templatePicker, SIGNAL(itemSelectionChanged()), this, SLOT(templatePickerSelectionChanged()) );
|
||||
|
||||
connect( orientationNormalRadio, SIGNAL(toggled(bool)), this, SLOT(orientationRadioToggled(bool)) );
|
||||
connect( orientationRotatedRadio, SIGNAL(toggled(bool)), this, SLOT(orientationRadioToggled(bool)) );
|
||||
|
||||
connect( cancelButton, SIGNAL(clicked()), this, SLOT(close()) );
|
||||
connect( createButton, SIGNAL(clicked()), this, SLOT(createButtonClicked()) );
|
||||
}
|
||||
|
||||
///
|
||||
@@ -74,7 +62,14 @@ namespace glabels
|
||||
///
|
||||
const libglabels::Template* NewLabelDialog::tmplate() const
|
||||
{
|
||||
return templatePicker->selectedTemplate();
|
||||
if ( !mCanceled )
|
||||
{
|
||||
return templatePicker->selectedTemplate();
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -90,34 +85,40 @@ namespace glabels
|
||||
///
|
||||
/// Search Entry Text Changed Slot
|
||||
///
|
||||
void NewLabelDialog::searchEntryTextChanged( const QString &text )
|
||||
void NewLabelDialog::onSearchEntryTextChanged()
|
||||
{
|
||||
templatePicker->applyFilter( text,
|
||||
pageSizeIsoRadio->isChecked(),
|
||||
pageSizeUsRadio->isChecked(),
|
||||
pageSizeOtherRadio->isChecked() );
|
||||
templatePicker->applyFilter( searchEntry->text(),
|
||||
pageSizeIsoCheck->isChecked(),
|
||||
pageSizeUsCheck->isChecked(),
|
||||
pageSizeOtherCheck->isChecked() );
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Search Entry Text Changed Slot
|
||||
///
|
||||
void NewLabelDialog::onSearchClearButtonClicked()
|
||||
{
|
||||
searchEntry->setText( "" );
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Page Size Radio Toggled Slot
|
||||
/// Page Size Check Toggled Slot
|
||||
///
|
||||
void NewLabelDialog::pageSizeRadioToggled( bool checked )
|
||||
void NewLabelDialog::onPageSizeCheckToggled()
|
||||
{
|
||||
if ( checked )
|
||||
{
|
||||
templatePicker->applyFilter( searchEntry->text(),
|
||||
pageSizeIsoRadio->isChecked(),
|
||||
pageSizeUsRadio->isChecked(),
|
||||
pageSizeOtherRadio->isChecked() );
|
||||
}
|
||||
templatePicker->applyFilter( searchEntry->text(),
|
||||
pageSizeIsoCheck->isChecked(),
|
||||
pageSizeUsCheck->isChecked(),
|
||||
pageSizeOtherCheck->isChecked() );
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Template Picker Selection Changed Slot
|
||||
///
|
||||
void NewLabelDialog::templatePickerSelectionChanged()
|
||||
void NewLabelDialog::onTemplatePickerSelectionChanged()
|
||||
{
|
||||
orientationNormalRadio->setChecked( true );
|
||||
|
||||
@@ -197,21 +198,28 @@ namespace glabels
|
||||
///
|
||||
/// Orientation Radio Button Toggled Slot
|
||||
///
|
||||
void NewLabelDialog::orientationRadioToggled( bool checked )
|
||||
void NewLabelDialog::onOrientationRadioToggled()
|
||||
{
|
||||
if ( checked )
|
||||
{
|
||||
simplePreview->setRotate( orientationRotatedRadio->isChecked() );
|
||||
}
|
||||
simplePreview->setRotate( orientationRotatedRadio->isChecked() );
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Create Button Clicked Slot
|
||||
///
|
||||
void NewLabelDialog::createButtonClicked()
|
||||
void NewLabelDialog::onCreateButtonClicked()
|
||||
{
|
||||
close();
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Cancel Button Clicked Slot
|
||||
///
|
||||
void NewLabelDialog::onCancelButtonClicked()
|
||||
{
|
||||
mCanceled = true;
|
||||
close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace glabels
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
public:
|
||||
NewLabelDialog( QWidget *parent );
|
||||
NewLabelDialog( QWidget *parent = 0 );
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
@@ -53,11 +53,20 @@ namespace glabels
|
||||
// Slots
|
||||
/////////////////////////////////
|
||||
private slots:
|
||||
void searchEntryTextChanged( const QString &text );
|
||||
void pageSizeRadioToggled( bool checked );
|
||||
void templatePickerSelectionChanged();
|
||||
void orientationRadioToggled( bool checked );
|
||||
void createButtonClicked();
|
||||
void onSearchEntryTextChanged();
|
||||
void onSearchClearButtonClicked();
|
||||
void onPageSizeCheckToggled();
|
||||
void onTemplatePickerSelectionChanged();
|
||||
void onOrientationRadioToggled();
|
||||
void onCreateButtonClicked();
|
||||
void onCancelButtonClicked();
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Private data
|
||||
/////////////////////////////////
|
||||
private:
|
||||
bool mCanceled;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -64,13 +64,14 @@ namespace glabels
|
||||
{
|
||||
TemplatePickerItem *tItem = dynamic_cast<TemplatePickerItem *>(item);
|
||||
|
||||
if ( tItem->tmplate()->name().contains( searchString, Qt::CaseInsensitive ) &&
|
||||
(isoMask == tItem->tmplate()->isSizeIso()) &&
|
||||
(usMask == tItem->tmplate()->isSizeUs()) &&
|
||||
(otherMask == tItem->tmplate()->isSizeOther()) )
|
||||
bool sizeMask =
|
||||
(isoMask && tItem->tmplate()->isSizeIso()) ||
|
||||
(usMask && tItem->tmplate()->isSizeUs()) ||
|
||||
(otherMask && tItem->tmplate()->isSizeOther());
|
||||
|
||||
if ( tItem->tmplate()->name().contains( searchString, Qt::CaseInsensitive ) && sizeMask )
|
||||
{
|
||||
item->setHidden( false );
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
<RCC version="1.0">
|
||||
<qresource>
|
||||
<file>icons/16x16/actions/edit-clear.png</file>
|
||||
<file>icons/16x16/actions/edit-find.png</file>
|
||||
<file>icons/16x16/actions/glabels-align-bottom.png</file>
|
||||
<file>icons/16x16/actions/glabels-align-hcenter.png</file>
|
||||
<file>icons/16x16/actions/glabels-align-left.png</file>
|
||||
@@ -28,6 +30,8 @@
|
||||
<file>icons/16x16/actions/glabels-rotate-right.png</file>
|
||||
<file>icons/16x16/actions/glabels-text.png</file>
|
||||
<file>icons/16x16/apps/glabels.png</file>
|
||||
<file>icons/24x24/actions/edit-clear.png</file>
|
||||
<file>icons/24x24/actions/edit-find.png</file>
|
||||
<file>icons/24x24/actions/glabels-align-text-center.png</file>
|
||||
<file>icons/24x24/actions/glabels-align-text-left.png</file>
|
||||
<file>icons/24x24/actions/glabels-align-text-right.png</file>
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 292 B |
Binary file not shown.
|
After Width: | Height: | Size: 416 B |
Binary file not shown.
|
After Width: | Height: | Size: 449 B |
Binary file not shown.
|
After Width: | Height: | Size: 569 B |
+248
-65
@@ -21,13 +21,45 @@
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="searchEntry">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>Search</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="searchEntry">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>Search</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="searchClearButton">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../icons.qrc">
|
||||
<normaloff>:/icons/16x16/actions/edit-clear.png</normaloff>:/icons/16x16/actions/edit-clear.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@@ -61,65 +93,44 @@
|
||||
<property name="checkable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<widget class="QRadioButton" name="pageSizeIsoRadio">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>20</y>
|
||||
<width>121</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>ISO sizes</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QRadioButton" name="pageSizeUsRadio">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>40</y>
|
||||
<width>111</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>US sizes</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QRadioButton" name="pageSizeOtherRadio">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>60</y>
|
||||
<width>111</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Other</string>
|
||||
</property>
|
||||
</widget>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="pageSizeIsoCheck">
|
||||
<property name="text">
|
||||
<string>ISO sizes</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="pageSizeUsCheck">
|
||||
<property name="text">
|
||||
<string>US sizes</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="pageSizeOtherCheck">
|
||||
<property name="text">
|
||||
<string>Other</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
@@ -445,6 +456,178 @@
|
||||
<header>SimplePreview.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
<resources>
|
||||
<include location="../icons.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>searchEntry</sender>
|
||||
<signal>textChanged(QString)</signal>
|
||||
<receiver>NewLabelDialog</receiver>
|
||||
<slot>onSearchEntryTextChanged()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>69</x>
|
||||
<y>48</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>2</x>
|
||||
<y>53</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>searchClearButton</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>NewLabelDialog</receiver>
|
||||
<slot>onSearchClearButtonClicked()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>177</x>
|
||||
<y>52</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>190</x>
|
||||
<y>7</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>pageSizeIsoCheck</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>NewLabelDialog</receiver>
|
||||
<slot>onPageSizeCheckToggled()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>78</x>
|
||||
<y>116</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>3</x>
|
||||
<y>110</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>pageSizeUsCheck</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>NewLabelDialog</receiver>
|
||||
<slot>onPageSizeCheckToggled()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>52</x>
|
||||
<y>145</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>8</x>
|
||||
<y>144</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>pageSizeOtherCheck</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>NewLabelDialog</receiver>
|
||||
<slot>onPageSizeCheckToggled()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>37</x>
|
||||
<y>170</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>10</x>
|
||||
<y>188</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>templatePicker</sender>
|
||||
<signal>itemSelectionChanged()</signal>
|
||||
<receiver>NewLabelDialog</receiver>
|
||||
<slot>onTemplatePickerSelectionChanged()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>232</x>
|
||||
<y>550</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>244</x>
|
||||
<y>697</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>orientationRotatedRadio</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>NewLabelDialog</receiver>
|
||||
<slot>onOrientationRadioToggled()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>901</x>
|
||||
<y>637</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>982</x>
|
||||
<y>617</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>orientationNormalRadio</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>NewLabelDialog</receiver>
|
||||
<slot>onOrientationRadioToggled()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>807</x>
|
||||
<y>644</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>982</x>
|
||||
<y>592</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>createButton</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>NewLabelDialog</receiver>
|
||||
<slot>onCreateButtonClicked()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>951</x>
|
||||
<y>699</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>985</x>
|
||||
<y>671</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>cancelButton</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>NewLabelDialog</receiver>
|
||||
<slot>onCancelButtonClicked()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>837</x>
|
||||
<y>692</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>767</x>
|
||||
<y>704</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
<slots>
|
||||
<slot>onSearchClearButtonClicked()</slot>
|
||||
<slot>onPageSizeCheckToggled()</slot>
|
||||
<slot>onTemplatePickerSelectionChanged()</slot>
|
||||
<slot>onOrientationRadioToggled()</slot>
|
||||
<slot>onCreateButtonClicked()</slot>
|
||||
<slot>onSearchEntryTextChanged()</slot>
|
||||
<slot>onCancelButtonClicked()</slot>
|
||||
</slots>
|
||||
</ui>
|
||||
|
||||
Reference in New Issue
Block a user