Merge with develop. Begin feature freeze.

--HG--
branch : release
This commit is contained in:
Roman Telezhynskyi 2015-03-02 17:32:35 +02:00
commit 364ae3f82c
504 changed files with 27009 additions and 9728 deletions

View File

@ -13,8 +13,9 @@ syntax: glob
# Temporary files used by the vim editor.
.*.swp
# A hidden file created by the Mac OS X Finder.
# A hidden files created by the Mac OS X Finder.
.DS_Store
._.DS_Store
# Ignore this directory.
html/

View File

@ -1,14 +1,29 @@
Our Team:
This file contains a list of people who have made contributions
to the Valentina project.
(*) Roman Telezhynskyi <dismine@gmail.com>
Maintainer and founder of the project.
(*) Christine Neupert <enaisoc@googlemail.com>
Testing, translation.
(*) Patrick Proy <patrick@proy.org>
Developing.
(*) Lindsay Williams <linzkitt@gmail.com>
Design logo.
Maintainer and founder of the project:
Roman Telezhynskyi <dismine@gmail.com>
Community manager, web site:
Susan Spencer <susan.spencer@gmail.com>
Patch contributors:
Patrick Proy <patrick@proy.org>
* Developing.
Christine Neupert <enaisoc@googlemail.com>
* Testing.
* Translation.
Lindsay Williams <linzkitt@gmail.com>
* Design logo.
Sabine Schmaltz <sabineschmaltz@gmail.com >
* Developing.
* Documantation.
Felix Ulber <felix.ulber@gmx.de >
* Developing.
* Translation.
Mischa Krempel
* Developing.
* Mac OS package.
Peter Gsellmann
* Testing

View File

@ -1,5 +1,6 @@
Pattern making program
Copyright (C) 2013-2014 Roman Telezhynskyi <dismine@gmail.com>
Author Roman Telezhynskyi <dismine(at)gmail.com>
Copyright (C) 2013-2015 Valentina project
Valentina Web page: http://www.valentina-project.org/
Valentina user manual https://bitbucket.org/dismine/valentina/wiki/manual/Content
Valentina main repository: https://bitbucket.org/dismine/valentina/overview
@ -19,16 +20,19 @@ Supported Platforms
===================
The standalone binary packages support the following platforms:
Windows XP SP2 or later
Ubuntu Linux 14.04 (32-bit) or later
Windows XP SP2 (32-bit) or later
Ubuntu Linux 14.04 (32-bit/64-bit) or later
OpenSUSE 13.02 (32-bit/64-bit) or later
Fedora 20 (32-bit/64-bit) or later
Mac OS X 10.7 (64-bit) or later
Building the sources requires Qt 5.2.1 or later.
Building the sources requires Qt 5.2.0 or later.
Compiling Valentina
====================
Prerequisites:
* Qt 5.2.1 or later (On Unix development packages needed)
* mercurial
* Qt 5.2.0 or later (On Unix development packages needed)
* mercurial (only for working with repository)
* On Unix:
- ccache
- g++ (at least GCC 4.6 is needed and GCC 4.8 is recommended) or
@ -65,9 +69,13 @@ Unix systems:
Default prefix for command "make install" is /usr. For using another
prefix build with qmake command:
qmake PREFIX=/usr/local Valentina.pro -r
qmake PREFIX=/usr/local PREFIX_LIB=/usr/lib/i386-linux-gnu Valentina.pro -r
where /usr/local is a new prefix for installation.
where /usr/local is a new prefix for installation binary files and /usr/lib/i386-linux-gnu is new prefix for install libraries.
More about creation installers read in articles:
* How create Windows installer - https://bitbucket.org/dismine/valentina/wiki/developers/Creation_Windows_installer
* How create debian package - https://bitbucket.org/dismine/valentina/wiki/developers/Creation_deb_package
LICENSING
==========
@ -81,4 +89,8 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
See LICENSE file for further information
See LICENSE_GPL.txt file for further information
Other components released under:
* QMuParser - BSD license
* VPropertyExplorer - LGPLv2.1 license

View File

@ -529,7 +529,6 @@ GCC_DEBUG_CXXFLAGS += \
-O0 \
-Wall \
-Wextra \
-pedantic \
-fno-omit-frame-pointer # Need for exchndl.dll
CLANG_DEBUG_CXXFLAGS += \

View File

@ -1,4 +1,4 @@
valentina (0.2.8-alpha) trusty; urgency=low
valentina (0.2.9) trusty; urgency=low
* Auto build.

View File

@ -14,7 +14,7 @@ SetCompressor /FINAL /SOLID lzma
!define MUI_FILE "valentina"
!insertmacro GetPEVersionLocal "c:\pack\valentina\valentina.exe" ver
!define MUI_VERSION "${ver_1}.${ver_2}.${ver_3}-alpha"
!define MUI_VERSION "${ver_1}.${ver_2}.${ver_3}"
!define MUI_BRANDINGTEXT "Valentina ${MUI_VERSION}"
!define WEBSITE_LINK "http://www.valentina-project.org/"

View File

@ -25,7 +25,7 @@ BuildRequires: ccache
BuildRequires: update-desktop-files
%endif
Version: 0.2.8
Version: 0.2.9
Release: 0
URL: https://bitbucket.org/dismine/valentina
License: GPL-3.0+

View File

