Skip to content

Commit

Permalink
Start: Reduce args to f3d
Browse files Browse the repository at this point in the history
f3d 2.2 does not support all proposed arguments. Also add debug logging.
  • Loading branch information
chennes committed Feb 14, 2025
1 parent bda8afd commit cbe47d8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/Mod/Start/App/DisplayedFilesModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ QHash<int, QByteArray> DisplayedFilesModel::roleNames() const

void DisplayedFilesModel::processNewThumbnail(const QString& file, const QByteArray& thumbnail)
{
Base::Console().Log("Processing new thumbnail for %s\n", file.toStdString().c_str());
if (!thumbnail.isEmpty()) {
_imageCache.insert(file, thumbnail);
}
Expand Down
8 changes: 6 additions & 2 deletions src/Mod/Start/App/ThumbnailSource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include "FileUtilities.h"

#include <App/Application.h>
#include <Base/Console.h>

using namespace Start;

Expand All @@ -47,13 +48,14 @@ void ThumbnailSource::run()
{
const QString thumbnailPath = getUniquePNG(_file.toStdString());
if (!useCachedPNG(thumbnailPath.toStdString(), _file.toStdString())) {
Base::Console().Log("Running ThumbnailSource f3d cache update for %s\n", _file.toStdString().c_str());
const ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath(
"User parameter:BaseApp/Preferences/Mod/Start");
const auto f3d = QString::fromUtf8(hGrp->GetASCII("f3d", "f3d").c_str());
constexpr int resolution = 128;
QStringList args;
args << QLatin1String("--config=thumbnail") << QLatin1String("--load-plugins=occt")
<< QLatin1String("--verbose=quiet") << QLatin1String("--output=") + thumbnailPath
args << QLatin1String("--load-plugins=occt")

Check warning on line 57 in src/Mod/Start/App/ThumbnailSource.cpp

View workflow job for this annotation

GitHub Actions / Lint / Lint

QString(QLatin1String) being called [-Wclazy-qstring-allocations]
<< QLatin1String("--output=") + thumbnailPath

Check warning on line 58 in src/Mod/Start/App/ThumbnailSource.cpp

View workflow job for this annotation

GitHub Actions / Lint / Lint

QString(QLatin1String) being called [-Wclazy-qstring-allocations]
<< QLatin1String("--resolution=") + QString::number(resolution) + QLatin1String(",")

Check warning on line 59 in src/Mod/Start/App/ThumbnailSource.cpp

View workflow job for this annotation

GitHub Actions / Lint / Lint

QString(QLatin1String) being called [-Wclazy-qstring-allocations]

Check warning on line 59 in src/Mod/Start/App/ThumbnailSource.cpp

View workflow job for this annotation

GitHub Actions / Lint / Lint

QString(QLatin1String) being called [-Wclazy-qstring-allocations]
+ QString::number(resolution)
<< _file;
Expand All @@ -62,8 +64,10 @@ void ThumbnailSource::run()
process.start(f3d, args);
process.waitForFinished();
if (process.exitCode() != 0) {
Base::Console().Log(" -> f3d call failed for %s\n", _file.toStdString().c_str());
return;
}
Base::Console().Log(" -> f3d call completed for %s\n", _file.toStdString().c_str());
}

if (QFile thumbnailFile(thumbnailPath); thumbnailFile.exists()) {
Expand Down

0 comments on commit cbe47d8

Please sign in to comment.