Fixed issue #397. Added UpdateWindowTitle

--HG--
branch : feature
This commit is contained in:
Valentina Zhuravska 2015-11-04 07:06:44 +02:00
parent 5b9914f409
commit aba82baa98
2 changed files with 54 additions and 28 deletions

View File

@ -360,14 +360,6 @@ bool MainWindow::LoadMeasurements(const QString &path)
}
return false;
}
QString shownName = strippedName(curFile);
if (curFile.isEmpty())
{
shownName = tr("untitled.val");
}
shownName += "[*]";
shownName += " [" + strippedName(path) + "[*]]";
setWindowTitle(shownName);
return true;
}
@ -1121,6 +1113,8 @@ void MainWindow::LoadIndividual()
ui->actionShowM->setEnabled(true);
helpLabel->setText(tr("Measurements loaded"));
doc->LiteParseTree(Document::LiteParse);
UpdateWindowTitle();
}
}
}
@ -1148,6 +1142,8 @@ void MainWindow::LoadStandard()
ui->actionShowM->setEnabled(true);
helpLabel->setText(tr("Measurements loaded"));
doc->LiteParseTree(Document::LiteParse);
UpdateWindowTitle();
}
}
}
@ -1170,13 +1166,7 @@ void MainWindow::UnloadMeasurements()
ui->actionUnloadMeasurements->setDisabled(true);
helpLabel->setText(tr("Measurements unloaded"));
QString shownName = strippedName(curFile);
if (curFile.isEmpty())
{
shownName = tr("untitled.val");
}
shownName += "[*]";
setWindowTitle(shownName);
UpdateWindowTitle();
}
else
{
@ -2810,12 +2800,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();
@ -2836,14 +2821,8 @@ void MainWindow::setCurrentFile(const QString &fileName)
restoreFiles.prepend(fileName);
settings->SetRestoreFileList(restoreFiles);
}
shownName+="[*]";
QString path = AbsoluteMPath(fileName, doc->MPath());
if(not path.isEmpty())
{
shownName += " [" + strippedName(path) + "[*]]";
}
setWindowTitle(shownName);
UpdateWindowTitle();
}
//---------------------------------------------------------------------------------------------------------------------
@ -3889,3 +3868,45 @@ 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()
{
QString shownName = GetPatternFileName();
shownName += GetMeasurementFileName();
setWindowTitle(shownName);
}

View File

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