Merge with develop

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2015-11-09 13:36:36 +02:00
commit 9a865ab72d
3 changed files with 60 additions and 8 deletions

View file

@ -1142,6 +1142,8 @@ void MainWindow::LoadIndividual()
ui->actionShowM->setEnabled(true);
helpLabel->setText(tr("Measurements loaded"));
doc->LiteParseTree(Document::LiteParse);
UpdateWindowTitle();
}
}
}
@ -1169,6 +1171,8 @@ void MainWindow::LoadStandard()
ui->actionShowM->setEnabled(true);
helpLabel->setText(tr("Measurements loaded"));
doc->LiteParseTree(Document::LiteParse);
UpdateWindowTitle();
}
}
}
@ -1190,6 +1194,8 @@ void MainWindow::UnloadMeasurements()
ui->actionShowM->setEnabled(false);
ui->actionUnloadMeasurements->setDisabled(true);
helpLabel->setText(tr("Measurements unloaded"));
UpdateWindowTitle();
}
else
{
@ -1266,6 +1272,7 @@ void MainWindow::MeasurementsChanged(const QString &path)
}
}
UpdateWindowTitle();
ToggleMSync(true);
}
@ -1287,6 +1294,7 @@ void MainWindow::SyncMeasurements()
VWidgetPopup::PopupMessage(this, msg);
doc->LiteParseTree(Document::LiteParse);
mChanges = false;
UpdateWindowTitle();
}
else
{
@ -2823,12 +2831,7 @@ void MainWindow::setCurrentFile(const QString &fileName)
curFile = fileName;
qApp->getUndoStack()->setClean();
QString shownName = StrippedName(curFile);
if (curFile.isEmpty())
{
shownName = tr("untitled.val");
}
else
if (not curFile.isEmpty())
{
qCDebug(vMainWindow, "Updating recent file list.");
VSettings *settings = qApp->ValentinaSettings();
@ -2849,8 +2852,8 @@ void MainWindow::setCurrentFile(const QString &fileName)
restoreFiles.prepend(fileName);
settings->SetRestoreFileList(restoreFiles);
}
shownName+="[*]";
setWindowTitle(shownName);
UpdateWindowTitle();
}
//---------------------------------------------------------------------------------------------------------------------
@ -3896,3 +3899,43 @@ void MainWindow::ProcessCMD()
qApp->exit(V_EX_OK);// close program after processing in console mode
}
}
//---------------------------------------------------------------------------------------------------------------------
QString MainWindow::GetPatternFileName()
{
QString shownName = tr("untitled.val");
if(not curFile.isEmpty())
{
shownName = StrippedName(curFile);
}
shownName += "[*]";
return shownName;
}
//---------------------------------------------------------------------------------------------------------------------
QString MainWindow::GetMeasurementFileName()
{
if(doc->MPath().isEmpty())
{
return "";
}
else
{
QString shownName = " [";
shownName += StrippedName(AbsoluteMPath(curFile, doc->MPath()));
if(mChanges)
{
shownName += "*";
}
shownName += "]";
return shownName;
}
}
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::UpdateWindowTitle()
{
setWindowTitle(GetPatternFileName()+GetMeasurementFileName());
}

View file

@ -311,6 +311,11 @@ private:
void SetSize(const QString &text);
void SetHeight(const QString & text);
QString GetPatternFileName();
QString GetMeasurementFileName();
void UpdateWindowTitle();
};
#endif // MAINWINDOW_H

View file

@ -866,7 +866,11 @@ void MainWindowsNoGUI::SetPrinterSettings(QPrinter *printer)
printer->setPageMargins(left, top, right, bottom, QPrinter::Millimeter);
}
#ifdef Q_OS_WIN
printer->setOutputFileName(QDir::homePath() + QDir::separator() + FileName());
#else
printer->setOutputFileName(QDir::homePath() + QDir::separator() + FileName() + QLatin1Literal(".pdf"));
#endif
printer->setDocName(FileName());
IsLayoutGrayscale() ? printer->setColorMode(QPrinter::GrayScale) : printer->setColorMode(QPrinter::Color);