Skip to content

Commit

Permalink
Merge branch 'master' into feature/boundaryenforcecontrol
Browse files Browse the repository at this point in the history
  • Loading branch information
sliptonic committed Oct 16, 2020
2 parents 053b8e9 + 1062b6e commit 576e0af
Show file tree
Hide file tree
Showing 51 changed files with 798 additions and 257 deletions.
6 changes: 5 additions & 1 deletion src/Base/PyObjectBase.cpp
Expand Up @@ -133,8 +133,12 @@ PyTypeObject PyObjectBase::Type = {
#if PY_MAJOR_VERSION >= 3
,0 /*tp_finalize */
#endif
#if PY_VERSION_HEX >= 0x03080000
#if PY_VERSION_HEX >= 0x03090000
,0 /*tp_vectorcall */
#elif PY_VERSION_HEX >= 0x03080000
,0 /*tp_vectorcall */
/* bpo-37250: kept for backwards compatibility in CPython 3.8 only */
,0 /*tp_print */
#endif
};

Expand Down
2 changes: 1 addition & 1 deletion src/Gui/Assistant.cpp
Expand Up @@ -61,7 +61,7 @@ void Assistant::showDocumentation(const QString &page)
if (!page.isEmpty()) {
QTextStream str(proc);
str << QLatin1String("setSource qthelp://org.freecad.usermanual/doc/")
<< page << QLatin1Char('\n') << endl;
<< page << QLatin1String("\n\n");
}
}

Expand Down
12 changes: 6 additions & 6 deletions src/Gui/AutoSaver.cpp
Expand Up @@ -149,12 +149,12 @@ void AutoSaver::saveDocument(const std::string& name, AutoSaveProperty& saver)
if (file.open(QFile::WriteOnly)) {
QTextStream str(&file);
str.setCodec("UTF-8");
str << "<?xml version='1.0' encoding='utf-8'?>" << endl
<< "<AutoRecovery SchemaVersion=\"1\">" << endl;
str << " <Status>Created</Status>" << endl;
str << " <Label>" << QString::fromUtf8(doc->Label.getValue()) << "</Label>" << endl; // store the document's current label
str << " <FileName>" << QString::fromUtf8(doc->FileName.getValue()) << "</FileName>" << endl; // store the document's current filename
str << "</AutoRecovery>" << endl;
str << "<?xml version='1.0' encoding='utf-8'?>\n"
<< "<AutoRecovery SchemaVersion=\"1\">\n";
str << " <Status>Created</Status>\n";
str << " <Label>" << QString::fromUtf8(doc->Label.getValue()) << "</Label>\n"; // store the document's current label
str << " <FileName>" << QString::fromUtf8(doc->FileName.getValue()) << "</FileName>\n"; // store the document's current filename
str << "</AutoRecovery>\n";
file.close();
}

Expand Down
12 changes: 6 additions & 6 deletions src/Gui/CommandView.cpp
Expand Up @@ -337,9 +337,9 @@ void StdCmdFreezeViews::onSaveViews()
QTextStream str(&file);
ActionGroup* pcAction = qobject_cast<ActionGroup*>(_pcAction);
QList<QAction*> acts = pcAction->actions();
str << "<?xml version='1.0' encoding='utf-8'?>" << endl
<< "<FrozenViews SchemaVersion=\"1\">" << endl;
str << " <Views Count=\"" << savedViews <<"\">" << endl;
str << "<?xml version='1.0' encoding='utf-8'?>\n"
<< "<FrozenViews SchemaVersion=\"1\">\n";
str << " <Views Count=\"" << savedViews <<"\">\n";

for (QList<QAction*>::ConstIterator it = acts.begin()+offset; it != acts.end(); ++it) {
if ( !(*it)->isVisible() )
Expand All @@ -356,11 +356,11 @@ void StdCmdFreezeViews::onSaveViews()
viewPos = lines.join(QString::fromLatin1(" "));
}

str << " <Camera settings=\"" << viewPos.toLatin1().constData() << "\"/>" << endl;
str << " <Camera settings=\"" << viewPos.toLatin1().constData() << "\"/>\n";
}

str << " </Views>" << endl;
str << "</FrozenViews>" << endl;
str << " </Views>\n";
str << "</FrozenViews>\n";
}
}

