Change in dialog individual measurements.
--HG-- branch : feature
This commit is contained in:
parent
9e81a2865b
commit
e95b886eb4
|
@ -20,3 +20,22 @@ defineTest(minQtVersion) {
|
||||||
}
|
}
|
||||||
return(false)
|
return(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Copies the given files to the destination directory
|
||||||
|
defineTest(copyToDestdir) {
|
||||||
|
files = $$1
|
||||||
|
DDIR = $$2
|
||||||
|
mkpath($$DDIR)
|
||||||
|
|
||||||
|
for(FILE, files) {
|
||||||
|
|
||||||
|
# Replace slashes in paths with backslashes for Windows
|
||||||
|
win32{
|
||||||
|
FILE ~= s,/,\\,g
|
||||||
|
DDIR ~= s,/,\\,g
|
||||||
|
}
|
||||||
|
QMAKE_POST_LINK += $$QMAKE_COPY $$quote($$FILE) $$quote($$DDIR) $$escape_expand(\\n\\t)
|
||||||
|
}
|
||||||
|
|
||||||
|
export(QMAKE_POST_LINK)
|
||||||
|
}
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
|
|
||||||
# Use out-of-source builds (shadow builds)
|
# Use out-of-source builds (shadow builds)
|
||||||
|
|
||||||
|
include(../../Valentina.pri)
|
||||||
|
|
||||||
QT += core gui widgets xml svg printsupport xmlpatterns
|
QT += core gui widgets xml svg printsupport xmlpatterns
|
||||||
|
|
||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
|
@ -155,16 +157,15 @@ QMAKE_DISTCLEAN += $${DESTDIR}/* \
|
||||||
$${RCC_DIR}/* \
|
$${RCC_DIR}/* \
|
||||||
$$PWD/share/translations/valentina_*.qm
|
$$PWD/share/translations/valentina_*.qm
|
||||||
|
|
||||||
INSTALL_TRANSLATIONS += share/translations/valentina_ru.qm \
|
INSTALL_TRANSLATIONS += \
|
||||||
|
share/translations/valentina_ru.qm \
|
||||||
share/translations/valentina_uk.qm \
|
share/translations/valentina_uk.qm \
|
||||||
share/translations/valentina_de.qm \
|
share/translations/valentina_de.qm \
|
||||||
share/translations/valentina_cs.qm \
|
share/translations/valentina_cs.qm \
|
||||||
share/translations/valentina_he_IL.qm \
|
share/translations/valentina_he_IL.qm \
|
||||||
share/translations/valentina_fr.qm
|
share/translations/valentina_fr.qm
|
||||||
|
|
||||||
INSTALL_STANDARD_MEASHUREMENTS += share/tables/standard/GOST_man_ru.vst
|
INSTALL_STANDARD_MEASHUREMENTS += share/resources/tables/standard/GOST_man_ru.vst
|
||||||
|
|
||||||
INSTALL_INDIVIDUAL_MEASHUREMENTS += share/tables/individual/indivindual_ru.vit
|
|
||||||
|
|
||||||
unix {
|
unix {
|
||||||
#VARIABLES
|
#VARIABLES
|
||||||
|
@ -184,14 +185,12 @@ translations.path = $$DATADIR/$${TARGET}/translations/
|
||||||
translations.files = $$INSTALL_TRANSLATIONS
|
translations.files = $$INSTALL_TRANSLATIONS
|
||||||
standard.path = $$DATADIR/$${TARGET}/tables/standard/
|
standard.path = $$DATADIR/$${TARGET}/tables/standard/
|
||||||
standard.files = $$INSTALL_STANDARD_MEASHUREMENTS
|
standard.files = $$INSTALL_STANDARD_MEASHUREMENTS
|
||||||
individual.path = $$DATADIR/$${TARGET}/tables/individual/
|
INSTALLS += \
|
||||||
individual.files = $$INSTALL_INDIVIDUAL_MEASHUREMENTS
|
target \
|
||||||
INSTALLS += target \
|
|
||||||
desktop \
|
desktop \
|
||||||
pixmaps \
|
pixmaps \
|
||||||
translations \
|
translations \
|
||||||
standard \
|
standard
|
||||||
individual
|
|
||||||
}
|
}
|
||||||
|
|
||||||
!isEmpty(TRANSLATIONS): {
|
!isEmpty(TRANSLATIONS): {
|
||||||
|
@ -202,25 +201,6 @@ INSTALLS += target \
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Copies the given files to the destination directory
|
|
||||||
defineTest(copyToDestdir) {
|
|
||||||
files = $$1
|
|
||||||
DDIR = $$2
|
|
||||||
mkpath($$DDIR)
|
|
||||||
|
|
||||||
for(FILE, files) {
|
|
||||||
|
|
||||||
# Replace slashes in paths with backslashes for Windows
|
|
||||||
win32{
|
|
||||||
FILE ~= s,/,\\,g
|
|
||||||
DDIR ~= s,/,\\,g
|
|
||||||
}
|
|
||||||
QMAKE_POST_LINK += $$QMAKE_COPY $$quote($$FILE) $$quote($$DDIR) $$escape_expand(\\n\\t)
|
|
||||||
}
|
|
||||||
|
|
||||||
export(QMAKE_POST_LINK)
|
|
||||||
}
|
|
||||||
|
|
||||||
for(DIR, INSTALL_TRANSLATIONS) {
|
for(DIR, INSTALL_TRANSLATIONS) {
|
||||||
#add these absolute paths to a variable which
|
#add these absolute paths to a variable which
|
||||||
#ends up as 'mkcommands = path1 path2 path3 ...'
|
#ends up as 'mkcommands = path1 path2 path3 ...'
|
||||||
|
@ -237,14 +217,6 @@ for(DIR, INSTALL_STANDARD_MEASHUREMENTS) {
|
||||||
|
|
||||||
copyToDestdir($$st_path, $$shell_path($$OUT_PWD/$$DESTDIR/tables/standard))
|
copyToDestdir($$st_path, $$shell_path($$OUT_PWD/$$DESTDIR/tables/standard))
|
||||||
|
|
||||||
for(DIR, INSTALL_INDIVIDUAL_MEASHUREMENTS) {
|
|
||||||
#add these absolute paths to a variable which
|
|
||||||
#ends up as 'mkcommands = path1 path2 path3 ...'
|
|
||||||
ind_path += $$PWD/$$DIR
|
|
||||||
}
|
|
||||||
|
|
||||||
copyToDestdir($$ind_path, $$shell_path($$OUT_PWD/$$DESTDIR/tables/individual))
|
|
||||||
|
|
||||||
win32:CONFIG(release, debug|release): LIBS += -L../libs/qmuparser/bin -lqmuparser2
|
win32:CONFIG(release, debug|release): LIBS += -L../libs/qmuparser/bin -lqmuparser2
|
||||||
else:win32:CONFIG(debug, debug|release): LIBS += -L../libs/qmuparser/bin -lqmuparser2
|
else:win32:CONFIG(debug, debug|release): LIBS += -L../libs/qmuparser/bin -lqmuparser2
|
||||||
else:unix: LIBS += -L../libs/qmuparser/bin -lqmuparser
|
else:unix: LIBS += -L../libs/qmuparser/bin -lqmuparser
|
||||||
|
|
|
@ -57,9 +57,7 @@ DialogIndividualMeasurements::DialogIndividualMeasurements(VContainer *data, con
|
||||||
|
|
||||||
ui->lineEditName->setText(_name);
|
ui->lineEditName->setText(_name);
|
||||||
|
|
||||||
LoadIndividualTables();
|
|
||||||
InitUnits();
|
InitUnits();
|
||||||
|
|
||||||
CheckState();
|
CheckState();
|
||||||
connect(ui->lineEditName, &QLineEdit::textChanged, this, &DialogIndividualMeasurements::CheckState);
|
connect(ui->lineEditName, &QLineEdit::textChanged, this, &DialogIndividualMeasurements::CheckState);
|
||||||
connect(ui->buttonGroupPath, static_cast<void (QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked), this,
|
connect(ui->buttonGroupPath, static_cast<void (QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked), this,
|
||||||
|
@ -91,9 +89,10 @@ void DialogIndividualMeasurements::DialogAccepted()
|
||||||
table.remove();
|
table.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
const qint32 index = ui->comboBoxLang->currentIndex();
|
//just in case
|
||||||
QString path = ui->comboBoxLang->itemData(index).toString();
|
VDomDocument::ValidateXML("://schema/individual_measurements.xsd", "://tables/individual/individual.vit");
|
||||||
QFile iMeasur(path);
|
QFile iMeasur("://tables/individual/individual.vit");
|
||||||
|
//TODO maybe make copy save?
|
||||||
if ( iMeasur.copy(_tablePath) == false )
|
if ( iMeasur.copy(_tablePath) == false )
|
||||||
{
|
{
|
||||||
QMessageBox::warning(this, tr("Could not create measurements file"), tr("Please try again or change file"));
|
QMessageBox::warning(this, tr("Could not create measurements file"), tr("Please try again or change file"));
|
||||||
|
@ -153,7 +152,6 @@ void DialogIndividualMeasurements::CheckState()
|
||||||
|
|
||||||
ui->lineEditPathNewM->setEnabled(false);
|
ui->lineEditPathNewM->setEnabled(false);
|
||||||
ui->toolButtonOpenNew->setEnabled(false);
|
ui->toolButtonOpenNew->setEnabled(false);
|
||||||
ui->comboBoxLang->setEnabled(false);
|
|
||||||
ui->comboBoxUnits->setEnabled(false);
|
ui->comboBoxUnits->setEnabled(false);
|
||||||
|
|
||||||
if (ui->lineEditPathExistM->text().isEmpty() == false)
|
if (ui->lineEditPathExistM->text().isEmpty() == false)
|
||||||
|
@ -165,7 +163,6 @@ void DialogIndividualMeasurements::CheckState()
|
||||||
{
|
{
|
||||||
ui->lineEditPathNewM->setEnabled(true);
|
ui->lineEditPathNewM->setEnabled(true);
|
||||||
ui->toolButtonOpenNew->setEnabled(true);
|
ui->toolButtonOpenNew->setEnabled(true);
|
||||||
ui->comboBoxLang->setEnabled(true);
|
|
||||||
ui->comboBoxUnits->setEnabled(true);
|
ui->comboBoxUnits->setEnabled(true);
|
||||||
|
|
||||||
ui->toolButtonOpenExist->setEnabled(false);
|
ui->toolButtonOpenExist->setEnabled(false);
|
||||||
|
@ -177,69 +174,10 @@ void DialogIndividualMeasurements::CheckState()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool flagLang = false;
|
|
||||||
{
|
|
||||||
const QComboBox *box = ui->comboBoxLang;
|
|
||||||
Q_CHECK_PTR(box);
|
|
||||||
if (box->count() > 0 && box->currentIndex() != -1)
|
|
||||||
{
|
|
||||||
flagLang = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
|
QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
|
||||||
Q_CHECK_PTR(bOk);
|
Q_CHECK_PTR(bOk);
|
||||||
bOk->setEnabled(flagName && flagPath && flagLang);
|
bOk->setEnabled(flagName && flagPath);
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void DialogIndividualMeasurements::LoadIndividualTables()
|
|
||||||
{
|
|
||||||
QStringList filters;
|
|
||||||
filters << "*.vit";
|
|
||||||
QDir tablesDir(qApp->pathToTables());
|
|
||||||
tablesDir.setNameFilters(filters);
|
|
||||||
tablesDir.setCurrent(qApp->pathToTables());
|
|
||||||
|
|
||||||
const QStringList allFiles = tablesDir.entryList(QDir::NoDotAndDotDot | QDir::Files);
|
|
||||||
if (allFiles.isEmpty() == true)
|
|
||||||
{
|
|
||||||
ui->comboBoxLang->clear();
|
|
||||||
CheckState();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < allFiles.size(); ++i)
|
|
||||||
{
|
|
||||||
QFileInfo fi(allFiles.at(i));
|
|
||||||
try
|
|
||||||
{
|
|
||||||
VDomDocument::ValidateXML("://schema/individual_measurements.xsd", fi.absoluteFilePath());
|
|
||||||
VIndividualMeasurements m(data);
|
|
||||||
m.setContent(fi.absoluteFilePath());
|
|
||||||
const QString lang = QLocale(m.Language()).nativeLanguageName();
|
|
||||||
ui->comboBoxLang->addItem(lang, QVariant(fi.absoluteFilePath()));
|
|
||||||
}
|
|
||||||
catch (VException &e)
|
|
||||||
{
|
|
||||||
qDebug()<<"File error."<<e.ErrorMessage()<<e.DetailedInformation()<<Q_FUNC_INFO;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(),
|
|
||||||
QApplication::applicationName());
|
|
||||||
|
|
||||||
QString defaultLocale = QLocale::system().name(); // e.g. "de_DE"
|
|
||||||
defaultLocale.truncate(defaultLocale.lastIndexOf('_')); // e.g. "de"
|
|
||||||
QString checkedLocale = settings.value("configuration/locale", defaultLocale).toString();
|
|
||||||
|
|
||||||
//TODO make sure this part work.
|
|
||||||
// set default translators and language checked
|
|
||||||
qint32 index = ui->comboBoxLang->findData(checkedLocale);
|
|
||||||
if (index != -1)
|
|
||||||
{
|
|
||||||
ui->comboBoxLang->setCurrentIndex(index);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -57,7 +57,6 @@ private:
|
||||||
QString _name;
|
QString _name;
|
||||||
QString _tablePath;
|
QString _tablePath;
|
||||||
VContainer *data;
|
VContainer *data;
|
||||||
void LoadIndividualTables();
|
|
||||||
void InitUnits();
|
void InitUnits();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -90,33 +90,6 @@
|
||||||
</attribute>
|
</attribute>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_2">
|
|
||||||
<property name="text">
|
|
||||||
<string>Language:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QComboBox" name="comboBoxLang">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||||
<item>
|
<item>
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
<RCC>
|
<RCC>
|
||||||
<qresource prefix="/"/>
|
<qresource prefix="/">
|
||||||
|
<file>tables/individual/individual.vit</file>
|
||||||
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
<xs:complexType>
|
<xs:complexType>
|
||||||
<xs:sequence>
|
<xs:sequence>
|
||||||
<xs:element name="version" type="formatVersion"></xs:element>
|
<xs:element name="version" type="formatVersion"></xs:element>
|
||||||
<xs:element name="lang" type="xs:string"></xs:element>
|
|
||||||
<xs:element name="personal">
|
<xs:element name="personal">
|
||||||
<xs:complexType>
|
<xs:complexType>
|
||||||
<xs:sequence>
|
<xs:sequence>
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<vit>
|
<vit>
|
||||||
<version>0.1.0</version>
|
<version>0.1.0</version>
|
||||||
<lang>en-us</lang>
|
|
||||||
<personal>
|
<personal>
|
||||||
<family-name/>
|
<family-name/>
|
||||||
<given-name/>
|
<given-name/>
|
|
@ -24,10 +24,7 @@ MOC_DIR = moc
|
||||||
OBJECTS_DIR = obj
|
OBJECTS_DIR = obj
|
||||||
|
|
||||||
# files created rcc
|
# files created rcc
|
||||||
RCC_DIR = rcc
|
#RCC_DIR = rcc
|
||||||
|
|
||||||
# files created uic
|
|
||||||
UI_DIR = uic
|
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
qmuparser.cpp \
|
qmuparser.cpp \
|
||||||
|
@ -73,8 +70,8 @@ CONFIG(debug, debug|release){
|
||||||
# Debug
|
# Debug
|
||||||
unix {
|
unix {
|
||||||
*-g++{
|
*-g++{
|
||||||
QMAKE_CXXFLAGS += -isystem "/usr/include/qt5" -isystem "/usr/include/qt5/QtCore" -isystem "$${UI_DIR}" \
|
QMAKE_CXXFLAGS += -isystem "/usr/include/qt5" -isystem "/usr/include/qt5/QtCore" -isystem "$${MOC_DIR}" \
|
||||||
-isystem "$${MOC_DIR}" -isystem "$${RCC_DIR}" \
|
#-isystem "$${RCC_DIR}" \
|
||||||
-O0 -Wall -Wextra -pedantic -Weffc++ -Woverloaded-virtual -Wctor-dtor-privacy \
|
-O0 -Wall -Wextra -pedantic -Weffc++ -Woverloaded-virtual -Wctor-dtor-privacy \
|
||||||
-Wnon-virtual-dtor -Wold-style-cast -Wconversion -Winit-self -Wstack-protector \
|
-Wnon-virtual-dtor -Wold-style-cast -Wconversion -Winit-self -Wstack-protector \
|
||||||
-Wunreachable-code -Wcast-align -Wcast-qual -Wdisabled-optimization -Wfloat-equal \
|
-Wunreachable-code -Wcast-align -Wcast-qual -Wdisabled-optimization -Wfloat-equal \
|
||||||
|
@ -101,8 +98,9 @@ CONFIG(debug, debug|release){
|
||||||
}
|
}
|
||||||
|
|
||||||
# Remove generated files at cleaning
|
# Remove generated files at cleaning
|
||||||
QMAKE_DISTCLEAN += $${DESTDIR}/* \
|
QMAKE_DISTCLEAN += \
|
||||||
|
$${DESTDIR}/* \
|
||||||
$${OBJECTS_DIR}/* \
|
$${OBJECTS_DIR}/* \
|
||||||
$${UI_DIR}/* \
|
#$${RCC_DIR}/* \
|
||||||
$${MOC_DIR}/* \
|
$${MOC_DIR}/*
|
||||||
$${RCC_DIR}/*
|
|
||||||
|
|
|
@ -4,11 +4,11 @@ SUBDIRS = \
|
||||||
sub_app \
|
sub_app \
|
||||||
sub_lib_qmuparser
|
sub_lib_qmuparser
|
||||||
|
|
||||||
sub_lib_qmuparser.subdir = libs/qmuparser
|
#sub_lib_qmuparser.subdir = libs/qmuparser
|
||||||
sub_lib_qmuparser.file = libs/qmuparser/qmuparser.pro
|
sub_lib_qmuparser.file = libs/qmuparser/qmuparser.pro
|
||||||
#sub_tests.file = tests/proj.pro
|
#sub_tests.file = tests/proj.pro
|
||||||
#sub_tests.depends = sub_lib
|
#sub_tests.depends = sub_lib
|
||||||
sub_app.subdir = app
|
#sub_app.subdir = app
|
||||||
sub_app.file = app/app.pro
|
sub_app.file = app/app.pro
|
||||||
sub_app.depends = sub_lib_qmuparser
|
sub_app.depends = sub_lib_qmuparser
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user