Track all three paper size search flags in settings.
This commit is contained in:
@@ -49,15 +49,6 @@ PreferencesDialog::PreferencesDialog( QWidget *parent )
|
|||||||
unitsPointsRadio->setChecked( true );
|
unitsPointsRadio->setChecked( true );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( Settings::preferIsoPaperSizes() )
|
|
||||||
{
|
|
||||||
preferedPaperSizesIsoRadio->setChecked( true );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
preferedPaperSizesUsRadio->setChecked( true );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -87,12 +78,3 @@ void PreferencesDialog::onUnitsRadiosChanged()
|
|||||||
Settings::setUnits( glabels::Distance::Units::PT );
|
Settings::setUnits( glabels::Distance::Units::PT );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
|
||||||
/// Prefered Paper Sizes Radios Changed
|
|
||||||
///
|
|
||||||
void PreferencesDialog::onPreferedPaperSizesRadiosChanged()
|
|
||||||
{
|
|
||||||
Settings::setPreferIsoPaperSizes( preferedPaperSizesIsoRadio->isChecked() );
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ public:
|
|||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
private slots:
|
private slots:
|
||||||
void onUnitsRadiosChanged();
|
void onUnitsRadiosChanged();
|
||||||
void onPreferedPaperSizesRadiosChanged();
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -20,10 +20,11 @@
|
|||||||
|
|
||||||
#include "SelectProductDialog.h"
|
#include "SelectProductDialog.h"
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
#include "libglabels/Db.h"
|
#include "libglabels/Db.h"
|
||||||
#include "TemplatePickerItem.h"
|
#include "TemplatePickerItem.h"
|
||||||
|
#include "Settings.h"
|
||||||
|
|
||||||
|
#include <QtDebug>
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
@@ -34,11 +35,9 @@ SelectProductDialog::SelectProductDialog( QWidget *parent )
|
|||||||
{
|
{
|
||||||
setupUi( this );
|
setupUi( this );
|
||||||
|
|
||||||
// TODO: Set default based on locale and/or saved preferences
|
pageSizeIsoCheck->setChecked( Settings::searchIsoPaperSizes() );
|
||||||
// Perhaps move to checkboxes
|
pageSizeUsCheck->setChecked( Settings::searchUsPaperSizes() );
|
||||||
pageSizeIsoCheck->setChecked( false );
|
pageSizeOtherCheck->setChecked( Settings::searchOtherPaperSizes() );
|
||||||
pageSizeUsCheck->setChecked( true );
|
|
||||||
pageSizeOtherCheck->setChecked( true );
|
|
||||||
|
|
||||||
QList<glabels::Template*> tmplates = glabels::Db::templates();
|
QList<glabels::Template*> tmplates = glabels::Db::templates();
|
||||||
templatePicker->setTemplates( tmplates );
|
templatePicker->setTemplates( tmplates );
|
||||||
@@ -89,8 +88,12 @@ void SelectProductDialog::onSearchClearButtonClicked()
|
|||||||
///
|
///
|
||||||
/// Page Size Check Toggled Slot
|
/// Page Size Check Toggled Slot
|
||||||
///
|
///
|
||||||
void SelectProductDialog::onPageSizeCheckToggled()
|
void SelectProductDialog::onPageSizeCheckClicked()
|
||||||
{
|
{
|
||||||
|
Settings::setSearchIsoPaperSizes( pageSizeIsoCheck->isChecked() );
|
||||||
|
Settings::setSearchUsPaperSizes( pageSizeUsCheck->isChecked() );
|
||||||
|
Settings::setSearchOtherPaperSizes( pageSizeOtherCheck->isChecked() );
|
||||||
|
|
||||||
templatePicker->applyFilter( searchEntry->text(),
|
templatePicker->applyFilter( searchEntry->text(),
|
||||||
pageSizeIsoCheck->isChecked(),
|
pageSizeIsoCheck->isChecked(),
|
||||||
pageSizeUsCheck->isChecked(),
|
pageSizeUsCheck->isChecked(),
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ public:
|
|||||||
private slots:
|
private slots:
|
||||||
void onSearchEntryTextChanged();
|
void onSearchEntryTextChanged();
|
||||||
void onSearchClearButtonClicked();
|
void onSearchClearButtonClicked();
|
||||||
void onPageSizeCheckToggled();
|
void onPageSizeCheckClicked();
|
||||||
void onTemplatePickerSelectionChanged();
|
void onTemplatePickerSelectionChanged();
|
||||||
void onSelectButtonClicked();
|
void onSelectButtonClicked();
|
||||||
void onCancelButtonClicked();
|
void onCancelButtonClicked();
|
||||||
|
|||||||
+96
-35
@@ -49,41 +49,6 @@ Settings* Settings::instance()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Settings::preferIsoPaperSizes()
|
|
||||||
{
|
|
||||||
// Guess at a suitable default
|
|
||||||
bool defaultValue;
|
|
||||||
switch (QLocale::system().country())
|
|
||||||
{
|
|
||||||
case QLocale::UnitedStates:
|
|
||||||
case QLocale::Canada:
|
|
||||||
defaultValue = false;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
defaultValue = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
mInstance->beginGroup( "Locale" );
|
|
||||||
bool returnValue = mInstance->value( "preferIsoPaperSizes", defaultValue ).toBool();
|
|
||||||
mInstance->endGroup();
|
|
||||||
|
|
||||||
return returnValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Settings::setPreferIsoPaperSizes( bool preferIsoPaperSizes )
|
|
||||||
{
|
|
||||||
|
|
||||||
mInstance->beginGroup( "Locale" );
|
|
||||||
mInstance->setValue( "preferIsoPaperSizes", preferIsoPaperSizes );
|
|
||||||
mInstance->endGroup();
|
|
||||||
|
|
||||||
emit mInstance->changed();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
glabels::Distance::Units Settings::units()
|
glabels::Distance::Units Settings::units()
|
||||||
{
|
{
|
||||||
// Guess at a suitable default
|
// Guess at a suitable default
|
||||||
@@ -115,3 +80,99 @@ void Settings::setUnits( glabels::Distance::Units units )
|
|||||||
|
|
||||||
emit mInstance->changed();
|
emit mInstance->changed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Settings::searchIsoPaperSizes()
|
||||||
|
{
|
||||||
|
// Guess at a suitable default
|
||||||
|
bool defaultValue;
|
||||||
|
switch (QLocale::system().country())
|
||||||
|
{
|
||||||
|
case QLocale::UnitedStates:
|
||||||
|
case QLocale::Canada:
|
||||||
|
defaultValue = false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
defaultValue = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
mInstance->beginGroup( "Search" );
|
||||||
|
bool returnValue = mInstance->value( "isoPaperSizes", defaultValue ).toBool();
|
||||||
|
mInstance->endGroup();
|
||||||
|
|
||||||
|
return returnValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Settings::setSearchIsoPaperSizes( bool searchIsoPaperSizes )
|
||||||
|
{
|
||||||
|
|
||||||
|
mInstance->beginGroup( "Search" );
|
||||||
|
mInstance->setValue( "isoPaperSizes", searchIsoPaperSizes );
|
||||||
|
mInstance->endGroup();
|
||||||
|
|
||||||
|
emit mInstance->changed();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Settings::searchUsPaperSizes()
|
||||||
|
{
|
||||||
|
// Guess at a suitable default
|
||||||
|
bool defaultValue;
|
||||||
|
switch (QLocale::system().country())
|
||||||
|
{
|
||||||
|
case QLocale::UnitedStates:
|
||||||
|
case QLocale::Canada:
|
||||||
|
defaultValue = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
defaultValue = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
mInstance->beginGroup( "Search" );
|
||||||
|
bool returnValue = mInstance->value( "usPaperSizes", defaultValue ).toBool();
|
||||||
|
mInstance->endGroup();
|
||||||
|
|
||||||
|
return returnValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Settings::setSearchUsPaperSizes( bool searchUsPaperSizes )
|
||||||
|
{
|
||||||
|
|
||||||
|
mInstance->beginGroup( "Search" );
|
||||||
|
mInstance->setValue( "usPaperSizes", searchUsPaperSizes );
|
||||||
|
mInstance->endGroup();
|
||||||
|
|
||||||
|
emit mInstance->changed();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Settings::searchOtherPaperSizes()
|
||||||
|
{
|
||||||
|
// Guess at a suitable default
|
||||||
|
bool defaultValue = true;
|
||||||
|
|
||||||
|
mInstance->beginGroup( "Search" );
|
||||||
|
bool returnValue = mInstance->value( "otherPaperSizes", defaultValue ).toBool();
|
||||||
|
mInstance->endGroup();
|
||||||
|
|
||||||
|
return returnValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Settings::setSearchOtherPaperSizes( bool searchOtherPaperSizes )
|
||||||
|
{
|
||||||
|
|
||||||
|
mInstance->beginGroup( "Search" );
|
||||||
|
mInstance->setValue( "otherPaperSizes", searchOtherPaperSizes );
|
||||||
|
mInstance->endGroup();
|
||||||
|
|
||||||
|
emit mInstance->changed();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+9
-3
@@ -59,12 +59,18 @@ signals:
|
|||||||
// Accessors
|
// Accessors
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
public:
|
public:
|
||||||
static bool preferIsoPaperSizes();
|
|
||||||
static void setPreferIsoPaperSizes( bool preferIsoPaperSizes );
|
|
||||||
|
|
||||||
static glabels::Distance::Units units();
|
static glabels::Distance::Units units();
|
||||||
static void setUnits( glabels::Distance::Units units );
|
static void setUnits( glabels::Distance::Units units );
|
||||||
|
|
||||||
|
static bool searchIsoPaperSizes();
|
||||||
|
static void setSearchIsoPaperSizes( bool searchIsoPaperSizes );
|
||||||
|
|
||||||
|
static bool searchUsPaperSizes();
|
||||||
|
static void setSearchUsPaperSizes( bool searchUsPaperSizes );
|
||||||
|
|
||||||
|
static bool searchOtherPaperSizes();
|
||||||
|
static void setSearchOtherPaperSizes( bool searchOtherPaperSizes );
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static Settings* mInstance;
|
static Settings* mInstance;
|
||||||
|
|||||||
@@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>299</width>
|
<width>318</width>
|
||||||
<height>385</height>
|
<height>295</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
<string>Locale</string>
|
<string>Locale</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QGridLayout" name="gridLayout_4">
|
<layout class="QGridLayout" name="gridLayout_4">
|
||||||
<item row="3" column="0">
|
<item row="2" column="0">
|
||||||
<spacer name="verticalSpacer">
|
<spacer name="verticalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
@@ -88,29 +88,6 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
|
||||||
<widget class="QGroupBox" name="groupBox_2">
|
|
||||||
<property name="title">
|
|
||||||
<string>Prefered Paper Sizes</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridLayout_3">
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QRadioButton" name="preferedPaperSizesUsRadio">
|
|
||||||
<property name="text">
|
|
||||||
<string>US</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QRadioButton" name="preferedPaperSizesIsoRadio">
|
|
||||||
<property name="text">
|
|
||||||
<string>ISO</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
@@ -193,38 +170,6 @@
|
|||||||
</hint>
|
</hint>
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
<connection>
|
|
||||||
<sender>preferedPaperSizesUsRadio</sender>
|
|
||||||
<signal>clicked()</signal>
|
|
||||||
<receiver>PreferencesDialog</receiver>
|
|
||||||
<slot>onPreferedPaperSizesRadiosChanged()</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>269</x>
|
|
||||||
<y>276</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>298</x>
|
|
||||||
<y>221</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
<connection>
|
|
||||||
<sender>preferedPaperSizesIsoRadio</sender>
|
|
||||||
<signal>clicked()</signal>
|
|
||||||
<receiver>PreferencesDialog</receiver>
|
|
||||||
<slot>onPreferedPaperSizesRadiosChanged()</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>269</x>
|
|
||||||
<y>303</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>298</x>
|
|
||||||
<y>255</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
<connection>
|
<connection>
|
||||||
<sender>unitsCentimetersRadio</sender>
|
<sender>unitsCentimetersRadio</sender>
|
||||||
<signal>clicked(bool)</signal>
|
<signal>clicked(bool)</signal>
|
||||||
|
|||||||
@@ -223,54 +223,6 @@
|
|||||||
</hint>
|
</hint>
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
<connection>
|
|
||||||
<sender>pageSizeIsoCheck</sender>
|
|
||||||
<signal>toggled(bool)</signal>
|
|
||||||
<receiver>SelectProductDialog</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>SelectProductDialog</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>SelectProductDialog</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>
|
<connection>
|
||||||
<sender>templatePicker</sender>
|
<sender>templatePicker</sender>
|
||||||
<signal>itemSelectionChanged()</signal>
|
<signal>itemSelectionChanged()</signal>
|
||||||
@@ -294,8 +246,8 @@
|
|||||||
<slot>onCancelButtonClicked()</slot>
|
<slot>onCancelButtonClicked()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>587</x>
|
<x>864</x>
|
||||||
<y>708</y>
|
<y>648</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>689</x>
|
<x>689</x>
|
||||||
@@ -310,8 +262,8 @@
|
|||||||
<slot>onSelectButtonClicked()</slot>
|
<slot>onSelectButtonClicked()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>660</x>
|
<x>955</x>
|
||||||
<y>689</y>
|
<y>648</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>687</x>
|
<x>687</x>
|
||||||
@@ -319,14 +271,62 @@
|
|||||||
</hint>
|
</hint>
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>pageSizeIsoCheck</sender>
|
||||||
|
<signal>clicked()</signal>
|
||||||
|
<receiver>SelectProductDialog</receiver>
|
||||||
|
<slot>onPageSizeCheckClicked()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>40</x>
|
||||||
|
<y>112</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>2</x>
|
||||||
|
<y>116</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>pageSizeUsCheck</sender>
|
||||||
|
<signal>clicked()</signal>
|
||||||
|
<receiver>SelectProductDialog</receiver>
|
||||||
|
<slot>onPageSizeCheckClicked()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>38</x>
|
||||||
|
<y>144</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>4</x>
|
||||||
|
<y>141</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>pageSizeOtherCheck</sender>
|
||||||
|
<signal>clicked()</signal>
|
||||||
|
<receiver>SelectProductDialog</receiver>
|
||||||
|
<slot>onPageSizeCheckClicked()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>35</x>
|
||||||
|
<y>169</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>8</x>
|
||||||
|
<y>168</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
</connections>
|
</connections>
|
||||||
<slots>
|
<slots>
|
||||||
<slot>onSearchClearButtonClicked()</slot>
|
<slot>onSearchClearButtonClicked()</slot>
|
||||||
<slot>onPageSizeCheckToggled()</slot>
|
|
||||||
<slot>onTemplatePickerSelectionChanged()</slot>
|
<slot>onTemplatePickerSelectionChanged()</slot>
|
||||||
<slot>onOrientationRadioToggled()</slot>
|
<slot>onOrientationRadioToggled()</slot>
|
||||||
<slot>onSearchEntryTextChanged()</slot>
|
<slot>onSearchEntryTextChanged()</slot>
|
||||||
<slot>onCancelButtonClicked()</slot>
|
<slot>onCancelButtonClicked()</slot>
|
||||||
<slot>onSelectButtonClicked()</slot>
|
<slot>onSelectButtonClicked()</slot>
|
||||||
|
<slot>onPageSizeCheckClicked()</slot>
|
||||||
</slots>
|
</slots>
|
||||||
</ui>
|
</ui>
|
||||||
|
|||||||
Reference in New Issue
Block a user