Gui: Prepare for clang-format (#16051)
* Gui: Prepare for clang-format * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -22,8 +22,8 @@
|
||||
|
||||
#include "PreCompiled.h"
|
||||
#ifndef _PreComp_
|
||||
# include <QRegularExpression>
|
||||
# include <QRegularExpressionMatch>
|
||||
#include <QRegularExpression>
|
||||
#include <QRegularExpressionMatch>
|
||||
#endif
|
||||
|
||||
#include "DlgSettingsImageImp.h"
|
||||
@@ -39,9 +39,9 @@ using namespace std;
|
||||
* Constructs a DlgSettingsImageImp as a child of 'parent', with the
|
||||
* name 'name' and widget flags set to 'f'.
|
||||
*/
|
||||
DlgSettingsImageImp::DlgSettingsImageImp( QWidget* parent )
|
||||
: QWidget( parent )
|
||||
, ui(new Ui_DlgSettingsImage)
|
||||
DlgSettingsImageImp::DlgSettingsImageImp(QWidget* parent)
|
||||
: QWidget(parent)
|
||||
, ui(new Ui_DlgSettingsImage)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setupConnections();
|
||||
@@ -52,7 +52,7 @@ DlgSettingsImageImp::DlgSettingsImageImp( QWidget* parent )
|
||||
|
||||
_width = width();
|
||||
_height = height();
|
||||
_fRatio = (float)_width/(float)_height;
|
||||
_fRatio = (float)_width / (float)_height;
|
||||
|
||||
ui->comboMethod->addItem(tr("Offscreen (New)"), QByteArray("QtOffscreenRenderer"));
|
||||
ui->comboMethod->addItem(tr("Offscreen (Old)"), QByteArray("CoinOffscreenRenderer"));
|
||||
@@ -67,6 +67,7 @@ DlgSettingsImageImp::~DlgSettingsImageImp() = default;
|
||||
|
||||
void DlgSettingsImageImp::setupConnections()
|
||||
{
|
||||
// clang-format off
|
||||
connect(ui->buttonRatioScreen, &QToolButton::clicked,
|
||||
this, &DlgSettingsImageImp::onButtonRatioScreenClicked);
|
||||
connect(ui->buttonRatio4x3, &QToolButton::clicked,
|
||||
@@ -79,9 +80,10 @@ void DlgSettingsImageImp::setupConnections()
|
||||
this, &DlgSettingsImageImp::onStandardSizeBoxActivated);
|
||||
connect(ui->comboMethod, qOverload<int>(&QComboBox::activated),
|
||||
this, &DlgSettingsImageImp::onComboMethodActivated);
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
void DlgSettingsImageImp::changeEvent(QEvent *e)
|
||||
void DlgSettingsImageImp::changeEvent(QEvent* e)
|
||||
{
|
||||
if (e->type() == QEvent::LanguageChange) {
|
||||
ui->retranslateUi(this);
|
||||
@@ -95,32 +97,32 @@ void DlgSettingsImageImp::changeEvent(QEvent *e)
|
||||
void DlgSettingsImageImp::setImageSize(int w, int h)
|
||||
{
|
||||
// set current screen size
|
||||
ui->standardSizeBox->setItemData(0, QSize(w,h));
|
||||
ui->standardSizeBox->setItemData(0, QSize(w, h));
|
||||
|
||||
ui->spinWidth->setValue(w);
|
||||
ui->spinHeight->setValue(h);
|
||||
|
||||
// As the image size is in pixel why shouldn't _width and _height be integers?
|
||||
_width = w;
|
||||
_width = w;
|
||||
_height = h;
|
||||
_fRatio = (float)_width/(float)_height;
|
||||
_fRatio = (float)_width / (float)_height;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the image size to \a s.
|
||||
*/
|
||||
void DlgSettingsImageImp::setImageSize( const QSize& s )
|
||||
void DlgSettingsImageImp::setImageSize(const QSize& s)
|
||||
{
|
||||
// set current screen size
|
||||
ui->standardSizeBox->setItemData(0, s);
|
||||
|
||||
ui->spinWidth->setValue( s.width() );
|
||||
ui->spinHeight->setValue( s.height() );
|
||||
ui->spinWidth->setValue(s.width());
|
||||
ui->spinHeight->setValue(s.height());
|
||||
|
||||
// As the image size is in pixel why shouldn't _width and _height be integers?
|
||||
_width = s.width();
|
||||
_width = s.width();
|
||||
_height = s.height();
|
||||
_fRatio = (float)_width/(float)_height;
|
||||
_fRatio = (float)_width / (float)_height;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -128,7 +130,7 @@ void DlgSettingsImageImp::setImageSize( const QSize& s )
|
||||
*/
|
||||
QSize DlgSettingsImageImp::imageSize() const
|
||||
{
|
||||
return { ui->spinWidth->value(), ui->spinHeight->value() };
|
||||
return {ui->spinWidth->value(), ui->spinHeight->value()};
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -148,15 +150,17 @@ int DlgSettingsImageImp::imageHeight() const
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the comment of the picture. If for the currently selected image format no comments are supported
|
||||
* QString() is returned.
|
||||
* Returns the comment of the picture. If for the currently selected image format no comments are
|
||||
* supported QString() is returned.
|
||||
*/
|
||||
QString DlgSettingsImageImp::comment() const
|
||||
{
|
||||
if ( !ui->textEditComment->isEnabled() )
|
||||
if (!ui->textEditComment->isEnabled()) {
|
||||
return {};
|
||||
else
|
||||
}
|
||||
else {
|
||||
return ui->textEditComment->toPlainText();
|
||||
}
|
||||
}
|
||||
|
||||
int DlgSettingsImageImp::backgroundType() const
|
||||
@@ -169,8 +173,9 @@ int DlgSettingsImageImp::backgroundType() const
|
||||
*/
|
||||
void DlgSettingsImageImp::setBackgroundType(int t)
|
||||
{
|
||||
if ( t < ui->comboBackground->count() )
|
||||
if (t < ui->comboBackground->count()) {
|
||||
ui->comboBackground->setCurrentIndex(t);
|
||||
}
|
||||
}
|
||||
|
||||
bool DlgSettingsImageImp::addWatermark() const
|
||||
@@ -180,26 +185,24 @@ bool DlgSettingsImageImp::addWatermark() const
|
||||
|
||||
void DlgSettingsImageImp::onSelectedFilter(const QString& filter)
|
||||
{
|
||||
bool ok = (filter.startsWith(QLatin1String("JPG")) ||
|
||||
filter.startsWith(QLatin1String("JPEG")) ||
|
||||
filter.startsWith(QLatin1String("PNG")));
|
||||
ui->buttonGroupComment->setEnabled( ok );
|
||||
bool ok = (filter.startsWith(QLatin1String("JPG")) || filter.startsWith(QLatin1String("JPEG"))
|
||||
|| filter.startsWith(QLatin1String("PNG")));
|
||||
ui->buttonGroupComment->setEnabled(ok);
|
||||
}
|
||||
|
||||
void DlgSettingsImageImp::adjustImageSize(float fRatio)
|
||||
{
|
||||
// if width has changed then adjust height and vice versa, if both has changed then adjust width
|
||||
if (_height != ui->spinHeight->value())
|
||||
{
|
||||
if (_height != ui->spinHeight->value()) {
|
||||
_height = ui->spinHeight->value();
|
||||
_width = (int)((float)_height*fRatio);
|
||||
ui->spinWidth->setValue( (int)_width );
|
||||
_width = (int)((float)_height * fRatio);
|
||||
ui->spinWidth->setValue((int)_width);
|
||||
}
|
||||
else // if( _width != spinWidth->value() )
|
||||
else // if( _width != spinWidth->value() )
|
||||
{
|
||||
_width = ui->spinWidth->value();
|
||||
_height = (int)((float)_width/fRatio);
|
||||
ui->spinHeight->setValue( (int)_height );
|
||||
_height = (int)((float)_width / fRatio);
|
||||
ui->spinHeight->setValue((int)_height);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -210,12 +213,12 @@ void DlgSettingsImageImp::onButtonRatioScreenClicked()
|
||||
|
||||
void DlgSettingsImageImp::onButtonRatio4x3Clicked()
|
||||
{
|
||||
adjustImageSize(4.0f/3.0f);
|
||||
adjustImageSize(4.0f / 3.0f);
|
||||
}
|
||||
|
||||
void DlgSettingsImageImp::onButtonRatio16x9Clicked()
|
||||
{
|
||||
adjustImageSize(16.0f/9.0f);
|
||||
adjustImageSize(16.0f / 9.0f);
|
||||
}
|
||||
|
||||
void DlgSettingsImageImp::onButtonRatio1x1Clicked()
|
||||
@@ -256,8 +259,9 @@ void DlgSettingsImageImp::onStandardSizeBoxActivated(int index)
|
||||
void DlgSettingsImageImp::setMethod(const QByteArray& m)
|
||||
{
|
||||
int index = ui->comboMethod->findData(m);
|
||||
if (index >= 0)
|
||||
if (index >= 0) {
|
||||
ui->comboMethod->setCurrentIndex(index);
|
||||
}
|
||||
}
|
||||
|
||||
QByteArray DlgSettingsImageImp::method() const
|
||||
|
||||
Reference in New Issue
Block a user