- Added side pane for product preview and information - Product selection is done with a separate pushbutton, so that user gets a chance to preview the complete product information before committing to the selection - Supports two view modes: Grid View and List View - View mode is automatically stored in Settings, so it will default to the user's prefered mode - Should address most concerns in #109 and #142
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include "Settings.h"
|
||||
|
||||
#include <QLocale>
|
||||
@@ -262,6 +263,28 @@ namespace glabels
|
||||
}
|
||||
|
||||
|
||||
QListView::ViewMode Settings::templatePickerMode()
|
||||
{
|
||||
QString defaultMode = "icon";
|
||||
|
||||
mInstance->beginGroup( "TemplatePicker" );
|
||||
QString returnMode = mInstance->value( "viewMode", defaultMode ).toString();
|
||||
mInstance->endGroup();
|
||||
|
||||
return returnMode == "icon" ? QListView::IconMode : QListView::ListMode;
|
||||
}
|
||||
|
||||
|
||||
void Settings::setTemplatePickerMode( QListView::ViewMode viewMode )
|
||||
{
|
||||
mInstance->beginGroup( "TemplatePicker" );
|
||||
mInstance->setValue( "viewMode", viewMode == QListView::IconMode ? "icon" : "list" );
|
||||
mInstance->endGroup();
|
||||
|
||||
emit mInstance->changed();
|
||||
}
|
||||
|
||||
|
||||
QStringList Settings::recentTemplateList()
|
||||
{
|
||||
QStringList defaultList;
|
||||
|
||||
+5
-1
@@ -24,6 +24,7 @@
|
||||
|
||||
#include "Distance.h"
|
||||
|
||||
#include <QListView>
|
||||
#include <QSettings>
|
||||
#include <QStringList>
|
||||
|
||||
@@ -87,6 +88,9 @@ namespace glabels
|
||||
static QStringList searchCategoryList();
|
||||
static void setSearchCategoryList( const QStringList& searchCategoryList );
|
||||
|
||||
static QListView::ViewMode templatePickerMode();
|
||||
static void setTemplatePickerMode( QListView::ViewMode viewMode );
|
||||
|
||||
static QStringList recentTemplateList();
|
||||
static void addToRecentTemplateList( const QString& name );
|
||||
|
||||
@@ -94,7 +98,7 @@ namespace glabels
|
||||
static QStringList recentFileList();
|
||||
static void addToRecentFileList( const QString& filePath );
|
||||
|
||||
|
||||
|
||||
private:
|
||||
static Settings* mInstance;
|
||||
static const int mMaxRecentFiles{5};
|
||||
|
||||
@@ -18,10 +18,12 @@
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include "Template.h"
|
||||
|
||||
#include "Db.h"
|
||||
#include "FrameContinuous.h"
|
||||
#include "StrUtil.h"
|
||||
|
||||
#include <QtDebug>
|
||||
|
||||
@@ -190,6 +192,30 @@ namespace glabels
|
||||
}
|
||||
|
||||
|
||||
QString Template::paperDescription( const Units& units ) const
|
||||
{
|
||||
if ( mPaperId == "other" )
|
||||
{
|
||||
if ( units.toEnum() == Units::IN )
|
||||
{
|
||||
QString wStr = StrUtil::formatFraction( mPageWidth.in() );
|
||||
QString hStr = StrUtil::formatFraction( mPageHeight.in() );
|
||||
|
||||
return QString("%1 x %2 %3").arg(wStr).arg(hStr).arg(units.toTrName());
|
||||
}
|
||||
else
|
||||
{
|
||||
return QString("%1 x %2 %3")
|
||||
.arg(mPageWidth.inUnits(units), 0, 'g', 5)
|
||||
.arg(mPageHeight.inUnits(units), 0, 'g', 5)
|
||||
.arg(units.toTrName());
|
||||
}
|
||||
}
|
||||
|
||||
return Db::lookupPaperNameFromId( mPaperId );
|
||||
}
|
||||
|
||||
|
||||
QString Template::paperId() const
|
||||
{
|
||||
return mPaperId;
|
||||
|
||||
@@ -73,6 +73,7 @@ namespace glabels
|
||||
QString part() const;
|
||||
QString description() const;
|
||||
|
||||
QString paperDescription( const Units& units ) const;
|
||||
QString paperId() const;
|
||||
Distance pageWidth() const;
|
||||
Distance pageHeight() const;
|
||||
|
||||
Reference in New Issue
Block a user