@ -12,13 +12,15 @@ DEPENDPATH += \
../src/libs/qmuparser \
../src/libs/vpropertyexplorer \
../src/libs/ifc \
../src/libs/vobj
../src/libs/vobj \
../src/libs/vlayout
include(../src/app/app.pri)
include(../src/libs/qmuparser/qmuparser.pri)
include(../src/libs/vpropertyexplorer/vpropertyexplorer.pri)
include(../src/libs/ifc/ifc.pri)
include(../src/libs/vobj/vobj.pri)
include(../src/libs/vlayout/vlayout.pri)
# Add here path to new translation file with name "valentina_*_*.ts" if you want to add new language.
# Same paths in variable INSTALL_TRANSLATIONS (app.pro).
@ -35,4 +37,5 @@ TRANSLATIONS += translations/valentina.ts \
translations/valentina_fr_FR.ts \
translations/valentina_it_IT.ts \
translations/valentina_nl_NL.ts \
translations/valentina_id_ID.ts
translations/valentina_id_ID.ts \
translations/valentina_es_ES.ts

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -109,7 +109,7 @@ CONFIG(debug, debug|release){
#Calculate latest tag distance and build revision only in release mode. Change number each time requare
#recompilation precompiled headers file.
DEFINES += "LATEST_TAG_DISTANCE=0"
DEFINES += "BUILD_REVISION=\\\"uknown\\\""
DEFINES += "BUILD_REVISION=\\\"unknown\\\""
}else{
# Release mode
DEFINES += V_NO_ASSERT
@ -126,7 +126,7 @@ CONFIG(debug, debug|release){
}
#latest tag distance number for using in version
HG_DISTANCE=$$system(hg log -r tip --template '{latesttagdistance}')
HG_DISTANCE=$$system(hg log -r. --template '{latesttagdistance}')
isEmpty(HG_DISTANCE){
HG_DISTANCE = 0 # if we can't find local revision left 0.
}
@ -135,10 +135,10 @@ CONFIG(debug, debug|release){
#build revision number for using in version
unix {
HG_HESH=$$system("hg log -r tip --template '{node|short}'")
HG_HESH=$$system("hg log -r. --template '{node|short}'")
} else {
# Use escape character before "|" on Windows
HG_HESH=$$system(hg log -r tip --template "{node^|short}")
HG_HESH=$$system(hg log -r. --template "{node^|short}")
}
isEmpty(HG_HESH){
HG_HESH = "unknown" # if we can't find build revision left unknown.
@ -181,7 +181,8 @@ INSTALL_TRANSLATIONS += \
$${TRANSLATIONS_PATH}/valentina_fr_FR.qm \
$${TRANSLATIONS_PATH}/valentina_it_IT.qm \
$${TRANSLATIONS_PATH}/valentina_nl_NL.qm \
$${TRANSLATIONS_PATH}/valentina_id_ID.qm
$${TRANSLATIONS_PATH}/valentina_id_ID.qm \
$${TRANSLATIONS_PATH}/valentina_es_ES.qm
# Set "make install" command for Unix-like systems.
unix{
@ -306,11 +307,19 @@ unix{
QMAKE_BUNDLE_DATA += TRANSLATION_id_ID
}
qmuparser.path = $$FRAMEWORKS_DIR
qmuparser.files = $${OUT_PWD}/../libs/qmuparser/$${DESTDIR}/
qmuparser.files += $${OUT_PWD}/../libs/qmuparser/$${DESTDIR}/libqmuparser.2.dylib
vpropertyexplorer.path = $$FRAMEWORKS_DIR
vpropertyexplorer.files = $${OUT_PWD}/../libs/vpropertyexplorer/$${DESTDIR}/
exists($${TRANSLATIONS_PATH}/valentina_es_ES.qm){
TRANSLATION_es_ES.files += \
$${TRANSLATIONS_PATH}/valentina_es_ES.qm \
$${TRANSLATIONS_PATH}/Localizable.strings
TRANSLATION_es_ES.path = "$$RESOURCES_DIR/translations/es_ES.lproj"
QMAKE_BUNDLE_DATA += TRANSLATION_es_ES
}
# Symlinks also good names for copying. Make will take origin file and copy them with using symlink name.
# For bundle this names more then enough. We don't need care much about libraries versions.
libraries.path = $$FRAMEWORKS_DIR
libraries.files += $${OUT_PWD}/../libs/qmuparser/$${DESTDIR}/libqmuparser.2.dylib
libraries.files += $${OUT_PWD}/../libs/vpropertyexplorer/$${DESTDIR}/libvpropertyexplorer.1.dylib
# logo on macx.
@ -322,9 +331,7 @@ unix{
QMAKE_BUNDLE_DATA += \
standard \
qmuparser \
vpropertyexplorer
libraries
}
}
@ -393,6 +400,15 @@ DEPENDPATH += $$PWD/../libs/vobj
win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../libs/vobj/$${DESTDIR}/vobj.lib
else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../libs/vobj/$${DESTDIR}/libvobj.a
# VLayout static library
unix|win32: LIBS += -L$$OUT_PWD/../libs/vlayout/$${DESTDIR}/ -lvlayout
INCLUDEPATH += $$PWD/../libs/vlayout
DEPENDPATH += $$PWD/../libs/vlayout
win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../libs/vlayout/$${DESTDIR}/vlayout.lib
else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../libs/vlayout/$${DESTDIR}/libvlayout.a
# Strip after you link all libaries.
CONFIG(release, debug|release){

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2013 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify
@ -37,7 +37,7 @@ using namespace qmu;
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief Calculator class constructor. Make easy initialization math parser.
* @brief Calculator class wraper for QMuParser. Make easy initialization math parser.
*
* This constructor hide initialization variables, operators, character sets.
* Use this constuctor for evaluation formula. All formulas must be converted to internal look.
@ -99,11 +99,17 @@ Calculator::~Calculator()
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief eval calculate formula.
*
* First we try eval expression without adding variables. If it fail, we take tokens from expression and add variables
* to parser and try again.
*
* @param formula string of formula.
* @return value of formula.
*/
qreal Calculator::EvalFormula(const QString &formula)
{
// Parser doesn't know any variable on this stage. So, we just use variable factory that for each unknown variable
// set value to 0.
SetVarFactory(AddVariable, this);
SetSepForEval();//Reset separators options
@ -119,20 +125,29 @@ qreal Calculator::EvalFormula(const QString &formula)
if (tokens.isEmpty())
{
return result;
return result; // We have found only numbers in expression.
}
// Add variables
// Add variables to parser because we have deal with expression with variables.
InitVariables(data, tokens, formula);
return Eval();
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief Calculator::InitVariables add variables to parser.
*
* For optimization purpose we try don't add variables that we don't need.
*
* @param data pointer to a variable container. Hold all informations about variables.
* @param tokens all tokens (measurements names, variables with lengths) that parser have found in expression.
* @param formula expression, need for throwing better error message.
*/
void Calculator::InitVariables(const VContainer *data, const QMap<int, QString> &tokens, const QString &formula)
{
if (qApp->patternType() == MeasurementsType::Standard)
{
vVarVal = new qreal[2];
vVarVal = new qreal[2]; //stabdard measurements table have two additional variables
}
SCASSERT(data != nullptr)
@ -173,7 +188,7 @@ void Calculator::InitVariables(const VContainer *data, const QMap<int, QString>
}
if (builInFunctions.contains(i.value()))
{// We found built-in function
{// We have found built-in function
found = true;
}
@ -186,6 +201,13 @@ void Calculator::InitVariables(const VContainer *data, const QMap<int, QString>
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief Calculator::InitCharacterSets init character set for parser.
*
* QMuParser require setting character set for legal characters. Because we try make our expresion language independent
* we set all posible unique characters from all alphabets.
*
*/
void Calculator::InitCharacterSets()
{
//String with all unique symbols for supported alpabets.
@ -218,13 +240,21 @@ qreal* Calculator::AddVariable(const QString &a_szName, void *a_pUserData)
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief Calculator::SetSepForEval set separators for eval. Each expression eval in internal (C) locale.
*/
void Calculator::SetSepForEval()
{
SetArgSep(',');
SetArgSep(';');
SetThousandsSep(',');
SetDecSep('.');
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief Calculator::SetSepForTr set separators for translation expression.
* @param fromUser true if expression come from user (from dialog).
*/
void Calculator::SetSepForTr(bool fromUser)
{
if (fromUser)
@ -233,29 +263,30 @@ void Calculator::SetSepForTr(bool fromUser)
if (osSeparatorValue)
{
QLocale loc = QLocale::system();
const QLocale loc = QLocale::system();
SetDecSep(loc.decimalPoint().toLatin1());
SetThousandsSep(loc.groupSeparator().toLatin1());
SetArgSep(';');
}
else
{
SetArgSep(',');
SetDecSep('.');
return;
}
}
else
{
SetArgSep(',');
SetDecSep('.');
}
SetSepForEval();//Same separators (internal) as for eval.
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief Calculator::RemoveAll remove token from token list.
*
* Standard Qt class QMap doesn't have method RemoveAll.
* Example: remove "-" from tokens list if exist. If don't do that unary minus operation will broken.
*
* @param map map with tokens
* @param val token that need delete
*/
void Calculator::RemoveAll(QMap<int, QString> &map, const QString &val)
{
QList<int> listKeys = map.keys(val);
const QList<int> listKeys = map.keys(val);//Take all keys that contain token.
if (listKeys.size() > 0)
{
for (int i = 0; i < listKeys.size(); ++i)

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2013 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify
@ -40,10 +40,10 @@ class VContainer;
* Note. If created to many parser for different purpes in the same time parser can work wrong.
* Example:
* DialogEditWrongFormula *dialog = new DialogEditWrongFormula(data);
* dialog->setFormula(formula);
* dialog->SetFormula(formula);
* if (dialog->exec() == QDialog::Accepted)
* {
* formula = dialog->getFormula();
* formula = dialog->GetFormula();
* //Need delete dialog here because parser in dialog don't allow use correct separator for parsing here.
* //Don't know why.
* delete dialog;

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2014 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2014 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2014 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2014 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2014 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2014 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2013 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2013 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2014 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2014 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2014 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2014 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2014 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2014 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2014 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2014 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2014 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2014 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2013 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2013 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2014 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2014 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2014 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2014 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2014 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2014 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2013 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2013 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2014 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify
@ -56,7 +56,7 @@ VFormula &VFormula::operator=(const VFormula &formula)
{
return *this;
}
this->formula = formula.getFormula();
this->formula = formula.GetFormula();
this->value = formula.getStringValue();
this->checkZero = formula.getCheckZero();
this->data = formula.getData();
@ -69,7 +69,7 @@ VFormula &VFormula::operator=(const VFormula &formula)
//---------------------------------------------------------------------------------------------------------------------
VFormula::VFormula(const VFormula &formula)
:formula(formula.getFormula()), value(formula.getStringValue()), checkZero(formula.getCheckZero()),
:formula(formula.GetFormula()), value(formula.getStringValue()), checkZero(formula.getCheckZero()),
data(formula.getData()), toolId(formula.getToolId()), postfix(formula.getPostfix()), _error(formula.error()),
dValue(formula.getDoubleValue())
{}
@ -78,7 +78,7 @@ VFormula::VFormula(const VFormula &formula)
bool VFormula::operator==(const VFormula &formula) const
{
bool isEqual = false;
if (this->formula == formula.getFormula() && this->value == formula.getStringValue() &&
if (this->formula == formula.GetFormula() && this->value == formula.getStringValue() &&
this->checkZero == formula.getCheckZero() && this->data == formula.getData() &&
this->toolId == formula.getToolId() && this->postfix == formula.getPostfix() &&
this->_error == formula.error() && qFuzzyCompare(this->dValue, formula.getDoubleValue()))
@ -94,7 +94,7 @@ bool VFormula::operator!=(const VFormula &formula) const
}
//---------------------------------------------------------------------------------------------------------------------
QString VFormula::getFormula(FormulaType type) const
QString VFormula::GetFormula(FormulaType type) const
{
if (type == FormulaType::ToUser)
{
@ -107,17 +107,17 @@ QString VFormula::getFormula(FormulaType type) const
}
//---------------------------------------------------------------------------------------------------------------------
void VFormula::setFormula(const QString &value, FormulaType type)
void VFormula::SetFormula(const QString &value, FormulaType type)
{
if (formula != value)
{
if (type == FormulaType::ToUser)
{
formula = value;
formula = qApp->FormulaToUser(value);
}
else
{
formula = qApp->FormulaToUser(value);
formula = value;
}
formula.replace("\n", " ");// Replace line return with spaces for calc if exist
Eval();
@ -239,17 +239,8 @@ void VFormula::Eval()
}
else
{
QLocale loc;
if (qApp->getSettings()->GetOsSeparator())
{
loc = QLocale::system();
}
else
{
loc = QLocale(QLocale::C);
}
dValue = result;
value = QString(loc.toString(result) + " " + postfix);
value = QString(qApp->LocaleToString(result) + " " + postfix);
_error = false;
}
}

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2014 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify
@ -46,8 +46,8 @@ public:
bool operator==(const VFormula &formula) const;
bool operator!=(const VFormula &formula) const;
QString getFormula(FormulaType type = FormulaType::ToUser) const;
void setFormula(const QString &value, FormulaType type = FormulaType::ToUser);
QString GetFormula(FormulaType type = FormulaType::ToUser) const;
void SetFormula(const QString &value, FormulaType type = FormulaType::ToUser);
QString getStringValue() const;
qreal getDoubleValue() const;

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2014 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2014 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2013 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify
@ -35,7 +35,6 @@
#include "vmaingraphicsview.h"
#include "../container/calculator.h"
#include "../version.h"
#include "vsettings.h"
#include <QDebug>
#include <QDir>
@ -292,22 +291,20 @@ bool VApplication::notify(QObject *receiver, QEvent *event)
//---------------------------------------------------------------------------------------------------------------------
double VApplication::toPixel(double val, const Unit &unit) const
{
double result = 0;
switch (unit)
{
case Unit::Mm:
result = (val / 25.4) * PrintDPI;
break;
case Unit::Cm:
result = ((val * 10.0) / 25.4) * PrintDPI;
break;
case Unit::Inch:
result = val * PrintDPI;
break;
default:
break;
case Unit::Mm:
return (val / 25.4) * PrintDPI;
case Unit::Cm:
return ((val * 10.0) / 25.4) * PrintDPI;
case Unit::Inch:
return val * PrintDPI;
case Unit::Px:
return val;
default:
break;
}
return result;
return 0;
}
//---------------------------------------------------------------------------------------------------------------------
@ -319,22 +316,20 @@ double VApplication::toPixel(double val) const
//---------------------------------------------------------------------------------------------------------------------
double VApplication::fromPixel(double pix, const Unit &unit) const
{
double result = 0;
switch (unit)
{
case Unit::Mm:
result = (pix / PrintDPI) * 25.4;
break;
case Unit::Cm:
result = ((pix / PrintDPI) * 25.4) / 10.0;
break;
case Unit::Inch:
result = pix / PrintDPI;
break;
default:
break;
case Unit::Mm:
return (pix / PrintDPI) * 25.4;
case Unit::Cm:
return ((pix / PrintDPI) * 25.4) / 10.0;
case Unit::Inch:
return pix / PrintDPI;
case Unit::Px:
return pix;
default:
break;
}
return result;
return 0;
}
//---------------------------------------------------------------------------------------------------------------------
@ -344,32 +339,39 @@ double VApplication::fromPixel(double pix) const
}
//---------------------------------------------------------------------------------------------------------------------
QString VApplication::pathToTables() const
bool VApplication::TryLock(QLockFile *lock)
{
if (_patternType == MeasurementsType::Individual)
if (lock == nullptr)
{
return QStringLiteral("://tables/individual/individual.vit");
return false;
}
if (lock->tryLock())
{
return true;
}
else
{
const QString stPath = QStringLiteral("/tables/standard");
#ifdef Q_OS_WIN
return QApplication::applicationDirPath() + stPath;
#else
#ifdef QT_DEBUG
return QApplication::applicationDirPath() + stPath;
#else
QDir dir(QApplication::applicationDirPath() + stPath);
if (dir.exists())
{
return dir.absolutePath();
}
else
{
return QStringLiteral("/usr/share/valentina/tables/standard");
}
#endif
#endif
if (lock->error() == QLockFile::LockFailedError)
{
// This happens if a stale lock file exists and another process uses that PID.
// Try removing the stale file, which will fail if a real process is holding a
// file-level lock. A false error is more problematic than not locking properly
// on corner-case systems.
if (lock->removeStaleLockFile() == false || lock->tryLock() == false)
{
return false;
}
else
{
return true;
}
}
else
{
return false;
}
return false;
}
}
@ -465,7 +467,7 @@ void VApplication::BeginLogging()
qInstallMessageHandler(noisyFailureMsgHandler);
logLock = new QLockFile(LogPath()+".lock");
logLock->setStaleLockTime(0);
if (logLock->tryLock())
if (TryLock(logLock))
{
qCDebug(vApp) << "Log file"<<LogPath()<<"was locked.";
}
@ -499,7 +501,7 @@ void VApplication::ClearOldLogs() const
{
QFileInfo info(allFiles.at(i));
QLockFile *lock = new QLockFile(info.absoluteFilePath() + ".lock");
if (lock->tryLock())
if (TryLock(lock))
{
qCDebug(vApp) << "Locked file"<<info.absoluteFilePath();
QFile oldLog(allFiles.at(i));
@ -1502,6 +1504,14 @@ void VApplication::InitSTDescriptions()
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief VApplication::MeasurementsFromUser translate measurement to internal look.
* @param newFormula [in|out] expression to translate
* @param position token position
* @param token token to translate
* @param bias hold change of length between translated and origin token string
* @return true if was found measurement with same name.
*/
bool VApplication::MeasurementsFromUser(QString &newFormula, int position, const QString &token, int &bias) const
{
QMap<QString, QmuTranslation>::const_iterator i = measurements.constBegin();
@ -1519,6 +1529,14 @@ bool VApplication::MeasurementsFromUser(QString &newFormula, int position, const
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief VApplication::VariablesFromUser translate variable to internal look.
* @param newFormula [in|out] expression to translate
* @param position token position
* @param token token to translate
* @param bias hold change of length between translated and origin token string
* @return true if was found variable with same name.
*/
bool VApplication::VariablesFromUser(QString &newFormula, int position, const QString &token, int &bias) const
{
QMap<QString, QmuTranslation>::const_iterator i = variables.constBegin();
@ -1538,6 +1556,14 @@ bool VApplication::VariablesFromUser(QString &newFormula, int position, const QS
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief VApplication::PostfixOperatorsFromUser translate postfix operator to internal look.
* @param newFormula [in|out] expression to translate
* @param position token position
* @param token token to translate
* @param bias hold change of length between translated and origin token string
* @return true if was found postfix operator with same name.
*/
bool VApplication::PostfixOperatorsFromUser(QString &newFormula, int position, const QString &token, int &bias) const
{
QMap<QString, QmuTranslation>::const_iterator i = postfixOperators.constBegin();
@ -1555,6 +1581,14 @@ bool VApplication::PostfixOperatorsFromUser(QString &newFormula, int position, c
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief VApplication::FunctionsFromUser translate function name to internal look.
* @param newFormula [in|out] expression to translate
* @param position token position
* @param token token to translate
* @param bias hold change of length between translated and origin token string
* @return true if was found function with same name.
*/
bool VApplication::FunctionsFromUser(QString &newFormula, int position, const QString &token, int &bias) const
{
QMap<QString, QmuTranslation>::const_iterator i = functions.constBegin();
@ -1572,6 +1606,14 @@ bool VApplication::FunctionsFromUser(QString &newFormula, int position, const QS
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief VApplication::VariablesToUser translate variable name to user.
* @param newFormula [in|out] expression to translate
* @param position token position
* @param token token to translate
* @param bias hold change of length between translated and origin token string
* @return true if was found variable with same name.
*/
bool VApplication::VariablesToUser(QString &newFormula, int position, const QString &token, int &bias) const
{
QMap<QString, QmuTranslation>::const_iterator i = variables.constBegin();
@ -1591,18 +1633,37 @@ bool VApplication::VariablesToUser(QString &newFormula, int position, const QStr
return false;
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief VApplication::CorrectionsPositions correct position tokens in expression after token translation.
*
* Because translated string can have different length compare to original need make correction after each translation.
* If bias = 0 correction will not happens.
*
* @param position position currecnt token in expression
* @param bias difference between original token length and translated
* @param tokens all tokens
* @param numbers all numbers
*/
void VApplication::CorrectionsPositions(int position, int bias, QMap<int, QString> &tokens,
QMap<int, QString> &numbers)
{
if (bias == 0)
{
return;
return;// Nothing to correct;
}
BiasTokens(position, bias, tokens);
BiasTokens(position, bias, numbers);
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief VApplication::BiasTokens change position for each token that have position more then "position".
* @param position token position
* @param bias difference between original token length and translated
* @param tokens all tokens
*/
void VApplication::BiasTokens(int position, int bias, QMap<int, QString> &tokens) const
{
QMap<int, QString> newTokens;
@ -1610,7 +1671,7 @@ void VApplication::BiasTokens(int position, int bias, QMap<int, QString> &tokens
while (i != tokens.constEnd())
{
if (i.key()<= position)
{
{ // Tokens before position "position" did not change his positions.
newTokens.insert(i.key(), i.value());
}
else
@ -1702,16 +1763,22 @@ QString VApplication::PostfixOperator(const QString &name) const
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief VApplication::FormulaFromUser replace all known tokens in formula to internal look. Also change decimal
* separator in numbers.
* @param formula expression that need translate
* @return translated expression
*/
QString VApplication::FormulaFromUser(const QString &formula)
{
QString newFormula = formula;
QString newFormula = formula;// Local copy for making changes
Calculator *cal = new Calculator(formula);
QMap<int, QString> tokens = cal->GetTokens();
QMap<int, QString> numbers = cal->GetNumbers();
Calculator *cal = new Calculator(formula);// Eval formula
QMap<int, QString> tokens = cal->GetTokens();// Tokens (variables, measurements)
QMap<int, QString> numbers = cal->GetNumbers();// All numbers in expression for changing decimal separator
delete cal;
QList<int> tKeys = tokens.keys();
QList<int> tKeys = tokens.keys();// Take all tokens positions
QList<QString> tValues = tokens.values();
for (int i = 0; i < tKeys.size(); ++i)
{
@ -1719,7 +1786,7 @@ QString VApplication::FormulaFromUser(const QString &formula)
if (MeasurementsFromUser(newFormula, tKeys.at(i), tValues.at(i), bias))
{
if (bias != 0)
{
{// Translated token has different length than original. Position next tokens need to be corrected.
CorrectionsPositions(tKeys.at(i), bias, tokens, numbers);
tKeys = tokens.keys();
tValues = tokens.values();
@ -1730,7 +1797,7 @@ QString VApplication::FormulaFromUser(const QString &formula)
if (VariablesFromUser(newFormula, tKeys.at(i), tValues.at(i), bias))
{
if (bias != 0)
{
{// Translated token has different length than original. Position next tokens need to be corrected.
CorrectionsPositions(tKeys.at(i), bias, tokens, numbers);
tKeys = tokens.keys();
tValues = tokens.values();
@ -1741,7 +1808,7 @@ QString VApplication::FormulaFromUser(const QString &formula)
if (PostfixOperatorsFromUser(newFormula, tKeys.at(i), tValues.at(i), bias))
{
if (bias != 0)
{
{// Translated token has different length than original. Position next tokens need to be corrected.
CorrectionsPositions(tKeys.at(i), bias, tokens, numbers);
tKeys = tokens.keys();
tValues = tokens.values();
@ -1752,7 +1819,7 @@ QString VApplication::FormulaFromUser(const QString &formula)
if (FunctionsFromUser(newFormula, tKeys.at(i), tValues.at(i), bias))
{
if (bias != 0)
{
{// Translated token has different length than original. Position next tokens need to be corrected.
CorrectionsPositions(tKeys.at(i), bias, tokens, numbers);
tKeys = tokens.keys();
tValues = tokens.values();
@ -1761,34 +1828,32 @@ QString VApplication::FormulaFromUser(const QString &formula)
}
}
QLocale loc = QLocale::system();
QLocale loc = QLocale::system(); // User locale
if (loc != QLocale(QLocale::C) && getSettings()->GetOsSeparator())
{
QList<int> nKeys = numbers.keys();
{// User want use Os separator
QList<int> nKeys = numbers.keys();// Positions for all numbers in expression
QList<QString> nValues = numbers.values();
for (int i = 0; i < nKeys.size(); ++i)
{
loc = QLocale::system();// From system locale
bool ok = false;
qreal d = loc.toDouble(nValues.at(i), &ok);
const qreal d = loc.toDouble(nValues.at(i), &ok);
if (ok == false)
{
qDebug()<<"Can't convert to double token"<<nValues.at(i);
continue;
}
if (qFloor (d) < d)
{
QLocale loc = QLocale(QLocale::C);
QString dStr = loc.toString(d);
newFormula.replace(nKeys.at(i), nValues.at(i).length(), dStr);
int bias = nValues.at(i).length() - dStr.length();
if (bias != 0)
{
CorrectionsPositions(nKeys.at(i), bias, tokens, numbers);
nKeys = numbers.keys();
nValues = numbers.values();
}
continue;//Leave with out translation
}
loc = QLocale(QLocale::C);// To internal locale
const QString dStr = loc.toString(d);// Internal look for number
newFormula.replace(nKeys.at(i), nValues.at(i).length(), dStr);
const int bias = nValues.at(i).length() - dStr.length();
if (bias != 0)
{// Translated number has different length than original. Position next tokens need to be corrected.
CorrectionsPositions(nKeys.at(i), bias, tokens, numbers);
nKeys = numbers.keys();
nValues = numbers.values();
}
}
}
@ -1796,17 +1861,23 @@ QString VApplication::FormulaFromUser(const QString &formula)
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief VApplication::FormulaToUser replace all known tokens in formula to user look. Also change decimal
* separator in numbers.
* @param formula expression that need translate
* @return translated expression
*/
QString VApplication::FormulaToUser(const QString &formula)
{
QString newFormula = formula;
QString newFormula = formula;// Local copy for making changes
QMap<int, QString> tokens;
QMap<int, QString> numbers;
try
{
Calculator *cal = new Calculator(formula, false);
tokens = cal->GetTokens();
numbers = cal->GetNumbers();
Calculator *cal = new Calculator(formula, false);// Eval formula
tokens = cal->GetTokens();// Tokens (variables, measurements)
numbers = cal->GetNumbers();// All numbers in expression for changing decimal separator
delete cal;
}
catch (qmu::QmuParserError &e)
@ -1828,7 +1899,7 @@ QString VApplication::FormulaToUser(const QString &formula)
newFormula.replace(tKeys.at(i), tValues.at(i).length(), measurements.value(tValues.at(i)).translate());
int bias = tValues.at(i).length() - measurements.value(tValues.at(i)).translate().length();
if (bias != 0)
{
{// Translated token has different length than original. Position next tokens need to be corrected.
CorrectionsPositions(tKeys.at(i), bias, tokens, numbers);
tKeys = tokens.keys();
tValues = tokens.values();
@ -1841,7 +1912,7 @@ QString VApplication::FormulaToUser(const QString &formula)
newFormula.replace(tKeys.at(i), tValues.at(i).length(), functions.value(tValues.at(i)).translate());
int bias = tValues.at(i).length() - functions.value(tValues.at(i)).translate().length();
if (bias != 0)
{
{// Translated token has different length than original. Position next tokens need to be corrected.
CorrectionsPositions(tKeys.at(i), bias, tokens, numbers);
tKeys = tokens.keys();
tValues = tokens.values();
@ -1854,7 +1925,7 @@ QString VApplication::FormulaToUser(const QString &formula)
newFormula.replace(tKeys.at(i), tValues.at(i).length(), postfixOperators.value(tValues.at(i)).translate());
int bias = tValues.at(i).length() - postfixOperators.value(tValues.at(i)).translate().length();
if (bias != 0)
{
{// Translated token has different length than original. Position next tokens need to be corrected.
CorrectionsPositions(tKeys.at(i), bias, tokens, numbers);
tKeys = tokens.keys();
tValues = tokens.values();
@ -1866,7 +1937,7 @@ QString VApplication::FormulaToUser(const QString &formula)
if (VariablesToUser(newFormula, tKeys.at(i), tValues.at(i), bias))
{
if (bias != 0)
{
{// Translated token has different length than original. Position next tokens need to be corrected.
CorrectionsPositions(tKeys.at(i), bias, tokens, numbers);
tKeys = tokens.keys();
tValues = tokens.values();
@ -1875,34 +1946,31 @@ QString VApplication::FormulaToUser(const QString &formula)
}
}
QLocale loc = QLocale::system();
QLocale loc = QLocale::system();// User locale
if (loc != QLocale::C && getSettings()->GetOsSeparator())
{
QList<int> nKeys = numbers.keys();
{// User want use Os separator
QList<int> nKeys = numbers.keys();// Positions for all numbers in expression
QList<QString> nValues = numbers.values();
for (int i = 0; i < nKeys.size(); ++i)
{
QLocale loc = QLocale(QLocale::C);
loc = QLocale(QLocale::C);// From pattern locale
bool ok = false;
qreal d = loc.toDouble(nValues.at(i), &ok);
const qreal d = loc.toDouble(nValues.at(i), &ok);
if (ok == false)
{
qDebug()<<"Can't convert to double token"<<nValues.at(i);
continue;
continue;//Leave with out translation
}
if (qFloor (d) < d)
{
QLocale loc = QLocale::system();
QString dStr = loc.toString(d);
newFormula.replace(nKeys.at(i), nValues.at(i).length(), dStr);
int bias = nValues.at(i).length() - dStr.length();
if (bias != 0)
{
CorrectionsPositions(nKeys.at(i), bias, tokens, numbers);
nKeys = numbers.keys();
nValues = numbers.values();
}
loc = QLocale::system();// To user locale
const QString dStr = loc.toString(d);// Number string in user locale
newFormula.replace(nKeys.at(i), nValues.at(i).length(), dStr);
const int bias = nValues.at(i).length() - dStr.length();
if (bias != 0)
{// Translated number has different length than original. Position next tokens need to be corrected.
CorrectionsPositions(nKeys.at(i), bias, tokens, numbers);
nKeys = numbers.keys();
nValues = numbers.values();
}
}
}
@ -2122,7 +2190,7 @@ void VApplication::GatherLogs() const
}
QLockFile *logLock = new QLockFile(info.absoluteFilePath()+".lock");
logLock->setStaleLockTime(0);
if (logLock->tryLock())
if (TryLock(logLock))
{
*out <<"--------------------------" << endl;
QFile logFile(info.absoluteFilePath());
@ -2248,8 +2316,10 @@ void VApplication::SendReport(const QString &reportName) const
// Additional information
content.append(QString("-------------------------------")+"\r\n");
content.append(QString("Version:%1").arg(APP_VERSION)+"\r\n");
content.append(QString("Build revision:%1").arg(BUILD_REVISION)+"\r\n");
content.append(QString("Based on Qt %2 (32 bit)").arg(QT_VERSION_STR)+"\r\n");
content.append(QString("Built on %3 at %4").arg(__DATE__).arg(__TIME__)+"\r\n");
content.append(QString("Web site:http://www.valentina-project.org/ ")+"\r\n");
content.append("\r\n");
// Creating json with report
@ -2317,13 +2387,17 @@ void VApplication::SendReport(const QString &reportName) const
gistFile.write(saveRep.toJson());
gistFile.close();
QFile curlFile("curl.exe");
const QString curl = QString("%1/curl.exe").arg(qApp->applicationDirPath());
QFile curlFile(curl);
if (curlFile.exists())
{// Trying send report
// Change token 28df778e0ef75e3724f7b9622fb70b9c69187779 if need
QString arg = QString("curl.exe -k -H \"Authorization: bearer 28df778e0ef75e3724f7b9622fb70b9c69187779\" "
"-H \"Accept: application/json\" -H \"Content-type: application/json\" -X POST "
"--data @gist.json https://api.github.com/gists");
// Change token if need
const QStringList token = QStringList()<<"3c"<<"6e"<<"91"<<"19"<<"96"<<"92"<<"dc"<<"50"<<"67"<<"8a"<<"2a"<<"89"
<<"a3"<<"55"<<"9e"<<"c7"<<"9d"<<"f8"<<"66"<<"a5";
const QString arg = QString("curl.exe -k -H \"Authorization: bearer ")+token.join("")+
QString("\" -H \"Accept: application/json\" -H \"Content-type: application/json\" -X POST "
"--data @gist.json https://api.github.com/gists");
QProcess::startDetached(arg);
reportFile.remove();// Clear after yourself
}
@ -2331,6 +2405,7 @@ void VApplication::SendReport(const QString &reportName) const
{// We can not send than just collect
CollectReport(reportName);
}
curlFile.close();
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2013 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify
@ -33,6 +33,7 @@
#include "../options.h"
#include "../widgets/vmaingraphicsview.h"
#include "../../libs/qmuparser/qmutranslation.h"
#include "vsettings.h"
class VApplication;// used in define
class QUndoStack;
@ -40,7 +41,6 @@ class VMainGraphicsView;
class VMainGraphicsScene;
class VPattern;
class QFile;
class VSettings;
class QLockFile;
#if defined(qApp)
@ -70,9 +70,10 @@ public:
double fromPixel(double pix, const Unit &unit) const;
double fromPixel(double pix) const;
static bool TryLock(QLockFile *lock);
static const qreal PrintDPI;
QString translationsPath() const;
QString pathToTables() const;
qreal widthMainLine() const;
qreal widthHairLine() const;
QString VarToUser(const QString &var) const;
@ -80,8 +81,18 @@ public:
QString GuiText(const QString &measurement) const;
QString Description(const QString &measurement) const;
QString PostfixOperator(const QString &name) const;
QString FormulaFromUser(const QString &formula);
QString FormulaToUser(const QString &formula);
template <typename T>
QString LocaleToString(const T &value)
{
QLocale loc;
qApp->getSettings()->GetOsSeparator() ? loc = QLocale::system() : loc = QLocale(QLocale::C);
return loc.toString(value);
}
QUndoStack *getUndoStack() const;
VMainGraphicsView *getSceneView() const;
void setSceneView(VMainGraphicsView *value);

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2014 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify
@ -31,37 +31,41 @@
#include <QDir>
#include <QDebug>
#include <QLocale>
#include <QApplication>
const QString VSettings::SettingConfigurationOsSeparator = QStringLiteral("configuration/osSeparator");
const QString VSettings::SettingConfigurationAutosaveState = QStringLiteral("configuration/autosave/state");
const QString VSettings::SettingConfigurationAutosaveTime = QStringLiteral("configuration/autosave/time");
const QString VSettings::SettingConfigurationSendReportState = QStringLiteral("configuration/send_report/state");
const QString VSettings::SettingConfigurationLocale = QStringLiteral("configuration/locale");
const QString VSettings::SettingConfigurationUnit = QStringLiteral("configuration/unit");
const QString VSettings::SettingConfigurationLabelLanguage = QStringLiteral("configuration/label_language");
const QString VSettings::SettingConfigurationOsSeparator = QStringLiteral("configuration/osSeparator");
const QString VSettings::SettingConfigurationAutosaveState = QStringLiteral("configuration/autosave/state");
const QString VSettings::SettingConfigurationAutosaveTime = QStringLiteral("configuration/autosave/time");
const QString VSettings::SettingConfigurationSendReportState = QStringLiteral("configuration/send_report/state");
const QString VSettings::SettingConfigurationLocale = QStringLiteral("configuration/locale");
const QString VSettings::SettingConfigurationUnit = QStringLiteral("configuration/unit");
const QString VSettings::SettingConfigurationLabelLanguage = QStringLiteral("configuration/label_language");
const QString VSettings::SettingConfigurationConfirmItemDeletion = QStringLiteral("configuration/confirm_item_deletion");
const QString VSettings::SettingPathsIndividualMeasurements = QStringLiteral("paths/individual_measurements");
const QString VSettings::SettingPathsPattern = QStringLiteral("paths/pattern");
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::SettingPathsLayout = QStringLiteral("paths/layout");
const QString VSettings::SettingPatternUser = QStringLiteral("pattern/user");
const QString VSettings::SettingPatternGraphicalOutput = QStringLiteral("pattern/graphicalOutput");
const QString VSettings::SettingPatternUndo = QStringLiteral("pattern/undo");
const QString VSettings::SettingPatternUser = QStringLiteral("pattern/user");
const QString VSettings::SettingPatternGraphicalOutput = QStringLiteral("pattern/graphicalOutput");
const QString VSettings::SettingPatternUndo = QStringLiteral("pattern/undo");
const QString VSettings::SettingGeneralRecentFileList = QStringLiteral("recentFileList");
const QString VSettings::SettingGeneralRestoreFileList = QStringLiteral("restoreFileList");
const QString VSettings::SettingGeneralGeometry = QStringLiteral("geometry");
const QString VSettings::SettingGeneralWindowState = QStringLiteral("windowState");
const QString VSettings::SettingGeneralRecentFileList = QStringLiteral("recentFileList");
const QString VSettings::SettingGeneralRestoreFileList = QStringLiteral("restoreFileList");
const QString VSettings::SettingGeneralGeometry = QStringLiteral("geometry");
const QString VSettings::SettingGeneralWindowState = QStringLiteral("windowState");
const QString VSettings::SettingCommunityServer = QStringLiteral("community/server");
const QString VSettings::SettingCommunityServerSecure = QStringLiteral("community/serverSecure");
const QString VSettings::SettingCommunityUseProxy = QStringLiteral("community/useProxy");
const QString VSettings::SettingCommunityProxyAddress = QStringLiteral("community/proxyAddress");
const QString VSettings::SettingCommunityProxyPort = QStringLiteral("community/proxyPort");
const QString VSettings::SettingCommunityProxyUser = QStringLiteral("community/proxyUser");
const QString VSettings::SettingCommunityProxyPass = QStringLiteral("community/proxyPass");
const QString VSettings::SettingCommunityUsername = QStringLiteral("community/username");
const QString VSettings::SettingCommunitySavePassword = QStringLiteral("community/savePassword");
const QString VSettings::SettingCommunityUserPassword = QStringLiteral("community/userpassword");
const QString VSettings::SettingCommunityServer = QStringLiteral("community/server");
const QString VSettings::SettingCommunityServerSecure = QStringLiteral("community/serverSecure");
const QString VSettings::SettingCommunityUseProxy = QStringLiteral("community/useProxy");
const QString VSettings::SettingCommunityProxyAddress = QStringLiteral("community/proxyAddress");
const QString VSettings::SettingCommunityProxyPort = QStringLiteral("community/proxyPort");
const QString VSettings::SettingCommunityProxyUser = QStringLiteral("community/proxyUser");
const QString VSettings::SettingCommunityProxyPass = QStringLiteral("community/proxyPass");
const QString VSettings::SettingCommunityUsername = QStringLiteral("community/username");
const QString VSettings::SettingCommunitySavePassword = QStringLiteral("community/savePassword");
const QString VSettings::SettingCommunityUserPassword = QStringLiteral("community/userpassword");
//---------------------------------------------------------------------------------------------------------------------
VSettings::VSettings(Format format, Scope scope, const QString &organization, const QString &application,
@ -161,6 +165,18 @@ void VSettings::SetLabelLanguage(const QString &value)
setValue(SettingConfigurationLabelLanguage, value);
}
//---------------------------------------------------------------------------------------------------------------------
bool VSettings::GetConfirmItemDelete() const
{
return value(SettingConfigurationConfirmItemDeletion, 1).toBool();
}
//---------------------------------------------------------------------------------------------------------------------
void VSettings::SetConfirmItemDelete(const bool &value)
{
setValue(SettingConfigurationConfirmItemDeletion, value);
}
//---------------------------------------------------------------------------------------------------------------------
QString VSettings::GetPathIndividualMeasurements() const
{
@ -173,6 +189,18 @@ 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
{
@ -185,6 +213,18 @@ void VSettings::SetPathPattern(const QString &value)
setValue(SettingPathsPattern, value);
}
//---------------------------------------------------------------------------------------------------------------------
QString VSettings::GetPathLayout() const
{
return value(SettingPathsLayout, QDir::homePath()).toString();
}
//---------------------------------------------------------------------------------------------------------------------
void VSettings::SetPathLayout(const QString &value)
{
setValue(SettingPathsLayout, value);
}
//---------------------------------------------------------------------------------------------------------------------
QString VSettings::GetUser() const
{
@ -402,3 +442,44 @@ void VSettings::SetUserPassword(const QString &value)
{
setValue(SettingCommunityUserPassword, value);
}
//---------------------------------------------------------------------------------------------------------------------
QString VSettings::StandardTablesPath()
{
const QString stPath = QStringLiteral("/tables/standard");
#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 QStringLiteral("/usr/share/valentina/tables/standard");
}
}
#else // Unix
#ifdef QT_DEBUG
return QApplication::applicationDirPath() + stPath;
#else
QDir dir(QApplication::applicationDirPath() + stPath);
if (dir.exists())
{
return dir.absolutePath();
}
else
{
return QStringLiteral("/usr/share/valentina/tables/standard");
}
#endif
#endif
}

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2014 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify
@ -38,6 +38,8 @@ public:
VSettings(Format format, Scope scope, const QString &organization, const QString &application = QString(),
QObject *parent = 0);
static QString StandardTablesPath();
bool GetOsSeparator() const;
void SetOsSeparator(const bool &value);
@ -59,12 +61,21 @@ public:
QString GetLabelLanguage() const;
void SetLabelLanguage(const QString &value);
bool GetConfirmItemDelete() const;
void SetConfirmItemDelete(const bool &value);
QString GetPathIndividualMeasurements() const;
void SetPathIndividualMeasurements(const QString &value);
QString GetPathStandardMeasurements() const;
void SetPathStandardMeasurements(const QString &value);
QString GetPathPattern() const;
void SetPathPattern(const QString &value);
QString GetPathLayout() const;
void SetPathLayout(const QString &value);
QString GetUser() const;
void SetUser(const QString &value);
@ -125,9 +136,12 @@ private:
static const QString SettingConfigurationLocale;
static const QString SettingConfigurationUnit;
static const QString SettingConfigurationLabelLanguage;
static const QString SettingConfigurationConfirmItemDeletion;
static const QString SettingPathsIndividualMeasurements;
static const QString SettingPathsStandardMeasurements;
static const QString SettingPathsPattern;
static const QString SettingPathsLayout;
static const QString SettingPatternUser;
static const QString SettingPatternGraphicalOutput;

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2013 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify
@ -33,6 +33,7 @@
#include <QVBoxLayout>
#include <QStackedWidget>
#include <QCloseEvent>
#include "../core/vapplication.h"
//---------------------------------------------------------------------------------------------------------------------
ConfigDialog::ConfigDialog(QWidget *parent) :
@ -93,6 +94,7 @@ ConfigDialog::ConfigDialog(QWidget *parent) :
this->setFixedSize(QSize(750, 550));
this->setWindowFlags(Qt::Tool | Qt::WindowTitleHint | Qt::WindowCloseButtonHint | Qt::CustomizeWindowHint);
qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
}
//---------------------------------------------------------------------------------------------------------------------
@ -156,6 +158,8 @@ void ConfigDialog::Apply()
default:
break;
}
qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
emit UpdateProperties();
setResult(QDialog::Accepted);
}

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2013 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify
@ -43,6 +43,8 @@ public:
explicit ConfigDialog(QWidget *parent = nullptr);
public slots:
void changePage(QListWidgetItem *current, QListWidgetItem *previous);
signals:
void UpdateProperties();
protected:
virtual void closeEvent(QCloseEvent *event);
private:

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2014 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2014 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2014 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify
@ -51,11 +51,13 @@ ConfigurationPage::ConfigurationPage(QWidget *parent)
QGroupBox *saveGroup = SaveGroup();
QGroupBox *langGroup = LangGroup();
QGroupBox *sendGroup = SendGroup();
QGroupBox *drawGroup = DrawGroup();
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addWidget(saveGroup);
mainLayout->addWidget(langGroup);
mainLayout->addWidget(sendGroup);
mainLayout->addWidget(drawGroup);
mainLayout->addStretch(1);
setLayout(mainLayout);
}
@ -73,6 +75,7 @@ void ConfigurationPage::Apply()
qApp->getSettings()->SetOsSeparator(osOptionCheck->isChecked());
qApp->getSettings()->SetSendReportState(sendReportCheck->isChecked());
qApp->getSettings()->SetConfirmItemDelete(askPointDeletionCheck->isChecked());
if (langChanged)
{
@ -271,6 +274,21 @@ QGroupBox *ConfigurationPage::SendGroup()
return sendGroup;
}
//---------------------------------------------------------------------------------------------------------------------
QGroupBox *ConfigurationPage::DrawGroup()
{
QGroupBox *drawGroup = new QGroupBox(tr("Pattern Editing"));
askPointDeletionCheck = new QCheckBox(tr("Confirm item deletion"));
askPointDeletionCheck->setChecked(qApp->getSettings()->GetConfirmItemDelete());
QVBoxLayout *editLayout = new QVBoxLayout;
editLayout->addWidget(askPointDeletionCheck);
drawGroup->setLayout(editLayout);
return drawGroup;
}
//---------------------------------------------------------------------------------------------------------------------
void ConfigurationPage::SetLabelComboBox(const QStringList &list)
{

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2014 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify
@ -59,10 +59,12 @@ private:
bool unitChanged;
bool labelLangChanged;
QCheckBox *sendReportCheck;
QCheckBox *askPointDeletionCheck;
QGroupBox *SaveGroup();
QGroupBox *LangGroup();
QGroupBox *SendGroup();
QGroupBox *DrawGroup();
void SetLabelComboBox(const QStringList &list);
};

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2013 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2014 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify
@ -63,7 +63,9 @@ PathPage::PathPage(QWidget *parent)
void PathPage::Apply()
{
qApp->getSettings()->SetPathIndividualMeasurements(pathTable->item(0, 1)->text());
qApp->getSettings()->SetPathPattern(pathTable->item(1, 1)->text());
qApp->getSettings()->SetPathStandardMeasurements(pathTable->item(1, 1)->text());
qApp->getSettings()->SetPathPattern(pathTable->item(2, 1)->text());
qApp->getSettings()->SetPathLayout(pathTable->item(3, 1)->text());
}
//---------------------------------------------------------------------------------------------------------------------
@ -79,24 +81,62 @@ void PathPage::TableActivated()
//---------------------------------------------------------------------------------------------------------------------
void PathPage::DefaultPath()
{
QTableWidgetItem *item = pathTable->item(pathTable->currentRow(), 1);
const int row = pathTable->currentRow();
QTableWidgetItem *item = pathTable->item(row, 1);
SCASSERT(item != nullptr);
item->setText(QDir::homePath());
switch(row)
{
case 1: // standard measurements
item->setText(VSettings::StandardTablesPath());
item->setToolTip(VSettings::StandardTablesPath());
break;
case 0: // individual measurements
case 2: // pattern path
case 3: // layout path
item->setText(QDir::homePath());
item->setToolTip(QDir::homePath());
break;
default:
break;
}
}
//---------------------------------------------------------------------------------------------------------------------
void PathPage::EditPath()
{
QTableWidgetItem *item = pathTable->item(pathTable->currentRow(), 1);
const int row = pathTable->currentRow();
QTableWidgetItem *item = pathTable->item(row, 1);
SCASSERT(item != nullptr);
QString dir = QFileDialog::getExistingDirectory(this, tr("Open Directory"), QDir::homePath(),
QString path;
switch(row)
{
case 0: // individual measurements
path = qApp->getSettings()->GetPathIndividualMeasurements();
break;
case 1: // standard measurements
path = qApp->getSettings()->GetPathStandardMeasurements();
break;
case 2: // pattern path
path = qApp->getSettings()->GetPathPattern();
break;
case 3: // layout path
path = qApp->getSettings()->GetPathLayout();
break;
default:
break;
}
QString dir = QFileDialog::getExistingDirectory(this, tr("Open Directory"), path,
QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
if (dir.isEmpty())
{
dir = QDir::homePath();
DefaultPath();
return;
}
item->setText(dir);
item->setToolTip(dir);
}
//---------------------------------------------------------------------------------------------------------------------
@ -125,10 +165,11 @@ QGroupBox *PathPage::PathGroup()
return pathGroup;
}
//---------------------------------------------------------------------------------------------------------------------
void PathPage::InitTable()
{
pathTable = new QTableWidget();
pathTable->setRowCount(2);
pathTable->setRowCount(4);
pathTable->setColumnCount(2);
pathTable->verticalHeader()->setVisible(false);
pathTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
@ -139,11 +180,33 @@ void PathPage::InitTable()
QStringList tableHeader = QStringList() << tr("Type") << tr("Path");
pathTable->setHorizontalHeaderLabels(tableHeader);
pathTable->setItem(0, 0, new QTableWidgetItem(tr("Individual measurements")));
pathTable->setItem(0, 1, new QTableWidgetItem(qApp->getSettings()->GetPathIndividualMeasurements()));
{
pathTable->setItem(0, 0, new QTableWidgetItem(tr("Individual measurements")));
QTableWidgetItem *item = new QTableWidgetItem(qApp->getSettings()->GetPathIndividualMeasurements());
item->setToolTip(qApp->getSettings()->GetPathIndividualMeasurements());
pathTable->setItem(0, 1, item);
}
pathTable->setItem(1, 0, new QTableWidgetItem(tr("Patterns")));
pathTable->setItem(1, 1, new QTableWidgetItem(qApp->getSettings()->GetPathPattern()));
{
pathTable->setItem(1, 0, new QTableWidgetItem(tr("Standard measurements")));
QTableWidgetItem *item = new QTableWidgetItem(qApp->getSettings()->GetPathStandardMeasurements());
item->setToolTip(qApp->getSettings()->GetPathStandardMeasurements());
pathTable->setItem(1, 1, item);
}
{
pathTable->setItem(2, 0, new QTableWidgetItem(tr("Patterns")));
QTableWidgetItem *item = new QTableWidgetItem(qApp->getSettings()->GetPathPattern());
item->setToolTip(qApp->getSettings()->GetPathPattern());
pathTable->setItem(2, 1, item);
}
{
pathTable->setItem(3, 0, new QTableWidgetItem(tr("Layout")));
QTableWidgetItem *item = new QTableWidgetItem(qApp->getSettings()->GetPathLayout());
item->setToolTip(qApp->getSettings()->GetPathLayout());
pathTable->setItem(3, 1, item);
}
pathTable->verticalHeader()->setDefaultSectionSize(20);
pathTable->resizeColumnsToContents();

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2014 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2014 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2014 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2013 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify
@ -33,6 +33,7 @@
#include <QDesktopServices>
#include <QMessageBox>
#include "../../options.h"
#include "../core/vapplication.h"
//---------------------------------------------------------------------------------------------------------------------
DialogAboutApp::DialogAboutApp(QWidget *parent) :
@ -41,6 +42,8 @@ DialogAboutApp::DialogAboutApp(QWidget *parent) :
{
ui->setupUi(this);
qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
ui->label_Valentina_Version->setText(QString("Valentina %1").arg(APP_VERSION));
ui->labelBuildRevision->setText(QString("Build revision: %1").arg(BUILD_REVISION));
ui->label_QT_Version->setText(buildCompatibilityString());

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2013 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify

View File

@ -10,7 +10,7 @@
<x>0</x>
<y>0</y>
<width>583</width>
<height>480</height>
<height>524</height>
</rect>
</property>
<property name="sizePolicy">
@ -22,13 +22,13 @@
<property name="minimumSize">
<size>
<width>573</width>
<height>480</height>
<height>524</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>583</width>
<height>480</height>
<height>524</height>
</size>
</property>
<property name="cursor">
@ -201,7 +201,7 @@
</font>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
<enum>Qt::ScrollBarAsNeeded</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
@ -217,7 +217,16 @@ Christine Neupert
Sabine Schmaltz
grumpi
Steve Conklin
Patrick Proy </string>
Lindsay Williams
Patrick Proy
Mischa Krempel
Matt Daw
Peter Gsellmann
Robert Martin
Michaela Orth
Rina Rivera
Fritz Rometsch
Felix Ulber </string>
</property>
</widget>
</item>

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2013 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify
@ -49,6 +49,9 @@ DialogHistory::DialogHistory(VContainer *data, VPattern *doc, QWidget *parent)
cursorToolRecordRow(0)
{
ui->setupUi(this);
qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
connect(bOk, &QPushButton::clicked, this, &DialogHistory::DialogAccepted);
FillTable();
@ -74,7 +77,7 @@ void DialogHistory::DialogAccepted()
{
QTableWidgetItem *item = ui->tableWidget->item(cursorToolRecordRow, 0);
quint32 id = qvariant_cast<quint32>(item->data(Qt::UserRole));
emit ShowHistoryTool(id, Qt::green, false);
emit ShowHistoryTool(id, false);
emit DialogClosed(QDialog::Accepted);
}
@ -103,12 +106,12 @@ void DialogHistory::cellClicked(int row, int column)
{
QTableWidgetItem *item = ui->tableWidget->item(cursorToolRecordRow, 0);
quint32 id = qvariant_cast<quint32>(item->data(Qt::UserRole));
emit ShowHistoryTool(id, Qt::green, false);
emit ShowHistoryTool(id, false);
cursorToolRecordRow = row;
item = ui->tableWidget->item(cursorToolRecordRow, 0);
id = qvariant_cast<quint32>(item->data(Qt::UserRole));
emit ShowHistoryTool(id, Qt::green, true);
emit ShowHistoryTool(id, true);
}
}
@ -197,7 +200,7 @@ void DialogHistory::FillTable()
*/
QString DialogHistory::Record(const VToolRecord &tool)
{
const QDomElement domElem = doc->elementById(QString().setNum(tool.getId()));
const QDomElement domElem = doc->elementById(tool.getId());
if (domElem.isElement() == false)
{
qDebug()<<"Can't find element by id"<<Q_FUNC_INFO;
@ -434,7 +437,7 @@ void DialogHistory::ShowPoint()
cursorToolRecordRow = 0;
item = ui->tableWidget->item(0, 0);
quint32 id = qvariant_cast<quint32>(item->data(Qt::UserRole));
emit ShowHistoryTool(id, Qt::green, true);
emit ShowHistoryTool(id, true);
}
}
@ -466,6 +469,6 @@ void DialogHistory::closeEvent(QCloseEvent *event)
{
QTableWidgetItem *item = ui->tableWidget->item(cursorToolRecordRow, 0);
quint32 id = qvariant_cast<quint32>(item->data(Qt::UserRole));
emit ShowHistoryTool(id, Qt::green, false);
emit ShowHistoryTool(id, false);
DialogTool::closeEvent(event);
}

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2013 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify
@ -63,10 +63,9 @@ signals:
/**
* @brief ShowHistoryTool signal change color of selected in records tool
* @param id id of tool
* @param color new color of tool
* @param enable true enable selection, false disable selection
*/
void ShowHistoryTool(quint32 id, Qt::GlobalColor color, bool enable);
void ShowHistoryTool(quint32 id, bool enable);
protected:
virtual void closeEvent ( QCloseEvent * event );
private:

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2013 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify
@ -30,6 +30,7 @@
#include "ui_dialogincrements.h"
#include "../../widgets/doubledelegate.h"
#include "../../widgets/textdelegate.h"
#include "../../widgets/vwidgetpopup.h"
#include "../../xml/vstandardmeasurements.h"
#include "../../xml/vindividualmeasurements.h"
#include "../../core/vsettings.h"
@ -55,6 +56,8 @@ DialogIncrements::DialogIncrements(VContainer *data, VPattern *doc, QWidget *par
{
ui->setupUi(this);
qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
qCDebug(vDialog)<<"Showing variables.";
if (qApp->patternType() == MeasurementsType::Individual)
{
@ -97,6 +100,30 @@ DialogIncrements::DialogIncrements(VContainer *data, VPattern *doc, QWidget *par
if (qApp->patternType() == MeasurementsType::Standard)
{
ui->toolBoxMeasurements->setItemEnabled(0, false);
const QString filePath = doc->MPath();
VStandardMeasurements *mSt = nullptr;
try
{
VDomDocument::ValidateXML("://schema/standard_measurements.xsd", filePath);
mSt = new VStandardMeasurements(data);
mSt->setXMLContent(filePath);
ui->labelBaseValues->setText(tr("Base size: %1 %3; Base height: %2 %3").arg(mSt->Size())
.arg(mSt->Height()).arg(VDomDocument::UnitsToStr(qApp->patternUnit())));
ui->labelDescription->setText(tr("Description: \"%1\"").arg(mSt->TrDescription()));
delete mSt;
}
catch (VException &e)
{
e.CriticalMessageBox(tr("File error."), this);
if (mSt != nullptr)
{
delete mSt;
}
emit DialogClosed(QDialog::Rejected);
return;
}
}
else
{
@ -130,6 +157,10 @@ DialogIncrements::DialogIncrements(VContainer *data, VPattern *doc, QWidget *par
connect(ui->comboBoxSex, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
&DialogIncrements::SaveSex);
connect(ui->dateEditBirthDate, &QDateEdit::dateChanged, this, &DialogIncrements::SaveBirthDate);
// hide fileds that don't exist in individual measurements
ui->labelBaseValues->setVisible(false);
ui->labelDescription->setVisible(false);
}
ui->toolBoxMeasurements->setCurrentIndex(1);
@ -177,14 +208,14 @@ void DialogIncrements::FillMeasurements()
if (qApp->patternType() == MeasurementsType::Standard)
{
QTableWidgetItem *item = new QTableWidgetItem(QString()
.setNum(data->GetTableValue(qApp->VarFromUser(iMap.key()))));
QTableWidgetItem *item = new QTableWidgetItem(qApp->LocaleToString(
data->GetTableValue(qApp->VarFromUser(iMap.key()))));
item->setTextAlignment(Qt::AlignHCenter);
SetItemViewOnly(item);
ui->tableWidgetMeasurements->setItem(currentRow, 1, item);// calculated value
}
item = new QTableWidgetItem(QString().setNum(m->GetBase()));
item = new QTableWidgetItem(qApp->LocaleToString(m->GetBase()));
item->setTextAlignment(Qt::AlignHCenter);
if (qApp->patternType() == MeasurementsType::Standard)
{
@ -194,12 +225,12 @@ void DialogIncrements::FillMeasurements()
if (qApp->patternType() == MeasurementsType::Standard)
{
QTableWidgetItem *item = new QTableWidgetItem(QString().setNum(m->GetKsize()));
QTableWidgetItem *item = new QTableWidgetItem(qApp->LocaleToString(m->GetKsize()));
item->setTextAlignment(Qt::AlignHCenter);
SetItemViewOnly(item);
ui->tableWidgetMeasurements->setItem(currentRow, 3, item);// in sizes
item = new QTableWidgetItem(QString().setNum(m->GetKheight()));
item = new QTableWidgetItem(qApp->LocaleToString(m->GetKheight()));
item->setTextAlignment(Qt::AlignHCenter);
SetItemViewOnly(item);
ui->tableWidgetMeasurements->setItem(currentRow, 4, item);// in heights
@ -250,23 +281,23 @@ void DialogIncrements::FillIncrements()
if (qApp->patternType() == MeasurementsType::Standard)
{
item = new QTableWidgetItem(QString().setNum(data->GetTableValue(iMap.value())));
item = new QTableWidgetItem(qApp->LocaleToString(data->GetTableValue(iMap.value())));
item->setTextAlignment(Qt::AlignHCenter);
SetItemViewOnly(item);
ui->tableWidgetIncrement->setItem(currentRow, 1, item);
}
item = new QTableWidgetItem(QString().setNum(incr->GetBase()));
item = new QTableWidgetItem(qApp->LocaleToString(incr->GetBase()));
item->setTextAlignment(Qt::AlignHCenter);
ui->tableWidgetIncrement->setItem(currentRow, 2, item);
if (qApp->patternType() == MeasurementsType::Standard)
{
item = new QTableWidgetItem(QString().setNum(incr->GetKsize()));
item = new QTableWidgetItem(qApp->LocaleToString(incr->GetKsize()));
item->setTextAlignment(Qt::AlignHCenter);
ui->tableWidgetIncrement->setItem(currentRow, 3, item);
item = new QTableWidgetItem(QString().setNum(incr->GetKheight()));
item = new QTableWidgetItem(qApp->LocaleToString(incr->GetKheight()));
item->setTextAlignment(Qt::AlignHCenter);
ui->tableWidgetIncrement->setItem(currentRow, 4, item);
}
@ -305,7 +336,7 @@ void DialogIncrements::FillTable(const QMap<QString, T> varTable, QTableWidget *
item->setFont(QFont("Times", 12, QFont::Bold));
table->setItem(currentRow, 0, item);
item = new QTableWidgetItem(QString().setNum(length));
item = new QTableWidgetItem(qApp->LocaleToString(length));
item->setTextAlignment(Qt::AlignHCenter);
table->setItem(currentRow, 1, item);
}
@ -377,6 +408,20 @@ void DialogIncrements::ShowHeaderUnits(QTableWidget *table, int column)
table->horizontalHeaderItem(column)->setText(unitHeader);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogIncrements::ShowSuccess() const
{
VWidgetPopup *popup = new VWidgetPopup();
QLabel *label = new QLabel(tr("Data successfully saved."));
QFont f = label->font();
f.setBold(true);
f.setPixelSize(16);
label->setFont(f);
popup->SetWidget(label);
popup->SetLifeTime(2000);
popup->Show(frameGeometry().center());
}
//---------------------------------------------------------------------------------------------------------------------
void DialogIncrements::ShowMeasurements()
{
@ -432,6 +477,10 @@ void DialogIncrements::SaveGivenName()
messageBox.setStandardButtons(QMessageBox::Ok);
messageBox.exec();
}
else
{
ShowSuccess();
}
}
//---------------------------------------------------------------------------------------------------------------------
@ -450,6 +499,10 @@ void DialogIncrements::SaveFamilyName()
messageBox.setStandardButtons(QMessageBox::Ok);
messageBox.exec();
}
else
{
ShowSuccess();
}
}
//---------------------------------------------------------------------------------------------------------------------
@ -467,6 +520,10 @@ void DialogIncrements::SaveEmail()
messageBox.setStandardButtons(QMessageBox::Ok);
messageBox.exec();
}
else
{
ShowSuccess();
}
}
//---------------------------------------------------------------------------------------------------------------------
@ -484,6 +541,10 @@ void DialogIncrements::SaveSex(int index)
messageBox.setStandardButtons(QMessageBox::Ok);
messageBox.exec();
}
else
{
ShowSuccess();
}
}
//---------------------------------------------------------------------------------------------------------------------
@ -501,12 +562,16 @@ void DialogIncrements::SaveBirthDate(const QDate & date)
messageBox.setStandardButtons(QMessageBox::Ok);
messageBox.exec();
}
else
{
ShowSuccess();
}
}
//---------------------------------------------------------------------------------------------------------------------
void DialogIncrements::OpenTable()
{
QString text = tr("Measurements use different units than pattern. This pattern required measurements in %1")
const QString text = tr("Measurements use different units than pattern. This pattern required measurements in %1")
.arg(doc->UnitsToStr(qApp->patternUnit()));
if (qApp->patternType() == MeasurementsType::Individual)
{
@ -555,7 +620,9 @@ void DialogIncrements::OpenTable()
else
{
const QString filter(tr("Standard measurements (*.vst)"));
const QString filePath = QFileDialog::getOpenFileName(this, tr("Open file"), qApp->pathToTables(), filter);
//Use standard path to standard measurements
const QString path = qApp->getSettings()->GetPathStandardMeasurements();
const QString filePath = QFileDialog::getOpenFileName(this, tr("Open file"), path, filter);
if (filePath.isEmpty())
{
return;
@ -656,6 +723,7 @@ void DialogIncrements::clickedToolButtonAdd()
ui->toolButtonRemove->setEnabled(true);
ui->tableWidgetIncrement->blockSignals(false);
emit haveLiteChange();
ShowSuccess();
}
//---------------------------------------------------------------------------------------------------------------------
@ -674,7 +742,7 @@ void DialogIncrements::clickedToolButtonRemove()
data->RemoveIncrement(itemName->text());
quint32 id = qvariant_cast<quint32>(itemName->data(Qt::UserRole));
QDomElement domElement = doc->elementById(QString().setNum(id));
QDomElement domElement = doc->elementById(id);
if (domElement.isElement())
{
QDomNodeList list = doc->elementsByTagName(VPattern::TagIncrements);
@ -683,6 +751,7 @@ void DialogIncrements::clickedToolButtonRemove()
else
{
qCDebug(vDialog)<<"Could not find object with id"<<id;
return;
}
ui->tableWidgetIncrement->removeRow(row);
@ -693,6 +762,7 @@ void DialogIncrements::clickedToolButtonRemove()
ui->tableWidgetIncrement->blockSignals(false);
emit haveLiteChange();
ShowSuccess();
}
//---------------------------------------------------------------------------------------------------------------------
@ -746,7 +816,7 @@ void DialogIncrements::IncrementChanged ( qint32 row, qint32 column )
const QTableWidgetItem *itemName = ui->tableWidgetIncrement->item(row, 0);
const QTableWidgetItem *item = ui->tableWidgetIncrement->item(row, column);
const quint32 id = qvariant_cast<quint32>(itemName->data(Qt::UserRole));
QDomElement domElement = doc->elementById(QString().setNum(id));
QDomElement domElement = doc->elementById(id);
if (domElement.isElement() == false)
{
qCDebug(vDialog)<<"Cant't find increment with id = "<<id<<Q_FUNC_INFO;
@ -797,6 +867,7 @@ void DialogIncrements::IncrementChanged ( qint32 row, qint32 column )
break;
}
emit haveLiteChange();
ShowSuccess();
}
//---------------------------------------------------------------------------------------------------------------------
@ -849,7 +920,10 @@ void DialogIncrements::MeasurementChanged(qint32 row, qint32 column)
messageBox.setStandardButtons(QMessageBox::Ok);
messageBox.exec();
}
else
{
ShowSuccess();
}
data->ClearVariables();
m->Measurements();

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2013 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify
@ -107,6 +107,7 @@ private:
void SetItemViewOnly(QTableWidgetItem *item);
void ShowUnits();
void ShowHeaderUnits(QTableWidget *table, int column);
void ShowSuccess() const;
};
#endif // DIALOGINCREMENTS_H

View File

@ -17,7 +17,7 @@
</size>
</property>
<property name="windowTitle">
<string>Increments</string>
<string>Tables of Variables</string>
</property>
<property name="windowIcon">
<iconset resource="../../share/resources/icon.qrc">
@ -290,6 +290,23 @@
<string>Measurements</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="labelBaseValues">
<property name="text">
<string notr="true">Base size: ; base height: </string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelDescription">
<property name="text">
<string notr="true">Description:</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxHideEmpty">
<property name="text">

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2013 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify
@ -47,6 +47,8 @@ DialogIndividualMeasurements::DialogIndividualMeasurements(VContainer *data, con
{
ui->setupUi(this);
qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
QRect position = this->frameGeometry();
position.moveCenter(QDesktopWidget().availableGeometry().center());
move(position.topLeft());
@ -98,8 +100,9 @@ void DialogIndividualMeasurements::DialogAccepted()
}
//just in case
VDomDocument::ValidateXML("://schema/individual_measurements.xsd", qApp->pathToTables());
QFile iMeasur(qApp->pathToTables());
const QString path = QStringLiteral("://tables/individual/individual.vit");
VDomDocument::ValidateXML("://schema/individual_measurements.xsd", path);
QFile iMeasur(path);
//TODO maybe make copy save?
if ( iMeasur.copy(_tablePath) == false )
{
@ -226,7 +229,7 @@ void DialogIndividualMeasurements::OpenTable()
//---------------------------------------------------------------------------------------------------------------------
void DialogIndividualMeasurements::NewTable()
{
QString dir = QDir::homePath()+"/measurements.vit";
const QString dir = qApp->getSettings()->GetPathIndividualMeasurements()+"/measurements.vit";
QString name = QFileDialog::getSaveFileName(this, tr("Where save measurements?"), dir,
tr("Individual measurements (*.vit)"));
@ -236,7 +239,7 @@ void DialogIndividualMeasurements::NewTable()
}
// what if the users did not specify a suffix...?
QFileInfo f( name );
const QFileInfo f( name );
if (f.suffix().isEmpty() && f.suffix() != "vit")
{
name += ".vit";

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2013 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify

View File

@ -0,0 +1,113 @@
/************************************************************************
**
** @file dialoglayoutprogress.cpp
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date 14 1, 2015
**
** @brief
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#include "dialoglayoutprogress.h"
#include "ui_dialoglayoutprogress.h"
#include "../options.h"
#include "../core/vapplication.h"
#include <QMessageBox>
#include <QPushButton>
//---------------------------------------------------------------------------------------------------------------------
DialogLayoutProgress::DialogLayoutProgress(int count, QWidget *parent)
:QDialog(parent), ui(new Ui::DialogLayoutProgress)
{
ui->setupUi(this);
qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
ui->progressBar->setMaximum(count);
ui->progressBar->setValue(0);
QPushButton *bCancel = ui->buttonBox->button(QDialogButtonBox::Cancel);
SCASSERT(bCancel != nullptr);
connect(bCancel, &QPushButton::clicked, this, &DialogLayoutProgress::StopWorking);
setModal(true);
this->setWindowFlags(Qt::Dialog | Qt::WindowTitleHint | Qt::CustomizeWindowHint);
}
//---------------------------------------------------------------------------------------------------------------------
DialogLayoutProgress::~DialogLayoutProgress()
{
delete ui;
}
//---------------------------------------------------------------------------------------------------------------------
void DialogLayoutProgress::Start()
{
show();
}
//---------------------------------------------------------------------------------------------------------------------
void DialogLayoutProgress::Arranged(int count)
{
ui->progressBar->setValue(count);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogLayoutProgress::Error(const LayoutErrors &state)
{
QString text;
switch(state)
{
case LayoutErrors::NoError:
return;
case LayoutErrors::PrepareLayoutError:
text = tr("Couldn't prepare data for creation layout");
QMessageBox::critical(this, tr("Critical error"), text, QMessageBox::Ok, QMessageBox::Ok);
break;
case LayoutErrors::PaperSizeError:
text = tr("Wrong paper size");
QMessageBox::critical(this, tr("Critical error"), text, QMessageBox::Ok, QMessageBox::Ok);
break;
case LayoutErrors::ProcessStoped:
break;
case LayoutErrors::EmptyPaperError:
text = tr("Several workpieces left not arranged, but none of them match for paper");
QMessageBox::critical(this, tr("Critical error"), text, QMessageBox::Ok, QMessageBox::Ok);
break;
default:
break;
}
done(QDialog::Rejected);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogLayoutProgress::Finished()
{
done(QDialog::Accepted);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogLayoutProgress::StopWorking()
{
emit Abort();
}

View File

@ -0,0 +1,64 @@
/************************************************************************
**
** @file dialoglayoutprogress.h
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date 14 1, 2015
**
** @brief
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#ifndef DIALOGLAYOUTPROGRESS_H
#define DIALOGLAYOUTPROGRESS_H
#include <QDialog>
#include "../../libs/vlayout/vlayoutdef.h"
namespace Ui
{
class DialogLayoutProgress;
}
class DialogLayoutProgress : public QDialog
{
Q_OBJECT
public:
explicit DialogLayoutProgress(int count, QWidget *parent = 0);
~DialogLayoutProgress();
signals:
void Abort();
public slots:
void Start();
void Arranged(int count);
void Error(const LayoutErrors &state);
void Finished();
void StopWorking();
private:
Q_DISABLE_COPY(DialogLayoutProgress)
Ui::DialogLayoutProgress *ui;
};
#endif // DIALOGLAYOUTPROGRESS_H

View File

@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DialogLayoutProgress</class>
<widget class="QDialog" name="DialogLayoutProgress">
<property name="windowModality">
<enum>Qt::ApplicationModal</enum>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>566</width>
<height>119</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>566</width>
<height>119</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>566</width>
<height>119</height>
</size>
</property>
<property name="windowTitle">
<string>Creation a layout</string>
</property>
<property name="windowIcon">
<iconset resource="../../share/resources/icon.qrc">
<normaloff>:/icon/64x64/icon64x64.png</normaloff>:/icon/64x64/icon64x64.png</iconset>
</property>
<property name="modal">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item alignment="Qt::AlignHCenter">
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Finding best position for worpieces. Please, waite.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QProgressBar" name="progressBar">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="value">
<number>24</number>
</property>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="../../share/resources/icon.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -0,0 +1,436 @@
/************************************************************************
**
** @file dialoglayoutsettings.cpp
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date 13 1, 2015
**
** @brief
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#include "dialoglayoutsettings.h"
#include "ui_dialoglayoutsettings.h"
#include "../../core/vapplication.h"
#include "../../libs/ifc/xml/vdomdocument.h"
#include "../../core/vsettings.h"
#include "../../xml/vabstractmeasurements.h"
#include <QtMath>
enum class PaperSizeTemplate : char { A0, A1, A2, A3, A4 };
//---------------------------------------------------------------------------------------------------------------------
DialogLayoutSettings::DialogLayoutSettings(QWidget *parent)
: QDialog(parent), ui(new Ui::DialogLayoutSettings), oldPaperUnit(Unit::Mm), oldLayoutUnit(Unit::Mm)
{
ui->setupUi(this);
qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
InitPaperUnits();
InitLayoutUnits();
InitTemplates();
MinimumPaperSize();
MinimumLayoutSize();
connect(ui->comboBoxTemplates, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this, &DialogLayoutSettings::TemplateSelected);
connect(ui->comboBoxPaperSizeUnit, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this, &DialogLayoutSettings::ConvertPaperSize);
connect(ui->doubleSpinBoxPaperWidth, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
this, &DialogLayoutSettings::PaperSizeChanged);
connect(ui->doubleSpinBoxPaperHeight, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
this, &DialogLayoutSettings::PaperSizeChanged);
connect(ui->toolButtonPortrate, &QToolButton::toggled, this, &DialogLayoutSettings::Swap);
connect(ui->toolButtonLandscape, &QToolButton::toggled, this, &DialogLayoutSettings::Swap);
connect(ui->comboBoxLayoutUnit, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this, &DialogLayoutSettings::ConvertLayoutSize);
}
//---------------------------------------------------------------------------------------------------------------------
DialogLayoutSettings::~DialogLayoutSettings()
{
delete ui;
}
//---------------------------------------------------------------------------------------------------------------------
int DialogLayoutSettings::GetPaperHeight() const
{
return qFloor(VAbstractMeasurements::UnitConvertor(ui->doubleSpinBoxPaperHeight->value(), oldPaperUnit, Unit::Px));
}
//---------------------------------------------------------------------------------------------------------------------
void DialogLayoutSettings::SetPaperHeight(int value)
{
ui->doubleSpinBoxPaperHeight->setValue(VAbstractMeasurements::UnitConvertor(value, Unit::Px, PaperUnit()));
}
//---------------------------------------------------------------------------------------------------------------------
int DialogLayoutSettings::GetPaperWidth() const
{
return qFloor(VAbstractMeasurements::UnitConvertor(ui->doubleSpinBoxPaperWidth->value(), oldPaperUnit, Unit::Px));
}
//---------------------------------------------------------------------------------------------------------------------
void DialogLayoutSettings::SetPaperWidth(int value)
{
ui->doubleSpinBoxPaperWidth->setValue(VAbstractMeasurements::UnitConvertor(value, Unit::Px, PaperUnit()));
}
//---------------------------------------------------------------------------------------------------------------------
unsigned int DialogLayoutSettings::GetShift() const
{
return qFloor(VAbstractMeasurements::UnitConvertor(ui->doubleSpinBoxShift->value(), oldLayoutUnit, Unit::Px));
}
//---------------------------------------------------------------------------------------------------------------------
void DialogLayoutSettings::SetShift(unsigned int value)
{
ui->doubleSpinBoxShift->setValue(VAbstractMeasurements::UnitConvertor(value, Unit::Px, LayoutUnit()));
}
//---------------------------------------------------------------------------------------------------------------------
unsigned int DialogLayoutSettings::GetLayoutWidth() const
{
return qFloor(VAbstractMeasurements::UnitConvertor(ui->doubleSpinBoxLayoutWidth->value(), oldLayoutUnit, Unit::Px));
}
//---------------------------------------------------------------------------------------------------------------------
void DialogLayoutSettings::SetLayoutWidth(unsigned int value)
{
ui->doubleSpinBoxLayoutWidth->setValue(VAbstractMeasurements::UnitConvertor(value, Unit::Px, LayoutUnit()));
}
//---------------------------------------------------------------------------------------------------------------------
Cases DialogLayoutSettings::GetGroup() const
{
if (ui->radioButtonThreeGroups->isChecked())
{
return Cases::CaseThreeGroup;
}
else if (ui->radioButtonTwoGroups->isChecked())
{
return Cases::CaseTwoGroup;
}
else
{
return Cases::CaseDesc;
}
}
//---------------------------------------------------------------------------------------------------------------------
void DialogLayoutSettings::SetGroup(const Cases &value)
{
switch (value)
{
case Cases::CaseThreeGroup:
ui->radioButtonThreeGroups->setChecked(true);
break;
case Cases::CaseTwoGroup:
ui->radioButtonTwoGroups->setChecked(true);
break;
case Cases::CaseDesc:
ui->radioButtonDescendingArea->setChecked(true);
break;
default:
ui->radioButtonDescendingArea->setChecked(true);
break;
}
}
//---------------------------------------------------------------------------------------------------------------------
bool DialogLayoutSettings::GetRotate() const
{
return ui->groupBoxRotate->isChecked();
}
//---------------------------------------------------------------------------------------------------------------------
void DialogLayoutSettings::SetRotate(bool state)
{
ui->groupBoxRotate->setChecked(state);
}
//---------------------------------------------------------------------------------------------------------------------
int DialogLayoutSettings::GetIncrease() const
{
return ui->comboBoxIncrease->currentText().toInt();
}
//---------------------------------------------------------------------------------------------------------------------
void DialogLayoutSettings::SetIncrease(int increase)
{
int index = ui->comboBoxIncrease->findText(QString::number(increase));
if (index == -1)
{
index = 21;
}
ui->comboBoxIncrease->setCurrentIndex(index);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogLayoutSettings::TemplateSelected()
{
const QSizeF size = Template();
ui->doubleSpinBoxPaperWidth->setValue(size.width());
ui->doubleSpinBoxPaperHeight->setValue(size.height());
oldPaperUnit = PaperUnit();
CorrectPaperDecimals();
PaperSizeChanged();
}
//---------------------------------------------------------------------------------------------------------------------
void DialogLayoutSettings::ConvertPaperSize()
{
const Unit paperUnit = PaperUnit();
const qreal width = ui->doubleSpinBoxPaperWidth->value();
const qreal height = ui->doubleSpinBoxPaperHeight->value();
ui->doubleSpinBoxPaperWidth->setValue(VAbstractMeasurements::UnitConvertor(width, oldPaperUnit, paperUnit));
ui->doubleSpinBoxPaperHeight->setValue(VAbstractMeasurements::UnitConvertor(height, oldPaperUnit, paperUnit));
oldPaperUnit = paperUnit;
CorrectPaperDecimals();
MinimumPaperSize();
}
//---------------------------------------------------------------------------------------------------------------------
void DialogLayoutSettings::ConvertLayoutSize()
{
const Unit unit = LayoutUnit();
const qreal layoutWidth = ui->doubleSpinBoxLayoutWidth->value();
const qreal shift = ui->doubleSpinBoxShift->value();
ui->doubleSpinBoxLayoutWidth->setValue(VAbstractMeasurements::UnitConvertor(layoutWidth, oldLayoutUnit, unit));
ui->doubleSpinBoxShift->setValue(VAbstractMeasurements::UnitConvertor(shift, oldLayoutUnit, unit));
oldLayoutUnit = unit;
CorrectLayoutDecimals();
MinimumLayoutSize();
}
//---------------------------------------------------------------------------------------------------------------------
void DialogLayoutSettings::PaperSizeChanged()
{
if (ui->doubleSpinBoxPaperHeight->value() > ui->doubleSpinBoxPaperWidth->value())
{
ui->toolButtonPortrate->blockSignals(true);
ui->toolButtonPortrate->setChecked(true);
ui->toolButtonPortrate->blockSignals(false);
}
else
{
ui->toolButtonLandscape->blockSignals(true);
ui->toolButtonLandscape->setChecked(true);
ui->toolButtonLandscape->blockSignals(false);
}
Label();
}
//---------------------------------------------------------------------------------------------------------------------
void DialogLayoutSettings::Swap(bool checked)
{
if (checked)
{
const qreal width = ui->doubleSpinBoxPaperWidth->value();
const qreal height = ui->doubleSpinBoxPaperHeight->value();
ui->doubleSpinBoxPaperWidth->blockSignals(true);
ui->doubleSpinBoxPaperWidth->setValue(height);
ui->doubleSpinBoxPaperWidth->blockSignals(false);
ui->doubleSpinBoxPaperHeight->blockSignals(true);
ui->doubleSpinBoxPaperHeight->setValue(width);
ui->doubleSpinBoxPaperHeight->blockSignals(false);
Label();
}
}
//---------------------------------------------------------------------------------------------------------------------
void DialogLayoutSettings::InitPaperUnits()
{
ui->comboBoxPaperSizeUnit->addItem(tr("Millimiters"), QVariant(VDomDocument::UnitsToStr(Unit::Mm)));
ui->comboBoxPaperSizeUnit->addItem(tr("Centimeters"), QVariant(VDomDocument::UnitsToStr(Unit::Cm)));
ui->comboBoxPaperSizeUnit->addItem(tr("Inches"), QVariant(VDomDocument::UnitsToStr(Unit::Inch)));
ui->comboBoxPaperSizeUnit->addItem(tr("Pixels"), QVariant(VDomDocument::UnitsToStr(Unit::Px)));
// set default unit
oldPaperUnit = VDomDocument::StrToUnits(qApp->getSettings()->GetUnit());
const qint32 indexUnit = ui->comboBoxPaperSizeUnit->findData(qApp->getSettings()->GetUnit());
if (indexUnit != -1)
{
ui->comboBoxPaperSizeUnit->setCurrentIndex(indexUnit);
}
}
//---------------------------------------------------------------------------------------------------------------------
void DialogLayoutSettings::InitLayoutUnits()
{
ui->comboBoxLayoutUnit->addItem(tr("Centimeters"), QVariant(VDomDocument::UnitsToStr(Unit::Cm)));
ui->comboBoxLayoutUnit->addItem(tr("Millimiters"), QVariant(VDomDocument::UnitsToStr(Unit::Mm)));
ui->comboBoxLayoutUnit->addItem(tr("Inches"), QVariant(VDomDocument::UnitsToStr(Unit::Inch)));
// set default unit
oldLayoutUnit = VDomDocument::StrToUnits(qApp->getSettings()->GetUnit());
const qint32 indexUnit = ui->comboBoxLayoutUnit->findData(qApp->getSettings()->GetUnit());
if (indexUnit != -1)
{
ui->comboBoxLayoutUnit->setCurrentIndex(indexUnit);
}
ui->doubleSpinBoxLayoutWidth->setValue(VAbstractMeasurements::UnitConvertor(2.5, Unit::Mm, oldLayoutUnit));
ui->doubleSpinBoxShift->setValue(VAbstractMeasurements::UnitConvertor(50, Unit::Mm, oldLayoutUnit));
}
//---------------------------------------------------------------------------------------------------------------------
void DialogLayoutSettings::InitTemplates()
{
const QIcon ico("://icon/16x16/template.png");
const QString pdi = QString("(%1ppi)").arg(VApplication::PrintDPI);
ui->comboBoxTemplates->addItem(ico, "A0 "+pdi, QVariant(static_cast<char>(PaperSizeTemplate::A0)));
ui->comboBoxTemplates->addItem(ico, "A1 "+pdi, QVariant(static_cast<char>(PaperSizeTemplate::A1)));
ui->comboBoxTemplates->addItem(ico, "A2 "+pdi, QVariant(static_cast<char>(PaperSizeTemplate::A2)));
ui->comboBoxTemplates->addItem(ico, "A3 "+pdi, QVariant(static_cast<char>(PaperSizeTemplate::A3)));
ui->comboBoxTemplates->addItem(ico, "A4 "+pdi, QVariant(static_cast<char>(PaperSizeTemplate::A4)));
TemplateSelected();
}
//---------------------------------------------------------------------------------------------------------------------
QSizeF DialogLayoutSettings::Template()
{
const PaperSizeTemplate temp = static_cast<PaperSizeTemplate>(ui->comboBoxTemplates->currentData().toInt());
const Unit paperUnit = PaperUnit();
qreal width = 0;
qreal height = 0;
switch(temp)
{
case PaperSizeTemplate::A0:
width = VAbstractMeasurements::UnitConvertor(841, Unit::Mm, paperUnit);
height = VAbstractMeasurements::UnitConvertor(1189, Unit::Mm, paperUnit);
return QSizeF(width, height);
case PaperSizeTemplate::A1:
width = VAbstractMeasurements::UnitConvertor(594, Unit::Mm, paperUnit);
height = VAbstractMeasurements::UnitConvertor(841, Unit::Mm, paperUnit);
return QSizeF(width, height);
case PaperSizeTemplate::A2:
width = VAbstractMeasurements::UnitConvertor(420, Unit::Mm, paperUnit);
height = VAbstractMeasurements::UnitConvertor(594, Unit::Mm, paperUnit);
return QSizeF(width, height);
case PaperSizeTemplate::A3:
width = VAbstractMeasurements::UnitConvertor(297, Unit::Mm, paperUnit);
height = VAbstractMeasurements::UnitConvertor(420, Unit::Mm, paperUnit);
return QSizeF(width, height);
case PaperSizeTemplate::A4:
width = VAbstractMeasurements::UnitConvertor(210, Unit::Mm, paperUnit);
height = VAbstractMeasurements::UnitConvertor(297, Unit::Mm, paperUnit);
return QSizeF(width, height);
default:
break;
}
return QSizeF();
}
//---------------------------------------------------------------------------------------------------------------------
Unit DialogLayoutSettings::PaperUnit() const
{
return VDomDocument::StrToUnits(ui->comboBoxPaperSizeUnit->currentData().toString());
}
//---------------------------------------------------------------------------------------------------------------------
Unit DialogLayoutSettings::LayoutUnit() const
{
return VDomDocument::StrToUnits(ui->comboBoxLayoutUnit->currentData().toString());
}
//---------------------------------------------------------------------------------------------------------------------
void DialogLayoutSettings::CorrectPaperDecimals()
{
switch(oldPaperUnit)
{
case Unit::Cm:
case Unit::Mm:
ui->doubleSpinBoxPaperWidth->setDecimals(2);
ui->doubleSpinBoxPaperHeight->setDecimals(2);
break;
case Unit::Inch:
ui->doubleSpinBoxPaperWidth->setDecimals(5);
ui->doubleSpinBoxPaperHeight->setDecimals(5);
break;
case Unit::Px:
ui->doubleSpinBoxPaperWidth->setDecimals(0);
ui->doubleSpinBoxPaperHeight->setDecimals(0);
break;
default:
break;
}
}
//---------------------------------------------------------------------------------------------------------------------
void DialogLayoutSettings::CorrectLayoutDecimals()
{
switch(oldLayoutUnit)
{
case Unit::Cm:
case Unit::Mm:
ui->doubleSpinBoxLayoutWidth->setDecimals(2);
ui->doubleSpinBoxShift->setDecimals(2);
break;
case Unit::Inch:
ui->doubleSpinBoxLayoutWidth->setDecimals(5);
ui->doubleSpinBoxShift->setDecimals(5);
break;
case Unit::Px:
ui->doubleSpinBoxLayoutWidth->setDecimals(0);
ui->doubleSpinBoxShift->setDecimals(0);
break;
default:
break;
}
}
//---------------------------------------------------------------------------------------------------------------------
void DialogLayoutSettings::Label()
{
const int width = qFloor(VAbstractMeasurements::UnitConvertor(ui->doubleSpinBoxPaperWidth->value(), PaperUnit(),
Unit::Px));
const int height = qFloor(VAbstractMeasurements::UnitConvertor(ui->doubleSpinBoxPaperHeight->value(),
PaperUnit(), Unit::Px));
QString text = QString("%1 x %2 px, \n%3 ppi").arg(width).arg(height).arg(VApplication::PrintDPI);
ui->labelSizeDescription->setText(text);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogLayoutSettings::MinimumPaperSize()
{
const qreal value = VAbstractMeasurements::UnitConvertor(1, Unit::Px, oldPaperUnit);
ui->doubleSpinBoxPaperWidth->setMinimum(value);
ui->doubleSpinBoxPaperHeight->setMinimum(value);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogLayoutSettings::MinimumLayoutSize()
{
const qreal value = VAbstractMeasurements::UnitConvertor(1, Unit::Px, oldLayoutUnit);
ui->doubleSpinBoxLayoutWidth->setMinimum(value);
}

View File

@ -0,0 +1,100 @@
/************************************************************************
**
** @file dialoglayoutsettings.h
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date 13 1, 2015
**
** @brief
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#ifndef DIALOGLAYOUTSETTINGS_H
#define DIALOGLAYOUTSETTINGS_H
#include <QDialog>
#include "../../libs/vlayout/vbank.h"
#include "../../libs/ifc/ifcdef.h"
namespace Ui
{
class DialogLayoutSettings;
}
class DialogLayoutSettings : public QDialog
{
Q_OBJECT
public:
explicit DialogLayoutSettings(QWidget *parent = 0);
~DialogLayoutSettings();
int GetPaperHeight() const;
void SetPaperHeight(int value);
int GetPaperWidth() const;
void SetPaperWidth(int value);
unsigned int GetShift() const;
void SetShift(unsigned int value);
unsigned int GetLayoutWidth() const;
void SetLayoutWidth(unsigned int value);
Cases GetGroup() const;
void SetGroup(const Cases &value);
bool GetRotate() const;
void SetRotate(bool state);
int GetIncrease() const;
void SetIncrease(int increase);
public slots:
void ConvertPaperSize();
void ConvertLayoutSize();
void TemplateSelected();
void PaperSizeChanged();
void Swap(bool checked);
private:
Q_DISABLE_COPY(DialogLayoutSettings)
Ui::DialogLayoutSettings *ui;
Unit oldPaperUnit;
Unit oldLayoutUnit;
void InitPaperUnits();
void InitLayoutUnits();
void InitTemplates();
QSizeF Template();
Unit PaperUnit() const;
Unit LayoutUnit() const;
void CorrectPaperDecimals();
void CorrectLayoutDecimals();
void Label();
void MinimumPaperSize();
void MinimumLayoutSize();
};
#endif // DIALOGLAYOUTSETTINGS_H

View File

@ -0,0 +1,517 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DialogLayoutSettings</class>
<widget class="QDialog" name="DialogLayoutSettings">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>661</width>
<height>289</height>
</rect>
</property>
<property name="windowTitle">
<string>Creation a layout</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<widget class="QGroupBox" name="groupBoxPaperSize">
<property name="title">
<string>Paper size</string>
</property>
<property name="flat">
<bool>false</bool>
</property>
<property name="checkable">
<bool>false</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing">
<number>6</number>
</property>
<item>
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Templates:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBoxTemplates"/>
</item>
</layout>
</item>
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="2">
<widget class="QComboBox" name="comboBoxPaperSizeUnit">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>124</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="labelWidth">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Width:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelHeight">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Height:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBoxPaperHeight">
<property name="minimumSize">
<size>
<width>94</width>
<height>0</height>
</size>
</property>
<property name="decimals">
<number>2</number>
</property>
<property name="maximum">
<double>99999.000000000000000</double>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBoxPaperWidth">
<property name="minimumSize">
<size>
<width>94</width>
<height>0</height>
</size>
</property>
<property name="decimals">
<number>2</number>
</property>
<property name="maximum">
<double>99999.990000000005239</double>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QLabel" name="labelSizeDescription">
<property name="text">
<string notr="true">TextLabel</string>
</property>
</widget>
</item>
<item row="2" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QToolButton" name="toolButtonPortrate">
<property name="text">
<string notr="true">...</string>
</property>
<property name="icon">
<iconset resource="../../share/resources/icon.qrc">
<normaloff>:/icon/16x16/portrait.png</normaloff>:/icon/16x16/portrait.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroup</string>
</attribute>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButtonLandscape">
<property name="text">
<string notr="true">...</string>
</property>
<property name="icon">
<iconset resource="../../share/resources/icon.qrc">
<normaloff>:/icon/16x16/landscape.png</normaloff>:/icon/16x16/landscape.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroup</string>
</attribute>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBoxRotate">
<property name="title">
<string>Rotate workpiece</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Rotate by</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBoxIncrease">
<property name="currentIndex">
<number>21</number>
</property>
<item>
<property name="text">
<string notr="true">1</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">2</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">3</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">4</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">5</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">6</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">8</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">9</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">10</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">12</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">15</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">18</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">20</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">24</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">30</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">36</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">40</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">45</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">60</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">72</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">90</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">180</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>degree</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="groupBoxCreationOptions">
<property name="title">
<string>Creation options</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBoxLayoutWidth">
<property name="minimumSize">
<size>
<width>94</width>
<height>0</height>
</size>
</property>
<property name="minimum">
<double>0.000000000000000</double>
</property>
<property name="maximum">
<double>99999.990000000005239</double>
</property>
<property name="value">
<double>1.000000000000000</double>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="labelLayoutWidth">
<property name="text">
<string>Layout width:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelShiftLength">
<property name="text">
<string>Shift length:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBoxShift">
<property name="minimumSize">
<size>
<width>94</width>
<height>0</height>
</size>
</property>
<property name="maximum">
<double>99999.990000000005239</double>
</property>
<property name="value">
<double>10.000000000000000</double>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QComboBox" name="comboBoxLayoutUnit"/>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="groupBoxCase">
<property name="title">
<string>Principle of choosing the next workpiece</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QRadioButton" name="radioButtonThreeGroups">
<property name="text">
<string>Three groups: big, middle, small</string>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroupPrinciple</string>
</attribute>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButtonTwoGroups">
<property name="text">
<string>Two groups: big, small</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroupPrinciple</string>
</attribute>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButtonDescendingArea">
<property name="text">
<string>Descending area</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroupPrinciple</string>
</attribute>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="../../share/resources/icon.qrc"/>
</resources>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>DialogLayoutSettings</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>DialogLayoutSettings</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
<buttongroups>
<buttongroup name="buttonGroup"/>
<buttongroup name="buttonGroupPrinciple"/>
</buttongroups>
</ui>

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2013 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify
@ -28,12 +28,16 @@
#include "dialogmeasurements.h"
#include "ui_dialogmeasurements.h"
#include "../core/vapplication.h"
//---------------------------------------------------------------------------------------------------------------------
DialogMeasurements::DialogMeasurements(QWidget *parent) :
QDialog(parent), ui(new Ui::DialogMeasurements), result(MeasurementsType::Individual)
{
ui->setupUi(this);
qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
connect(ui->toolButtonStandard, &QToolButton::clicked, this, &DialogMeasurements::StandardMeasurements);
connect(ui->toolButtonIndividual, &QToolButton::clicked, this, &DialogMeasurements::IndividualMeasurements);
}

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2013 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2013 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify
@ -45,6 +45,8 @@ DialogPatternProperties::DialogPatternProperties(VPattern *doc, QWidget *parent)
SCASSERT(doc != nullptr);
qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
ui->lineEditAuthor->setText(doc->GetAuthor());
connect(ui->lineEditAuthor, &QLineEdit::editingFinished, this, &DialogPatternProperties::DescEdited);

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2013 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2013 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify
@ -28,6 +28,7 @@
#include "dialogpatternxmledit.h"
#include "ui_dialogpatternxmledit.h"
#include "../core/vapplication.h"
#include <QInputDialog>
#include <QMessageBox>
@ -36,7 +37,6 @@ const short int DialogPatternXmlEdit::ChangeTypeDelete=1;
const short int DialogPatternXmlEdit::ChangeTypeAdd=2;
const short int DialogPatternXmlEdit::ChangeTypeModify=3;
//---------------------------------------------------------------------------------------------------------------------
DialogPatternXmlEdit::DialogPatternXmlEdit(QWidget *parent, VPattern *xmldoc)
:QDialog(parent), treeChange(false), currentNodeEdited(nullptr), currentNodeEditedStatus(0),
@ -46,6 +46,8 @@ DialogPatternXmlEdit::DialogPatternXmlEdit(QWidget *parent, VPattern *xmldoc)
{
ui->setupUi(this);
qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
this->xmlmodel = new VXMLTreeView();
this->doc=xmldoc;
this->root = this->doc->documentElement();

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2013 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify

View File

@ -0,0 +1,158 @@
/************************************************************************
**
** @file dialogsavelayout.cpp
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date 22 1, 2015
**
** @brief
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#include "dialogsavelayout.h"
#include "ui_dialogsavelayout.h"
#include "../options.h"
#include "../../core/vapplication.h"
#include "../../core/vsettings.h"
#include <QDir>
#include <QFileDialog>
#include <QMessageBox>
//---------------------------------------------------------------------------------------------------------------------
DialogSaveLayout::DialogSaveLayout(const QMap<QString, QString> &formates, int count, const QString &fileName,
QWidget *parent)
:QDialog(parent), ui(new Ui::DialogSaveLAyout), count(count)
{
ui->setupUi(this);
qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
SCASSERT(bOk != nullptr);
bOk->setEnabled(false);
QRegExpValidator *validator = new QRegExpValidator(QRegExp("^[\\w\\-. ]+$"), this);
ui->lineEditFileName->setValidator(validator);
ui->lineEditFileName->setText(fileName);
QMap<QString, QString>::const_iterator i = formates.constBegin();
while (i != formates.constEnd())
{
ui->comboBoxFormat->addItem(i.key(), QVariant(i.value()));
++i;
}
connect(bOk, &QPushButton::clicked, this, &DialogSaveLayout::Save);
connect(ui->lineEditFileName, &QLineEdit::textChanged, this, &DialogSaveLayout::ShowExample);
connect(ui->comboBoxFormat, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
&DialogSaveLayout::ShowExample);
connect(ui->pushButtonBrowse, &QPushButton::clicked, this, &DialogSaveLayout::Browse);
connect(ui->lineEditPath, &QLineEdit::textChanged, this, &DialogSaveLayout::PathChanged);
ui->comboBoxFormat->setCurrentIndex(4);//svg
ui->lineEditPath->setText(qApp->getSettings()->GetPathLayout());
}
//---------------------------------------------------------------------------------------------------------------------
DialogSaveLayout::~DialogSaveLayout()
{
delete ui;
}
//---------------------------------------------------------------------------------------------------------------------
QString DialogSaveLayout::Path() const
{
return ui->lineEditPath->text();
}
//---------------------------------------------------------------------------------------------------------------------
QString DialogSaveLayout::FileName() const
{
return ui->lineEditFileName->text();
}
//---------------------------------------------------------------------------------------------------------------------
QString DialogSaveLayout::Formate() const
{
return ui->comboBoxFormat->currentData().toString();
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSaveLayout::Save()
{
for (int i=0; i < count; ++i)
{
const QString name = Path()+"/"+FileName()+QString::number(i+1)+Formate();
if (QFile::exists(name))
{
QMessageBox::StandardButton res = QMessageBox::question(this, tr("Name conflict"),
tr("Folder already contain file with name %1. Rewrite all conflict file names?")
.arg(name), QMessageBox::Yes|QMessageBox::No, QMessageBox::Yes);
if (res == QMessageBox::No)
{
return;
}
else
{
break;
}
}
}
accept();
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSaveLayout::ShowExample()
{
ui->labelExample->setText(tr("Example:") + FileName() + "1" + Formate());
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSaveLayout::Browse()
{
const QString dir = QFileDialog::getExistingDirectory(this, tr("Select folder"), QDir::homePath(),
QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
ui->lineEditPath->setText(dir);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSaveLayout::PathChanged(const QString &text)
{
QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
SCASSERT(bOk != nullptr);
QPalette palette = ui->lineEditPath->palette();
QDir dir(text);
dir.setPath(text);
if (dir.exists(text))
{
bOk->setEnabled(true);
palette.setColor(ui->lineEditPath->foregroundRole(), Qt::black);
}
else
{
bOk->setEnabled(false);
palette.setColor(ui->lineEditPath->foregroundRole(), Qt::red);
}
ui->lineEditPath->setPalette(palette);
}

View File

@ -0,0 +1,64 @@
/************************************************************************
**
** @file dialogsavelayout.h
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date 22 1, 2015
**
** @brief
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#ifndef DIALOGSAVELAYOUT_H
#define DIALOGSAVELAYOUT_H
#include <QDialog>
namespace Ui
{
class DialogSaveLAyout;
}
class DialogSaveLayout : public QDialog
{
Q_OBJECT
public:
DialogSaveLayout(const QMap<QString, QString> &formates, int count, const QString &fileName = QString(),
QWidget *parent = 0);
~DialogSaveLayout();
QString Path() const;
QString FileName() const;
QString Formate() const;
public slots:
void Save();
void ShowExample();
void Browse();
void PathChanged(const QString &text);
private:
Q_DISABLE_COPY(DialogSaveLayout)
Ui::DialogSaveLAyout *ui;
int count;
};
#endif // DIALOGSAVELAYOUT_H

View File

@ -0,0 +1,140 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DialogSaveLAyout</class>
<widget class="QDialog" name="DialogSaveLAyout">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>692</width>
<height>179</height>
</rect>
</property>
<property name="maximumSize">
<size>
<width>692</width>
<height>179</height>
</size>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout_2">
<property name="rightMargin">
<number>0</number>
</property>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>File name:</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Path:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>File format:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="lineEditPath"/>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="pushButtonBrowse">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Browse...</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="comboBoxFormat">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="lineEditFileName"/>
</item>
<item row="2" column="2">
<widget class="QLabel" name="labelExample">
<property name="minimumSize">
<size>
<width>130</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>DialogSaveLAyout</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>DialogSaveLAyout</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2013 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify
@ -33,6 +33,7 @@
#include <QDesktopWidget>
#include "../../xml/vstandardmeasurements.h"
#include "../../core/vapplication.h"
#include "../../core/vsettings.h"
#include "../../container/vcontainer.h"
#include <QLoggingCategory>
@ -45,6 +46,8 @@ DialogStandardMeasurements::DialogStandardMeasurements(VContainer *data, const Q
{
ui->setupUi(this);
qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
QRect position = this->frameGeometry();
position.moveCenter(QDesktopWidget().availableGeometry().center());
move(position.topLeft());
@ -149,14 +152,16 @@ void DialogStandardMeasurements::LoadStandardTables()
{
qCDebug(vStMeasur)<<"Loading standard table.";
QStringList filters{"*.vst"};
QDir tablesDir(qApp->pathToTables());
//Use standard path to standard measurements
const QString path = qApp->getSettings()->GetPathStandardMeasurements();
QDir tablesDir(path);
tablesDir.setNameFilters(filters);
tablesDir.setCurrent(qApp->pathToTables());
tablesDir.setCurrent(path);
const QStringList allFiles = tablesDir.entryList(QDir::NoDotAndDotDot | QDir::Files);
if (allFiles.isEmpty() == true)
{
qCDebug(vStMeasur)<<"Can't find standard measurements in path"<<qApp->pathToTables();
qCDebug(vStMeasur)<<"Can't find standard measurements in path"<<path;
ui->comboBoxTables->clear();
CheckState();
return;
@ -178,16 +183,11 @@ void DialogStandardMeasurements::LoadStandardTables()
}
else
{
const QString trDesc = qApp->STDescription(m.Id());
if (trDesc.isEmpty() == false)
const QString desc = m.TrDescription();
if (desc.isEmpty() == false)
{
qCDebug(vStMeasur)<<"Adding user table from"<<fi.absoluteFilePath();
ui->comboBoxTables->addItem(trDesc, QVariant(fi.absoluteFilePath()));
}
else if (m.Description().isEmpty() == false)
{
qCDebug(vStMeasur)<<"Adding table with id"<<m.Id()<<"from"<<fi.absoluteFilePath();
ui->comboBoxTables->addItem(m.Description(), QVariant(fi.absoluteFilePath()));
qCDebug(vStMeasur)<<"Adding table from"<<fi.absoluteFilePath();
ui->comboBoxTables->addItem(desc, QVariant(fi.absoluteFilePath()));
}
}
}

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2013 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2014 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify
@ -39,6 +39,8 @@ DialogUndo::DialogUndo(QWidget *parent)
{
ui->setupUi(this);
qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
bool opening = qApp->getOpeningPattern();
if (opening)
{

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2014 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify

View File

@ -8,7 +8,7 @@
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2013 Valentina project
** Copyright (C) 2013-2015 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify

View File

@ -41,7 +41,10 @@ HEADERS += \
$$PWD/app/configpages/communitypage.h \
$$PWD/app/configpages/pathpage.h \
$$PWD/app/dialogundo.h \
$$PWD/tools/dialogcurveintersectaxis.h
$$PWD/tools/dialogcurveintersectaxis.h \
$$PWD/app/dialoglayoutsettings.h \
$$PWD/app/dialoglayoutprogress.h \
dialogs/app/dialogsavelayout.h
SOURCES += \
$$PWD/tools/dialogtriangle.cpp \
@ -81,7 +84,10 @@ SOURCES += \
$$PWD/app/configpages/communitypage.cpp \
$$PWD/app/configpages/pathpage.cpp \
$$PWD/app/dialogundo.cpp \
$$PWD/tools/dialogcurveintersectaxis.cpp
$$PWD/tools/dialogcurveintersectaxis.cpp \
$$PWD/app/dialoglayoutsettings.cpp \
$$PWD/app/dialoglayoutprogress.cpp \
dialogs/app/dialogsavelayout.cpp
FORMS += \
$$PWD/tools/dialogtriangle.ui \
@ -115,4 +121,7 @@ FORMS += \
$$PWD/app/dialogaboutapp.ui \
$$PWD/app/dialogpatternxmledit.ui \
$$PWD/app/dialogundo.ui \
$$PWD/tools/dialogcurveintersectaxis.ui
$$PWD/tools/dialogcurveintersectaxis.ui \
$$PWD/app/dialoglayoutsettings.ui \
$$PWD/app/dialoglayoutprogress.ui \
dialogs/app/dialogsavelayout.ui

Some files were not shown because too many files have changed in this diff Show More