Run Tape for creating measurement file.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2015-08-18 13:36:17 +03:00
parent f3d24856be
commit 05acaaa8fc
5 changed files with 74 additions and 3 deletions

View file

@ -308,6 +308,59 @@ QString VApplication::translationsPath() const
#endif #endif
} }
//---------------------------------------------------------------------------------------------------------------------
QString VApplication::TapeFilePath() const
{
const QString tape = QStringLiteral("tape");
#ifdef Q_OS_WIN
QFileInfo tapeFile(QApplication::applicationDirPath() + "/" + tape + ".exe");
if (tapeFile.exists())
{
return fileBundle.absoluteFilePath();
}
else
{
return QApplication::applicationDirPath() + "/../../tape/bin/" + tape + ".exe";
}
#elif defined(Q_OS_MAC)
QFileInfo tapeFile(QApplication::applicationDirPath() + "/" + tape);
if (tapeFile.exists())
{
return tapeFile.absoluteFilePath();
}
else
{
QFileInfo file(QApplication::applicationDirPath() + "/../../tape/bin/" + tape);
if (file.exists())
{
return file.absoluteFilePath();
}
else
{
return tape;
}
}
#else // Unix
QFileInfo file(QApplication::applicationDirPath() + "/../../tape/bin/" + tape);
if (file.exists())
{
return file.absoluteFilePath();
}
else
{
QFileInfo tapeFile(QApplication::applicationDirPath() + "/" + tape);
if (tapeFile.exists())
{
return tapeFile.absoluteFilePath();
}
else
{
return tape;
}
}
#endif
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QString VApplication::LogDirPath() const QString VApplication::LogDirPath() const
{ {

View file

@ -60,6 +60,7 @@ public:
void InitOptions(); void InitOptions();
QString translationsPath() const; QString translationsPath() const;
QString TapeFilePath() const;
QTimer *getAutoSaveTimer() const; QTimer *getAutoSaveTimer() const;
void setAutoSaveTimer(QTimer *value); void setAutoSaveTimer(QTimer *value);

View file

@ -301,6 +301,7 @@ void MainWindow::LoadMeasurements(const QString &path)
delete m; delete m;
return; return;
} }
helpLabel->setText(tr("Measurements loaded"));
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -1001,6 +1002,12 @@ void MainWindow::LoadStandard()
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::CreateMeasurements()
{
QProcess::startDetached(qApp->TapeFilePath());
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
* @brief ToolBarOption enable option toolbar. * @brief ToolBarOption enable option toolbar.
@ -1033,9 +1040,9 @@ void MainWindow::ToolBarOption()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QComboBox *MainWindow::SetGradationList(const QString &label, const QStringList &list) QComboBox *MainWindow::SetGradationList(const QString &label, const QStringList &list)
{ {
ui->toolBarOption->addWidget(new QLabel(label)); ui->toolBarOption->addWidget(new QLabel(label, this));
QComboBox *comboBox = new QComboBox; QComboBox *comboBox = new QComboBox(this);
comboBox->addItems(list); comboBox->addItems(list);
ui->toolBarOption->addWidget(comboBox); ui->toolBarOption->addWidget(comboBox);
@ -2766,7 +2773,7 @@ void MainWindow::CreateActions()
connect(ui->actionShowCurveDetails, &QAction::triggered, this, &MainWindow::ActionCurveDetailsMode); connect(ui->actionShowCurveDetails, &QAction::triggered, this, &MainWindow::ActionCurveDetailsMode);
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->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

@ -162,6 +162,7 @@ protected:
private slots: private slots:
void LoadIndividual(); void LoadIndividual();
void LoadStandard(); void LoadStandard();
void CreateMeasurements();
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

@ -1087,6 +1087,7 @@
<addaction name="actionTable"/> <addaction name="actionTable"/>
<addaction name="actionLoadIndividual"/> <addaction name="actionLoadIndividual"/>
<addaction name="actionLoadStandard"/> <addaction name="actionLoadStandard"/>
<addaction name="actionCreateNew"/>
</widget> </widget>
<widget class="QMenu" name="menuWindow"> <widget class="QMenu" name="menuWindow">
<property name="title"> <property name="title">
@ -1872,6 +1873,14 @@
<string>Load Standard ...</string> <string>Load Standard ...</string>
</property> </property>
</action> </action>
<action name="actionCreateNew">
<property name="text">
<string>Create new ...</string>
</property>
<property name="toolTip">
<string>Create new measurements</string>
</property>
</action>
</widget> </widget>
<layoutdefault spacing="6" margin="11"/> <layoutdefault spacing="6" margin="11"/>
<customwidgets> <customwidgets>