Expand Down
5 changes: 2 additions & 3 deletions src/Gui/DlgDisplayPropertiesImp.cpp
Expand Up @@ -168,9 +168,8 @@ void DlgDisplayPropertiesImp::slotChangedObject(const Gui::ViewProvider& obj,
// We pick out all the properties for which we need to update this dialog.
std::vector<Gui::ViewProvider*> Provider = getSelection();
std::vector<Gui::ViewProvider*>::const_iterator vp = std::find_if
(Provider.begin(), Provider.end(),
std::bind2nd(std::equal_to<Gui::ViewProvider*>(),
const_cast<Gui::ViewProvider*>(&obj)));
(Provider.begin(), Provider.end(), [&obj](Gui::ViewProvider* v) { return v == &obj; });

if (vp != Provider.end()) {
const char* name = obj.getPropertyName(&prop);
// this is not a property of the view provider but of the document object
Expand Down
20 changes: 10 additions & 10 deletions src/Gui/DocumentRecovery.cpp
Expand Up @@ -362,28 +362,28 @@ void DocumentRecoveryPrivate::writeRecoveryInfo(const DocumentRecoveryPrivate::I
if (file.open(QFile::WriteOnly)) {
QTextStream str(&file);
str.setCodec("UTF-8");
str << "<?xml version='1.0' encoding='utf-8'?>" << endl
<< "<AutoRecovery SchemaVersion=\"1\">" << endl;
str << "<?xml version='1.0' encoding='utf-8'?>\n"
<< "<AutoRecovery SchemaVersion=\"1\">\n";
switch (info.status) {
case Created:
str << " <Status>Created</Status>" << endl;
str << " <Status>Created</Status>\n";
break;
case Overage:
str << " <Status>Deprecated</Status>" << endl;
str << " <Status>Deprecated</Status>\n";
break;
case Success:
str << " <Status>Success</Status>" << endl;
str << " <Status>Success</Status>\n";
break;
case Failure:
str << " <Status>Failure</Status>" << endl;
str << " <Status>Failure</Status>\n";
break;
default:
str << " <Status>Unknown</Status>" << endl;
str << " <Status>Unknown</Status>\n";
break;
}
str << " <Label>" << info.label << "</Label>" << endl;
str << " <FileName>" << info.fileName << "</FileName>" << endl;
str << "</AutoRecovery>" << endl;
str << " <Label>" << info.label << "</Label>\n";
str << " <FileName>" << info.fileName << "</FileName>\n";
str << "</AutoRecovery>\n";
file.close();
}
}
Expand Down
5 changes: 5 additions & 0 deletions src/Gui/NetworkRetriever.cpp
Expand Up @@ -374,7 +374,12 @@ void NetworkRetriever::wgetFinished(int exitCode, QProcess::ExitStatus status)
bool NetworkRetriever::testWget()
{
QProcess proc;
#if QT_VERSION > 0x050000
proc.setProgram(QString::fromLatin1("wget"));
proc.start();
#else
proc.start(QString::fromLatin1("wget"));
#endif
bool ok = proc.state() == QProcess::Running;
proc.kill();
proc.waitForFinished();
Expand Down
6 changes: 2 additions & 4 deletions src/Gui/OnlineDocumentation.cpp
Expand Up @@ -255,8 +255,7 @@ QByteArray PythonOnlineHelp::fileNotFound() const
QString http(QLatin1String("HTTP/1.1 %1 %2\r\n%3\r\n"));
QString httpResponseHeader = http.arg(404).arg(QLatin1String("File not found")).arg(header);

QByteArray res;
res.append(httpResponseHeader);
QByteArray res = httpResponseHeader.toLatin1();
return res;
}

Expand Down Expand Up @@ -285,8 +284,7 @@ QByteArray PythonOnlineHelp::loadFailed(const QString& error) const
QString http(QLatin1String("HTTP/1.1 %1 %2\r\n%3\r\n"));
QString httpResponseHeader = http.arg(404).arg(QLatin1String("File not found")).arg(header);

QByteArray res;
res.append(httpResponseHeader);
QByteArray res = httpResponseHeader.toLatin1();
return res;
}

Expand Down
5 changes: 2 additions & 3 deletions src/Gui/ProjectView.cpp
Expand Up @@ -36,7 +36,7 @@
# include <QTimer>
#endif

#include <QDirModel>
#include <QFileSystemModel>
#include <Base/Console.h>
#include <App/Document.h>

Expand All @@ -56,8 +56,7 @@ using namespace Gui;
ProjectWidget::ProjectWidget(QWidget* parent)
: QTreeView(parent)
{
fileModel = new QDirModel(this);
fileModel->setSorting(QDir::DirsFirst | QDir::Type);
fileModel = new QFileSystemModel(this);
setModel(fileModel);
}

Expand Down
5 changes: 3 additions & 2 deletions src/Gui/ProjectView.h
Expand Up @@ -31,7 +31,8 @@

#include <Gui/DockWindow.h>
#include <Gui/Selection.h>
class QDirModel;

class QFileSystemModel;

namespace Gui {

Expand All @@ -48,7 +49,7 @@ class ProjectWidget : public QTreeView
~ProjectWidget();

private:
QDirModel *fileModel;
QFileSystemModel *fileModel;

};

Expand Down
13 changes: 13 additions & 0 deletions src/Gui/QSint/actionpanel/actionbox.cpp
Expand Up @@ -116,6 +116,19 @@ void ActionBox::setIcon(const QPixmap & icon)
iconLabel->setFixedSize(icon.size());
}

