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(); const QStringList args = parser.positionalArguments();
if (args.count() > 1) if (args.count() > 0)
{ {
for (int i = 0; i < args.size(); ++i) for (int i = 0; i < args.size(); ++i)
{ {

View File

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

View File

@ -293,7 +293,7 @@ void MainWindow::LoadMeasurements(const QString &path)
delete m; delete m;
doc->SetPath(path); doc->SetPath(path);
PatternWasModified(false); PatternWasModified(false);
doc->LiteParseTree(Document::LiteParse); ui->actionShowM->setEnabled(true);
} }
catch (VException &e) catch (VException &e)
{ {
@ -985,6 +985,7 @@ void MainWindow::LoadIndividual()
if (not mPath.isEmpty()) if (not mPath.isEmpty())
{ {
LoadMeasurements(mPath); LoadMeasurements(mPath);
doc->LiteParseTree(Document::LiteParse);
} }
} }
@ -999,6 +1000,7 @@ void MainWindow::LoadStandard()
if (not mPath.isEmpty()) if (not mPath.isEmpty())
{ {
LoadMeasurements(mPath); LoadMeasurements(mPath);
doc->LiteParseTree(Document::LiteParse);
} }
} }
@ -1008,6 +1010,32 @@ void MainWindow::CreateMeasurements()
QProcess::startDetached(qApp->TapeFilePath()); 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. * @brief ToolBarOption enable option toolbar.
@ -1825,6 +1853,7 @@ void MainWindow::Clear()
ui->actionShowCurveDetails->setEnabled(false); ui->actionShowCurveDetails->setEnabled(false);
ui->actionLoadIndividual->setEnabled(false); ui->actionLoadIndividual->setEnabled(false);
ui->actionLoadStandard->setEnabled(false); ui->actionLoadStandard->setEnabled(false);
ui->actionShowM->setEnabled(false);
SetEnableTool(false); SetEnableTool(false);
qApp->setPatternUnit(Unit::Cm); qApp->setPatternUnit(Unit::Cm);
qApp->setPatternType(MeasurementsType::Individual); qApp->setPatternType(MeasurementsType::Individual);
@ -2774,6 +2803,7 @@ void MainWindow::CreateActions()
connect(ui->actionLoadIndividual, &QAction::triggered, this, &MainWindow::LoadIndividual); connect(ui->actionLoadIndividual, &QAction::triggered, this, &MainWindow::LoadIndividual);
connect(ui->actionLoadStandard, &QAction::triggered, this, &MainWindow::LoadStandard); connect(ui->actionLoadStandard, &QAction::triggered, this, &MainWindow::LoadStandard);
connect(ui->actionCreateNew, &QAction::triggered, this, &MainWindow::CreateMeasurements); 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->actionExportAs, &QAction::triggered, this, &MainWindow::ExportLayoutAs);
connect(ui->actionPrintPreview, &QAction::triggered, this, &MainWindow::PrintPreviewOrigin); connect(ui->actionPrintPreview, &QAction::triggered, this, &MainWindow::PrintPreviewOrigin);
connect(ui->actionPrintPreviewTailed, &QAction::triggered, this, &MainWindow::PrintPreviewTiled); connect(ui->actionPrintPreviewTailed, &QAction::triggered, this, &MainWindow::PrintPreviewTiled);

View File

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

View File

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

View File

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