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
}
//---------------------------------------------------------------------------------------------------------------------
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
{

View File

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

View File

@ -301,6 +301,7 @@ void MainWindow::LoadMeasurements(const QString &path)
delete m;
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.
@ -1033,9 +1040,9 @@ void MainWindow::ToolBarOption()
//---------------------------------------------------------------------------------------------------------------------
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);
ui->toolBarOption->addWidget(comboBox);
@ -2766,7 +2773,7 @@ void MainWindow::CreateActions()
connect(ui->actionShowCurveDetails, &QAction::triggered, this, &MainWindow::ActionCurveDetailsMode);
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->actionExportAs, &QAction::triggered, this, &MainWindow::ExportLayoutAs);
connect(ui->actionPrintPreview, &QAction::triggered, this, &MainWindow::PrintPreviewOrigin);
connect(ui->actionPrintPreviewTailed, &QAction::triggered, this, &MainWindow::PrintPreviewTiled);

View File

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

View File

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