All: Reformat according to new standard

This commit is contained in:
pre-commit-ci[bot]
2025-11-11 13:49:01 +01:00
committed by Kacper Donat
parent eafd18dac0
commit 25c3ba7338
2390 changed files with 154630 additions and 115818 deletions

View File

@@ -74,7 +74,8 @@ StartView::StartView(QWidget* parent)
{
setObjectName(QLatin1String("StartView"));
auto hGrp = App::GetApplication().GetParameterGroupByPath(
"User parameter:BaseApp/Preferences/Mod/Start");
"User parameter:BaseApp/Preferences/Mod/Start"
);
auto cardSpacing = hGrp->GetInt("FileCardSpacing", 15); // NOLINT
auto showExamples = hGrp->GetBool("ShowExamples", true); // NOLINT
@@ -94,10 +95,7 @@ StartView::StartView(QWidget* parent)
auto firstStartRegion = gsl::owner<QHBoxLayout*>(new QHBoxLayout(firstStartScrollWidget));
firstStartRegion->setAlignment(Qt::AlignCenter);
auto firstStartWidget = gsl::owner<FirstStartWidget*>(new FirstStartWidget(this));
connect(firstStartWidget,
&FirstStartWidget::dismissed,
this,
&StartView::firstStartWidgetDismissed);
connect(firstStartWidget, &FirstStartWidget::dismissed, this, &StartView::firstStartWidgetDismissed);
firstStartRegion->addWidget(firstStartWidget);
_contents->addWidget(firstStartScrollArea);
@@ -169,8 +167,9 @@ StartView::StartView(QWidget* parent)
_showOnStartupCheckBox = gsl::owner<QCheckBox*>(new QCheckBox());
bool showOnStartup = hGrp->GetBool("ShowOnStartup", true);
_showOnStartupCheckBox->setCheckState(showOnStartup ? Qt::CheckState::Unchecked
: Qt::CheckState::Checked);
_showOnStartupCheckBox->setCheckState(
showOnStartup ? Qt::CheckState::Unchecked : Qt::CheckState::Checked
);
connect(_showOnStartupCheckBox, &QCheckBox::toggled, this, &StartView::showOnStartupChanged);
footerLayout->addWidget(_openFirstStart);
@@ -201,30 +200,34 @@ StartView::StartView(QWidget* parent)
void StartView::configureNewFileButtons(QLayout* layout) const
{
auto newEmptyFile =
gsl::owner<NewFileButton*>(new NewFileButton({tr("Empty File"),
tr("Creates a new empty FreeCAD file"),
QLatin1String(":/icons/document-new.svg")}));
auto openFile =
gsl::owner<NewFileButton*>(new NewFileButton({tr("Open File"),
tr("Opens an existing CAD file or 3D model"),
QLatin1String(":/icons/document-open.svg")}));
auto partDesign = gsl::owner<NewFileButton*>(
new NewFileButton({tr("Parametric Body"),
tr("Creates a body with the Part Design workbench"),
QLatin1String(":/icons/PartDesignWorkbench.svg")}));
auto assembly = gsl::owner<NewFileButton*>(
new NewFileButton({tr("Assembly"),
tr("Creates an assembly project"),
QLatin1String(":/icons/AssemblyWorkbench.svg")}));
auto draft = gsl::owner<NewFileButton*>(
new NewFileButton({tr("2D Draft"),
tr("Creates a 2D Draft document"),
QLatin1String(":/icons/DraftWorkbench.svg")}));
auto arch =
gsl::owner<NewFileButton*>(new NewFileButton({tr("BIM/Architecture"),
tr("Creates an architectural project"),
QLatin1String(":/icons/BIMWorkbench.svg")}));
auto newEmptyFile = gsl::owner<NewFileButton*>(new NewFileButton(
{tr("Empty File"),
tr("Creates a new empty FreeCAD file"),
QLatin1String(":/icons/document-new.svg")}
));
auto openFile = gsl::owner<NewFileButton*>(new NewFileButton(
{tr("Open File"),
tr("Opens an existing CAD file or 3D model"),
QLatin1String(":/icons/document-open.svg")}
));
auto partDesign = gsl::owner<NewFileButton*>(new NewFileButton(
{tr("Parametric Body"),
tr("Creates a body with the Part Design workbench"),
QLatin1String(":/icons/PartDesignWorkbench.svg")}
));
auto assembly = gsl::owner<NewFileButton*>(new NewFileButton(
{tr("Assembly"),
tr("Creates an assembly project"),
QLatin1String(":/icons/AssemblyWorkbench.svg")}
));
auto draft = gsl::owner<NewFileButton*>(new NewFileButton(
{tr("2D Draft"), tr("Creates a 2D Draft document"), QLatin1String(":/icons/DraftWorkbench.svg")}
));
auto arch = gsl::owner<NewFileButton*>(new NewFileButton(
{tr("BIM/Architecture"),
tr("Creates an architectural project"),
QLatin1String(":/icons/BIMWorkbench.svg")}
));
// TODO: Ensure all of the required WBs are actually available
layout->addWidget(partDesign);
@@ -254,15 +257,15 @@ void StartView::configureFileCardWidget(QListView* fileCardWidget)
}
void StartView::configureRecentFilesListWidget(QListView* recentFilesListWidget,
QLabel* recentFilesLabel)
void StartView::configureRecentFilesListWidget(QListView* recentFilesListWidget, QLabel* recentFilesLabel)
{
_recentFilesModel.loadRecentFiles();
recentFilesListWidget->setModel(&_recentFilesModel);
configureFileCardWidget(recentFilesListWidget);
auto recentFilesGroup = App::GetApplication().GetParameterGroupByPath(
"User parameter:BaseApp/Preferences/RecentFiles");
"User parameter:BaseApp/Preferences/RecentFiles"
);
auto numRecentFiles {recentFilesGroup->GetInt("RecentFiles", 0)};
if (numRecentFiles == 0) {
recentFilesListWidget->hide();
@@ -347,7 +350,8 @@ void StartView::newArchFile()
// Set the camera zoom level to 10 m, which is more appropriate for architectural projects
Gui::Command::doCommand(
Gui::Command::Gui,
"Gui.activeDocument().activeView().viewDefaultOrientation(None, 10000.0)");
"Gui.activeDocument().activeView().viewDefaultOrientation(None, 10000.0)"
);
postStart(PostStartBehavior::doNotSwitchWorkbench);
}
@@ -363,7 +367,8 @@ bool StartView::onHasMsg(const char* pMsg) const
void StartView::postStart(PostStartBehavior behavior)
{
auto hGrp = App::GetApplication().GetParameterGroupByPath(
"User parameter:BaseApp/Preferences/Mod/Start");
"User parameter:BaseApp/Preferences/Mod/Start"
);
if (behavior == PostStartBehavior::switchWorkbench) {
auto wb = hGrp->GetASCII("AutoloadModule", "");
@@ -390,8 +395,7 @@ void StartView::postStart(PostStartBehavior behavior)
void StartView::fileCardSelected(const QModelIndex& index)
{
try {
auto filename =
index.data(static_cast<int>(Start::DisplayedFilesModelRoles::path)).toString();
auto filename = index.data(static_cast<int>(Start::DisplayedFilesModelRoles::path)).toString();
Gui::ModuleIO::verifyAndOpenFile(filename);
}
catch (Base::PyException& e) {
@@ -408,12 +412,14 @@ void StartView::fileCardSelected(const QModelIndex& index)
void StartView::showOnStartupChanged(bool checked)
{
auto hGrp = App::GetApplication().GetParameterGroupByPath(
"User parameter:BaseApp/Preferences/Mod/Start");
"User parameter:BaseApp/Preferences/Mod/Start"
);
hGrp->SetBool(
"ShowOnStartup",
!checked); // The sense of this option has been reversed: the checkbox actually says
// "*Don't* show on startup" now, but the option is preserved in its
// original sense, so is stored inverted.
!checked
); // The sense of this option has been reversed: the checkbox actually says
// "*Don't* show on startup" now, but the option is preserved in its
// original sense, so is stored inverted.
}
void StartView::openFirstStartClicked()
@@ -424,7 +430,8 @@ void StartView::openFirstStartClicked()
void StartView::firstStartWidgetDismissed()
{
auto hGrp = App::GetApplication().GetParameterGroupByPath(
"User parameter:BaseApp/Preferences/Mod/Start");
"User parameter:BaseApp/Preferences/Mod/Start"
);
hGrp->SetBool("FirstStart2024", false);
_contents->setCurrentIndex(1);
}
@@ -453,11 +460,13 @@ void StartView::showEvent(QShowEvent* event)
{
if (auto mainWindow = Gui::getMainWindow()) {
if (auto mdiArea = mainWindow->findChild<QMdiArea*>()) {
connect(mdiArea,
&QMdiArea::subWindowActivated,
this,
&StartView::onMdiSubWindowActivated,
Qt::UniqueConnection);
connect(
mdiArea,
&QMdiArea::subWindowActivated,
this,
&StartView::onMdiSubWindowActivated,
Qt::UniqueConnection
);
}
}
Gui::MDIView::showEvent(event);
@@ -496,7 +505,8 @@ void StartView::retranslateUi()
_recentFilesLabel->setText(h1Start + tr("Recent Files") + h1End);
auto hGrp = App::GetApplication().GetParameterGroupByPath(
"User parameter:BaseApp/Preferences/Mod/Start");
"User parameter:BaseApp/Preferences/Mod/Start"
);
std::string customFolder(hGrp->GetASCII("CustomFolder", ""));
bool shortCustomFolder = hGrp->GetBool("ShortCustomFolder", true); // false shows full path
if (!customFolder.empty()) {
@@ -509,6 +519,5 @@ void StartView::retranslateUi()
QString application = QString::fromUtf8(App::Application::Config()["ExeName"].c_str());
_openFirstStart->setText(tr("Open First Start Setup"));
_showOnStartupCheckBox->setText(
tr("Do not show this Start page again (start with blank screen)"));
_showOnStartupCheckBox->setText(tr("Do not show this Start page again (start with blank screen)"));
}