Successful build with MSVC 2012.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2015-10-23 20:47:33 +03:00
parent 1af1283ed4
commit d6653ca9af
22 changed files with 312 additions and 276 deletions

View File

@ -137,7 +137,7 @@ private:
QComboBox *gradationSizes;
QComboBox *comboBoxUnits;
int formulaBaseHeight;
VLockGuardPtr<char> lock;
std::shared_ptr<VLockGuard<char>> lock;
QSharedPointer<VTableSearch> search;
QLabel *labelGradationHeights;
QLabel *labelGradationSizes;

View File

@ -68,7 +68,7 @@ Q_LOGGING_CATEGORY(vApp, "v.application")
#pragma warning( pop )
#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)
@ -503,9 +503,8 @@ void VApplication::BeginLogging()
//---------------------------------------------------------------------------------------------------------------------
void VApplication::ClearOldLogs() const
{
QStringList filters{"*.log"};
QDir logsDir(LogDirPath());
logsDir.setNameFilters(filters);
logsDir.setNameFilters(QStringList("*.log"));
logsDir.setCurrent(LogDirPath());
const QStringList allFiles = logsDir.entryList(QDir::NoDotAndDotDot | QDir::Files);

View File

@ -96,7 +96,7 @@ private:
VTranslateVars *trVars;
QTimer *autoSaveTimer;
VLockGuardPtr<QFile> lockLog;
std::shared_ptr<VLockGuard<QFile>> lockLog;
std::shared_ptr<QTextStream> out;
void InitLineWidth();

View File

@ -65,131 +65,8 @@ const static auto SINGLE_OPTION_GRADATIONHEIGHT = QStringLiteral("e");
#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()
, 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)
VCommandLine::VCommandLine() : parser(), optionsUsed(InitOptionsUsed()), isGuiEnabled(false)
{
parser.setApplicationDescription(translate("VCommandLine", "Pattern making program."));
parser.addHelpOption();
@ -204,7 +81,7 @@ VCommandLine::VCommandLine() : parser()
}
}
//------------------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------------------------------
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 ...
@ -212,12 +89,146 @@ int VCommandLine::Lo2Px(const QString &src, const DialogLayoutSettings &converte
return converter.LayoutToPixels(src.toFloat());
}
//------------------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------------------------------
int VCommandLine::Pg2Px(const QString& src, const DialogLayoutSettings& converter)
{
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
{

View File

@ -87,6 +87,8 @@ private:
static int Lo2Px(const QString& src, const DialogLayoutSettings& converter);
static int Pg2Px(const QString& src, const DialogLayoutSettings& converter);
static QMap<QString, QCommandLineOption *> InitOptionsUsed();
};
#endif // VCMDEXPORT_H

View File

@ -31,7 +31,6 @@
#include "../core/vapplication.h"
#include "../ifc/xml/vdomdocument.h"
#include "../vmisc/vsettings.h"
#include <vector>
#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0)
# include "../vmisc/vmath.h"
@ -42,20 +41,19 @@
#include <QPushButton>
//must be the same order as PaperSizeTemplate constants
const DialogLayoutSettings::FormatsVector DialogLayoutSettings::pageFormatNames={
"A0",
"A1",
"A2",
"A3",
"A4",
tr("Letter"),
tr("Legal"),
tr("Roll 24in"),
tr("Roll 30in"),
tr("Roll 36in"),
tr("Roll 42in"),
tr("Roll 44in"),
};
const DialogLayoutSettings::FormatsVector DialogLayoutSettings::pageFormatNames =
DialogLayoutSettings::FormatsVector () << QLatin1Literal("A0")
<< QLatin1Literal("A1")
<< QLatin1Literal("A2")
<< QLatin1Literal("A3")
<< QLatin1Literal("A4")
<< QApplication::translate("DialogLayoutSettings", "Letter")
<< QApplication::translate("DialogLayoutSettings", "Legal")
<< QApplication::translate("DialogLayoutSettings", "Roll 24in")
<< QApplication::translate("DialogLayoutSettings", "Roll 30in")
<< QApplication::translate("DialogLayoutSettings", "Roll 36in")
<< QApplication::translate("DialogLayoutSettings", "Roll 42in")
<< QApplication::translate("DialogLayoutSettings", "Roll 44in");
//---------------------------------------------------------------------------------------------------------------------
DialogLayoutSettings::DialogLayoutSettings(VLayoutGenerator *generator, QWidget *parent, bool disableSettings)
@ -481,7 +479,14 @@ void DialogLayoutSettings::InitTemplates()
auto cntr = static_cast<VIndexType>(PaperSizeTemplate::A0);
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);
}

View File

