Added initial selection info to NewLabelDialog.
This commit is contained in:
+36
-1
@@ -87,7 +87,42 @@ namespace gLabels
|
|||||||
{
|
{
|
||||||
// Set template to preview
|
// Set template to preview
|
||||||
TemplatePickerItem *tItem = dynamic_cast<TemplatePickerItem*>(selectedItems.first());
|
TemplatePickerItem *tItem = dynamic_cast<TemplatePickerItem*>(selectedItems.first());
|
||||||
simplePreview->setTemplate( tItem->tmplate() );
|
const libglabels::Template *tmplate = tItem->tmplate();
|
||||||
|
const libglabels::Frame *frame = tmplate->frames().first();
|
||||||
|
|
||||||
|
simplePreview->setTemplate( tmplate );
|
||||||
|
|
||||||
|
const libglabels::Vendor *vendor = libglabels::Db::lookupVendorFromName( tmplate->brand() );
|
||||||
|
if ( (vendor != NULL) && (vendor->url() != NULL) )
|
||||||
|
{
|
||||||
|
QString markup = "<a href='" + vendor->url() + "'>" + vendor->name() + "</a>";
|
||||||
|
vendorLabel->setText( markup );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
vendorLabel->setText( tmplate->brand() );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( tmplate->productUrl() != NULL )
|
||||||
|
{
|
||||||
|
QString markup = "<a href='" + tmplate->productUrl() + "'>" + tmplate->part() + "</a>";
|
||||||
|
partLabel->setText( markup );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
partLabel->setText( tmplate->part() );
|
||||||
|
}
|
||||||
|
|
||||||
|
descriptionLabel->setText( tmplate->description() );
|
||||||
|
|
||||||
|
QString pgSizeString = libglabels::Db::lookupPaperNameFromId( tmplate->paperId() );
|
||||||
|
pageSizeLabel->setText( pgSizeString );
|
||||||
|
|
||||||
|
QString labelSizeString = frame->sizeDescription( libglabels::Units::inch() );
|
||||||
|
labelSizeLabel->setText( labelSizeString );
|
||||||
|
|
||||||
|
QString layoutString = frame->layoutDescription();
|
||||||
|
layoutLabel->setText( layoutString );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+127
-17
@@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>1036</width>
|
<width>958</width>
|
||||||
<height>735</height>
|
<height>759</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@@ -133,7 +133,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="groupBox_3">
|
<widget class="QGroupBox" name="groupBox_3">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Preview</string>
|
<string>Selection info</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
|
<set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
|
||||||
@@ -158,6 +158,129 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QFormLayout" name="formLayout">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Vendor:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLabel" name="vendorLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">TextLabel</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="text">
|
||||||
|
<string>Part #:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QLabel" name="partLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">TextLabel</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="label_5">
|
||||||
|
<property name="text">
|
||||||
|
<string>Description:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QLabel" name="descriptionLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">TextLabel</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QLabel" name="label_7">
|
||||||
|
<property name="text">
|
||||||
|
<string>Page size:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
|
<widget class="QLabel" name="pageSizeLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">TextLabel</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0">
|
||||||
|
<widget class="QLabel" name="label_9">
|
||||||
|
<property name="text">
|
||||||
|
<string>Label size:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="1">
|
||||||
|
<widget class="QLabel" name="labelSizeLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">TextLabel</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="0">
|
||||||
|
<widget class="QLabel" name="label_11">
|
||||||
|
<property name="text">
|
||||||
|
<string>Layout:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="1">
|
||||||
|
<widget class="QLabel" name="layoutLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">TextLabel</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="6" column="0">
|
||||||
|
<widget class="QLabel" name="label_13">
|
||||||
|
<property name="text">
|
||||||
|
<string>Similar products:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="6" column="1">
|
||||||
|
<widget class="QTextBrowser" name="similarBrowser">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>180</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="acceptDrops">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="autoFillBackground">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::NoFrame</enum>
|
||||||
|
</property>
|
||||||
|
<property name="openLinks">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -170,7 +293,7 @@
|
|||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Label Orientation</string>
|
<string>Orientation</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
@@ -253,19 +376,6 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
<zorder>createButton</zorder>
|
|
||||||
<zorder>horizontalSpacer</zorder>
|
|
||||||
<zorder>orientationNormalRadio</zorder>
|
|
||||||
<zorder>orientationRotatedRadio</zorder>
|
|
||||||
<zorder>label</zorder>
|
|
||||||
<zorder></zorder>
|
|
||||||
<zorder>label</zorder>
|
|
||||||
<zorder>groupBox_2</zorder>
|
|
||||||
<zorder>groupBox_3</zorder>
|
|
||||||
<zorder>templatePicker</zorder>
|
|
||||||
<zorder>searchEntry</zorder>
|
|
||||||
<zorder>groupBox</zorder>
|
|
||||||
<zorder>horizontalSpacer</zorder>
|
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
|
|||||||
+4
-4
@@ -52,9 +52,9 @@ namespace libglabels
|
|||||||
|
|
||||||
inline const QString &id() const { return mId; }
|
inline const QString &id() const { return mId; }
|
||||||
inline int nLabels() const { return mNLabels; }
|
inline int nLabels() const { return mNLabels; }
|
||||||
inline const QString &layoutDescription() { return mLayoutDescription; }
|
inline const QString &layoutDescription() const { return mLayoutDescription; }
|
||||||
inline const QList<Layout*> &layouts() { return mLayouts; }
|
inline const QList<Layout*> &layouts() const { return mLayouts; }
|
||||||
inline const QList<Markup*> &markups() { return mMarkups; }
|
inline const QList<Markup*> &markups() const { return mMarkups; }
|
||||||
|
|
||||||
QVector<Point> getOrigins() const;
|
QVector<Point> getOrigins() const;
|
||||||
|
|
||||||
@@ -64,7 +64,7 @@ namespace libglabels
|
|||||||
virtual double w() const = 0;
|
virtual double w() const = 0;
|
||||||
virtual double h() const = 0;
|
virtual double h() const = 0;
|
||||||
|
|
||||||
virtual const QString &sizeDescription( Units *units ) = 0;
|
virtual const QString sizeDescription( const Units *units ) const = 0;
|
||||||
virtual bool isSimilarTo( Frame *other ) const = 0;
|
virtual bool isSimilarTo( Frame *other ) const = 0;
|
||||||
|
|
||||||
virtual const QPainterPath &path() const = 0;
|
virtual const QPainterPath &path() const = 0;
|
||||||
|
|||||||
@@ -29,26 +29,24 @@
|
|||||||
namespace libglabels
|
namespace libglabels
|
||||||
{
|
{
|
||||||
|
|
||||||
const QString &FrameCd::sizeDescription( Units *units )
|
const QString FrameCd::sizeDescription( const Units *units ) const
|
||||||
{
|
{
|
||||||
if ( units->id() == "in" )
|
if ( units->id() == "in" )
|
||||||
{
|
{
|
||||||
QString dStr = StrUtil::formatFraction( 2 * mR1 * units->unitsPerPoint() );
|
QString dStr = StrUtil::formatFraction( 2 * mR1 * units->unitsPerPoint() );
|
||||||
|
|
||||||
mSizeDescription = QString().sprintf( "%s %s %s",
|
return QString().sprintf( "%s %s %s",
|
||||||
qPrintable(dStr),
|
qPrintable(dStr),
|
||||||
qPrintable(units->name()),
|
qPrintable(units->name()),
|
||||||
qPrintable(tr("diameter")) );
|
qPrintable(tr("diameter")) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mSizeDescription = QString().sprintf( "%.5g %s %s",
|
return QString().sprintf( "%.5g %s %s",
|
||||||
2 * mR1 * units->unitsPerPoint(),
|
2 * mR1 * units->unitsPerPoint(),
|
||||||
qPrintable(units->name()),
|
qPrintable(units->name()),
|
||||||
qPrintable(tr("diameter")) );
|
qPrintable(tr("diameter")) );
|
||||||
}
|
}
|
||||||
|
|
||||||
return mSizeDescription;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ namespace libglabels
|
|||||||
double w() const { return (mW == 0) ? 2*mR1 : mW; }
|
double w() const { return (mW == 0) ? 2*mR1 : mW; }
|
||||||
double h() const { return (mH == 0) ? 2*mR1 : mH; }
|
double h() const { return (mH == 0) ? 2*mR1 : mH; }
|
||||||
|
|
||||||
const QString &sizeDescription( Units *units );
|
const QString sizeDescription( const Units *units ) const;
|
||||||
bool isSimilarTo( Frame *other ) const;
|
bool isSimilarTo( Frame *other ) const;
|
||||||
|
|
||||||
const QPainterPath &path() const { return mPath; }
|
const QPainterPath &path() const { return mPath; }
|
||||||
@@ -71,8 +71,6 @@ namespace libglabels
|
|||||||
double mH;
|
double mH;
|
||||||
double mWaste;
|
double mWaste;
|
||||||
|
|
||||||
QString mSizeDescription;
|
|
||||||
|
|
||||||
QPainterPath mPath;
|
QPainterPath mPath;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -29,21 +29,21 @@
|
|||||||
namespace libglabels
|
namespace libglabels
|
||||||
{
|
{
|
||||||
|
|
||||||
const QString &FrameEllipse::sizeDescription( Units *units )
|
const QString FrameEllipse::sizeDescription( const Units *units ) const
|
||||||
{
|
{
|
||||||
if ( units->id() == "in" )
|
if ( units->id() == "in" )
|
||||||
{
|
{
|
||||||
QString wStr = StrUtil::formatFraction( mW * units->unitsPerPoint() );
|
QString wStr = StrUtil::formatFraction( mW * units->unitsPerPoint() );
|
||||||
QString hStr = StrUtil::formatFraction( mH * units->unitsPerPoint() );
|
QString hStr = StrUtil::formatFraction( mH * units->unitsPerPoint() );
|
||||||
|
|
||||||
mSizeDescription = QString().sprintf( "%s x %s %s",
|
return QString().sprintf( "%s x %s %s",
|
||||||
qPrintable(wStr),
|
qPrintable(wStr),
|
||||||
qPrintable(hStr),
|
qPrintable(hStr),
|
||||||
qPrintable(units->name()) );
|
qPrintable(units->name()) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mSizeDescription = QString().sprintf( "%.5g x %.5g %s",
|
return QString().sprintf( "%.5g x %.5g %s",
|
||||||
mW * units->unitsPerPoint(),
|
mW * units->unitsPerPoint(),
|
||||||
mH * units->unitsPerPoint(),
|
mH * units->unitsPerPoint(),
|
||||||
qPrintable(units->name()) );
|
qPrintable(units->name()) );
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ namespace libglabels
|
|||||||
double w() const { return mW; }
|
double w() const { return mW; }
|
||||||
double h() const { return mH; }
|
double h() const { return mH; }
|
||||||
|
|
||||||
const QString &sizeDescription( Units *units );
|
const QString sizeDescription( const Units *units ) const;
|
||||||
bool isSimilarTo( Frame *other ) const;
|
bool isSimilarTo( Frame *other ) const;
|
||||||
|
|
||||||
const QPainterPath &path() const { return mPath; }
|
const QPainterPath &path() const { return mPath; }
|
||||||
@@ -62,8 +62,6 @@ namespace libglabels
|
|||||||
double mH;
|
double mH;
|
||||||
double mWaste;
|
double mWaste;
|
||||||
|
|
||||||
QString mSizeDescription;
|
|
||||||
|
|
||||||
QPainterPath mPath;
|
QPainterPath mPath;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -29,27 +29,25 @@
|
|||||||
namespace libglabels
|
namespace libglabels
|
||||||
{
|
{
|
||||||
|
|
||||||
const QString &FrameRect::sizeDescription( Units *units )
|
const QString FrameRect::sizeDescription( const Units *units ) const
|
||||||
{
|
{
|
||||||
if ( units->id() == "in" )
|
if ( units->id() == "in" )
|
||||||
{
|
{
|
||||||
QString wStr = StrUtil::formatFraction( mW * units->unitsPerPoint() );
|
QString wStr = StrUtil::formatFraction( mW * units->unitsPerPoint() );
|
||||||
QString hStr = StrUtil::formatFraction( mH * units->unitsPerPoint() );
|
QString hStr = StrUtil::formatFraction( mH * units->unitsPerPoint() );
|
||||||
|
|
||||||
mSizeDescription = QString().sprintf( "%s x %s %s",
|
return QString().sprintf( "%s x %s %s",
|
||||||
qPrintable(wStr),
|
qPrintable(wStr),
|
||||||
qPrintable(hStr),
|
qPrintable(hStr),
|
||||||
qPrintable(units->name()) );
|
qPrintable(units->name()) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mSizeDescription = QString().sprintf( "%.5g x %.5g %s",
|
return QString().sprintf( "%.5g x %.5g %s",
|
||||||
mW * units->unitsPerPoint(),
|
mW * units->unitsPerPoint(),
|
||||||
mH * units->unitsPerPoint(),
|
mH * units->unitsPerPoint(),
|
||||||
qPrintable(units->name()) );
|
qPrintable(units->name()) );
|
||||||
}
|
}
|
||||||
|
|
||||||
return mSizeDescription;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ namespace libglabels
|
|||||||
double w() const { return mW; }
|
double w() const { return mW; }
|
||||||
double h() const { return mH; }
|
double h() const { return mH; }
|
||||||
|
|
||||||
const QString &sizeDescription( Units *units );
|
const QString sizeDescription( const Units *units ) const;
|
||||||
bool isSimilarTo( Frame *other ) const;
|
bool isSimilarTo( Frame *other ) const;
|
||||||
|
|
||||||
const QPainterPath &path() const { return mPath; }
|
const QPainterPath &path() const { return mPath; }
|
||||||
@@ -69,8 +69,6 @@ namespace libglabels
|
|||||||
double mXWaste;
|
double mXWaste;
|
||||||
double mYWaste;
|
double mYWaste;
|
||||||
|
|
||||||
QString mSizeDescription;
|
|
||||||
|
|
||||||
QPainterPath mPath;
|
QPainterPath mPath;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -29,26 +29,24 @@
|
|||||||
namespace libglabels
|
namespace libglabels
|
||||||
{
|
{
|
||||||
|
|
||||||
const QString &FrameRound::sizeDescription( Units *units )
|
const QString FrameRound::sizeDescription( const Units *units ) const
|
||||||
{
|
{
|
||||||
if ( units->id() == "in" )
|
if ( units->id() == "in" )
|
||||||
{
|
{
|
||||||
QString dStr = StrUtil::formatFraction( 2 * mR * units->unitsPerPoint() );
|
QString dStr = StrUtil::formatFraction( 2 * mR * units->unitsPerPoint() );
|
||||||
|
|
||||||
mSizeDescription = QString().sprintf( "%s %s %s",
|
return QString().sprintf( "%s %s %s",
|
||||||
qPrintable(dStr),
|
qPrintable(dStr),
|
||||||
qPrintable(units->name()),
|
qPrintable(units->name()),
|
||||||
qPrintable(tr("diameter")) );
|
qPrintable(tr("diameter")) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mSizeDescription = QString().sprintf( "%.5g %s %s",
|
return QString().sprintf( "%.5g %s %s",
|
||||||
2 * mR * units->unitsPerPoint(),
|
2 * mR * units->unitsPerPoint(),
|
||||||
qPrintable(units->name()),
|
qPrintable(units->name()),
|
||||||
qPrintable(tr("diameter")) );
|
qPrintable(tr("diameter")) );
|
||||||
}
|
}
|
||||||
|
|
||||||
return mSizeDescription;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ namespace libglabels
|
|||||||
double w() const { return 2*mR; }
|
double w() const { return 2*mR; }
|
||||||
double h() const { return 2*mR; }
|
double h() const { return 2*mR; }
|
||||||
|
|
||||||
const QString &sizeDescription( Units *units );
|
const QString sizeDescription( const Units *units ) const;
|
||||||
bool isSimilarTo( Frame *other ) const;
|
bool isSimilarTo( Frame *other ) const;
|
||||||
|
|
||||||
const QPainterPath &path() const { return mPath; }
|
const QPainterPath &path() const { return mPath; }
|
||||||
@@ -61,8 +61,6 @@ namespace libglabels
|
|||||||
double mR;
|
double mR;
|
||||||
double mWaste;
|
double mWaste;
|
||||||
|
|
||||||
QString mSizeDescription;
|
|
||||||
|
|
||||||
QPainterPath mPath;
|
QPainterPath mPath;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ namespace libglabels
|
|||||||
namespace StrUtil
|
namespace StrUtil
|
||||||
{
|
{
|
||||||
|
|
||||||
QString &formatFraction( double x )
|
QString formatFraction( double x )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
double product, remainder;
|
double product, remainder;
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ namespace libglabels
|
|||||||
namespace StrUtil
|
namespace StrUtil
|
||||||
{
|
{
|
||||||
|
|
||||||
QString &formatFraction( double x );
|
QString formatFraction( double x );
|
||||||
|
|
||||||
int comparePartNames( const QString &s1, const QString &s2 );
|
int comparePartNames( const QString &s1, const QString &s2 );
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user