Mesh: Apply clang-format
This commit is contained in:
@@ -22,10 +22,10 @@
|
||||
|
||||
#include "PreCompiled.h"
|
||||
#ifndef _PreComp_
|
||||
# include <QElapsedTimer>
|
||||
# include <QMessageBox>
|
||||
# include <QPointer>
|
||||
# include <QTextCursor>
|
||||
#include <QElapsedTimer>
|
||||
#include <QMessageBox>
|
||||
#include <QPointer>
|
||||
#include <QTextCursor>
|
||||
#endif
|
||||
|
||||
#include <App/Application.h>
|
||||
@@ -43,15 +43,17 @@
|
||||
|
||||
using namespace MeshGui;
|
||||
|
||||
class GmshWidget::Private {
|
||||
class GmshWidget::Private
|
||||
{
|
||||
public:
|
||||
explicit Private(QWidget* parent)
|
||||
: gmsh(parent)
|
||||
: gmsh(parent)
|
||||
{
|
||||
/* coverity[uninit_ctor] Members of ui are set in setupUI() */
|
||||
}
|
||||
|
||||
void appendText(const QString& text, bool error) {
|
||||
void appendText(const QString& text, bool error)
|
||||
{
|
||||
syntax->setParagraphType(error ? Gui::DockWnd::ReportHighlighter::Error
|
||||
: Gui::DockWnd::ReportHighlighter::Message);
|
||||
QTextCursor cursor(ui.outputWindow->document());
|
||||
@@ -71,8 +73,8 @@ public:
|
||||
};
|
||||
|
||||
GmshWidget::GmshWidget(QWidget* parent, Qt::WindowFlags fl)
|
||||
: QWidget(parent, fl)
|
||||
, d(new Private(parent))
|
||||
: QWidget(parent, fl)
|
||||
, d(new Private(parent))
|
||||
{
|
||||
d->ui.setupUi(this);
|
||||
setupConnections();
|
||||
@@ -82,7 +84,8 @@ GmshWidget::GmshWidget(QWidget* parent, Qt::WindowFlags fl)
|
||||
|
||||
// 2D Meshing algorithms
|
||||
// https://gmsh.info/doc/texinfo/gmsh.html#index-Mesh_002eAlgorithm
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
MeshAdapt = 1,
|
||||
Automatic = 2,
|
||||
Delaunay = 5,
|
||||
@@ -108,6 +111,7 @@ GmshWidget::~GmshWidget()
|
||||
|
||||
void GmshWidget::setupConnections()
|
||||
{
|
||||
// clang-format off
|
||||
connect(&d->gmsh, &QProcess::started, this, &GmshWidget::started);
|
||||
connect(&d->gmsh, qOverload<int, QProcess::ExitStatus>(&QProcess::finished),
|
||||
this, &GmshWidget::finished);
|
||||
@@ -121,9 +125,10 @@ void GmshWidget::setupConnections()
|
||||
this, &GmshWidget::onKillButtonClicked);
|
||||
connect(d->ui.clearButton, &QPushButton::clicked,
|
||||
this, &GmshWidget::onClearButtonClicked);
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
void GmshWidget::changeEvent(QEvent *e)
|
||||
void GmshWidget::changeEvent(QEvent* e)
|
||||
{
|
||||
if (e->type() == QEvent::LanguageChange) {
|
||||
d->ui.retranslateUi(this);
|
||||
@@ -177,12 +182,8 @@ void GmshWidget::accept()
|
||||
// ./gmsh - -bin -2 /tmp/mesh.geo -o /tmp/best.stl
|
||||
QString proc = d->ui.fileChooser->fileName();
|
||||
QStringList args;
|
||||
args << QLatin1String("-")
|
||||
<< QLatin1String("-bin")
|
||||
<< QLatin1String("-2")
|
||||
<< inpFile
|
||||
<< QLatin1String("-o")
|
||||
<< outFile;
|
||||
args << QLatin1String("-") << QLatin1String("-bin") << QLatin1String("-2") << inpFile
|
||||
<< QLatin1String("-o") << outFile;
|
||||
d->gmsh.start(proc, args);
|
||||
|
||||
d->time.start();
|
||||
@@ -239,10 +240,12 @@ void GmshWidget::started()
|
||||
void GmshWidget::finished(int /*exitCode*/, QProcess::ExitStatus exitStatus)
|
||||
{
|
||||
d->ui.killButton->setDisabled(true);
|
||||
if (d->label)
|
||||
if (d->label) {
|
||||
d->label->close();
|
||||
}
|
||||
|
||||
d->ui.labelTime->setText(QString::fromLatin1("%1 %2 ms").arg(tr("Time:")).arg(d->time.elapsed()));
|
||||
d->ui.labelTime->setText(
|
||||
QString::fromLatin1("%1 %2 ms").arg(tr("Time:")).arg(d->time.elapsed()));
|
||||
if (exitStatus == QProcess::NormalExit) {
|
||||
loadOutput();
|
||||
}
|
||||
@@ -252,11 +255,11 @@ void GmshWidget::errorOccurred(QProcess::ProcessError error)
|
||||
{
|
||||
QString msg;
|
||||
switch (error) {
|
||||
case QProcess::FailedToStart:
|
||||
msg = tr("Failed to start");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case QProcess::FailedToStart:
|
||||
msg = tr("Failed to start");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (!msg.isEmpty()) {
|
||||
@@ -271,12 +274,12 @@ void GmshWidget::reject()
|
||||
|
||||
// -------------------------------------------------
|
||||
|
||||
class RemeshGmsh::Private {
|
||||
class RemeshGmsh::Private
|
||||
{
|
||||
public:
|
||||
explicit Private(Mesh::Feature* mesh)
|
||||
: mesh(mesh)
|
||||
{
|
||||
}
|
||||
: mesh(mesh)
|
||||
{}
|
||||
|
||||
public:
|
||||
App::DocumentObjectWeakPtrT mesh;
|
||||
@@ -286,8 +289,8 @@ public:
|
||||
};
|
||||
|
||||
RemeshGmsh::RemeshGmsh(Mesh::Feature* mesh, QWidget* parent, Qt::WindowFlags fl)
|
||||
: GmshWidget(parent, fl)
|
||||
, d(new Private(mesh))
|
||||
: GmshWidget(parent, fl)
|
||||
, d(new Private(mesh))
|
||||
{
|
||||
// Copy mesh that is used each time when applying Gmsh's remeshing function
|
||||
d->copy = mesh->Mesh.getValue().getKernel();
|
||||
@@ -299,6 +302,7 @@ RemeshGmsh::~RemeshGmsh() = default;
|
||||
|
||||
bool RemeshGmsh::writeProject(QString& inpFile, QString& outFile)
|
||||
{
|
||||
// clang-format off
|
||||
if (!d->mesh.expired()) {
|
||||
Base::FileInfo stl(d->stlFile);
|
||||
MeshCore::MeshOutput output(d->copy);
|
||||
@@ -358,12 +362,14 @@ bool RemeshGmsh::writeProject(QString& inpFile, QString& outFile)
|
||||
}
|
||||
|
||||
return false;
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
bool RemeshGmsh::loadOutput()
|
||||
{
|
||||
if (d->mesh.expired())
|
||||
if (d->mesh.expired()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Now read-in modified mesh
|
||||
Base::FileInfo stl(d->stlFile);
|
||||
@@ -394,8 +400,7 @@ bool RemeshGmsh::loadOutput()
|
||||
TaskRemeshGmsh::TaskRemeshGmsh(Mesh::Feature* mesh)
|
||||
{
|
||||
widget = new RemeshGmsh(mesh);
|
||||
taskbox = new Gui::TaskView::TaskBox(
|
||||
QPixmap(), widget->windowTitle(), false, nullptr);
|
||||
taskbox = new Gui::TaskView::TaskBox(QPixmap(), widget->windowTitle(), false, nullptr);
|
||||
taskbox->groupLayout()->addWidget(widget);
|
||||
Content.push_back(taskbox);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user