Skip to content

Commit

Permalink
run pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Nov 29, 2024
1 parent 556a645 commit 00381bb
Show file tree
Hide file tree
Showing 1,666 changed files with 43,055 additions and 54,781 deletions.
27 changes: 13 additions & 14 deletions editors/QtCreator/templates/wizards/qgis/qgis_test/file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,39 +23,38 @@
#include <QObject>
#include <qgsapplication.h>

class %{CN}: public QObject
class % { CN } : public QObject
{

Q_OBJECT

private slots:
void initTestCase(); // will be called before the first testfunction is executed.
void initTestCase(); // will be called before the first testfunction is executed.
void cleanupTestCase(); // will be called after the last testfunction was executed.
void init(); // will be called before each testfunction is executed.
void cleanup(); // will be called after every testfunction.
void init(); // will be called before each testfunction is executed.
void cleanup(); // will be called after every testfunction.

// Add your test methods here
};

void %{CN}::initTestCase()
void % { CN }
::initTestCase()
{

}

void %{CN}::cleanupTestCase()
void % { CN }
::cleanupTestCase()
{

}

void %{CN}::init()
void % { CN }
::init()
{

}

void %{CN}::cleanup()
void % { CN }
::cleanup()
{

}

QGSTEST_MAIN( %{CN} )
QGSTEST_MAIN( % { CN } )
#include "%{JS: Cpp.classToFileName('%{Class}', '.moc')}"
25 changes: 9 additions & 16 deletions src/app/3d/qgs3danimationexportdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,22 @@
#include <QRegularExpression>
#include <QRegularExpressionValidator>

