Successful build with MSVC 2012.
--HG-- branch : develop
This commit is contained in:
parent
1af1283ed4
commit
d6653ca9af
|
@ -137,7 +137,7 @@ private:
|
||||||
QComboBox *gradationSizes;
|
QComboBox *gradationSizes;
|
||||||
QComboBox *comboBoxUnits;
|
QComboBox *comboBoxUnits;
|
||||||
int formulaBaseHeight;
|
int formulaBaseHeight;
|
||||||
VLockGuardPtr<char> lock;
|
std::shared_ptr<VLockGuard<char>> lock;
|
||||||
QSharedPointer<VTableSearch> search;
|
QSharedPointer<VTableSearch> search;
|
||||||
QLabel *labelGradationHeights;
|
QLabel *labelGradationHeights;
|
||||||
QLabel *labelGradationSizes;
|
QLabel *labelGradationSizes;
|
||||||
|
|
|
@ -68,7 +68,7 @@ Q_LOGGING_CATEGORY(vApp, "v.application")
|
||||||
#pragma warning( pop )
|
#pragma warning( pop )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
constexpr auto DAYS_TO_KEEP_LOGS = 3;
|
Q_DECL_CONSTEXPR auto DAYS_TO_KEEP_LOGS = 3;
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg)
|
inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg)
|
||||||
|
@ -503,9 +503,8 @@ void VApplication::BeginLogging()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VApplication::ClearOldLogs() const
|
void VApplication::ClearOldLogs() const
|
||||||
{
|
{
|
||||||
QStringList filters{"*.log"};
|
|
||||||
QDir logsDir(LogDirPath());
|
QDir logsDir(LogDirPath());
|
||||||
logsDir.setNameFilters(filters);
|
logsDir.setNameFilters(QStringList("*.log"));
|
||||||
logsDir.setCurrent(LogDirPath());
|
logsDir.setCurrent(LogDirPath());
|
||||||
|
|
||||||
const QStringList allFiles = logsDir.entryList(QDir::NoDotAndDotDot | QDir::Files);
|
const QStringList allFiles = logsDir.entryList(QDir::NoDotAndDotDot | QDir::Files);
|
||||||
|
|
|
@ -96,7 +96,7 @@ private:
|
||||||
VTranslateVars *trVars;
|
VTranslateVars *trVars;
|
||||||
QTimer *autoSaveTimer;
|
QTimer *autoSaveTimer;
|
||||||
|
|
||||||
VLockGuardPtr<QFile> lockLog;
|
std::shared_ptr<VLockGuard<QFile>> lockLog;
|
||||||
std::shared_ptr<QTextStream> out;
|
std::shared_ptr<QTextStream> out;
|
||||||
|
|
||||||
void InitLineWidth();
|
void InitLineWidth();
|
||||||
|
|
|
@ -65,131 +65,8 @@ const static auto SINGLE_OPTION_GRADATIONHEIGHT = QStringLiteral("e");
|
||||||
|
|
||||||
#define translate(context, source) QCoreApplication::translate((context), (source))
|
#define translate(context, source) QCoreApplication::translate((context), (source))
|
||||||
|
|
||||||
//such a tricky initialization is used, because it uses static functions which relay on static variables and order of
|
|
||||||
//initialization is not defined between compiled units. i.e. - segv is possible (I hit it when
|
|
||||||
//VDomDocument::UnitsHelpString() was crashing because of not inited string vars).
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VCommandLine::VCommandLine() : parser()
|
VCommandLine::VCommandLine() : parser(), optionsUsed(InitOptionsUsed()), isGuiEnabled(false)
|
||||||
, optionsUsed ({
|
|
||||||
//keep in mind order here - that is how user will see it, so group-up for usability
|
|
||||||
//===================================================================================
|
|
||||||
|
|
||||||
{LONG_OPTION_BASENAME,
|
|
||||||
new QCommandLineOption(QStringList() << SINGLE_OPTION_BASENAME << LONG_OPTION_BASENAME,
|
|
||||||
translate("VCommandLine", "The base filename of exported layout files. Use it to "
|
|
||||||
"enable console export mode."),
|
|
||||||
translate("VCommandLine", "The base filename of layout files"))},
|
|
||||||
|
|
||||||
{LONG_OPTION_DESTINATION,
|
|
||||||
new QCommandLineOption(QStringList() << SINGLE_OPTION_DESTINATION << LONG_OPTION_DESTINATION,
|
|
||||||
translate("VCommandLine", "The path to output destination folder."),
|
|
||||||
translate("VCommandLine", "The destination folder"))},
|
|
||||||
|
|
||||||
{LONG_OPTION_MEASUREFILE,
|
|
||||||
new QCommandLineOption(QStringList() << SINGLE_OPTION_MEASUREFILE << LONG_OPTION_MEASUREFILE,
|
|
||||||
translate("VCommandLine", "Path to custom measure file (export mode)."),
|
|
||||||
translate("VCommandLine", "The measure file"))},
|
|
||||||
|
|
||||||
{LONG_OPTION_EXP2FORMAT,
|
|
||||||
new QCommandLineOption(QStringList() << SINGLE_OPTION_EXP2FORMAT << LONG_OPTION_EXP2FORMAT,
|
|
||||||
translate("VCommandLine", "Number corresponding to output format (default = 0, "
|
|
||||||
"export mode): ") + DialogSaveLayout::MakeHelpFormatList(),
|
|
||||||
translate("VCommandLine", "Format number"), "0")},
|
|
||||||
|
|
||||||
{LONG_OPTION_GRADATIONSIZE,
|
|
||||||
new QCommandLineOption(QStringList() << SINGLE_OPTION_GRADATIONSIZE << LONG_OPTION_GRADATIONSIZE,
|
|
||||||
translate("VCommandLine", "Set size value a pattern file, that was opened with "
|
|
||||||
"standard measurements (export mode). Valid values: %1cm.")
|
|
||||||
.arg(VMeasurement::WholeListSizes(Unit::Cm).join(", ")),
|
|
||||||
translate("VCommandLine", "The size value"))},
|
|
||||||
|
|
||||||
{LONG_OPTION_GRADATIONHEIGHT,
|
|
||||||
new QCommandLineOption(QStringList() << SINGLE_OPTION_GRADATIONHEIGHT << LONG_OPTION_GRADATIONHEIGHT,
|
|
||||||
translate("VCommandLine", "Set height value a pattern file, that was opened with "
|
|
||||||
"standard measurements (export mode). Valid values: %1cm.")
|
|
||||||
.arg(VMeasurement::WholeListHeights(Unit::Cm).join(", ")),
|
|
||||||
translate("VCommandLine", "The height value"))},
|
|
||||||
|
|
||||||
//===================================================================================
|
|
||||||
|
|
||||||
{LONG_OPTION_PAGETEMPLATE,
|
|
||||||
new QCommandLineOption(QStringList() << SINGLE_OPTION_PAGETEMPLATE << LONG_OPTION_PAGETEMPLATE,
|
|
||||||
translate("VCommandLine", "Number corresponding to page template (default = 0, "
|
|
||||||
"export mode): ") + DialogLayoutSettings::MakeHelpTemplateList(),
|
|
||||||
translate("VCommandLine", "Template number"), "0")},
|
|
||||||
|
|
||||||
|
|
||||||
{LONG_OPTION_PAGEW,
|
|
||||||
new QCommandLineOption(QStringList() << SINGLE_OPTION_PAGEW << LONG_OPTION_PAGEW,
|
|
||||||
translate("VCommandLine", "Page width in current units like 12.0 (cannot be used "
|
|
||||||
"with \"%1\", export mode).").arg(LONG_OPTION_PAGETEMPLATE),
|
|
||||||
translate("VCommandLine", "The page width"))},
|
|
||||||
|
|
||||||
{LONG_OPTION_PAGEH,
|
|
||||||
new QCommandLineOption(QStringList() << SINGLE_OPTION_PAGEH << LONG_OPTION_PAGEH,
|
|
||||||
translate("VCommandLine", "Page height in current units like 12.0 (cannot be used "
|
|
||||||
"with \"%1\", export mode).").arg(LONG_OPTION_PAGETEMPLATE),
|
|
||||||
("The page height"))},
|
|
||||||
|
|
||||||
{LONG_OPTION_PAGEUNITS,
|
|
||||||
new QCommandLineOption(QStringList() << SINGLE_OPTION_PAGEUNITS << LONG_OPTION_PAGEUNITS,
|
|
||||||
translate("VCommandLine", "Page height/width measure units (cannot be used "
|
|
||||||
"with \"%1\", export mode): ")
|
|
||||||
.arg(LONG_OPTION_PAGETEMPLATE) + VDomDocument::UnitsHelpString(),
|
|
||||||
translate("VCommandLine", "The measure unit"))},
|
|
||||||
|
|
||||||
//===================================================================================
|
|
||||||
|
|
||||||
{LONG_OPTION_ROTATE,
|
|
||||||
new QCommandLineOption(QStringList() << SINGLE_OPTION_ROTATE << LONG_OPTION_ROTATE,
|
|
||||||
translate("VCommandLine", "Rotation in degrees (one of predefined). Default (or "
|
|
||||||
"0) is no-rotate (export mode)."),
|
|
||||||
translate("VCommandLine", "Angle"))},
|
|
||||||
|
|
||||||
{LONG_OPTION_CROP,
|
|
||||||
new QCommandLineOption(QStringList() << SINGLE_OPTION_CROP << LONG_OPTION_CROP,
|
|
||||||
translate("VCommandLine", "Auto crop unused length (export mode)."))},
|
|
||||||
|
|
||||||
{LONG_OPTION_UNITE,
|
|
||||||
new QCommandLineOption(QStringList() << SINGLE_OPTION_UNITE << LONG_OPTION_UNITE,
|
|
||||||
translate("VCommandLine", "Unite pages if possible (export mode)."))},
|
|
||||||
|
|
||||||
//===================================================================================
|
|
||||||
|
|
||||||
{LONG_OPTION_SAVELENGTH,
|
|
||||||
new QCommandLineOption(QStringList() << SINGLE_OPTION_SAVELENGTH << LONG_OPTION_SAVELENGTH,
|
|
||||||
translate("VCommandLine", "Save length of the sheet if set. (export mode)."))},
|
|
||||||
|
|
||||||
{LONG_OPTION_SHIFTUNITS,
|
|
||||||
new QCommandLineOption(QStringList() << SINGLE_OPTION_SHIFTUNITS << LONG_OPTION_SHIFTUNITS,
|
|
||||||
translate("VCommandLine", "Layout units (as paper's one except px, export mode)."),
|
|
||||||
translate("VCommandLine", "The unit"))},
|
|
||||||
|
|
||||||
{LONG_OPTION_SHIFTLENGTH,
|
|
||||||
new QCommandLineOption(QStringList() << SINGLE_OPTION_SHIFTLENGTH << LONG_OPTION_SHIFTLENGTH,
|
|
||||||
translate("VCommandLine", "Shift layout length measured in layout units (export "
|
|
||||||
"mode)."),
|
|
||||||
translate("VCommandLine", "Shift length"))},
|
|
||||||
|
|
||||||
{LONG_OPTION_GAPWIDTH,
|
|
||||||
new QCommandLineOption(QStringList() << SINGLE_OPTION_GAPWIDTH << LONG_OPTION_GAPWIDTH,
|
|
||||||
translate("VCommandLine", "Gap width x2, measured in layout units. (export mode)."),
|
|
||||||
translate("VCommandLine", "The gap width"))},
|
|
||||||
|
|
||||||
{LONG_OPTION_GROUPPING,
|
|
||||||
new QCommandLineOption(QStringList() << SINGLE_OPTION_GROUPPING << LONG_OPTION_GROUPPING,
|
|
||||||
translate("VCommandLine", "Sets layout groupping (export mode): ")
|
|
||||||
+ DialogLayoutSettings::MakeGroupsHelp(),
|
|
||||||
translate("VCommandLine", "Grouping type"), "2")},
|
|
||||||
|
|
||||||
{LONG_OPTION_TEST,
|
|
||||||
new QCommandLineOption(QStringList() << SINGLE_OPTION_TEST << LONG_OPTION_TEST,
|
|
||||||
translate("VCommandLine", "Run the program in a test mode. The program this mode "
|
|
||||||
"load a single pattern file and silently quit without showing the main "
|
|
||||||
"window. The key have priority before key '%1'.")
|
|
||||||
.arg(LONG_OPTION_BASENAME))}
|
|
||||||
}),
|
|
||||||
isGuiEnabled(false)
|
|
||||||
{
|
{
|
||||||
parser.setApplicationDescription(translate("VCommandLine", "Pattern making program."));
|
parser.setApplicationDescription(translate("VCommandLine", "Pattern making program."));
|
||||||
parser.addHelpOption();
|
parser.addHelpOption();
|
||||||
|
@ -204,7 +81,7 @@ VCommandLine::VCommandLine() : parser()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
int VCommandLine::Lo2Px(const QString &src, const DialogLayoutSettings &converter)
|
int VCommandLine::Lo2Px(const QString &src, const DialogLayoutSettings &converter)
|
||||||
{
|
{
|
||||||
//that is dirty-dirty hack ...eventually number is converted float <--> int 3 or 4 times including inside dialog ...
|
//that is dirty-dirty hack ...eventually number is converted float <--> int 3 or 4 times including inside dialog ...
|
||||||
|
@ -212,12 +89,146 @@ int VCommandLine::Lo2Px(const QString &src, const DialogLayoutSettings &converte
|
||||||
return converter.LayoutToPixels(src.toFloat());
|
return converter.LayoutToPixels(src.toFloat());
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
int VCommandLine::Pg2Px(const QString& src, const DialogLayoutSettings& converter)
|
int VCommandLine::Pg2Px(const QString& src, const DialogLayoutSettings& converter)
|
||||||
{
|
{
|
||||||
return converter.PageToPixels(src.toFloat());
|
return converter.PageToPixels(src.toFloat());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QMap<QString, QCommandLineOption *> VCommandLine::InitOptionsUsed()
|
||||||
|
{
|
||||||
|
QMap<QString, QCommandLineOption *> options;
|
||||||
|
|
||||||
|
//keep in mind order here - that is how user will see it, so group-up for usability
|
||||||
|
//=================================================================================================================
|
||||||
|
options.insert(LONG_OPTION_BASENAME,
|
||||||
|
new QCommandLineOption(QStringList() << SINGLE_OPTION_BASENAME << LONG_OPTION_BASENAME,
|
||||||
|
translate("VCommandLine", "The base filename of exported layout files. Use "
|
||||||
|
"it to enable console export mode."),
|
||||||
|
translate("VCommandLine", "The base filename of layout files")));
|
||||||
|
|
||||||
|
options.insert(LONG_OPTION_DESTINATION,
|
||||||
|
new QCommandLineOption(QStringList() << SINGLE_OPTION_DESTINATION << LONG_OPTION_DESTINATION,
|
||||||
|
translate("VCommandLine", "The path to output destination folder."),
|
||||||
|
translate("VCommandLine", "The destination folder")));
|
||||||
|
|
||||||
|
options.insert(LONG_OPTION_MEASUREFILE,
|
||||||
|
new QCommandLineOption(QStringList() << SINGLE_OPTION_MEASUREFILE << LONG_OPTION_MEASUREFILE,
|
||||||
|
translate("VCommandLine", "Path to custom measure file (export mode)."),
|
||||||
|
translate("VCommandLine", "The measure file")));
|
||||||
|
|
||||||
|
options.insert(LONG_OPTION_EXP2FORMAT,
|
||||||
|
new QCommandLineOption(QStringList() << SINGLE_OPTION_EXP2FORMAT << LONG_OPTION_EXP2FORMAT,
|
||||||
|
translate("VCommandLine", "Number corresponding to output format (default = "
|
||||||
|
"0, export mode): ") +
|
||||||
|
DialogSaveLayout::MakeHelpFormatList(),
|
||||||
|
translate("VCommandLine", "Format number"), "0"));
|
||||||
|
|
||||||
|
options.insert(LONG_OPTION_GRADATIONSIZE,
|
||||||
|
new QCommandLineOption(QStringList() << SINGLE_OPTION_GRADATIONSIZE << LONG_OPTION_GRADATIONSIZE,
|
||||||
|
translate("VCommandLine", "Set size value a pattern file, that was opened "
|
||||||
|
"with standard measurements (export mode). Valid "
|
||||||
|
"values: %1cm.")
|
||||||
|
.arg(VMeasurement::WholeListSizes(Unit::Cm).join(", ")),
|
||||||
|
translate("VCommandLine", "The size value")));
|
||||||
|
|
||||||
|
options.insert(LONG_OPTION_GRADATIONHEIGHT,
|
||||||
|
new QCommandLineOption(QStringList() << SINGLE_OPTION_GRADATIONHEIGHT << LONG_OPTION_GRADATIONHEIGHT,
|
||||||
|
translate("VCommandLine", "Set height value a pattern file, that was opened "
|
||||||
|
"with standard measurements (export mode). Valid "
|
||||||
|
"values: %1cm.")
|
||||||
|
.arg(VMeasurement::WholeListHeights(Unit::Cm).join(", ")),
|
||||||
|
translate("VCommandLine", "The height value")));
|
||||||
|
|
||||||
|
//=================================================================================================================
|
||||||
|
|
||||||
|
options.insert(LONG_OPTION_PAGETEMPLATE,
|
||||||
|
new QCommandLineOption(QStringList() << SINGLE_OPTION_PAGETEMPLATE << LONG_OPTION_PAGETEMPLATE,
|
||||||
|
translate("VCommandLine", "Number corresponding to page template (default = "
|
||||||
|
"0, export mode): ") +
|
||||||
|
DialogLayoutSettings::MakeHelpTemplateList(),
|
||||||
|
translate("VCommandLine", "Template number"), "0"));
|
||||||
|
|
||||||
|
|
||||||
|
options.insert(LONG_OPTION_PAGEW,
|
||||||
|
new QCommandLineOption(QStringList() << SINGLE_OPTION_PAGEW << LONG_OPTION_PAGEW,
|
||||||
|
translate("VCommandLine", "Page width in current units like 12.0 (cannot be "
|
||||||
|
"used with \"%1\", export mode).")
|
||||||
|
.arg(LONG_OPTION_PAGETEMPLATE),
|
||||||
|
translate("VCommandLine", "The page width")));
|
||||||
|
|
||||||
|
options.insert(LONG_OPTION_PAGEH,
|
||||||
|
new QCommandLineOption(QStringList() << SINGLE_OPTION_PAGEH << LONG_OPTION_PAGEH,
|
||||||
|
translate("VCommandLine", "Page height in current units like 12.0 (cannot "
|
||||||
|
"be used with \"%1\", export mode).")
|
||||||
|
.arg(LONG_OPTION_PAGETEMPLATE),
|
||||||
|
("The page height")));
|
||||||
|
|
||||||
|
options.insert(LONG_OPTION_PAGEUNITS,
|
||||||
|
new QCommandLineOption(QStringList() << SINGLE_OPTION_PAGEUNITS << LONG_OPTION_PAGEUNITS,
|
||||||
|
translate("VCommandLine", "Page height/width measure units (cannot be used "
|
||||||
|
"with \"%1\", export mode): ")
|
||||||
|
.arg(LONG_OPTION_PAGETEMPLATE) + VDomDocument::UnitsHelpString(),
|
||||||
|
translate("VCommandLine", "The measure unit")));
|
||||||
|
|
||||||
|
//=================================================================================================================
|
||||||
|
|
||||||
|
options.insert(LONG_OPTION_ROTATE,
|
||||||
|
new QCommandLineOption(QStringList() << SINGLE_OPTION_ROTATE << LONG_OPTION_ROTATE,
|
||||||
|
translate("VCommandLine", "Rotation in degrees (one of predefined). Default "
|
||||||
|
"(or 0) is no-rotate (export mode)."),
|
||||||
|
translate("VCommandLine", "Angle")));
|
||||||
|
|
||||||
|
options.insert(LONG_OPTION_CROP,
|
||||||
|
new QCommandLineOption(QStringList() << SINGLE_OPTION_CROP << LONG_OPTION_CROP,
|
||||||
|
translate("VCommandLine", "Auto crop unused length (export mode).")));
|
||||||
|
|
||||||
|
options.insert(LONG_OPTION_UNITE,
|
||||||
|
new QCommandLineOption(QStringList() << SINGLE_OPTION_UNITE << LONG_OPTION_UNITE,
|
||||||
|
translate("VCommandLine", "Unite pages if possible (export mode).")));
|
||||||
|
|
||||||
|
//=================================================================================================================
|
||||||
|
|
||||||
|
options.insert(LONG_OPTION_SAVELENGTH,
|
||||||
|
new QCommandLineOption(QStringList() << SINGLE_OPTION_SAVELENGTH << LONG_OPTION_SAVELENGTH,
|
||||||
|
translate("VCommandLine",
|
||||||
|
"Save length of the sheet if set. (export mode).")));
|
||||||
|
|
||||||
|
options.insert(LONG_OPTION_SHIFTUNITS,
|
||||||
|
new QCommandLineOption(QStringList() << SINGLE_OPTION_SHIFTUNITS << LONG_OPTION_SHIFTUNITS,
|
||||||
|
translate("VCommandLine",
|
||||||
|
"Layout units (as paper's one except px, export mode)."),
|
||||||
|
translate("VCommandLine", "The unit")));
|
||||||
|
|
||||||
|
options.insert(LONG_OPTION_SHIFTLENGTH,
|
||||||
|
new QCommandLineOption(QStringList() << SINGLE_OPTION_SHIFTLENGTH << LONG_OPTION_SHIFTLENGTH,
|
||||||
|
translate("VCommandLine", "Shift layout length measured in layout units "
|
||||||
|
"(export mode)."),
|
||||||
|
translate("VCommandLine", "Shift length")));
|
||||||
|
|
||||||
|
options.insert(LONG_OPTION_GAPWIDTH,
|
||||||
|
new QCommandLineOption(QStringList() << SINGLE_OPTION_GAPWIDTH << LONG_OPTION_GAPWIDTH,
|
||||||
|
translate("VCommandLine",
|
||||||
|
"Gap width x2, measured in layout units. (export mode)."),
|
||||||
|
translate("VCommandLine", "The gap width")));
|
||||||
|
|
||||||
|
options.insert(LONG_OPTION_GROUPPING,
|
||||||
|
new QCommandLineOption(QStringList() << SINGLE_OPTION_GROUPPING << LONG_OPTION_GROUPPING,
|
||||||
|
translate("VCommandLine", "Sets layout groupping (export mode): ")
|
||||||
|
+ DialogLayoutSettings::MakeGroupsHelp(),
|
||||||
|
translate("VCommandLine", "Grouping type"), "2"));
|
||||||
|
|
||||||
|
options.insert(LONG_OPTION_TEST,
|
||||||
|
new QCommandLineOption(QStringList() << SINGLE_OPTION_TEST << LONG_OPTION_TEST,
|
||||||
|
translate("VCommandLine", "Run the program in a test mode. The program this "
|
||||||
|
"mode load a single pattern file and silently "
|
||||||
|
"quit without showing the main window. The key "
|
||||||
|
"have priority before key '%1'.")
|
||||||
|
.arg(LONG_OPTION_BASENAME)));
|
||||||
|
return options;
|
||||||
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------
|
||||||
VLayoutGeneratorPtr VCommandLine::DefaultGenerator() const
|
VLayoutGeneratorPtr VCommandLine::DefaultGenerator() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -87,6 +87,8 @@ private:
|
||||||
|
|
||||||
static int Lo2Px(const QString& src, const DialogLayoutSettings& converter);
|
static int Lo2Px(const QString& src, const DialogLayoutSettings& converter);
|
||||||
static int Pg2Px(const QString& src, const DialogLayoutSettings& converter);
|
static int Pg2Px(const QString& src, const DialogLayoutSettings& converter);
|
||||||
|
|
||||||
|
static QMap<QString, QCommandLineOption *> InitOptionsUsed();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VCMDEXPORT_H
|
#endif // VCMDEXPORT_H
|
||||||
|
|
|
@ -31,7 +31,6 @@
|
||||||
#include "../core/vapplication.h"
|
#include "../core/vapplication.h"
|
||||||
#include "../ifc/xml/vdomdocument.h"
|
#include "../ifc/xml/vdomdocument.h"
|
||||||
#include "../vmisc/vsettings.h"
|
#include "../vmisc/vsettings.h"
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0)
|
#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0)
|
||||||
# include "../vmisc/vmath.h"
|
# include "../vmisc/vmath.h"
|
||||||
|
@ -42,20 +41,19 @@
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
|
||||||
//must be the same order as PaperSizeTemplate constants
|
//must be the same order as PaperSizeTemplate constants
|
||||||
const DialogLayoutSettings::FormatsVector DialogLayoutSettings::pageFormatNames={
|
const DialogLayoutSettings::FormatsVector DialogLayoutSettings::pageFormatNames =
|
||||||
"A0",
|
DialogLayoutSettings::FormatsVector () << QLatin1Literal("A0")
|
||||||
"A1",
|
<< QLatin1Literal("A1")
|
||||||
"A2",
|
<< QLatin1Literal("A2")
|
||||||
"A3",
|
<< QLatin1Literal("A3")
|
||||||
"A4",
|
<< QLatin1Literal("A4")
|
||||||
tr("Letter"),
|
<< QApplication::translate("DialogLayoutSettings", "Letter")
|
||||||
tr("Legal"),
|
<< QApplication::translate("DialogLayoutSettings", "Legal")
|
||||||
tr("Roll 24in"),
|
<< QApplication::translate("DialogLayoutSettings", "Roll 24in")
|
||||||
tr("Roll 30in"),
|
<< QApplication::translate("DialogLayoutSettings", "Roll 30in")
|
||||||
tr("Roll 36in"),
|
<< QApplication::translate("DialogLayoutSettings", "Roll 36in")
|
||||||
tr("Roll 42in"),
|
<< QApplication::translate("DialogLayoutSettings", "Roll 42in")
|
||||||
tr("Roll 44in"),
|
<< QApplication::translate("DialogLayoutSettings", "Roll 44in");
|
||||||
};
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
DialogLayoutSettings::DialogLayoutSettings(VLayoutGenerator *generator, QWidget *parent, bool disableSettings)
|
DialogLayoutSettings::DialogLayoutSettings(VLayoutGenerator *generator, QWidget *parent, bool disableSettings)
|
||||||
|
@ -481,7 +479,14 @@ void DialogLayoutSettings::InitTemplates()
|
||||||
auto cntr = static_cast<VIndexType>(PaperSizeTemplate::A0);
|
auto cntr = static_cast<VIndexType>(PaperSizeTemplate::A0);
|
||||||
foreach(const auto& v, pageFormatNames)
|
foreach(const auto& v, pageFormatNames)
|
||||||
{
|
{
|
||||||
ui->comboBoxTemplates->addItem(icoPaper, v+" "+pdi, QVariant(cntr++));
|
if (cntr <= 6)
|
||||||
|
{
|
||||||
|
ui->comboBoxTemplates->addItem(icoPaper, v+" "+pdi, QVariant(cntr++));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui->comboBoxTemplates->addItem(icoRoll, v+" "+pdi, QVariant(cntr++));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ui->comboBoxTemplates->setCurrentIndex(-1);
|
ui->comboBoxTemplates->setCurrentIndex(-1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,8 +47,18 @@ class DialogLayoutSettings : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
enum class PaperSizeTemplate : char { A0 = 0, A1, A2, A3, A4, Letter, Legal, Roll24in, Roll30in, Roll36in, Roll42in,
|
enum class PaperSizeTemplate : char { A0 = 0,
|
||||||
Roll44in};
|
A1,
|
||||||
|
A2,
|
||||||
|
A3,
|
||||||
|
A4,
|
||||||
|
Letter,
|
||||||
|
Legal,
|
||||||
|
Roll24in = 7, // Be carefull when change order roll type
|
||||||
|
Roll30in, // Used also for showing icon
|
||||||
|
Roll36in,
|
||||||
|
Roll42in,
|
||||||
|
Roll44in = 11};
|
||||||
explicit DialogLayoutSettings(VLayoutGenerator *generator, QWidget *parent = nullptr, bool disableSettings = false);
|
explicit DialogLayoutSettings(VLayoutGenerator *generator, QWidget *parent = nullptr, bool disableSettings = false);
|
||||||
~DialogLayoutSettings();
|
~DialogLayoutSettings();
|
||||||
|
|
||||||
|
@ -103,7 +113,7 @@ public slots:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(DialogLayoutSettings)
|
Q_DISABLE_COPY(DialogLayoutSettings)
|
||||||
typedef std::vector<QString> FormatsVector;
|
typedef QStringList FormatsVector;
|
||||||
typedef int VIndexType;
|
typedef int VIndexType;
|
||||||
const static FormatsVector pageFormatNames;
|
const static FormatsVector pageFormatNames;
|
||||||
|
|
||||||
|
|
|
@ -39,28 +39,14 @@
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
using namespace nm_DialogSaveLayout;
|
|
||||||
|
|
||||||
const QString baseFilenameRegExp = QStringLiteral("^[\\w\\-. ]+$");
|
const QString baseFilenameRegExp = QStringLiteral("^[\\w\\-. ]+$");
|
||||||
|
|
||||||
bool VFrmWithTest::havePdf = false;
|
bool DialogSaveLayout::havePdf = false;
|
||||||
bool VFrmWithTest::tested = false;
|
bool DialogSaveLayout::tested = false;
|
||||||
|
|
||||||
const std::vector<VFrmWithTest> DialogSaveLayout::availFormats =
|
|
||||||
{
|
|
||||||
VFrmWithTest(tr("Svg files (*.svg)"), ".svg"),
|
|
||||||
VFrmWithTest(tr("PDF files (*.pdf)"), ".pdf"),
|
|
||||||
VFrmWithTest(tr("Images (*.png)"), ".png"),
|
|
||||||
VFrmWithTest(tr("Wavefront OBJ (*.obj)"), ".obj"),
|
|
||||||
VFrmWithTest(tr("PS files (*.ps)"), ".ps", 1), //fixme: use 1 to have exe once tested on 1st run, or any other value to test always as original do
|
|
||||||
VFrmWithTest(tr("EPS files (*.eps)"), ".eps", 1),
|
|
||||||
VFrmWithTest(tr("DXF files (*.dxf)"), ".dxf"),
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
DialogSaveLayout::DialogSaveLayout(int count, const QString &fileName, QWidget *parent)
|
DialogSaveLayout::DialogSaveLayout(int count, const QString &fileName, QWidget *parent)
|
||||||
:QDialog(parent), ui(new Ui::DialogSaveLAyout), count(count)
|
:QDialog(parent), ui(new Ui::DialogSaveLAyout), count(count), availFormats(InitAvailFormats())
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
@ -96,10 +82,7 @@ DialogSaveLayout::DialogSaveLayout(int count, const QString &fileName, QWidget *
|
||||||
|
|
||||||
foreach (auto& v , availFormats)
|
foreach (auto& v , availFormats)
|
||||||
{
|
{
|
||||||
if (v.test())
|
ui->comboBoxFormat->addItem(v.first, QVariant(v.second));
|
||||||
{
|
|
||||||
ui->comboBoxFormat->addItem(v.pair.first, QVariant(v.pair.second));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
connect(bOk, &QPushButton::clicked, this, &DialogSaveLayout::Save);
|
connect(bOk, &QPushButton::clicked, this, &DialogSaveLayout::Save);
|
||||||
connect(ui->lineEditFileName, &QLineEdit::textChanged, this, &DialogSaveLayout::ShowExample);
|
connect(ui->lineEditFileName, &QLineEdit::textChanged, this, &DialogSaveLayout::ShowExample);
|
||||||
|
@ -116,7 +99,7 @@ DialogSaveLayout::DialogSaveLayout(int count, const QString &fileName, QWidget *
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
void DialogSaveLayout::SelectFormate(const size_t formate)
|
void DialogSaveLayout::SelectFormate(const int formate)
|
||||||
{
|
{
|
||||||
if (formate >= availFormats.size())
|
if (formate >= availFormats.size())
|
||||||
{
|
{
|
||||||
|
@ -124,7 +107,7 @@ void DialogSaveLayout::SelectFormate(const size_t formate)
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
const int i = ui->comboBoxFormat->findData(availFormats[formate].pair.second);
|
const int i = ui->comboBoxFormat->findData(availFormats.at(formate).second);
|
||||||
if (i < 0)
|
if (i < 0)
|
||||||
{
|
{
|
||||||
VException e(tr("Selected not present format."));
|
VException e(tr("Selected not present format."));
|
||||||
|
@ -138,12 +121,10 @@ QString DialogSaveLayout::MakeHelpFormatList()
|
||||||
{
|
{
|
||||||
QString out = "\n";
|
QString out = "\n";
|
||||||
int cntr = 0;
|
int cntr = 0;
|
||||||
|
const QVector<std::pair<QString, QString>> availFormats = InitAvailFormats();
|
||||||
foreach(auto& v, availFormats)
|
foreach(auto& v, availFormats)
|
||||||
{
|
{
|
||||||
if (v.test())
|
out += "\t"+v.first+" = "+ QString::number(cntr++)+"\n";
|
||||||
{
|
|
||||||
out += "\t"+v.pair.first+" = "+ QString::number(cntr++)+"\n";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
@ -264,9 +245,20 @@ void DialogSaveLayout::PathChanged(const QString &text)
|
||||||
|
|
||||||
ui->lineEditPath->setPalette(palette);
|
ui->lineEditPath->setPalette(palette);
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
bool VFrmWithTest::TestPdf()
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
bool DialogSaveLayout::SupportPSTest()
|
||||||
|
{
|
||||||
|
if (!tested)
|
||||||
|
{
|
||||||
|
havePdf = TestPdf();
|
||||||
|
tested = true;
|
||||||
|
}
|
||||||
|
return havePdf;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
bool DialogSaveLayout::TestPdf()
|
||||||
{
|
{
|
||||||
bool res = false;
|
bool res = false;
|
||||||
|
|
||||||
|
@ -286,3 +278,20 @@ bool VFrmWithTest::TestPdf()
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QVector<std::pair<QString, QString>> DialogSaveLayout::InitAvailFormats()
|
||||||
|
{
|
||||||
|
QVector<std::pair<QString, QString>> list;
|
||||||
|
list.append(std::make_pair(tr("Svg files (*.svg)"), QLatin1Literal(".svg")));
|
||||||
|
list.append(std::make_pair(tr("PDF files (*.pdf)"), QLatin1Literal(".pdf")));
|
||||||
|
list.append(std::make_pair(tr("Images (*.png)"), QLatin1Literal(".png")));
|
||||||
|
list.append(std::make_pair(tr("Wavefront OBJ (*.obj)"), QLatin1Literal(".obj")));
|
||||||
|
if (SupportPSTest())
|
||||||
|
{
|
||||||
|
list.append(std::make_pair(tr("PS files (*.ps)"), QLatin1Literal(".ps")));
|
||||||
|
list.append(std::make_pair(tr("EPS files (*.eps)"), QLatin1Literal(".eps")));
|
||||||
|
}
|
||||||
|
list.append(std::make_pair(tr("DXF files (*.dxf)"), QLatin1Literal(".dxf")));
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
|
@ -36,43 +36,6 @@
|
||||||
#else
|
#else
|
||||||
# define PDFTOPS "pdftops"
|
# define PDFTOPS "pdftops"
|
||||||
#endif
|
#endif
|
||||||
#include <vector>
|
|
||||||
#include <functional>
|
|
||||||
|
|
||||||
namespace nm_DialogSaveLayout
|
|
||||||
{
|
|
||||||
struct VFrmWithTest //could declare inside dialog class, but using namespace shorter to write and understand
|
|
||||||
{
|
|
||||||
typedef std::function<bool()> test_func;
|
|
||||||
const std::pair<QString, QString> pair;
|
|
||||||
const test_func test;
|
|
||||||
|
|
||||||
VFrmWithTest(const QString& v1, const QString& v2)
|
|
||||||
:pair(std::make_pair(v1,v2)),
|
|
||||||
test([](){return true;})
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
VFrmWithTest(const QString& v1, const QString& v2, int dummy)
|
|
||||||
:pair(std::make_pair(v1,v2)), test((dummy != 1 )?TestPdf:VFrmWithTest::SingleTest)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
private:
|
|
||||||
static bool havePdf;
|
|
||||||
static bool tested;
|
|
||||||
|
|
||||||
static bool TestPdf();
|
|
||||||
static bool SingleTest()
|
|
||||||
{
|
|
||||||
if (!tested)
|
|
||||||
{
|
|
||||||
havePdf = TestPdf();
|
|
||||||
tested = true;
|
|
||||||
}
|
|
||||||
return havePdf;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
|
@ -91,7 +54,7 @@ public:
|
||||||
QString Path() const;
|
QString Path() const;
|
||||||
QString FileName() const;
|
QString FileName() const;
|
||||||
QString Formate() const;
|
QString Formate() const;
|
||||||
void SelectFormate(const size_t formate);
|
void SelectFormate(const int formate);
|
||||||
static QString MakeHelpFormatList();
|
static QString MakeHelpFormatList();
|
||||||
void SetDestinationPath(const QString& cmdDestinationPath);
|
void SetDestinationPath(const QString& cmdDestinationPath);
|
||||||
public slots:
|
public slots:
|
||||||
|
@ -101,10 +64,16 @@ public slots:
|
||||||
void PathChanged(const QString &text);
|
void PathChanged(const QString &text);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const static std::vector<nm_DialogSaveLayout::VFrmWithTest> availFormats;
|
|
||||||
Q_DISABLE_COPY(DialogSaveLayout)
|
Q_DISABLE_COPY(DialogSaveLayout)
|
||||||
Ui::DialogSaveLAyout *ui;
|
Ui::DialogSaveLAyout *ui;
|
||||||
int count;
|
int count;
|
||||||
|
// Note. We can't make availFormats static because MSVC doesn't support C++11 list initialization
|
||||||
|
QVector<std::pair<QString, QString>> availFormats;
|
||||||
|
static bool havePdf;
|
||||||
|
static bool tested;
|
||||||
|
static bool SupportPSTest();
|
||||||
|
static bool TestPdf();
|
||||||
|
static QVector<std::pair<QString, QString> > InitAvailFormats();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DIALOGSAVELAYOUT_H
|
#endif // DIALOGSAVELAYOUT_H
|
||||||
|
|
|
@ -231,7 +231,7 @@ private:
|
||||||
QPointer<QLabel> gradationHeightsLabel;
|
QPointer<QLabel> gradationHeightsLabel;
|
||||||
QPointer<QLabel> gradationSizesLabel;
|
QPointer<QLabel> gradationSizesLabel;
|
||||||
VToolOptionsPropertyBrowser *toolOptions;
|
VToolOptionsPropertyBrowser *toolOptions;
|
||||||
VLockGuardPtr<char> lock;
|
std::shared_ptr<VLockGuard<char>> lock;
|
||||||
|
|
||||||
void ToolBarOption();
|
void ToolBarOption();
|
||||||
void ToolBarStages();
|
void ToolBarStages();
|
||||||
|
|
|
@ -2184,8 +2184,7 @@ void VPattern::ParseToolsElement(VMainGraphicsScene *scene, const QDomElement &d
|
||||||
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
|
||||||
Q_ASSERT_X(type.isEmpty() == false, Q_FUNC_INFO, "type of spline is empty");
|
Q_ASSERT_X(type.isEmpty() == false, Q_FUNC_INFO, "type of spline is empty");
|
||||||
|
|
||||||
QStringList tools{VToolUnionDetails::ToolType};
|
const QStringList tools = QStringList() << VToolUnionDetails::ToolType;
|
||||||
|
|
||||||
switch (tools.indexOf(type))
|
switch (tools.indexOf(type))
|
||||||
{
|
{
|
||||||
case 0: //VToolUnionDetails::ToolType
|
case 0: //VToolUnionDetails::ToolType
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QMUPARSERSHARED_EXPORT inline QString NameRegExp()
|
inline QString NameRegExp()
|
||||||
{
|
{
|
||||||
//Same regexp in pattern.xsd shema file. Don't forget synchronize.
|
//Same regexp in pattern.xsd shema file. Don't forget synchronize.
|
||||||
return QStringLiteral("^([^0-9*/^+\\-=\\s()?%:;!.,`'\"]){1,1}([^*/^+\\-=\\s()?%:;!.,`'\"]){0,}$");
|
return QStringLiteral("^([^0-9*/^+\\-=\\s()?%:;!.,`'\"]){1,1}([^*/^+\\-=\\s()?%:;!.,`'\"]){0,}$");
|
||||||
|
|
|
@ -33,6 +33,14 @@
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
#include <QRectF>
|
#include <QRectF>
|
||||||
|
|
||||||
|
// An annoying char define, from the Windows team in <rpcndr.h>
|
||||||
|
// #define small char
|
||||||
|
// http://stuartjames.info/Journal/c--visual-studio-2012-vs2012--win8--converting-projects-up-some-conflicts-i-found.aspx
|
||||||
|
#if defined (Q_OS_WIN) && defined (Q_CC_MSVC)
|
||||||
|
#pragma push_macro("small")
|
||||||
|
#undef small
|
||||||
|
#endif
|
||||||
|
|
||||||
class QPointF;
|
class QPointF;
|
||||||
class VLayoutDetail;
|
class VLayoutDetail;
|
||||||
|
|
||||||
|
@ -92,4 +100,8 @@ private:
|
||||||
void BiggestBoundingRect();
|
void BiggestBoundingRect();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if defined (Q_OS_WIN) && defined (Q_CC_MSVC)
|
||||||
|
#pragma pop_macro("small")
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // VBANK_H
|
#endif // VBANK_H
|
||||||
|
|
|
@ -929,18 +929,18 @@ QStringList ListGroupQ()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QStringList SupportedLocales()
|
QStringList SupportedLocales()
|
||||||
{
|
{
|
||||||
const QStringList locales = {QStringLiteral("ru_RU"),
|
const QStringList locales = QStringList() << QStringLiteral("ru_RU")
|
||||||
QStringLiteral("uk_UA"),
|
<< QStringLiteral("uk_UA")
|
||||||
QStringLiteral("de_DE"),
|
<< QStringLiteral("de_DE")
|
||||||
QStringLiteral("cs_CZ"),
|
<< QStringLiteral("cs_CZ")
|
||||||
QStringLiteral("he_IL"),
|
<< QStringLiteral("he_IL")
|
||||||
QStringLiteral("fr_FR"),
|
<< QStringLiteral("fr_FR")
|
||||||
QStringLiteral("it_IT"),
|
<< QStringLiteral("it_IT")
|
||||||
QStringLiteral("nl_NL"),
|
<< QStringLiteral("nl_NL")
|
||||||
QStringLiteral("id_ID"),
|
<< QStringLiteral("id_ID")
|
||||||
QStringLiteral("es_ES"),
|
<< QStringLiteral("es_ES")
|
||||||
QStringLiteral("fi_FI"),
|
<< QStringLiteral("fi_FI")
|
||||||
QStringLiteral("en_US")};
|
<< QStringLiteral("en_US");
|
||||||
|
|
||||||
return locales;
|
return locales;
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ QString compilerString()
|
||||||
#elif defined(Q_CC_MSVC)
|
#elif defined(Q_CC_MSVC)
|
||||||
if (_MSC_VER >= 1800) // 1800: MSVC 2013 (yearly release cycle)
|
if (_MSC_VER >= 1800) // 1800: MSVC 2013 (yearly release cycle)
|
||||||
{
|
{
|
||||||
compiler = QLatin1String("MSVC ") + QString::number(2008 + ((_MSC_VER / 100) - 13));
|
return QLatin1String("MSVC ") + QString::number(2008 + ((_MSC_VER / 100) - 13));
|
||||||
}
|
}
|
||||||
if (_MSC_VER >= 1500) // 1500: MSVC 2008, 1600: MSVC 2010, ... (2-year release cycle)
|
if (_MSC_VER >= 1500) // 1500: MSVC 2008, 1600: MSVC 2010, ... (2-year release cycle)
|
||||||
{
|
{
|
||||||
|
|
|
@ -169,29 +169,25 @@ bool VLockGuard<Guarded>::TryLock(const QString &lockName, int stale, int timeou
|
||||||
//use pointer and function below to persistent things like class-member, because lock is taken by constructor
|
//use pointer and function below to persistent things like class-member, because lock is taken by constructor
|
||||||
//helper functions allow to write shorter creating and setting new lock-pointer
|
//helper functions allow to write shorter creating and setting new lock-pointer
|
||||||
|
|
||||||
//new C++11 - "template typedef" http://stackoverflow.com/questions/2795023/c-template-typedef
|
|
||||||
template <typename Guarded>
|
|
||||||
using VLockGuardPtr = std::shared_ptr<VLockGuard<Guarded>>;
|
|
||||||
|
|
||||||
#if defined (Q_CC_INTEL)
|
#if defined (Q_CC_INTEL)
|
||||||
#pragma warning( push )
|
#pragma warning( push )
|
||||||
#pragma warning( disable: 1418 )
|
#pragma warning( disable: 1418 )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
template <typename Guarded>
|
template <typename Guarded>
|
||||||
void VlpCreateLock(VLockGuardPtr<Guarded>& r, const QString& lockName, int stale = 0, int timeout = 0)
|
void VlpCreateLock(std::shared_ptr<VLockGuard<Guarded>>& r, const QString& lockName, int stale = 0, int timeout = 0)
|
||||||
{
|
{
|
||||||
r.reset(new VLockGuard<Guarded>(lockName, stale, timeout));
|
r.reset(new VLockGuard<Guarded>(lockName, stale, timeout));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Guarded, typename Alloc>
|
template <typename Guarded, typename Alloc>
|
||||||
void VlpCreateLock(VLockGuardPtr<Guarded>& r, const QString& lockName, Alloc a, int stale = 0, int timeout = 0)
|
void VlpCreateLock(std::shared_ptr<VLockGuard<Guarded>>& r, const QString& lockName, Alloc a, int stale = 0, int timeout = 0)
|
||||||
{
|
{
|
||||||
r.reset(new VLockGuard<Guarded>(lockName, a, stale, timeout));
|
r.reset(new VLockGuard<Guarded>(lockName, a, stale, timeout));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Guarded, typename Alloc, typename Del>
|
template <typename Guarded, typename Alloc, typename Del>
|
||||||
void VlpCreateLock(VLockGuardPtr<Guarded>& r, const QString& lockName, Alloc a, Del d, int stale = 0, int timeout = 0)
|
void VlpCreateLock(std::shared_ptr<VLockGuard<Guarded>>& r, const QString& lockName, Alloc a, Del d, int stale = 0, int timeout = 0)
|
||||||
{
|
{
|
||||||
r.reset(new VLockGuard<Guarded>(lockName, a, d, stale, timeout));
|
r.reset(new VLockGuard<Guarded>(lockName, a, d, stale, timeout));
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,40 +31,40 @@
|
||||||
|
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
|
|
||||||
constexpr auto V_EX_OK = 0; /*Indicate the successful exit.*/
|
static const auto V_EX_OK = 0; /*Indicate the successful exit.*/
|
||||||
|
|
||||||
constexpr auto V_EX_USAGE = 64; /*The command was used incorrectly, e.g., with the wrong number of arguments, a
|
static const auto V_EX_USAGE = 64; /*The command was used incorrectly, e.g., with the wrong number of
|
||||||
bad flag, a bad syntax in a parameter, or whatever.*/
|
arguments, a bad flag, a bad syntax in a parameter, or whatever.*/
|
||||||
|
|
||||||
constexpr auto V_EX_DATAERR = 65; /*The input data was incorrect in some way. This should only be used for
|
static const auto V_EX_DATAERR = 65; /*The input data was incorrect in some way. This should only be used for
|
||||||
user's data and not system files.*/
|
user's data and not system files.*/
|
||||||
|
|
||||||
constexpr auto V_EX_NOINPUT = 66; /*An input file (not a system file) did not exist or was not readable.*/
|
static const auto V_EX_NOINPUT = 66; /*An input file (not a system file) did not exist or was not readable.*/
|
||||||
|
|
||||||
constexpr auto V_EX_UNAVAILABLE = 69; /*A service is unavailable. This can occur if a support program or file does
|
static const auto V_EX_UNAVAILABLE = 69; /*A service is unavailable. This can occur if a support program or file
|
||||||
not exist. This can also be used as a catchall message when something you
|
does not exist. This can also be used as a catchall message when
|
||||||
wanted to do doesn't work, but you don't know why.*/
|
something you wanted to do doesn't work, but you don't know why.*/
|
||||||
|
|
||||||
constexpr auto V_EX_SOFTWARE = 70; /*An internal software error has been detected. This should be limited to
|
static const auto V_EX_SOFTWARE = 70; /*An internal software error has been detected. This should be limited to
|
||||||
nonoperating operating system related errors as possible.*/
|
nonoperating operating system related errors as possible.*/
|
||||||
|
|
||||||
constexpr auto V_EX_OSERR = 71; /*An operating system error has been detected. This is intended to be used for
|
static const auto V_EX_OSERR = 71; /*An operating system error has been detected. This is intended to be
|
||||||
such things as ``cannot fork'', ``cannot create pipe'', or the like. It
|
used for such things as ``cannot fork'', ``cannot create pipe'', or the
|
||||||
includes things like getuid returning a user that does not exist in the passwd
|
like. It includes things like getuid returning a user that does not exist
|
||||||
file.*/
|
in the passwd file.*/
|
||||||
|
|
||||||
constexpr auto V_EX_OSFILE = 72; /*Some system file (e.g., /etc/passwd, /var/run/utmp, etc.) does not exist,
|
static const auto V_EX_OSFILE = 72; /*Some system file (e.g., /etc/passwd, /var/run/utmp, etc.) does not exist,
|
||||||
cannot be opened, or has some sort of error (e.g., syntax error).*/
|
cannot be opened, or has some sort of error (e.g., syntax error).*/
|
||||||
|
|
||||||
constexpr auto V_EX_CANTCREAT = 73; /*A (user specified) output file cannot be created.*/
|
static const auto V_EX_CANTCREAT = 73; /*A (user specified) output file cannot be created.*/
|
||||||
|
|
||||||
constexpr auto V_EX_IOERR = 74; /*An error occurred while doing I/O on some file.*/
|
static const auto V_EX_IOERR = 74; /*An error occurred while doing I/O on some file.*/
|
||||||
|
|
||||||
constexpr auto V_EX_NOPERM = 77; /*You did not have sufficient permission to perform the operation. This is not
|
static const auto V_EX_NOPERM = 77; /*You did not have sufficient permission to perform the operation. This
|
||||||
intended for file system problems, which should use EX_NOINPUT or EX_CANTCREAT,
|
is not intended for file system problems, which should use EX_NOINPUT or
|
||||||
but rather for higher level permissions.*/
|
EX_CANTCREAT, but rather for higher level permissions.*/
|
||||||
|
|
||||||
constexpr auto V_EX_CONFIG = 78; /*Something was found in an unconfigured or misconfigured state.*/
|
static const auto V_EX_CONFIG = 78; /*Something was found in an unconfigured or misconfigured state.*/
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
inline QTextStream& vStdErr()
|
inline QTextStream& vStdErr()
|
||||||
|
|
|
@ -22,9 +22,16 @@
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <QtGlobal>
|
||||||
|
|
||||||
#include "delaunay.h"
|
#include "delaunay.h"
|
||||||
|
|
||||||
|
#ifdef Q_CC_GNU
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wold-style-cast"
|
||||||
|
#pragma GCC diagnostic ignored "-Wcast-qual"
|
||||||
|
#endif
|
||||||
|
|
||||||
#if PREDICATE == EXACT_PREDICATE
|
#if PREDICATE == EXACT_PREDICATE
|
||||||
extern void exactinit();
|
extern void exactinit();
|
||||||
extern real incircle(real* pa, real* pb, real* pc, real* pd);
|
extern real incircle(real* pa, real* pb, real* pc, real* pd);
|
||||||
|
@ -1061,7 +1068,7 @@ delaunay2d_t* delaunay2d_from(del_point2d_t *points, unsigned int num_points) {
|
||||||
|
|
||||||
res = (delaunay2d_t*)malloc(sizeof(delaunay2d_t));
|
res = (delaunay2d_t*)malloc(sizeof(delaunay2d_t));
|
||||||
res->num_points = num_points;
|
res->num_points = num_points;
|
||||||
res->points = malloc(sizeof(del_point2d_t) * num_points);
|
res->points = (del_point2d_t*)malloc(sizeof(del_point2d_t) * num_points);
|
||||||
memcpy(res->points, points, sizeof(del_point2d_t) * num_points);
|
memcpy(res->points, points, sizeof(del_point2d_t) * num_points);
|
||||||
res->num_faces = del.num_faces;
|
res->num_faces = del.num_faces;
|
||||||
res->faces = faces;
|
res->faces = faces;
|
||||||
|
@ -1074,3 +1081,7 @@ void delaunay2d_release(delaunay2d_t *del) {
|
||||||
free(del->points);
|
free(del->points);
|
||||||
free(del);
|
free(del);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef Q_CC_GNU
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
#endif
|
|
@ -2,7 +2,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* Routines for Arbitrary Precision Floating-point Arithmetic */
|
/* Routines for Arbitrary Precision Floating-point Arithmetic */
|
||||||
/* and Fast Robust Geometric Predicates */
|
/* and Fast Robust Geometric Predicates */
|
||||||
/* (predicates.c) */
|
/* (predicates.cpp) */
|
||||||
/* */
|
/* */
|
||||||
/* May 18, 1996 */
|
/* May 18, 1996 */
|
||||||
/* */
|
/* */
|
||||||
|
@ -110,6 +110,12 @@
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
|
|
||||||
|
#ifdef Q_CC_GNU
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wold-style-cast"
|
||||||
|
#pragma GCC diagnostic ignored "-Wfloat-equal"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* On some machines, the exact arithmetic routines might be defeated by the */
|
/* On some machines, the exact arithmetic routines might be defeated by the */
|
||||||
/* use of internal extended precision floating-point registers. Sometimes */
|
/* use of internal extended precision floating-point registers. Sometimes */
|
||||||
/* this problem can be fixed by defining certain values to be volatile, */
|
/* this problem can be fixed by defining certain values to be volatile, */
|
||||||
|
@ -1068,3 +1074,7 @@ qreal incircle(qreal *pa, qreal *pb, qreal *pc, qreal *pd)
|
||||||
|
|
||||||
return incircleadapt(pa, pb, pc, pd, permanent);
|
return incircleadapt(pa, pb, pc, pd, permanent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef Q_CC_GNU
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
#endif
|
|
@ -3,10 +3,10 @@
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
$$PWD/vobjengine.cpp \
|
$$PWD/vobjengine.cpp \
|
||||||
$$PWD/delaunay.c \
|
|
||||||
$$PWD/predicates.c \
|
|
||||||
$$PWD/vobjpaintdevice.cpp \
|
$$PWD/vobjpaintdevice.cpp \
|
||||||
$$PWD/stable.cpp
|
$$PWD/stable.cpp \
|
||||||
|
$$PWD/delaunay.cpp \
|
||||||
|
$$PWD/predicates.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
$$PWD/vobjengine.h \
|
$$PWD/vobjengine.h \
|
||||||
|
|
|
@ -18,19 +18,18 @@
|
||||||
#ifndef CHECKABLEMESSAGEBOX_H
|
#ifndef CHECKABLEMESSAGEBOX_H
|
||||||
#define CHECKABLEMESSAGEBOX_H
|
#define CHECKABLEMESSAGEBOX_H
|
||||||
|
|
||||||
|
#include "vpropertyexplorer_global.h"
|
||||||
#include <QDialogButtonBox>
|
#include <QDialogButtonBox>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
|
||||||
class QSettings;
|
class QSettings;
|
||||||
QT_END_NAMESPACE
|
|
||||||
|
|
||||||
namespace Utils
|
namespace Utils
|
||||||
{
|
{
|
||||||
|
|
||||||
class CheckableMessageBoxPrivate;
|
class CheckableMessageBoxPrivate;
|
||||||
|
|
||||||
class Q_DECL_EXPORT CheckableMessageBox : public QDialog
|
class VPROPERTYEXPLORERSHARED_EXPORT CheckableMessageBox : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(QString text READ text WRITE setText)
|
Q_PROPERTY(QString text READ text WRITE setText)
|
||||||
|
|
|
@ -31,10 +31,14 @@
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
|
#ifdef Q_CC_MSVC
|
||||||
|
#include <ciso646>
|
||||||
|
#endif /* Q_CC_MSVC */
|
||||||
|
|
||||||
// Return codes for testing run application
|
// Return codes for testing run application
|
||||||
constexpr auto TST_EX_BIN = -1; // Can't find binary.
|
static const auto TST_EX_BIN = -1; // Can't find binary.
|
||||||
constexpr auto TST_EX_TIME_OUT = -2; // The operation timed out or an error occurred.
|
static const auto TST_EX_TIME_OUT = -2; // The operation timed out or an error occurred.
|
||||||
constexpr auto TST_EX_CRASH = -3; // Program crashed.
|
static const auto TST_EX_CRASH = -3; // Program crashed.
|
||||||
|
|
||||||
enum ErrorState {ErrorLoad = 0, ErrorInstall, ErrorSize, NoError};
|
enum ErrorState {ErrorLoad = 0, ErrorInstall, ErrorSize, NoError};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user