@ -47,8 +47,18 @@ class DialogLayoutSettings : public QDialog
{
Q_OBJECT
public:
enum class PaperSizeTemplate : char { A0 = 0, A1, A2, A3, A4, Letter, Legal, Roll24in, Roll30in, Roll36in, Roll42in,
Roll44in};
enum class PaperSizeTemplate : char { A0 = 0,
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);
~DialogLayoutSettings();
@ -103,7 +113,7 @@ public slots:
private:
Q_DISABLE_COPY(DialogLayoutSettings)
typedef std::vector<QString> FormatsVector;
typedef QStringList FormatsVector;
typedef int VIndexType;
const static FormatsVector pageFormatNames;

View File

@ -39,28 +39,14 @@
#include <QProcess>
#include <QDebug>
using namespace nm_DialogSaveLayout;
const QString baseFilenameRegExp = QStringLiteral("^[\\w\\-. ]+$");
bool VFrmWithTest::havePdf = false;
bool VFrmWithTest::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"),
};
bool DialogSaveLayout::havePdf = false;
bool DialogSaveLayout::tested = false;
//---------------------------------------------------------------------------------------------------------------------
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);
@ -96,10 +82,7 @@ DialogSaveLayout::DialogSaveLayout(int count, const QString &fileName, QWidget *
foreach (auto& v , availFormats)
{
if (v.test())
{
ui->comboBoxFormat->addItem(v.pair.first, QVariant(v.pair.second));
}
ui->comboBoxFormat->addItem(v.first, QVariant(v.second));
}
connect(bOk, &QPushButton::clicked, this, &DialogSaveLayout::Save);
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())
{
@ -124,7 +107,7 @@ void DialogSaveLayout::SelectFormate(const size_t formate)
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)
{
VException e(tr("Selected not present format."));
@ -138,12 +121,10 @@ QString DialogSaveLayout::MakeHelpFormatList()
{
QString out = "\n";
int cntr = 0;
const QVector<std::pair<QString, QString>> availFormats = InitAvailFormats();
foreach(auto& v, availFormats)
{
if (v.test())
{
out += "\t"+v.pair.first+" = "+ QString::number(cntr++)+"\n";
}
out += "\t"+v.first+" = "+ QString::number(cntr++)+"\n";
}
return out;
}
@ -264,9 +245,20 @@ void DialogSaveLayout::PathChanged(const QString &text)
ui->lineEditPath->setPalette(palette);
}
//---------------------------------------------------------------------------------------------------------------------
bool VFrmWithTest::TestPdf()
//---------------------------------------------------------------------------------------------------------------------
bool DialogSaveLayout::SupportPSTest()
{
if (!tested)
{
havePdf = TestPdf();
tested = true;
}
return havePdf;
}
//---------------------------------------------------------------------------------------------------------------------
bool DialogSaveLayout::TestPdf()
{
bool res = false;
@ -286,3 +278,20 @@ bool VFrmWithTest::TestPdf()
}
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;
}

View File

@ -36,43 +36,6 @@
#else
# define PDFTOPS "pdftops"
#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
{
@ -91,7 +54,7 @@ public:
QString Path() const;
QString FileName() const;
QString Formate() const;
void SelectFormate(const size_t formate);
void SelectFormate(const int formate);
static QString MakeHelpFormatList();
void SetDestinationPath(const QString& cmdDestinationPath);
public slots:
@ -101,10 +64,16 @@ public slots:
void PathChanged(const QString &text);
private:
const static std::vector<nm_DialogSaveLayout::VFrmWithTest> availFormats;
Q_DISABLE_COPY(DialogSaveLayout)
Ui::DialogSaveLAyout *ui;
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

View File

@ -231,7 +231,7 @@ private:
QPointer<QLabel> gradationHeightsLabel;
QPointer<QLabel> gradationSizesLabel;
VToolOptionsPropertyBrowser *toolOptions;
VLockGuardPtr<char> lock;
std::shared_ptr<VLockGuard<char>> lock;
void ToolBarOption();
void ToolBarStages();

View File

@ -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(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))
{
case 0: //VToolUnionDetails::ToolType

View File

@ -32,7 +32,7 @@
#endif
//---------------------------------------------------------------------------------------------------------------------
QMUPARSERSHARED_EXPORT inline QString NameRegExp()
inline QString NameRegExp()
{
//Same regexp in pattern.xsd shema file. Don't forget synchronize.
return QStringLiteral("^([^0-9*/^+\\-=\\s()?%:;!.,`'\"]){1,1}([^*/^+\\-=\\s()?%:;!.,`'\"]){0,}$");

View File

@ -33,6 +33,14 @@
#include <QHash>
#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 VLayoutDetail;
@ -92,4 +100,8 @@ private:
void BiggestBoundingRect();
};
#if defined (Q_OS_WIN) && defined (Q_CC_MSVC)
#pragma pop_macro("small")
#endif
#endif // VBANK_H

View File

@ -929,18 +929,18 @@ QStringList ListGroupQ()
//---------------------------------------------------------------------------------------------------------------------
QStringList SupportedLocales()
{
const QStringList locales = {QStringLiteral("ru_RU"),
QStringLiteral("uk_UA"),
QStringLiteral("de_DE"),
QStringLiteral("cs_CZ"),
QStringLiteral("he_IL"),
QStringLiteral("fr_FR"),
QStringLiteral("it_IT"),
QStringLiteral("nl_NL"),
QStringLiteral("id_ID"),
QStringLiteral("es_ES"),
QStringLiteral("fi_FI"),
QStringLiteral("en_US")};
const QStringList locales = QStringList() << QStringLiteral("ru_RU")
<< QStringLiteral("uk_UA")
<< QStringLiteral("de_DE")
<< QStringLiteral("cs_CZ")
<< QStringLiteral("he_IL")
<< QStringLiteral("fr_FR")
<< QStringLiteral("it_IT")
<< QStringLiteral("nl_NL")
<< QStringLiteral("id_ID")
<< QStringLiteral("es_ES")
<< QStringLiteral("fi_FI")
<< QStringLiteral("en_US");
return locales;
}

View File

@ -53,7 +53,7 @@ QString compilerString()
#elif defined(Q_CC_MSVC)
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)
{

View File

@ -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
//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)
#pragma warning( push )
#pragma warning( disable: 1418 )
#endif
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));
}
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));
}
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));
}

