Changes for returning support Qt 5.0 and GCC 4.6.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2016-08-21 18:57:08 +03:00
parent b0a7af152a
commit bfff8ccb96
16 changed files with 115 additions and 62 deletions

View File

@ -290,7 +290,7 @@ QGroupBox *TapeConfigurationPage::GradationGroup()
{ {
defSizeCombo->setCurrentIndex(index); defSizeCombo->setCurrentIndex(index);
} }
connect(defHeightCombo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, connect(defHeightCombo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
DefGradationChanged); DefGradationChanged);
gradationLayout->addRow(defSizeLabel, defSizeCombo); gradationLayout->addRow(defSizeLabel, defSizeCombo);

View File

@ -376,6 +376,15 @@ DEPENDPATH += $$PWD/../../libs/fervor
win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/fervor/$${DESTDIR}/fervor.lib win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/fervor/$${DESTDIR}/fervor.lib
else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/fervor/$${DESTDIR}/libfervor.a else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/fervor/$${DESTDIR}/libfervor.a
# IFC static library (depend on QMuParser, VMisc)
unix|win32: LIBS += -L$$OUT_PWD/../../libs/ifc/$${DESTDIR}/ -lifc
INCLUDEPATH += $$PWD/../../libs/ifc
DEPENDPATH += $$PWD/../../libs/ifc
win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/ifc/$${DESTDIR}/ifc.lib
else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/ifc/$${DESTDIR}/libifc.a
#VMisc static library #VMisc static library
unix|win32: LIBS += -L$$OUT_PWD/../../libs/vmisc/$${DESTDIR}/ -lvmisc unix|win32: LIBS += -L$$OUT_PWD/../../libs/vmisc/$${DESTDIR}/ -lvmisc
@ -394,15 +403,6 @@ DEPENDPATH += $$PWD/../../libs/vgeometry
win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vgeometry/$${DESTDIR}/vgeometry.lib win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vgeometry/$${DESTDIR}/vgeometry.lib
else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vgeometry/$${DESTDIR}/libvgeometry.a else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vgeometry/$${DESTDIR}/libvgeometry.a
# IFC static library (depend on QMuParser)
unix|win32: LIBS += -L$$OUT_PWD/../../libs/ifc/$${DESTDIR}/ -lifc
INCLUDEPATH += $$PWD/../../libs/ifc
DEPENDPATH += $$PWD/../../libs/ifc
win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/ifc/$${DESTDIR}/ifc.lib
else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/ifc/$${DESTDIR}/libifc.a
# VLayout static library # VLayout static library
unix|win32: LIBS += -L$$OUT_PWD/../../libs/vlayout/$${DESTDIR}/ -lvlayout unix|win32: LIBS += -L$$OUT_PWD/../../libs/vlayout/$${DESTDIR}/ -lvlayout

View File

