Show current measurements in Tape.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2015-08-18 17:53:33 +03:00
parent 81d072d030
commit 6c2c36a11d
6 changed files with 56 additions and 7 deletions

View file

@ -156,7 +156,7 @@ int main(int argc, char *argv[])
}
const QStringList args = parser.positionalArguments();
if (args.count() > 1)
if (args.count() > 0)
{
for (int i = 0; i < args.size(); ++i)
{

View file

@ -161,6 +161,12 @@ void TMainWindow::LoadFile(const QString &path)
{
if (m == nullptr)
{
if (not QFileInfo(path).exists())
{
qCritical() << "File " << path << " doesn't exist";
return;
}
// Check if file already opened
QList<TMainWindow*>list = qApp->MainWindows();
for (int i = 0; i < list.size(); ++i)

View file

@ -293,7 +293,7 @@ void MainWindow::LoadMeasurements(const QString &path)
delete m;
doc->SetPath(path);
PatternWasModified(false);
doc->LiteParseTree(Document::LiteParse);
ui->actionShowM->setEnabled(true);
}
catch (VException &e)
{
@ -985,6 +985,7 @@ void MainWindow::LoadIndividual()
if (not mPath.isEmpty())
{
LoadMeasurements(mPath);
doc->LiteParseTree(Document::LiteParse);
}
}
@ -999,6 +1000,7 @@ void MainWindow::LoadStandard()
if (not mPath.isEmpty())
{
LoadMeasurements(mPath);
doc->LiteParseTree(Document::LiteParse);
}
}
@ -1008,6 +1010,32 @@ void MainWindow::CreateMeasurements()
QProcess::startDetached(qApp->TapeFilePath());
}
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ShowMeasurements()
{
if (not doc->MPath().isEmpty())
{
QString run;
if (qApp->patternType() == MeasurementsType::Standard)
{
run = QString("\"%1\" \"%2\" -u %3 -h %4 -s %5").arg(qApp->TapeFilePath()).arg(doc->MPath())
.arg(VDomDocument::UnitsToStr(qApp->patternUnit()))
.arg(static_cast<int>(pattern->height()))
.arg(static_cast<int>(pattern->size()));
}
else
{
run = QString("\"%1\" \"%2\" -u %3").arg(qApp->TapeFilePath()).arg(doc->MPath())
.arg(VDomDocument::UnitsToStr(qApp->patternUnit()));
}
QProcess::startDetached(run);
}
else
{
ui->actionShowM->setEnabled(false);
}
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ToolBarOption enable option toolbar.
@ -1825,6 +1853,7 @@ void MainWindow::Clear()
ui->actionShowCurveDetails->setEnabled(false);
ui->actionLoadIndividual->setEnabled(false);
ui->actionLoadStandard->setEnabled(false);
ui->actionShowM->setEnabled(false);
SetEnableTool(false);
qApp->setPatternUnit(Unit::Cm);
qApp->setPatternType(MeasurementsType::Individual);
@ -2774,6 +2803,7 @@ void MainWindow::CreateActions()
connect(ui->actionLoadIndividual, &QAction::triggered, this, &MainWindow::LoadIndividual);
connect(ui->actionLoadStandard, &QAction::triggered, this, &MainWindow::LoadStandard);
connect(ui->actionCreateNew, &QAction::triggered, this, &MainWindow::CreateMeasurements);
connect(ui->actionShowM, &QAction::triggered, this, &MainWindow::ShowMeasurements);
connect(ui->actionExportAs, &QAction::triggered, this, &MainWindow::ExportLayoutAs);
connect(ui->actionPrintPreview, &QAction::triggered, this, &MainWindow::PrintPreviewOrigin);
connect(ui->actionPrintPreviewTailed, &QAction::triggered, this, &MainWindow::PrintPreviewTiled);

View file

@ -163,6 +163,7 @@ private slots:
void LoadIndividual();
void LoadStandard();
void CreateMeasurements();
void ShowMeasurements();
private:
Q_DISABLE_COPY(MainWindow)
/** @brief ui keeps information about user interface */

View file

@ -372,7 +372,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>130</width>
<width>117</width>
<height>58</height>
</rect>
</property>
@ -458,7 +458,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>130</width>
<width>117</width>
<height>156</height>
</rect>
</property>
@ -622,7 +622,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>130</width>
<width>117</width>
<height>196</height>
</rect>
</property>
@ -864,7 +864,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>130</width>
<width>117</width>
<height>58</height>
</rect>
</property>
@ -1088,6 +1088,7 @@
<addaction name="actionLoadIndividual"/>
<addaction name="actionLoadStandard"/>
<addaction name="actionCreateNew"/>
<addaction name="actionShowM"/>
</widget>
<widget class="QMenu" name="menuWindow">
<property name="title">
@ -1881,6 +1882,17 @@
<string>Create new measurements</string>
</property>
</action>
<action name="actionShowM">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Show ...</string>
</property>
<property name="toolTip">
<string>Show measurements</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>

View file

@ -453,7 +453,7 @@ QVector<VToolRecord> VAbstractPattern::getLocalHistory() const
//---------------------------------------------------------------------------------------------------------------------
QString VAbstractPattern::MPath() const
{
return UniqueTagText(TagUnit);
return UniqueTagText(TagMeasurements);
}
//---------------------------------------------------------------------------------------------------------------------