Save and Save as.
--HG-- branch : feature
This commit is contained in:
parent
5ba6d62d94
commit
4aa690d55d
|
@ -32,6 +32,10 @@
|
||||||
#include "dialogs/dialogabouttape.h"
|
#include "dialogs/dialogabouttape.h"
|
||||||
#include "dialogs/dialognewmeasurements.h"
|
#include "dialogs/dialognewmeasurements.h"
|
||||||
|
|
||||||
|
#include <QFileDialog>
|
||||||
|
#include <QFileInfo>
|
||||||
|
#include <QMessageBox>
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
TMainWindow::TMainWindow(QWidget *parent)
|
TMainWindow::TMainWindow(QWidget *parent)
|
||||||
:QMainWindow(parent),
|
:QMainWindow(parent),
|
||||||
|
@ -39,7 +43,8 @@ TMainWindow::TMainWindow(QWidget *parent)
|
||||||
m(nullptr),
|
m(nullptr),
|
||||||
data(nullptr),
|
data(nullptr),
|
||||||
mUnit(Unit::Cm),
|
mUnit(Unit::Cm),
|
||||||
mType(MeasurementsType::Individual)
|
mType(MeasurementsType::Individual),
|
||||||
|
curFile()
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
ui->tabWidget->setVisible(false);
|
ui->tabWidget->setVisible(false);
|
||||||
|
@ -87,6 +92,9 @@ void TMainWindow::FileNew()
|
||||||
m = new VMeasurements(mUnit, data);
|
m = new VMeasurements(mUnit, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SetCurrentFile("");
|
||||||
|
MeasurementsWasSaved(false);
|
||||||
|
|
||||||
InitWindow();
|
InitWindow();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -113,13 +121,88 @@ void TMainWindow::FileOpen()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void TMainWindow::FileSave()
|
void TMainWindow::FileSave()
|
||||||
{
|
{
|
||||||
|
if (curFile.isEmpty())
|
||||||
|
{
|
||||||
|
return FileSaveAs();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QString error;
|
||||||
|
bool result = SaveMeasurements(curFile, error);
|
||||||
|
if (not result)
|
||||||
|
{
|
||||||
|
QMessageBox messageBox;
|
||||||
|
messageBox.setIcon(QMessageBox::Warning);
|
||||||
|
messageBox.setInformativeText(tr("Could not save file"));
|
||||||
|
messageBox.setDefaultButton(QMessageBox::Ok);
|
||||||
|
messageBox.setDetailedText(error);
|
||||||
|
messageBox.setStandardButtons(QMessageBox::Ok);
|
||||||
|
messageBox.exec();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void TMainWindow::FileSaveAs()
|
void TMainWindow::FileSaveAs()
|
||||||
{
|
{
|
||||||
|
QString filters;
|
||||||
|
QString fName = tr("measurements");
|
||||||
|
QString suffix;
|
||||||
|
if (mType == MeasurementsType::Individual)
|
||||||
|
{
|
||||||
|
filters = tr("Standard measurements (*.vst)");
|
||||||
|
suffix = "vst";
|
||||||
|
fName += "." + suffix;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
filters = tr("Individual measurements (*.vit)");
|
||||||
|
suffix = "vit";
|
||||||
|
fName += "." + suffix;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString dir;
|
||||||
|
if (curFile.isEmpty())
|
||||||
|
{
|
||||||
|
if (mType == MeasurementsType::Individual)
|
||||||
|
{
|
||||||
|
dir = qApp->Settings()->GetPathStandardMeasurements() + "/" + fName;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dir = qApp->Settings()->GetPathIndividualMeasurements() + "/" + fName;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dir = QFileInfo(curFile).absolutePath() + "/" + fName;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString fileName = QFileDialog::getSaveFileName(this, tr("Save as"), dir, filters);
|
||||||
|
|
||||||
|
if (fileName.isEmpty())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QFileInfo f( fileName );
|
||||||
|
if (f.suffix().isEmpty() && f.suffix() != suffix)
|
||||||
|
{
|
||||||
|
fileName += "." + suffix;
|
||||||
|
}
|
||||||
|
QString error;
|
||||||
|
bool result = SaveMeasurements(fileName, error);
|
||||||
|
if (result == false)
|
||||||
|
{
|
||||||
|
QMessageBox messageBox;
|
||||||
|
messageBox.setIcon(QMessageBox::Warning);
|
||||||
|
messageBox.setInformativeText(tr("Could not save file"));
|
||||||
|
messageBox.setDefaultButton(QMessageBox::Ok);
|
||||||
|
messageBox.setDetailedText(error);
|
||||||
|
messageBox.setStandardButtons(QMessageBox::Ok);
|
||||||
|
messageBox.exec();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -330,6 +413,7 @@ void TMainWindow::InitWindow()
|
||||||
ui->actionAddCustom->setEnabled(true);
|
ui->actionAddCustom->setEnabled(true);
|
||||||
ui->actionAddKnown->setEnabled(true);
|
ui->actionAddKnown->setEnabled(true);
|
||||||
ui->actionReadOnly->setEnabled(true);
|
ui->actionReadOnly->setEnabled(true);
|
||||||
|
ui->actionSaveAs->setEnabled(true);
|
||||||
|
|
||||||
InitTable();
|
InitTable();
|
||||||
}
|
}
|
||||||
|
@ -348,3 +432,50 @@ void TMainWindow::InitTable()
|
||||||
ui->tableWidget->setColumnHidden( 4, true );// in heights
|
ui->tableWidget->setColumnHidden( 4, true );// in heights
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void TMainWindow::MeasurementsWasSaved(bool saved)
|
||||||
|
{
|
||||||
|
setWindowModified(!saved);
|
||||||
|
ui->actionSave->setEnabled(!saved);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void TMainWindow::SetCurrentFile(const QString &fileName)
|
||||||
|
{
|
||||||
|
curFile = fileName;
|
||||||
|
QString shownName = QFileInfo(curFile).fileName();
|
||||||
|
if (curFile.isEmpty())
|
||||||
|
{
|
||||||
|
shownName = tr("untitled");
|
||||||
|
if (mType == MeasurementsType::Standard)
|
||||||
|
{
|
||||||
|
shownName += ".vst";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
shownName += ".vit";
|
||||||
|
}
|
||||||
|
ui->labelPathToFile->setText(tr("<Empty>"));
|
||||||
|
ui->pushButtonShowInFolder->setEnabled(false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui->labelPathToFile->setText(curFile);
|
||||||
|
ui->pushButtonShowInFolder->setEnabled(true);
|
||||||
|
}
|
||||||
|
shownName += "[*]";
|
||||||
|
setWindowTitle(shownName);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
bool TMainWindow::SaveMeasurements(const QString &fileName, QString &error)
|
||||||
|
{
|
||||||
|
const bool result = m->SaveDocument(fileName, error);
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
SetCurrentFile(fileName);
|
||||||
|
MeasurementsWasSaved(result);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
|
@ -73,10 +73,15 @@ private:
|
||||||
VContainer *data;
|
VContainer *data;
|
||||||
Unit mUnit;
|
Unit mUnit;
|
||||||
MeasurementsType mType;
|
MeasurementsType mType;
|
||||||
|
QString curFile;
|
||||||
|
|
||||||
void SetupMenu();
|
void SetupMenu();
|
||||||
void InitWindow();
|
void InitWindow();
|
||||||
void InitTable();
|
void InitTable();
|
||||||
|
|
||||||
|
void MeasurementsWasSaved(bool saved);
|
||||||
|
void SetCurrentFile(const QString &fileName);
|
||||||
|
bool SaveMeasurements(const QString &fileName, QString &error);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TMAINWINDOW_H
|
#endif // TMAINWINDOW_H
|
||||||
|
|
|
@ -423,7 +423,7 @@
|
||||||
<item row="1" column="1">
|
<item row="1" column="1">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayoutPath">
|
<layout class="QHBoxLayout" name="horizontalLayoutPath">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_18">
|
<widget class="QLabel" name="labelPathToFile">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Path to file</string>
|
<string>Path to file</string>
|
||||||
</property>
|
</property>
|
||||||
|
|
|
@ -88,8 +88,8 @@ void PathPage::DefaultPath()
|
||||||
switch (row)
|
switch (row)
|
||||||
{
|
{
|
||||||
case 1: // standard measurements
|
case 1: // standard measurements
|
||||||
item->setText(VSettings::StandardTablesPath());
|
item->setText(qApp->Settings()->StandardTablesPath());
|
||||||
item->setToolTip(VSettings::StandardTablesPath());
|
item->setToolTip(qApp->Settings()->StandardTablesPath());
|
||||||
break;
|
break;
|
||||||
case 0: // individual measurements
|
case 0: // individual measurements
|
||||||
case 2: // pattern path
|
case 2: // pattern path
|
||||||
|
|
|
@ -1543,7 +1543,7 @@ bool MainWindow::SaveAs()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dir = QFileInfo(curFile).absolutePath() + tr("/pattern.val");
|
dir = QFileInfo(curFile).absolutePath() + "/" + tr("pattern") + ".val";
|
||||||
}
|
}
|
||||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Save as"), dir, filters);
|
QString fileName = QFileDialog::getSaveFileName(this, tr("Save as"), dir, filters);
|
||||||
|
|
||||||
|
|
|
@ -272,7 +272,7 @@ void VMeasurements::CreateEmptyStandardFile(Unit unit, int baseSize, int baseHei
|
||||||
mElement.appendChild(version);
|
mElement.appendChild(version);
|
||||||
|
|
||||||
QDomElement ro = createElement(TagReadOnly);
|
QDomElement ro = createElement(TagReadOnly);
|
||||||
const QDomText roNodeText = createTextNode(false);
|
const QDomText roNodeText = createTextNode("false");
|
||||||
ro.appendChild(roNodeText);
|
ro.appendChild(roNodeText);
|
||||||
mElement.appendChild(ro);
|
mElement.appendChild(ro);
|
||||||
|
|
||||||
|
@ -311,7 +311,7 @@ void VMeasurements::CreateEmptyIndividualFile(Unit unit)
|
||||||
mElement.appendChild(version);
|
mElement.appendChild(version);
|
||||||
|
|
||||||
QDomElement ro = createElement(TagReadOnly);
|
QDomElement ro = createElement(TagReadOnly);
|
||||||
const QDomText roNodeText = createTextNode(false);
|
const QDomText roNodeText = createTextNode("false");
|
||||||
ro.appendChild(roNodeText);
|
ro.appendChild(roNodeText);
|
||||||
mElement.appendChild(ro);
|
mElement.appendChild(ro);
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,9 @@
|
||||||
# include <QtMath>
|
# include <QtMath>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
const QString VCommonSettings::SettingPathsIndividualMeasurements = QStringLiteral("paths/individual_measurements");
|
||||||
|
const QString VCommonSettings::SettingPathsStandardMeasurements = QStringLiteral("paths/standard_measurements");
|
||||||
|
|
||||||
const QString VCommonSettings::SettingConfigurationOsSeparator = QStringLiteral("configuration/osSeparator");
|
const QString VCommonSettings::SettingConfigurationOsSeparator = QStringLiteral("configuration/osSeparator");
|
||||||
const QString VCommonSettings::SettingConfigurationAutosaveState = QStringLiteral("configuration/autosave/state");
|
const QString VCommonSettings::SettingConfigurationAutosaveState = QStringLiteral("configuration/autosave/state");
|
||||||
const QString VCommonSettings::SettingConfigurationAutosaveTime = QStringLiteral("configuration/autosave/time");
|
const QString VCommonSettings::SettingConfigurationAutosaveTime = QStringLiteral("configuration/autosave/time");
|
||||||
|
@ -66,6 +69,30 @@ VCommonSettings::VCommonSettings(Format format, Scope scope, const QString &orga
|
||||||
:QSettings(format, scope, organization, application, parent)
|
:QSettings(format, scope, organization, application, parent)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QString VCommonSettings::GetPathIndividualMeasurements() const
|
||||||
|
{
|
||||||
|
return value(SettingPathsIndividualMeasurements, QDir::homePath()).toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VCommonSettings::SetPathIndividualMeasurements(const QString &value)
|
||||||
|
{
|
||||||
|
setValue(SettingPathsIndividualMeasurements, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QString VCommonSettings::GetPathStandardMeasurements() const
|
||||||
|
{
|
||||||
|
return value(SettingPathsStandardMeasurements, StandardTablesPath()).toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VCommonSettings::SetPathStandardMeasurements(const QString &value)
|
||||||
|
{
|
||||||
|
setValue(SettingPathsStandardMeasurements, value);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool VCommonSettings::GetOsSeparator() const
|
bool VCommonSettings::GetOsSeparator() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -39,6 +39,14 @@ public:
|
||||||
VCommonSettings(Format format, Scope scope, const QString &organization, const QString &application = QString(),
|
VCommonSettings(Format format, Scope scope, const QString &organization, const QString &application = QString(),
|
||||||
QObject *parent = 0);
|
QObject *parent = 0);
|
||||||
|
|
||||||
|
virtual QString StandardTablesPath()const=0 ;
|
||||||
|
|
||||||
|
QString GetPathIndividualMeasurements() const;
|
||||||
|
void SetPathIndividualMeasurements(const QString &value);
|
||||||
|
|
||||||
|
QString GetPathStandardMeasurements() const;
|
||||||
|
void SetPathStandardMeasurements(const QString &value);
|
||||||
|
|
||||||
bool GetOsSeparator() const;
|
bool GetOsSeparator() const;
|
||||||
void SetOsSeparator(const bool &value);
|
void SetOsSeparator(const bool &value);
|
||||||
|
|
||||||
|
@ -86,6 +94,9 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VCommonSettings)
|
Q_DISABLE_COPY(VCommonSettings)
|
||||||
|
static const QString SettingPathsIndividualMeasurements;
|
||||||
|
static const QString SettingPathsStandardMeasurements;
|
||||||
|
|
||||||
static const QString SettingConfigurationOsSeparator;
|
static const QString SettingConfigurationOsSeparator;
|
||||||
static const QString SettingConfigurationAutosaveState;
|
static const QString SettingConfigurationAutosaveState;
|
||||||
static const QString SettingConfigurationAutosaveTime;
|
static const QString SettingConfigurationAutosaveTime;
|
||||||
|
|
|
@ -43,8 +43,6 @@
|
||||||
|
|
||||||
const QString VSettings::SettingConfigurationLabelLanguage = QStringLiteral("configuration/label_language");
|
const QString VSettings::SettingConfigurationLabelLanguage = QStringLiteral("configuration/label_language");
|
||||||
|
|
||||||
const QString VSettings::SettingPathsIndividualMeasurements = QStringLiteral("paths/individual_measurements");
|
|
||||||
const QString VSettings::SettingPathsStandardMeasurements = QStringLiteral("paths/standard_measurements");
|
|
||||||
const QString VSettings::SettingPathsPattern = QStringLiteral("paths/pattern");
|
const QString VSettings::SettingPathsPattern = QStringLiteral("paths/pattern");
|
||||||
const QString VSettings::SettingPathsLayout = QStringLiteral("paths/layout");
|
const QString VSettings::SettingPathsLayout = QStringLiteral("paths/layout");
|
||||||
|
|
||||||
|
@ -90,30 +88,6 @@ void VSettings::SetLabelLanguage(const QString &value)
|
||||||
setValue(SettingConfigurationLabelLanguage, value);
|
setValue(SettingConfigurationLabelLanguage, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
QString VSettings::GetPathIndividualMeasurements() const
|
|
||||||
{
|
|
||||||
return value(SettingPathsIndividualMeasurements, QDir::homePath()).toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void VSettings::SetPathIndividualMeasurements(const QString &value)
|
|
||||||
{
|
|
||||||
setValue(SettingPathsIndividualMeasurements, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
QString VSettings::GetPathStandardMeasurements() const
|
|
||||||
{
|
|
||||||
return value(SettingPathsStandardMeasurements, StandardTablesPath()).toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void VSettings::SetPathStandardMeasurements(const QString &value)
|
|
||||||
{
|
|
||||||
setValue(SettingPathsStandardMeasurements, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VSettings::GetPathPattern() const
|
QString VSettings::GetPathPattern() const
|
||||||
{
|
{
|
||||||
|
@ -495,7 +469,7 @@ void VSettings::SetLayoutUnitePages(bool value)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VSettings::StandardTablesPath()
|
QString VSettings::StandardTablesPath() const
|
||||||
{
|
{
|
||||||
const QString stPath = QStringLiteral("/tables/standard");
|
const QString stPath = QStringLiteral("/tables/standard");
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
|
|
|
@ -39,17 +39,11 @@ public:
|
||||||
VSettings(Format format, Scope scope, const QString &organization, const QString &application = QString(),
|
VSettings(Format format, Scope scope, const QString &organization, const QString &application = QString(),
|
||||||
QObject *parent = 0);
|
QObject *parent = 0);
|
||||||
|
|
||||||
static QString StandardTablesPath();
|
virtual QString StandardTablesPath() const Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
QString GetLabelLanguage() const;
|
QString GetLabelLanguage() const;
|
||||||
void SetLabelLanguage(const QString &value);
|
void SetLabelLanguage(const QString &value);
|
||||||
|
|
||||||
QString GetPathIndividualMeasurements() const;
|
|
||||||
void SetPathIndividualMeasurements(const QString &value);
|
|
||||||
|
|
||||||
QString GetPathStandardMeasurements() const;
|
|
||||||
void SetPathStandardMeasurements(const QString &value);
|
|
||||||
|
|
||||||
QString GetPathPattern() const;
|
QString GetPathPattern() const;
|
||||||
void SetPathPattern(const QString &value);
|
void SetPathPattern(const QString &value);
|
||||||
|
|
||||||
|
@ -128,8 +122,6 @@ private:
|
||||||
Q_DISABLE_COPY(VSettings)
|
Q_DISABLE_COPY(VSettings)
|
||||||
static const QString SettingConfigurationLabelLanguage;
|
static const QString SettingConfigurationLabelLanguage;
|
||||||
|
|
||||||
static const QString SettingPathsIndividualMeasurements;
|
|
||||||
static const QString SettingPathsStandardMeasurements;
|
|
||||||
static const QString SettingPathsPattern;
|
static const QString SettingPathsPattern;
|
||||||
static const QString SettingPathsLayout;
|
static const QString SettingPathsLayout;
|
||||||
|
|
||||||
|
|
|
@ -28,9 +28,81 @@
|
||||||
|
|
||||||
#include "vtapesettings.h"
|
#include "vtapesettings.h"
|
||||||
|
|
||||||
|
#include <QApplication>
|
||||||
|
#include <QDir>
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VTapeSettings::VTapeSettings(Format format, Scope scope, const QString &organization, const QString &application,
|
VTapeSettings::VTapeSettings(Format format, Scope scope, const QString &organization, const QString &application,
|
||||||
QObject *parent)
|
QObject *parent)
|
||||||
:VCommonSettings(format, scope, organization, application, parent)
|
:VCommonSettings(format, scope, organization, application, parent)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QString VTapeSettings::StandardTablesPath() const
|
||||||
|
{
|
||||||
|
const QString stPath = QStringLiteral("/tables/standard");
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
QDir dir(QApplication::applicationDirPath() + stPath);
|
||||||
|
if (dir.exists())
|
||||||
|
{
|
||||||
|
return dir.absolutePath();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return QApplication::applicationDirPath() + "../../valentina/bin" + stPath;
|
||||||
|
}
|
||||||
|
#elif defined(Q_OS_MAC)
|
||||||
|
QDir dirBundle(QApplication::applicationDirPath() + QStringLiteral("/../Resources") + stPath);
|
||||||
|
if (dirBundle.exists())
|
||||||
|
{
|
||||||
|
return dirBundle.absolutePath();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QDir dir1(QApplication::applicationDirPath() + stPath);
|
||||||
|
if (dir1.exists())
|
||||||
|
{
|
||||||
|
return dir1.absolutePath();
|
||||||
|
}
|
||||||
|
|
||||||
|
QDir dir2(QApplication::applicationDirPath() + "../../valentina/bin" + stPath);
|
||||||
|
if (dir2.exists())
|
||||||
|
{
|
||||||
|
return dir2.absolutePath();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return QStringLiteral("/usr/share/valentina/tables/standard");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else // Unix
|
||||||
|
#ifdef QT_DEBUG
|
||||||
|
QDir dir(QApplication::applicationDirPath() + stPath);
|
||||||
|
if (dir.exists())
|
||||||
|
{
|
||||||
|
return dir.absolutePath();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return QApplication::applicationDirPath() + "../../valentina/bin" + stPath;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
QDir dir1(QApplication::applicationDirPath() + stPath);
|
||||||
|
if (dir1.exists())
|
||||||
|
{
|
||||||
|
return dir1.absolutePath();
|
||||||
|
}
|
||||||
|
|
||||||
|
QDir dir2(QApplication::applicationDirPath() + "../../valentina/bin" + stPath);
|
||||||
|
if (dir2.exists())
|
||||||
|
{
|
||||||
|
return dir2.absolutePath();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return QStringLiteral("/usr/share/valentina/tables/standard");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
|
@ -37,6 +37,11 @@ class VTapeSettings : public VCommonSettings
|
||||||
public:
|
public:
|
||||||
VTapeSettings(Format format, Scope scope, const QString &organization, const QString &application = QString(),
|
VTapeSettings(Format format, Scope scope, const QString &organization, const QString &application = QString(),
|
||||||
QObject *parent = 0);
|
QObject *parent = 0);
|
||||||
|
|
||||||
|
virtual QString StandardTablesPath()const Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
|
private:
|
||||||
|
Q_DISABLE_COPY(VTapeSettings)
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VTAPESETTINGS_H
|
#endif // VTAPESETTINGS_H
|
||||||
|
|
Loading…
Reference in New Issue
Block a user