@ -1734,10 +1734,11 @@ void TMainWindow::SetupMenu()
for (int i = 0; i < MaxRecentFiles; ++i) for (int i = 0; i < MaxRecentFiles; ++i)
{ {
recentFileActs[i] = new QAction(this); QAction *action = new QAction(this);
connect(recentFileActs[i], &QAction::triggered, this, [this]() recentFileActs[i] = action;
connect(action, &QAction::triggered, [action, this]()
{ {
if (auto action = qobject_cast<QAction *>(sender())) if (action)
{ {
const QString filePath = action->data().toString(); const QString filePath = action->data().toString();
if (not filePath.isEmpty()) if (not filePath.isEmpty())
@ -2783,6 +2784,7 @@ void TMainWindow::CreateWindowMenu(QMenu *menu)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool TMainWindow::IgnoreLocking(int error, const QString &path) bool TMainWindow::IgnoreLocking(int error, const QString &path)
{ {
#if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)
QMessageBox::StandardButton answer = QMessageBox::Abort; QMessageBox::StandardButton answer = QMessageBox::Abort;
if (not qApp->IsTestMode()) if (not qApp->IsTestMode())
{ {
@ -2844,6 +2846,11 @@ bool TMainWindow::IgnoreLocking(int error, const QString &path)
return false; return false;
} }
return true; return true;
#else
Q_UNUSED(error);
Q_UNUSED(path);
return true;// On older Qt lock assumed always taken. Allow user to ignore warning.
#endif // QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -3612,11 +3612,12 @@ void MainWindow::CreateActions()
//Actions for recent files loaded by a main window application. //Actions for recent files loaded by a main window application.
for (int i = 0; i < MaxRecentFiles; ++i) for (int i = 0; i < MaxRecentFiles; ++i)
{ {
recentFileActs[i] = new QAction(this); QAction *action = new QAction(this);
recentFileActs[i]->setVisible(false); action->setVisible(false);
connect(recentFileActs[i], &QAction::triggered, this, [this]() recentFileActs[i] = action;
connect(recentFileActs[i], &QAction::triggered, [action, this]()
{ {
if (QAction *action = qobject_cast<QAction *>(sender())) if (action)
{ {
const QString filePath = action->data().toString(); const QString filePath = action->data().toString();
if (not filePath.isEmpty()) if (not filePath.isEmpty())
@ -4524,6 +4525,7 @@ void MainWindow::UpdateWindowTitle()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool MainWindow::IgnoreLocking(int error, const QString &path) bool MainWindow::IgnoreLocking(int error, const QString &path)
{ {
#if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)
QMessageBox::StandardButton answer = QMessageBox::Abort; QMessageBox::StandardButton answer = QMessageBox::Abort;
if (VApplication::IsGUIMode()) if (VApplication::IsGUIMode())
{ {
@ -4586,6 +4588,11 @@ bool MainWindow::IgnoreLocking(int error, const QString &path)
return false; return false;
} }
return true; return true;
#else
Q_UNUSED(error);
Q_UNUSED(path);
return true;// On older Qt lock assumed always taken. Allow user to ignore warning.
#endif // QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -67,6 +67,9 @@ void DL_WriterA::dxfReal(int gc, double value) const
char str[256]; char str[256];
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_MSVC(4996) QT_WARNING_DISABLE_MSVC(4996)
#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) < 408
QT_WARNING_DISABLE_GCC("-Wformat")
#endif
if (version==DL_Codes::AC1009_MIN) if (version==DL_Codes::AC1009_MIN)
{ {
sprintf(str, "%.6lf", value); sprintf(str, "%.6lf", value);

View File

@ -41,10 +41,18 @@ template <class T> class QVector;
#include <ciso646> #include <ciso646>
#endif /* Q_CC_MSVC */ #endif /* Q_CC_MSVC */
#ifdef __GNUC__
#define V_UNUSED __attribute__ ((unused))
#else
#define V_UNUSED
#endif
// Return codes for testing run application // Return codes for testing run application
static const auto TST_EX_BIN = -1; // Can't find binary. static const auto V_UNUSED 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 V_UNUSED TST_EX_TIME_OUT = -2; // The operation timed out or an error occurred.
static const auto TST_EX_CRASH = -3; // Program crashed. static const auto V_UNUSED TST_EX_CRASH = -3; // Program crashed.
#undef V_UNUSED
enum ErrorState {ErrorLoad = 0, ErrorInstall, ErrorSize, NoError}; enum ErrorState {ErrorLoad = 0, ErrorInstall, ErrorSize, NoError};

View File

@ -47,7 +47,7 @@
#include <QtCore/QTemporaryFile> #include <QtCore/QTemporaryFile>
QSaveFilePrivate::QSaveFilePrivate() QSaveFilePrivate::QSaveFilePrivate()
: tempFile(0), error(QFile::NoError) : fileName(), tempFile(0), error(QFile::NoError)
{ {
} }
@ -256,7 +256,7 @@ bool QSaveFile::open(OpenMode mode)
Cannot be called. Cannot be called.
Call commit() instead. Call commit() instead.
*/ */
void QSaveFile::close() Q_NORETURN void QSaveFile::close()
{ {
qFatal("QSaveFile::close called"); qFatal("QSaveFile::close called");
} }

View File

@ -69,6 +69,8 @@ public:
QTemporaryFile *tempFile; QTemporaryFile *tempFile;
QFile::FileError error; QFile::FileError error;
private:
Q_DISABLE_COPY(QSaveFilePrivate)
}; };
#endif // QT_VERSION < QT_VERSION_CHECK(5, 1, 0) #endif // QT_VERSION < QT_VERSION_CHECK(5, 1, 0)

View File

@ -42,11 +42,11 @@ extern "C" {
enum { enum {
/* gcc optimizers consider code after __builtin_trap() dead. /* gcc optimizers consider code after __builtin_trap() dead.
* Making __builtin_trap() unsuitable for breaking into the debugger */ * Making __builtin_trap() unsuitable for breaking into the debugger */
DEBUG_BREAK_PREFER_BUILTIN_TRAP_TO_SIGTRAP = 0, DEBUG_BREAK_PREFER_BUILTIN_TRAP_TO_SIGTRAP = 0
}; };
#if defined(__i386__) || defined(__x86_64__) #if defined(__i386__) || defined(__x86_64__)
enum { HAVE_TRAP_INSTRUCTION = 1, }; enum { HAVE_TRAP_INSTRUCTION = 1 };
__attribute__((gnu_inline, always_inline)) __attribute__((gnu_inline, always_inline))
__inline__ static void trap_instruction(void) __inline__ static void trap_instruction(void)
{ {
@ -81,7 +81,7 @@ __inline__ static void trap_instruction(void)
*/ */
} }
#elif defined(__arm__) && !defined(__thumb__) #elif defined(__arm__) && !defined(__thumb__)
enum { HAVE_TRAP_INSTRUCTION = 1, }; enum { HAVE_TRAP_INSTRUCTION = 1 };
__attribute__((gnu_inline, always_inline)) __attribute__((gnu_inline, always_inline))
__inline__ static void trap_instruction(void) __inline__ static void trap_instruction(void)
{ {
@ -92,7 +92,7 @@ __inline__ static void trap_instruction(void)
* as Thumb mode */ * as Thumb mode */
} }
#elif defined(__aarch64__) #elif defined(__aarch64__)
enum { HAVE_TRAP_INSTRUCTION = 1, }; enum { HAVE_TRAP_INSTRUCTION = 1 };
__attribute__((gnu_inline, always_inline)) __attribute__((gnu_inline, always_inline))
__inline__ static void trap_instruction(void) __inline__ static void trap_instruction(void)
{ {
@ -101,7 +101,7 @@ __inline__ static void trap_instruction(void)
__asm__ volatile(".inst 0xd4200000"); __asm__ volatile(".inst 0xd4200000");
} }
#else #else
enum { HAVE_TRAP_INSTRUCTION = 0, }; enum { HAVE_TRAP_INSTRUCTION = 0 };
#endif #endif
__attribute__((gnu_inline, always_inline)) __attribute__((gnu_inline, always_inline))

View File

@ -45,7 +45,7 @@
#define PEDANT_COMPILER ,lock(nullptr) #define PEDANT_COMPILER ,lock(nullptr)
#else #else
#define PEDANT_COMPILER #define PEDANT_COMPILER
#warning To have lock-file support you must use Qt 5.1+. Expect collissions when run 2 copies of the program. #pragma message("To have lock-file support you must use Qt 5.1+. Expect collissions when run 2 copies of the program.")
#endif #endif
/*@brief /*@brief
@ -188,6 +188,10 @@ bool VLockGuard<Guarded>::TryLock(const QString &lockName, int stale, int timeou
SetFileAttributesW(lockFile.toStdWString().c_str(), FILE_ATTRIBUTE_HIDDEN); SetFileAttributesW(lockFile.toStdWString().c_str(), FILE_ATTRIBUTE_HIDDEN);
#endif #endif
} }
#else
Q_UNUSED(lockName);
Q_UNUSED(stale);
Q_UNUSED(timeout);
#endif #endif
return res; return res;
} }

View File

@ -31,40 +31,53 @@
#include <QTextStream> #include <QTextStream>
static const auto V_EX_OK = 0; /*Indicate the successful exit.*/ #ifdef __GNUC__
#define V_UNUSED __attribute__ ((unused))
#else
#define V_UNUSED
#endif
static const auto V_EX_USAGE = 64; /*The command was used incorrectly, e.g., with the wrong number of static const auto V_UNUSED V_EX_OK = 0; /*Indicate the successful exit.*/
arguments, a bad flag, a bad syntax in a parameter, or whatever.*/
static const auto V_EX_DATAERR = 65; /*The input data was incorrect in some way. This should only be used for static const auto V_UNUSED V_EX_USAGE = 64; /*The command was used incorrectly, e.g., with the wrong number of
user's data and not system files.*/ arguments, a bad flag, a bad syntax in a parameter, or whatever.*/
static const auto V_EX_NOINPUT = 66; /*An input file (not a system file) did not exist or was not readable.*/ static const auto V_UNUSED 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_UNAVAILABLE = 69; /*A service is unavailable. This can occur if a support program or file static const auto V_UNUSED V_EX_NOINPUT = 66; /*An input file (not a system file) did not exist or was not
does not exist. This can also be used as a catchall message when readable.*/
something you wanted to do doesn't work, but you don't know why.*/
static const auto V_EX_SOFTWARE = 70; /*An internal software error has been detected. This should be limited to static const auto V_UNUSED V_EX_UNAVAILABLE = 69; /*A service is unavailable. This can occur if a support program or
nonoperating operating system related errors as possible.*/ 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_OSERR = 71; /*An operating system error has been detected. This is intended to be static const auto V_UNUSED V_EX_SOFTWARE = 70; /*An internal software error has been detected. This should be
used for such things as ``cannot fork'', ``cannot create pipe'', or the limited to nonoperating operating system related errors as
like. It includes things like getuid returning a user that does not exist possible.*/
in the passwd file.*/
static const auto V_EX_OSFILE = 72; /*Some system file (e.g., /etc/passwd, /var/run/utmp, etc.) does not exist, static const auto V_UNUSED V_EX_OSERR = 71; /*An operating system error has been detected. This is intended to be
cannot be opened, or has some sort of error (e.g., syntax error).*/ 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_CANTCREAT = 73; /*A (user specified) output file cannot be created.*/ static const auto V_UNUSED 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_IOERR = 74; /*An error occurred while doing I/O on some file.*/ static const auto V_UNUSED V_EX_CANTCREAT = 73; /*A (user specified) output file cannot be created.*/
static const auto V_EX_NOPERM = 77; /*You did not have sufficient permission to perform the operation. This static const auto V_UNUSED V_EX_IOERR = 74; /*An error occurred while doing I/O on some file.*/
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_CONFIG = 78; /*Something was found in an unconfigured or misconfigured state.*/ static const auto V_UNUSED 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_UNUSED V_EX_CONFIG = 78; /*Something was found in an unconfigured or misconfigured state.*/
#undef V_UNUSED
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
inline QTextStream& vStdErr() inline QTextStream& vStdErr()

View File

@ -113,7 +113,11 @@ QT_WARNING_PUSH
QT_WARNING_DISABLE_MSVC(4701) QT_WARNING_DISABLE_MSVC(4701)
QT_WARNING_DISABLE_GCC("-Wold-style-cast") QT_WARNING_DISABLE_GCC("-Wold-style-cast")
QT_WARNING_DISABLE_GCC("-Wfloat-equal") QT_WARNING_DISABLE_GCC("-Wfloat-equal")
#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 408
QT_WARNING_DISABLE_GCC("-Wmaybe-uninitialized") QT_WARNING_DISABLE_GCC("-Wmaybe-uninitialized")
#else
QT_WARNING_DISABLE_GCC("-Wuninitialized")
#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 */

View File

@ -239,7 +239,7 @@ QString VDrawTool::ObjectName(quint32 id) const
{ {
try try
{ {
return VAbstractTool::data.GeometricObject<T>(id)->name(); return data.GeometricObject<T>(id)->name();
} }
catch (const VExceptionBadId &e) catch (const VExceptionBadId &e)
{ {

View File

@ -1053,7 +1053,12 @@ quint32 VToolUnionDetails::TakeNextId(QVector<quint32> &children)
quint32 idChild = NULL_ID; quint32 idChild = NULL_ID;
if (not children.isEmpty()) if (not children.isEmpty())
{ {
#if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)
idChild = children.takeFirst(); idChild = children.takeFirst();
#else
idChild = children.first();
children.remove(0);
#endif
} }
else else
{ {

View File

@ -271,7 +271,7 @@ QGraphicsPathItem *VisToolRotation::GetCurve(quint32 i, const QColor &color)
template <class Item> template <class Item>
int VisToolRotation::AddCurve(qreal angle, const QPointF &origin, quint32 id, int i) int VisToolRotation::AddCurve(qreal angle, const QPointF &origin, quint32 id, int i)
{ {
const QSharedPointer<Item> curve = Visualization::data->GeometricObject<Item>(id); const QSharedPointer<Item> curve = Visualization::data->template GeometricObject<Item>(id);
++i; ++i;
QGraphicsPathItem *path = GetCurve(i, supportColor2); QGraphicsPathItem *path = GetCurve(i, supportColor2);

View File

@ -137,6 +137,15 @@ DEPENDPATH += $$PWD/../../libs/vpatterndb
win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vpatterndb/$${DESTDIR}/vpatterndb.lib win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vpatterndb/$${DESTDIR}/vpatterndb.lib
else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vpatterndb/$${DESTDIR}/libvpatterndb.a else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vpatterndb/$${DESTDIR}/libvpatterndb.a
# IFC static library (depend on QMuParser, VMisc)
unix|win32: LIBS += -L$$OUT_PWD/../../libs/ifc/$${DESTDIR}/ -lifc
INCLUDEPATH += $$PWD/../../libs/ifc
DEPENDPATH += $$PWD/../../libs/ifc
win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/ifc/$${DESTDIR}/ifc.lib
else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/ifc/$${DESTDIR}/libifc.a
#VMisc static library #VMisc static library
unix|win32: LIBS += -L$$OUT_PWD/../../libs/vmisc/$${DESTDIR}/ -lvmisc unix|win32: LIBS += -L$$OUT_PWD/../../libs/vmisc/$${DESTDIR}/ -lvmisc
@ -155,15 +164,6 @@ DEPENDPATH += $$PWD/../../libs/vgeometry
win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vgeometry/$${DESTDIR}/vgeometry.lib win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vgeometry/$${DESTDIR}/vgeometry.lib
else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vgeometry/$${DESTDIR}/libvgeometry.a else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/vgeometry/$${DESTDIR}/libvgeometry.a
# IFC static library (depend on QMuParser)
unix|win32: LIBS += -L$$OUT_PWD/../../libs/ifc/$${DESTDIR}/ -lifc
INCLUDEPATH += $$PWD/../../libs/ifc
DEPENDPATH += $$PWD/../../libs/ifc
win32:!win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/ifc/$${DESTDIR}/ifc.lib
else:unix|win32-g++: PRE_TARGETDEPS += $$OUT_PWD/../../libs/ifc/$${DESTDIR}/libifc.a
# VLayout static library # VLayout static library
unix|win32: LIBS += -L$$OUT_PWD/../../libs/vlayout/$${DESTDIR} -lvlayout unix|win32: LIBS += -L$$OUT_PWD/../../libs/vlayout/$${DESTDIR} -lvlayout