QPixmap ActionBox::icon() const
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
return iconLabel->pixmap(Qt::ReturnByValue);
#else
QPixmap p;
const QPixmap* ptr = iconLabel->pixmap();
if (ptr)
p = *ptr;
return p;
#endif
}

ActionLabel* ActionBox::createItem(QAction * action, QLayout * l)
{
if (!action)
Expand Down
2 changes: 1 addition & 1 deletion src/Gui/QSint/actionpanel/actionbox.h
Expand Up @@ -182,7 +182,7 @@ class QSINT_EXPORT ActionBox : public QFrame
void setIcon(const QPixmap & icon);
/** Returns icon of the ActionBox.
*/
inline const QPixmap* icon() const { return iconLabel->pixmap(); }
QPixmap icon() const;// { return iconLabel->pixmap(); }

/** Returns header item of the ActionBox.
*/
Expand Down
4 changes: 2 additions & 2 deletions src/Gui/QSint/actionpanel/taskgroup_p.cpp
Expand Up @@ -106,7 +106,7 @@ void TaskGroup::keyPressEvent ( QKeyEvent * event )
{
case Qt::Key_Down:
{
QKeyEvent ke(QEvent::KeyPress, Qt::Key_Tab, 0);
QKeyEvent ke(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier);
QApplication::sendEvent(this, &ke);
return;
}
Expand All @@ -131,7 +131,7 @@ void TaskGroup::keyReleaseEvent ( QKeyEvent * event )
{
case Qt::Key_Down:
{
QKeyEvent ke(QEvent::KeyRelease, Qt::Key_Tab, 0);
QKeyEvent ke(QEvent::KeyRelease, Qt::Key_Tab, Qt::NoModifier);
QApplication::sendEvent(this, &ke);
return;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Gui/QSint/actionpanel/taskheader_p.cpp
Expand Up @@ -264,7 +264,7 @@ void TaskHeader::keyPressEvent ( QKeyEvent * event )
{
case Qt::Key_Down:
{
QKeyEvent ke(QEvent::KeyPress, Qt::Key_Tab,0 );
QKeyEvent ke(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier);
QApplication::sendEvent(this, &ke);
return;
}
Expand All @@ -288,7 +288,7 @@ void TaskHeader::keyReleaseEvent ( QKeyEvent * event )
{
case Qt::Key_Down:
{
QKeyEvent ke(QEvent::KeyRelease, Qt::Key_Tab, 0);
QKeyEvent ke(QEvent::KeyRelease, Qt::Key_Tab, Qt::NoModifier);
QApplication::sendEvent(this, &ke);
return;
}
Expand Down
30 changes: 15 additions & 15 deletions src/Gui/Splashscreen.cpp
Expand Up @@ -770,38 +770,38 @@ void AboutDialog::on_copyButton_clicked()
}
}

str << "OS: " << SystemInfo::getOperatingSystem() << deskInfo << endl;
str << "OS: " << SystemInfo::getOperatingSystem() << deskInfo << '\n';

int wordSize = SystemInfo::getWordSizeOfOS();
if (wordSize > 0) {
str << "Word size of OS: " << wordSize << "-bit" << endl;
str << "Word size of OS: " << wordSize << "-bit\n";
}
str << "Word size of " << exe << ": " << QSysInfo::WordSize << "-bit" << endl;
str << "Word size of " << exe << ": " << QSysInfo::WordSize << "-bit\n";
str << "Version: " << major << "." << minor << "." << build;
char *appimage = getenv("APPIMAGE");
if (appimage)
str << " AppImage";
str << endl;
str << '\n';

#if defined(_DEBUG) || defined(DEBUG)
str << "Build type: Debug" << endl;
str << "Build type: Debug\n";
#elif defined(NDEBUG)
str << "Build type: Release" << endl;
str << "Build type: Release\n";
#elif defined(CMAKE_BUILD_TYPE)
str << "Build type: " << CMAKE_BUILD_TYPE << endl;
str << "Build type: " << CMAKE_BUILD_TYPE << '\n';
#else
str << "Build type: Unknown" << endl;
str << "Build type: Unknown\n";
#endif
it = config.find("BuildRevisionBranch");
if (it != config.end())
str << "Branch: " << QString::fromUtf8(it->second.c_str()) << endl;
str << "Branch: " << QString::fromUtf8(it->second.c_str()) << '\n';
it = config.find("BuildRevisionHash");
if (it != config.end())
str << "Hash: " << it->second.c_str() << endl;
str << "Hash: " << it->second.c_str() << '\n';
// report also the version numbers of the most important libraries in FreeCAD
str << "Python version: " << PY_VERSION << endl;
str << "Qt version: " << QT_VERSION_STR << endl;
str << "Coin version: " << COIN_VERSION << endl;
str << "Python version: " << PY_VERSION << '\n';
str << "Qt version: " << QT_VERSION_STR << '\n';
str << "Coin version: " << COIN_VERSION << '\n';
#if defined(HAVE_OCC_VERSION)
str << "OCC version: "
<< OCC_VERSION_MAJOR << "."
Expand All @@ -810,12 +810,12 @@ void AboutDialog::on_copyButton_clicked()
#ifdef OCC_VERSION_DEVELOPMENT
<< "." OCC_VERSION_DEVELOPMENT
#endif
<< endl;
<< '\n';
#endif
QLocale loc;
str << "Locale: " << loc.languageToString(loc.language()) << "/"
<< loc.countryToString(loc.country())
<< " (" << loc.name() << ")" << endl;
<< " (" << loc.name() << ")\n";

QClipboard* cb = QApplication::clipboard();
cb->setText(data);
Expand Down
2 changes: 1 addition & 1 deletion src/Gui/TaskElementColors.cpp
Expand Up @@ -263,7 +263,7 @@ class ElementColors::Private: public Gui::SelectionGate
boost::starts_with(msg.pSubName,editSub))
{
for(auto item : ui->elementList->findItems(
QString::fromLatin1(msg.pSubName-editSub.size()),0))
QString::fromLatin1(msg.pSubName-editSub.size()), Qt::MatchExactly))
item->setSelected(msg.Type==SelectionChanges::AddSelection);
}
}
Expand Down
5 changes: 2 additions & 3 deletions src/Gui/TaskView/TaskAppearance.cpp
Expand Up @@ -101,9 +101,8 @@ void TaskAppearance::slotChangedObject(const Gui::ViewProvider& obj,
// We pick out all the properties for which we need to update this dialog.
std::vector<Gui::ViewProvider*> Provider = getSelection();
std::vector<Gui::ViewProvider*>::const_iterator vp = std::find_if
(Provider.begin(), Provider.end(),
std::bind2nd(std::equal_to<Gui::ViewProvider*>(),
const_cast<Gui::ViewProvider*>(&obj)));
(Provider.begin(), Provider.end(), [&obj](Gui::ViewProvider* v) { return v == &obj; });

if (vp != Provider.end()) {
std::string prop_name = obj.getPropertyName(&prop);
if (prop.getTypeId().isDerivedFrom(App::PropertyInteger::getClassTypeId())) {
Expand Down
4 changes: 2 additions & 2 deletions src/Mod/Arch/ArchSectionPlane.py
Expand Up @@ -368,14 +368,14 @@ def getSVG(source,
for o in objs:
if Draft.getType(o) == "Space":
spaces.append(o)
elif Draft.getType(o) in ["AngularDimension","LinearDimension","Annotation","Label","Text", "DraftText"]:
elif Draft.getType(o) in ["Dimension","AngularDimension","LinearDimension","Annotation","Label","Text", "DraftText"]:
if isOriented(o,cutplane):
drafts.append(o)
elif o.isDerivedFrom("Part::Part2DObject"):
drafts.append(o)
elif looksLikeDraft(o):
drafts.append(o)
else:
elif not o.isDerivedFrom("App::DocumentObjectGroup"):
nonspaces.append(o)
if Draft.getType(o) == "Window":
windows.append(o)
Expand Down

0 comments on commit 576e0af

Please sign in to comment.