View File

@ -31,40 +31,40 @@
#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
bad flag, a bad syntax in a parameter, or whatever.*/
static const auto V_EX_USAGE = 64; /*The command was used incorrectly, e.g., with the wrong number of
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
user's data and not system files.*/
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.*/
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
not exist. This can also be used as a catchall message when something you
wanted to do doesn't work, but you don't know why.*/
static const auto V_EX_UNAVAILABLE = 69; /*A service is unavailable. This can occur if a support program or file
does not exist. This can also be used as a catchall message when
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
nonoperating operating system related errors as possible.*/
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.*/
constexpr auto V_EX_OSERR = 71; /*An operating system error has been detected. This is intended to be used for
such things as ``cannot fork'', ``cannot create pipe'', or the like. It
includes things like getuid returning a user that does not exist in the passwd
file.*/
static const auto V_EX_OSERR = 71; /*An operating system error has been detected. This is intended to be
used for such things as ``cannot fork'', ``cannot create pipe'', or the
like. It includes things like getuid returning a user that does not exist
in the passwd file.*/
constexpr 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).*/
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).*/
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
intended for file system problems, which should use EX_NOINPUT or EX_CANTCREAT,
but rather for higher level permissions.*/
static const auto V_EX_NOPERM = 77; /*You did not have sufficient permission to perform the operation. This
is not intended for file system problems, which should use EX_NOINPUT or
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()

View File

@ -22,9 +22,16 @@
#include <math.h>
#include <string.h>
#include <assert.h>
#include <QtGlobal>
#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
extern void exactinit();
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->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);
res->num_faces = del.num_faces;
res->faces = faces;
@ -1074,3 +1081,7 @@ void delaunay2d_release(delaunay2d_t *del) {
free(del->points);
free(del);
}
#ifdef Q_CC_GNU
#pragma GCC diagnostic pop
#endif

View File

@ -2,7 +2,7 @@
/* */
/* Routines for Arbitrary Precision Floating-point Arithmetic */
/* and Fast Robust Geometric Predicates */
/* (predicates.c) */
/* (predicates.cpp) */
/* */
/* May 18, 1996 */
/* */
@ -110,6 +110,12 @@
#include <math.h>
#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 */
/* use of internal extended precision floating-point registers. Sometimes */
/* 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);
}
#ifdef Q_CC_GNU
#pragma GCC diagnostic pop
#endif

View File

@ -3,10 +3,10 @@
SOURCES += \
$$PWD/vobjengine.cpp \
$$PWD/delaunay.c \
$$PWD/predicates.c \
$$PWD/vobjpaintdevice.cpp \
$$PWD/stable.cpp
$$PWD/stable.cpp \
$$PWD/delaunay.cpp \
$$PWD/predicates.cpp
HEADERS += \
$$PWD/vobjengine.h \

View File

@ -18,19 +18,18 @@
#ifndef CHECKABLEMESSAGEBOX_H
#define CHECKABLEMESSAGEBOX_H
#include "vpropertyexplorer_global.h"
#include <QDialogButtonBox>
#include <QMessageBox>
QT_BEGIN_NAMESPACE
class QSettings;
QT_END_NAMESPACE
namespace Utils
{
class CheckableMessageBoxPrivate;
class Q_DECL_EXPORT CheckableMessageBox : public QDialog
class VPROPERTYEXPLORERSHARED_EXPORT CheckableMessageBox : public QDialog
{
Q_OBJECT
Q_PROPERTY(QString text READ text WRITE setText)

View File

@ -31,10 +31,14 @@
#include <QObject>
#ifdef Q_CC_MSVC
#include <ciso646>
#endif /* Q_CC_MSVC */
// Return codes for testing run application
constexpr auto TST_EX_BIN = -1; // Can't find binary.
constexpr 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_BIN = -1; // Can't find binary.
static const auto TST_EX_TIME_OUT = -2; // The operation timed out or an error occurred.
static const auto TST_EX_CRASH = -3; // Program crashed.
enum ErrorState {ErrorLoad = 0, ErrorInstall, ErrorSize, NoError};