Resolved issue #388. Add field for measurement template directory in Valentina.exe, 'File', 'Preferences', 'Paths'
--HG-- branch : feature
This commit is contained in:
parent
de12c77aa4
commit
e16943cfa2
|
@ -66,6 +66,7 @@ void PathPage::Apply()
|
||||||
qApp->ValentinaSettings()->SetPathStandardMeasurements(pathTable->item(1, 1)->text());
|
qApp->ValentinaSettings()->SetPathStandardMeasurements(pathTable->item(1, 1)->text());
|
||||||
qApp->ValentinaSettings()->SetPathPattern(pathTable->item(2, 1)->text());
|
qApp->ValentinaSettings()->SetPathPattern(pathTable->item(2, 1)->text());
|
||||||
qApp->ValentinaSettings()->SetPathLayout(pathTable->item(3, 1)->text());
|
qApp->ValentinaSettings()->SetPathLayout(pathTable->item(3, 1)->text());
|
||||||
|
qApp->ValentinaSettings()->SetPathTemplate(pathTable->item(4, 1)->text());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -97,6 +98,10 @@ void PathPage::DefaultPath()
|
||||||
item->setText(QDir::homePath());
|
item->setText(QDir::homePath());
|
||||||
item->setToolTip(QDir::homePath());
|
item->setToolTip(QDir::homePath());
|
||||||
break;
|
break;
|
||||||
|
case 4: // templates
|
||||||
|
item->setText(qApp->ValentinaSettings()->TemplatesPath());
|
||||||
|
item->setToolTip(qApp->ValentinaSettings()->TemplatesPath());
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -124,6 +129,9 @@ void PathPage::EditPath()
|
||||||
case 3: // layout path
|
case 3: // layout path
|
||||||
path = qApp->ValentinaSettings()->GetPathLayout();
|
path = qApp->ValentinaSettings()->GetPathLayout();
|
||||||
break;
|
break;
|
||||||
|
case 4: // templates
|
||||||
|
path = qApp->ValentinaSettings()->GetPathTemplate();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -169,7 +177,7 @@ QGroupBox *PathPage::PathGroup()
|
||||||
void PathPage::InitTable()
|
void PathPage::InitTable()
|
||||||
{
|
{
|
||||||
pathTable = new QTableWidget();
|
pathTable = new QTableWidget();
|
||||||
pathTable->setRowCount(4);
|
pathTable->setRowCount(5);
|
||||||
pathTable->setColumnCount(2);
|
pathTable->setColumnCount(2);
|
||||||
pathTable->verticalHeader()->setVisible(false);
|
pathTable->verticalHeader()->setVisible(false);
|
||||||
pathTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
pathTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
||||||
|
@ -208,6 +216,13 @@ void PathPage::InitTable()
|
||||||
pathTable->setItem(3, 1, item);
|
pathTable->setItem(3, 1, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
pathTable->setItem(4, 0, new QTableWidgetItem(tr("Templates")));
|
||||||
|
QTableWidgetItem *item = new QTableWidgetItem(qApp->ValentinaSettings()->GetPathTemplate());
|
||||||
|
item->setToolTip(qApp->ValentinaSettings()->GetPathTemplate());
|
||||||
|
pathTable->setItem(4, 1, item);
|
||||||
|
}
|
||||||
|
|
||||||
pathTable->verticalHeader()->setDefaultSectionSize(20);
|
pathTable->verticalHeader()->setDefaultSectionSize(20);
|
||||||
pathTable->resizeColumnsToContents();
|
pathTable->resizeColumnsToContents();
|
||||||
pathTable->resizeRowsToContents();
|
pathTable->resizeRowsToContents();
|
||||||
|
|
|
@ -43,6 +43,7 @@
|
||||||
|
|
||||||
const QString VCommonSettings::SettingPathsIndividualMeasurements = QStringLiteral("paths/individual_measurements");
|
const QString VCommonSettings::SettingPathsIndividualMeasurements = QStringLiteral("paths/individual_measurements");
|
||||||
const QString VCommonSettings::SettingPathsStandardMeasurements = QStringLiteral("paths/standard_measurements");
|
const QString VCommonSettings::SettingPathsStandardMeasurements = QStringLiteral("paths/standard_measurements");
|
||||||
|
const QString VCommonSettings::SettingPathsTemplates = QStringLiteral("paths/templates");
|
||||||
|
|
||||||
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");
|
||||||
|
@ -96,6 +97,63 @@ void VCommonSettings::SetPathStandardMeasurements(const QString &value)
|
||||||
commonSettings.setValue(SettingPathsStandardMeasurements, value);
|
commonSettings.setValue(SettingPathsStandardMeasurements, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QString VCommonSettings::GetPathTemplate() const
|
||||||
|
{
|
||||||
|
QSettings settings(commonSettings.format(), commonSettings.scope(), commonSettings.organizationName());
|
||||||
|
return settings.value(SettingPathsTemplates, TemplatesPath()).toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VCommonSettings::SetPathTemplate(const QString &value)
|
||||||
|
{
|
||||||
|
commonSettings.setValue(SettingPathsTemplates, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QString VCommonSettings::TemplatesPath() const
|
||||||
|
{
|
||||||
|
const QString stPath = QStringLiteral("/tables/templates");
|
||||||
|
const QString unixFullPath = QStringLiteral("/usr/share/valentina/tables/templates");
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
return QApplication::applicationDirPath() + stPath;
|
||||||
|
#elif defined(Q_OS_MAC)
|
||||||
|
QDir dirBundle(QApplication::applicationDirPath() + QStringLiteral("/../Resources") + stPath);
|
||||||
|
if (dirBundle.exists())
|
||||||
|
{
|
||||||
|
return dirBundle.absolutePath();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QDir dir(QApplication::applicationDirPath() + stPath);
|
||||||
|
if (dir.exists())
|
||||||
|
{
|
||||||
|
return dir.absolutePath();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return unixFullPath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else // Unix
|
||||||
|
#ifdef QT_DEBUG
|
||||||
|
Q_UNUSED(unixFullPath);
|
||||||
|
return QApplication::applicationDirPath() + stPath;
|
||||||
|
#else
|
||||||
|
QDir dir(QApplication::applicationDirPath() + stPath);
|
||||||
|
if (dir.exists())
|
||||||
|
{
|
||||||
|
return dir.absolutePath();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return unixFullPath;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool VCommonSettings::GetOsSeparator() const
|
bool VCommonSettings::GetOsSeparator() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -40,6 +40,7 @@ public:
|
||||||
QObject *parent = 0);
|
QObject *parent = 0);
|
||||||
|
|
||||||
virtual QString StandardTablesPath()const=0 ;
|
virtual QString StandardTablesPath()const=0 ;
|
||||||
|
QString TemplatesPath() const;
|
||||||
|
|
||||||
QString GetPathIndividualMeasurements() const;
|
QString GetPathIndividualMeasurements() const;
|
||||||
void SetPathIndividualMeasurements(const QString &value);
|
void SetPathIndividualMeasurements(const QString &value);
|
||||||
|
@ -47,6 +48,9 @@ public:
|
||||||
QString GetPathStandardMeasurements() const;
|
QString GetPathStandardMeasurements() const;
|
||||||
void SetPathStandardMeasurements(const QString &value);
|
void SetPathStandardMeasurements(const QString &value);
|
||||||
|
|
||||||
|
QString GetPathTemplate() const;
|
||||||
|
void SetPathTemplate(const QString &value);
|
||||||
|
|
||||||
bool GetOsSeparator() const;
|
bool GetOsSeparator() const;
|
||||||
void SetOsSeparator(const bool &value);
|
void SetOsSeparator(const bool &value);
|
||||||
|
|
||||||
|
@ -102,6 +106,7 @@ private:
|
||||||
|
|
||||||
static const QString SettingPathsIndividualMeasurements;
|
static const QString SettingPathsIndividualMeasurements;
|
||||||
static const QString SettingPathsStandardMeasurements;
|
static const QString SettingPathsStandardMeasurements;
|
||||||
|
static const QString SettingPathsTemplates;
|
||||||
|
|
||||||
static const QString SettingConfigurationOsSeparator;
|
static const QString SettingConfigurationOsSeparator;
|
||||||
static const QString SettingConfigurationAutosaveState;
|
static const QString SettingConfigurationAutosaveState;
|
||||||
|
|
|
@ -31,7 +31,6 @@
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
|
||||||
const QString VTapeSettings::SettingPathsTemplates = QStringLiteral("paths/templates");
|
|
||||||
const QString VTapeSettings::SettingDataBaseGeometry = QStringLiteral("database/geometry");
|
const QString VTapeSettings::SettingDataBaseGeometry = QStringLiteral("database/geometry");
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -110,61 +109,6 @@ QString VTapeSettings::StandardTablesPath() const
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
QString VTapeSettings::TemplatesPath() const
|
|
||||||
{
|
|
||||||
const QString stPath = QStringLiteral("/tables/templates");
|
|
||||||
const QString unixFullPath = QStringLiteral("/usr/share/valentina/tables/templates");
|
|
||||||
#ifdef Q_OS_WIN
|
|
||||||
return QApplication::applicationDirPath() + stPath;
|
|
||||||
#elif defined(Q_OS_MAC)
|
|
||||||
QDir dirBundle(QApplication::applicationDirPath() + QStringLiteral("/../Resources") + stPath);
|
|
||||||
if (dirBundle.exists())
|
|
||||||
{
|
|
||||||
return dirBundle.absolutePath();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
QDir dir(QApplication::applicationDirPath() + stPath);
|
|
||||||
if (dir.exists())
|
|
||||||
{
|
|
||||||
return dir.absolutePath();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return unixFullPath;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#else // Unix
|
|
||||||
#ifdef QT_DEBUG
|
|
||||||
Q_UNUSED(unixFullPath);
|
|
||||||
return QApplication::applicationDirPath() + stPath;
|
|
||||||
#else
|
|
||||||
QDir dir(QApplication::applicationDirPath() + stPath);
|
|
||||||
if (dir.exists())
|
|
||||||
{
|
|
||||||
return dir.absolutePath();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return unixFullPath;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
QString VTapeSettings::GetPathTemplate() const
|
|
||||||
{
|
|
||||||
return value(SettingPathsTemplates, TemplatesPath()).toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void VTapeSettings::SetPathTemplate(const QString &value)
|
|
||||||
{
|
|
||||||
setValue(SettingPathsTemplates, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QByteArray VTapeSettings::GetDataBaseGeometry() const
|
QByteArray VTapeSettings::GetDataBaseGeometry() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -39,10 +39,6 @@ public:
|
||||||
QObject *parent = 0);
|
QObject *parent = 0);
|
||||||
|
|
||||||
virtual QString StandardTablesPath()const Q_DECL_OVERRIDE;
|
virtual QString StandardTablesPath()const Q_DECL_OVERRIDE;
|
||||||
QString TemplatesPath() const;
|
|
||||||
|
|
||||||
QString GetPathTemplate() const;
|
|
||||||
void SetPathTemplate(const QString &value);
|
|
||||||
|
|
||||||
QByteArray GetDataBaseGeometry() const;
|
QByteArray GetDataBaseGeometry() const;
|
||||||
void SetDataBaseGeometry(const QByteArray &value);
|
void SetDataBaseGeometry(const QByteArray &value);
|
||||||
|
@ -50,7 +46,6 @@ public:
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VTapeSettings)
|
Q_DISABLE_COPY(VTapeSettings)
|
||||||
|
|
||||||
static const QString SettingPathsTemplates;
|
|
||||||
static const QString SettingDataBaseGeometry;
|
static const QString SettingDataBaseGeometry;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user