Merged develop into feature

--HG--
branch : feature
This commit is contained in:
Bojan Kverh 2016-06-23 19:36:00 +02:00
commit cef47f89fc
4 changed files with 48 additions and 71 deletions

View File

@ -1346,9 +1346,9 @@ void TMainWindow::ShowMData()
const qreal value = UnitConvertor(data->GetTableValue(meash->GetName(), mType), mUnit, pUnit);
ui->labelCalculatedValue->setText(qApp->LocaleToString(value) + " " +postfix);
ui->doubleSpinBoxBaseValue->setValue(static_cast<int>(meash->GetBase()));
ui->doubleSpinBoxInSizes->setValue(static_cast<int>(meash->GetKsize()));
ui->doubleSpinBoxInHeights->setValue(static_cast<int>(meash->GetKheight()));
ui->doubleSpinBoxBaseValue->setValue(meash->GetBase());
ui->doubleSpinBoxInSizes->setValue(meash->GetKsize());
ui->doubleSpinBoxInHeights->setValue(meash->GetKheight());
ui->labelCalculatedValue->blockSignals(false);
ui->doubleSpinBoxBaseValue->blockSignals(false);
@ -1584,22 +1584,6 @@ void TMainWindow::SaveMBaseValue(double value)
}
const QTableWidgetItem *nameField = ui->tableWidget->item(ui->tableWidget->currentRow(), ColumnName);
QSharedPointer<VMeasurement> meash;
try
{
// Translate to internal look.
meash = data->GetVariable<VMeasurement>(nameField->data(Qt::UserRole).toString());
}
catch(const VExceptionBadId &e)
{
qCWarning(tMainWindow, "%s\n\n%s\n\n%s",
qUtf8Printable(tr("Can't find measurement '%1'.").arg(nameField->text())),
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
return;
}
m->SetMBaseValue(nameField->data(Qt::UserRole).toString(), value);
MeasurementsWasSaved(false);
@ -1610,6 +1594,8 @@ void TMainWindow::SaveMBaseValue(double value)
ui->tableWidget->blockSignals(true);
ui->tableWidget->selectRow(row);
ui->tableWidget->blockSignals(false);
ShowMData();
}
//---------------------------------------------------------------------------------------------------------------------
@ -1623,22 +1609,6 @@ void TMainWindow::SaveMSizeIncrease(double value)
}
const QTableWidgetItem *nameField = ui->tableWidget->item(ui->tableWidget->currentRow(), ColumnName);
QSharedPointer<VMeasurement> meash;
try
{
// Translate to internal look.
meash = data->GetVariable<VMeasurement>(nameField->data(Qt::UserRole).toString());
}
catch(const VExceptionBadId &e)
{
qCWarning(tMainWindow, "%s\n\n%s\n\n%s",
qUtf8Printable(tr("Can't find measurement '%1'.").arg(nameField->text())),
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
return;
}
m->SetMSizeIncrease(nameField->data(Qt::UserRole).toString(), value);
MeasurementsWasSaved(false);
@ -1649,6 +1619,8 @@ void TMainWindow::SaveMSizeIncrease(double value)
ui->tableWidget->blockSignals(true);
ui->tableWidget->selectRow(row);
ui->tableWidget->blockSignals(false);
ShowMData();
}
//---------------------------------------------------------------------------------------------------------------------
@ -1662,22 +1634,6 @@ void TMainWindow::SaveMHeightIncrease(double value)
}
const QTableWidgetItem *nameField = ui->tableWidget->item(ui->tableWidget->currentRow(), ColumnName);
QSharedPointer<VMeasurement> meash;
try
{
// Translate to internal look.
meash = data->GetVariable<VMeasurement>(nameField->data(Qt::UserRole).toString());
}
catch(const VExceptionBadId &e)
{
qCWarning(tMainWindow, "%s\n\n%s\n\n%s",
qUtf8Printable(tr("Can't find measurement '%1'.").arg(nameField->text())),
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
return;
}
m->SetMHeightIncrease(nameField->data(Qt::UserRole).toString(), value);
MeasurementsWasSaved(false);
@ -1688,6 +1644,8 @@ void TMainWindow::SaveMHeightIncrease(double value)
ui->tableWidget->blockSignals(true);
ui->tableWidget->selectRow(row);
ui->tableWidget->blockSignals(false);
ShowMData();
}
//---------------------------------------------------------------------------------------------------------------------
@ -2919,6 +2877,16 @@ void TMainWindow::SetDecimals()
switch (mUnit)
{
case Unit::Cm:
ui->doubleSpinBoxBaseValue->setDecimals(2);
ui->doubleSpinBoxBaseValue->setSingleStep(0.01);
ui->doubleSpinBoxInSizes->setDecimals(2);
ui->doubleSpinBoxInSizes->setSingleStep(0.01);
ui->doubleSpinBoxInHeights->setDecimals(2);
ui->doubleSpinBoxInHeights->setSingleStep(0.01);
break;
case Unit::Mm:
ui->doubleSpinBoxBaseValue->setDecimals(1);
ui->doubleSpinBoxBaseValue->setSingleStep(0.1);
@ -2928,16 +2896,6 @@ void TMainWindow::SetDecimals()
ui->doubleSpinBoxInHeights->setDecimals(1);
ui->doubleSpinBoxInHeights->setSingleStep(0.1);
break;
case Unit::Mm:
ui->doubleSpinBoxBaseValue->setDecimals(0);
ui->doubleSpinBoxBaseValue->setSingleStep(1);
ui->doubleSpinBoxInSizes->setDecimals(0);
ui->doubleSpinBoxInSizes->setSingleStep(1);
ui->doubleSpinBoxInHeights->setDecimals(0);
ui->doubleSpinBoxInHeights->setSingleStep(1);
break;
case Unit::Inch:
ui->doubleSpinBoxBaseValue->setDecimals(5);
ui->doubleSpinBoxBaseValue->setSingleStep(0.00001);

View File

@ -62,7 +62,13 @@ MainWindowsNoGUI::MainWindowsNoGUI(QWidget *parent)
shadows(QList<QGraphicsItem *>()), scenes(QList<QGraphicsScene *>()), details(QList<QList<QGraphicsItem *> >()),
undoAction(nullptr), redoAction(nullptr), actionDockWidgetToolOptions(nullptr), actionDockWidgetGroups(nullptr),
curFile(QString()),
isLayoutStale(true), margins(), paperSize(), isTiled(false)
isLayoutStale(true),
margins(),
paperSize(),
isTiled(false),
isAutoCrop(false),
isUnitePages(false)
{
InitTempLayoutScene();
}
@ -130,6 +136,8 @@ bool MainWindowsNoGUI::LayoutSettings(VLayoutGenerator& lGenerator)
PrepareSceneList();
margins = lGenerator.GetFields();
paperSize = QSizeF(lGenerator.GetPaperWidth(), lGenerator.GetPaperHeight());
isAutoCrop = lGenerator.GetAutoCrop();
isUnitePages = lGenerator.IsUnitePages();
isLayoutStale = false;
if (VApplication::IsGUIMode())
{
@ -913,7 +921,16 @@ void MainWindowsNoGUI::SetPrinterSettings(QPrinter *printer, const PrintType &pr
if (not isTiled)
{
const QSizeF size = QSizeF(FromPixel(paperSize.width(), Unit::Mm), FromPixel(paperSize.height(), Unit::Mm));
QSizeF size = QSizeF(FromPixel(paperSize.width(), Unit::Mm), FromPixel(paperSize.height(), Unit::Mm));
if (isAutoCrop || isUnitePages)
{
auto *paper = qgraphicsitem_cast<QGraphicsRectItem *>(papers.at(0));
if (paper)
{
size = QSizeF(FromPixel(paperSize.width(), Unit::Mm), FromPixel(paper->rect().height(), Unit::Mm));
}
}
const QPrinter::PageSize pSZ = FindTemplate(size);
if (pSZ == QPrinter::Custom)
{

View File

@ -103,6 +103,8 @@ private:
Q_DISABLE_COPY(MainWindowsNoGUI)
bool isTiled;
bool isAutoCrop;
bool isUnitePages;
void CreateShadows();
void CreateScenes();

View File

@ -437,20 +437,20 @@ win32:*-g++ {
SCP_FOUND = false
exists("C:/Program Files (x86)/Inno Setup 5/iscc.exe") {
INNO_ISCC = "C:/Program Files (x86)/Inno Setup 5/iscc.exe"
SCP_FOUND = true
} else {
exists(INNO_ISCC = "C:/Program Files/Inno Setup 5/iscc.exe") {
INNO_ISCC = INNO_ISCC = "C:/Program Files/Inno Setup 5/iscc.exe"
SCP_FOUND = true
}
INNO_ISCC = "C:/Program Files (x86)/Inno Setup 5/iscc.exe"
SCP_FOUND = true
} else {
exists("C:/Program Files/Inno Setup 5/iscc.exe") {
INNO_ISCC = "C:/Program Files/Inno Setup 5/iscc.exe"
SCP_FOUND = true
}
}
if($$SCP_FOUND) {
package_inno.path = $${OUT_PWD}/../../../package
package_inno.files += \
$$PWD/../../../dist/win/inno/LICENSE_VALENTINA \
$$PWD/../../../dist/win/inno/valentina.iss
$$PWD/../../../dist/win/inno/valentina.iss
INSTALLS += package_inno
# Do the packaging