Qgs3DAnimationExportDialog::Qgs3DAnimationExportDialog(): QDialog( nullptr )
Qgs3DAnimationExportDialog::Qgs3DAnimationExportDialog()
: QDialog( nullptr )
{
setupUi( this );
mFpsSpinBox->setClearValue( 30 );
mWidthSpinBox->setClearValue( 800 );
mHeightSpinBox->setClearValue( 600 );
const QgsSettings settings;

const QString templateText = settings.value( QStringLiteral( "Export3DAnimation/fileNameTemplate" ),
QStringLiteral( "%1####.jpg" ).arg( QgsProject::instance()->baseName() )
, QgsSettings::App ).toString();
const QString templateText = settings.value( QStringLiteral( "Export3DAnimation/fileNameTemplate" ), QStringLiteral( "%1####.jpg" ).arg( QgsProject::instance()->baseName() ), QgsSettings::App ).toString();
mTemplateLineEdit->setText( templateText );
const thread_local QRegularExpression rx( QStringLiteral( "^\\w+#+\\.{1}\\w+$" ) ); //e.g. anyprefix#####.png
QValidator *validator = new QRegularExpressionValidator( rx, this );
mTemplateLineEdit->setValidator( validator );

connect( mTemplateLineEdit, &QLineEdit::textChanged, this, [ = ]
{
connect( mTemplateLineEdit, &QLineEdit::textChanged, this, [=] {
QgsSettings settings;
settings.setValue( QStringLiteral( "Export3DAnimation/fileNameTemplate" ), mTemplateLineEdit->text() );
} );
Expand All @@ -53,35 +51,30 @@ Qgs3DAnimationExportDialog::Qgs3DAnimationExportDialog(): QDialog( nullptr )
mOutputDirFileWidget->setDefaultRoot( settings.value( QStringLiteral( "Export3DAnimation/lastDir" ), QString(), QgsSettings::App ).toString() );
mOutputDirFileWidget->setFilePath( settings.value( QStringLiteral( "Export3DAnimation/lastDir" ), QString(), QgsSettings::App ).toString() );

connect( mOutputDirFileWidget, &QgsFileWidget::fileChanged, this, [ = ]
{
connect( mOutputDirFileWidget, &QgsFileWidget::fileChanged, this, [=] {
QgsSettings settings;
settings.setValue( QStringLiteral( "Export3DAnimation/lastDir" ), mOutputDirFileWidget->filePath(), QgsSettings::App );
} );

mFpsSpinBox->setValue( settings.value( QStringLiteral( "Export3DAnimation/fps" ), 30 ).toInt() );
connect( mFpsSpinBox, static_cast < void ( QSpinBox::* )( int ) > ( &QgsSpinBox::valueChanged ), this, [ = ]
{
connect( mFpsSpinBox, static_cast<void ( QSpinBox::* )( int )>( &QgsSpinBox::valueChanged ), this, [=] {
QgsSettings settings;
settings.setValue( QStringLiteral( "Export3DAnimation/fps" ), mFpsSpinBox->value() );
} );

mWidthSpinBox->setValue( settings.value( QStringLiteral( "Export3DAnimation/width" ), 800 ).toInt() );
connect( mWidthSpinBox, static_cast < void ( QSpinBox::* )( int ) > ( &QgsSpinBox::valueChanged ), this, [ = ]
{
connect( mWidthSpinBox, static_cast<void ( QSpinBox::* )( int )>( &QgsSpinBox::valueChanged ), this, [=] {
QgsSettings settings;
settings.setValue( QStringLiteral( "Export3DAnimation/width" ), mWidthSpinBox->value() );
} );

mHeightSpinBox->setValue( settings.value( QStringLiteral( "Export3DAnimation/height" ), 600 ).toInt() );
connect( mHeightSpinBox, static_cast < void ( QSpinBox::* )( int ) > ( &QgsSpinBox::valueChanged ), this, [ = ]
{
connect( mHeightSpinBox, static_cast<void ( QSpinBox::* )( int )>( &QgsSpinBox::valueChanged ), this, [=] {
QgsSettings settings;
settings.setValue( QStringLiteral( "Export3DAnimation/height" ), mHeightSpinBox->value() );
} );

connect( mButtonBox, &QDialogButtonBox::helpRequested, this, [ = ]
{
connect( mButtonBox, &QDialogButtonBox::helpRequested, this, [=] {
QgsHelp::openHelp( QStringLiteral( "map_views/3d_map_view.html#create-animation" ) );
} );

Expand Down
4 changes: 2 additions & 2 deletions src/app/3d/qgs3danimationexportdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ class Qgs3DAnimationExportDialog : public QDialog, private Ui::AnimationExport3D
~Qgs3DAnimationExportDialog() override;

//! Returns output directory for frames
QString outputDirectory( ) const;
QString outputDirectory() const;

//! Returns filename template for frames
QString fileNameExpression( ) const;
QString fileNameExpression() const;

//! Returns frames per second
int fps() const;
Expand Down
23 changes: 11 additions & 12 deletions src/app/3d/qgs3danimationwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,15 +191,13 @@ void Qgs3DAnimationWidget::onExportAnimation()
if ( dialog.exec() == QDialog::Accepted )
{
QgsFeedback progressFeedback;
std::unique_ptr< QgsScopedProxyProgressTask > progressTask = std::make_unique< QgsScopedProxyProgressTask >( tr( "Exporting animation" ) );
std::unique_ptr<QgsScopedProxyProgressTask> progressTask = std::make_unique<QgsScopedProxyProgressTask>( tr( "Exporting animation" ) );

QProgressDialog progressDialog( tr( "Exporting frames..." ), tr( "Abort" ), 0, 100, this );
progressDialog.setWindowModality( Qt::WindowModal );
QString error;

connect( &progressFeedback, &QgsFeedback::progressChanged, this,
[&progressDialog, &progressTask]( double progress )
{
connect( &progressFeedback, &QgsFeedback::progressChanged, this, [&progressDialog, &progressTask]( double progress ) {
progressDialog.setValue( static_cast<int>( progress ) );
progressTask->setProgress( progress );
QCoreApplication::processEvents();
Expand All @@ -208,14 +206,15 @@ void Qgs3DAnimationWidget::onExportAnimation()
connect( &progressDialog, &QProgressDialog::canceled, &progressFeedback, &QgsFeedback::cancel );

const bool success = Qgs3DUtils::exportAnimation(
animation(),
*mMap,
dialog.fps(),
dialog.outputDirectory(),
dialog.fileNameExpression(),
dialog.frameSize(),
error,
&progressFeedback );
animation(),
*mMap,
dialog.fps(),
dialog.outputDirectory(),
dialog.fileNameExpression(),
dialog.frameSize(),
error,
&progressFeedback
);

progressTask.reset();

Expand Down
18 changes: 9 additions & 9 deletions src/app/3d/qgs3dapputils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,16 @@

void Qgs3DAppUtils::initialize()
{
qgis::down_cast< Qgs3DSymbolMetadata * >( QgsApplication::symbol3DRegistry()->symbolMetadata( QStringLiteral( "point" ) ) )->setWidgetFunction( QgsPoint3DSymbolWidget::create );
qgis::down_cast< Qgs3DSymbolMetadata * >( QgsApplication::symbol3DRegistry()->symbolMetadata( QStringLiteral( "line" ) ) )->setWidgetFunction( QgsLine3DSymbolWidget::create );
qgis::down_cast< Qgs3DSymbolMetadata * >( QgsApplication::symbol3DRegistry()->symbolMetadata( QStringLiteral( "polygon" ) ) )->setWidgetFunction( QgsPolygon3DSymbolWidget::create );
qgis::down_cast<Qgs3DSymbolMetadata *>( QgsApplication::symbol3DRegistry()->symbolMetadata( QStringLiteral( "point" ) ) )->setWidgetFunction( QgsPoint3DSymbolWidget::create );
qgis::down_cast<Qgs3DSymbolMetadata *>( QgsApplication::symbol3DRegistry()->symbolMetadata( QStringLiteral( "line" ) ) )->setWidgetFunction( QgsLine3DSymbolWidget::create );
qgis::down_cast<Qgs3DSymbolMetadata *>( QgsApplication::symbol3DRegistry()->symbolMetadata( QStringLiteral( "polygon" ) ) )->setWidgetFunction( QgsPolygon3DSymbolWidget::create );

qgis::down_cast< QgsMaterialSettingsMetadata * >( Qgs3D::materialRegistry()->materialSettingsMetadata( QStringLiteral( "null" ) ) )->setWidgetFunction( QgsNullMaterialWidget::create );
qgis::down_cast< QgsMaterialSettingsMetadata * >( Qgs3D::materialRegistry()->materialSettingsMetadata( QStringLiteral( "phong" ) ) )->setWidgetFunction( QgsPhongMaterialWidget::create );
qgis::down_cast< QgsMaterialSettingsMetadata * >( Qgs3D::materialRegistry()->materialSettingsMetadata( QStringLiteral( "phongtextured" ) ) )->setWidgetFunction( QgsPhongTexturedMaterialWidget::create );
qgis::down_cast< QgsMaterialSettingsMetadata * >( Qgs3D::materialRegistry()->materialSettingsMetadata( QStringLiteral( "gooch" ) ) )->setWidgetFunction( QgsGoochMaterialWidget::create );
qgis::down_cast< QgsMaterialSettingsMetadata * >( Qgs3D::materialRegistry()->materialSettingsMetadata( QStringLiteral( "simpleline" ) ) )->setWidgetFunction( QgsSimpleLineMaterialWidget::create );
qgis::down_cast< QgsMaterialSettingsMetadata * >( Qgs3D::materialRegistry()->materialSettingsMetadata( QStringLiteral( "metalrough" ) ) )->setWidgetFunction( QgsMetalRoughMaterialWidget::create );
qgis::down_cast<QgsMaterialSettingsMetadata *>( Qgs3D::materialRegistry()->materialSettingsMetadata( QStringLiteral( "null" ) ) )->setWidgetFunction( QgsNullMaterialWidget::create );
qgis::down_cast<QgsMaterialSettingsMetadata *>( Qgs3D::materialRegistry()->materialSettingsMetadata( QStringLiteral( "phong" ) ) )->setWidgetFunction( QgsPhongMaterialWidget::create );
qgis::down_cast<QgsMaterialSettingsMetadata *>( Qgs3D::materialRegistry()->materialSettingsMetadata( QStringLiteral( "phongtextured" ) ) )->setWidgetFunction( QgsPhongTexturedMaterialWidget::create );
qgis::down_cast<QgsMaterialSettingsMetadata *>( Qgs3D::materialRegistry()->materialSettingsMetadata( QStringLiteral( "gooch" ) ) )->setWidgetFunction( QgsGoochMaterialWidget::create );
qgis::down_cast<QgsMaterialSettingsMetadata *>( Qgs3D::materialRegistry()->materialSettingsMetadata( QStringLiteral( "simpleline" ) ) )->setWidgetFunction( QgsSimpleLineMaterialWidget::create );
qgis::down_cast<QgsMaterialSettingsMetadata *>( Qgs3D::materialRegistry()->materialSettingsMetadata( QStringLiteral( "metalrough" ) ) )->setWidgetFunction( QgsMetalRoughMaterialWidget::create );

QgsStyleModel::setIconGenerator( new Qgs3DIconGenerator( QgsApplication::defaultStyleModel() ) );
}
2 changes: 0 additions & 2 deletions src/app/3d/qgs3dapputils.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,10 @@
class Qgs3DAppUtils
{
public:

/**
* Initializes 3D components belonging to the app library.
*/
static void initialize();

};

#endif // QGS3DAPPUTILS_H
Loading

0 comments on commit 00381bb

Please sign in to comment.