Linux specific Qt5 port
This commit is contained in:
parent
5e375a6238
commit
87f2866884
|
@ -1387,11 +1387,38 @@ _qt_msg_handler_old old_qtmsg_handler = 0;
|
|||
#if QT_VERSION >= 0x050000
|
||||
void messageHandler(QtMsgType type, const QMessageLogContext &context, const QString &qmsg)
|
||||
{
|
||||
Q_UNUSED(context);
|
||||
const QChar *msg = qmsg.unicode();
|
||||
#ifdef FC_DEBUG
|
||||
switch (type)
|
||||
{
|
||||
case QtInfoMsg:
|
||||
case QtDebugMsg:
|
||||
Base::Console().Message("%s\n", msg);
|
||||
break;
|
||||
case QtWarningMsg:
|
||||
Base::Console().Warning("%s\n", msg);
|
||||
break;
|
||||
case QtCriticalMsg:
|
||||
Base::Console().Error("%s\n", msg);
|
||||
break;
|
||||
case QtFatalMsg:
|
||||
Base::Console().Error("%s\n", msg);
|
||||
abort(); // deliberately core dump
|
||||
}
|
||||
#ifdef FC_OS_WIN32
|
||||
if (old_qtmsg_handler)
|
||||
(*old_qtmsg_handler)(type, context, qmsg);
|
||||
#endif
|
||||
#else
|
||||
// do not stress user with Qt internals but write to log file if enabled
|
||||
Q_UNUSED(type);
|
||||
Base::Console().Log("%s\n", msg);
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
void messageHandler(QtMsgType type, const char *msg)
|
||||
{
|
||||
#endif
|
||||
#ifdef FC_DEBUG
|
||||
switch (type)
|
||||
{
|
||||
|
@ -1410,18 +1437,15 @@ void messageHandler(QtMsgType type, const char *msg)
|
|||
}
|
||||
#ifdef FC_OS_WIN32
|
||||
if (old_qtmsg_handler)
|
||||
#if QT_VERSION >=0x050000
|
||||
(*old_qtmsg_handler)(type, context, qmsg);
|
||||
#else
|
||||
(*old_qtmsg_handler)(type, msg);
|
||||
#endif
|
||||
#endif
|
||||
#else
|
||||
// do not stress user with Qt internals but write to log file if enabled
|
||||
Q_UNUSED(type);
|
||||
Base::Console().Log("%s\n", msg);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef FC_DEBUG // redirect Coin messages to FreeCAD
|
||||
void messageHandlerCoin(const SoError * error, void * /*userdata*/)
|
||||
|
|
|
@ -151,12 +151,22 @@ QString FileDialog::getSaveFileName (QWidget * parent, const QString & caption,
|
|||
// before showing the file dialog.
|
||||
#if defined(FC_OS_LINUX)
|
||||
QList<QUrl> urls;
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
urls << QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::DesktopLocation));
|
||||
urls << QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation));
|
||||
urls << QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::HomeLocation));
|
||||
urls << QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::MusicLocation));
|
||||
urls << QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::PicturesLocation));
|
||||
urls << QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::MoviesLocation));
|
||||
#else
|
||||
urls << QUrl::fromLocalFile(QDesktopServices::storageLocation(QDesktopServices::DesktopLocation));
|
||||
urls << QUrl::fromLocalFile(QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation));
|
||||
urls << QUrl::fromLocalFile(QDesktopServices::storageLocation(QDesktopServices::HomeLocation));
|
||||
urls << QUrl::fromLocalFile(QDesktopServices::storageLocation(QDesktopServices::MusicLocation));
|
||||
urls << QUrl::fromLocalFile(QDesktopServices::storageLocation(QDesktopServices::PicturesLocation));
|
||||
urls << QUrl::fromLocalFile(QDesktopServices::storageLocation(QDesktopServices::MoviesLocation));
|
||||
#endif
|
||||
urls << QUrl::fromLocalFile(getWorkingDirectory());
|
||||
urls << QUrl::fromLocalFile(restoreLocation());
|
||||
urls << QUrl::fromLocalFile(QDir::currentPath());
|
||||
|
@ -232,12 +242,22 @@ QString FileDialog::getOpenFileName(QWidget * parent, const QString & caption, c
|
|||
|
||||
#if defined(FC_OS_LINUX)
|
||||
QList<QUrl> urls;
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
urls << QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::DesktopLocation));
|
||||
urls << QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation));
|
||||
urls << QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::HomeLocation));
|
||||
urls << QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::MusicLocation));
|
||||
urls << QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::PicturesLocation));
|
||||
urls << QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::MoviesLocation));
|
||||
#else
|
||||
urls << QUrl::fromLocalFile(QDesktopServices::storageLocation(QDesktopServices::DesktopLocation));
|
||||
urls << QUrl::fromLocalFile(QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation));
|
||||
urls << QUrl::fromLocalFile(QDesktopServices::storageLocation(QDesktopServices::HomeLocation));
|
||||
urls << QUrl::fromLocalFile(QDesktopServices::storageLocation(QDesktopServices::MusicLocation));
|
||||
urls << QUrl::fromLocalFile(QDesktopServices::storageLocation(QDesktopServices::PicturesLocation));
|
||||
urls << QUrl::fromLocalFile(QDesktopServices::storageLocation(QDesktopServices::MoviesLocation));
|
||||
#endif
|
||||
urls << QUrl::fromLocalFile(getWorkingDirectory());
|
||||
urls << QUrl::fromLocalFile(restoreLocation());
|
||||
urls << QUrl::fromLocalFile(QDir::currentPath());
|
||||
|
@ -292,12 +312,22 @@ QStringList FileDialog::getOpenFileNames (QWidget * parent, const QString & capt
|
|||
|
||||
#if defined(FC_OS_LINUX)
|
||||
QList<QUrl> urls;
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
urls << QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::DesktopLocation));
|
||||
urls << QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation));
|
||||
urls << QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::HomeLocation));
|
||||
urls << QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::MusicLocation));
|
||||
urls << QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::PicturesLocation));
|
||||
urls << QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::MoviesLocation));
|
||||
#else
|
||||
urls << QUrl::fromLocalFile(QDesktopServices::storageLocation(QDesktopServices::DesktopLocation));
|
||||
urls << QUrl::fromLocalFile(QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation));
|
||||
urls << QUrl::fromLocalFile(QDesktopServices::storageLocation(QDesktopServices::HomeLocation));
|
||||
urls << QUrl::fromLocalFile(QDesktopServices::storageLocation(QDesktopServices::MusicLocation));
|
||||
urls << QUrl::fromLocalFile(QDesktopServices::storageLocation(QDesktopServices::PicturesLocation));
|
||||
urls << QUrl::fromLocalFile(QDesktopServices::storageLocation(QDesktopServices::MoviesLocation));
|
||||
#endif
|
||||
urls << QUrl::fromLocalFile(getWorkingDirectory());
|
||||
urls << QUrl::fromLocalFile(restoreLocation());
|
||||
urls << QUrl::fromLocalFile(QDir::currentPath());
|
||||
|
|
|
@ -206,6 +206,8 @@ Py::Object PythonWrapper::fromQIcon(const QIcon* icon)
|
|||
PyObject* pyobj = Shiboken::createWrapper<QIcon>(icon, true);
|
||||
if (pyobj)
|
||||
return Py::asObject(pyobj);
|
||||
#else
|
||||
Q_UNUSED(icon);
|
||||
#endif
|
||||
throw Py::RuntimeError("Failed to wrap icon");
|
||||
}
|
||||
|
|
|
@ -91,11 +91,13 @@ int main( int argc, char ** argv )
|
|||
// Make sure to setup the Qt locale system before setting LANG and LC_ALL to C.
|
||||
// which is needed to use the system locale settings.
|
||||
(void)QLocale::system();
|
||||
#if QT_VERSION < 0x050000
|
||||
// http://www.freecadweb.org/tracker/view.php?id=399
|
||||
// Because of setting LANG=C the Qt automagic to use the correct encoding
|
||||
// for file names is broken. This is a workaround to force the use of UTF-8 encoding
|
||||
QFile::setEncodingFunction(myEncoderFunc);
|
||||
QFile::setDecodingFunction(myDecoderFunc);
|
||||
#endif
|
||||
// Make sure that we use '.' as decimal point. See also
|
||||
// http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=559846
|
||||
putenv("LC_NUMERIC=C");
|
||||
|
|
Loading…
Reference in New Issue
Block a user