Skip to content

Commit 3f7e661

Browse files
committed
1.2025.02.04: astyle code
1 parent 4b5b6b6 commit 3f7e661

18 files changed

+87
-77
lines changed

src/FilterOptionsWidget.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@
2121
bool FilterOptionsWidget::disconnectAll(void)
2222
{
2323
bool result = true;
24-
24+
2525
if(!disconnect(this, SIGNAL(FilterOptionsWidget::reloadRequested()), 0, 0)) result = false;
2626
if(!disconnect(this, SIGNAL(FilterOptionsWidget::invalidateThumbnail(PageId const&)), 0, 0)) result = false;
2727
if(!disconnect(this, SIGNAL(FilterOptionsWidget::invalidateThumbnail(PageInfo const&)), 0, 0)) result = false;
2828
if(!disconnect(this, SIGNAL(FilterOptionsWidget::invalidateAllThumbnails()), 0, 0)) result = false;
2929
if(!disconnect(this, SIGNAL(FilterOptionsWidget::goToPage(PageId const&)), 0, 0)) result = false;
30-
30+
3131
return result;
3232
}

src/MainWindow.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -502,11 +502,13 @@ MainWindow::createBatchProcessingWidget()
502502

503503
bool MainWindow::eventFilter(QObject* obj, QEvent* ev)
504504
{
505-
if (obj == filterOptions && ev->type() == QEvent::Resize) {
505+
if (obj == filterOptions && ev->type() == QEvent::Resize)
506+
{
506507
scrollArea->setMinimumWidth(filterOptions->minimumSizeHint().width());
507508
}
508509

509-
if (obj == thumbView && ev->type() == QEvent::Resize) {
510+
if (obj == thumbView && ev->type() == QEvent::Resize)
511+
{
510512
dockWidgetThumbnails->setFixedWidth(dockWidgetThumbnails->sizeHint().width());
511513
}
512514

@@ -1670,7 +1672,7 @@ MainWindow::stylesheetChanged(const QString stylesheetFilePath)
16701672
QString stylesheet = stylesheetFile.readAll();
16711673

16721674
stylesheet.replace("@path_to_pics@", STYLESHEETS_DIR);
1673-
1675+
16741676
setStyleSheet(stylesheet);
16751677
}
16761678

src/NewOpenProjectPanel.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ NewOpenProjectPanel::addRecentProject(QString const& file_path)
8686
}
8787

8888
const int max_length = 30;
89-
if (base_name.length() > max_length) {
89+
if (base_name.length() > max_length)
90+
{
9091
base_name.truncate(max_length);
9192
base_name.append("...");
9293
}
@@ -96,7 +97,7 @@ NewOpenProjectPanel::addRecentProject(QString const& file_path)
9697

9798
button->setToolTip(file_path);
9899
recentProjectsGroup->layout()->addWidget(button);
99-
100+
100101
connect(
101102
button, SIGNAL(clicked()),
102103
this, SLOT(recentProjectButtonClicked())

src/ProjectFilesDialog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,7 @@ ProjectFilesDialog::FileList::remove(QItemSelection const& selection)
706706
);
707707

708708
int rows_removed = 0;
709-
709+
710710
for (auto it = sorted_ranges.begin(); it != sorted_ranges.end(); it++)
711711
{
712712
int const first = it->first - rows_removed;

src/SettingsDialog.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,10 @@ SettingsDialog::accept()
138138
m_pOpenCLPlugin->selectDevice(std::string(device.data(), device.size()));
139139
}
140140
#endif
141-
141+
142142
QString stylesheetFilePath = ui.stylesheetCombo->currentData().toString();
143-
if (stylesheetFilePath != m_oldStylesheetFilePath) {
143+
if (stylesheetFilePath != m_oldStylesheetFilePath)
144+
{
144145
settings.setValue("settings/stylesheet", stylesheetFilePath);
145146
}
146147
}
@@ -172,7 +173,7 @@ void
172173
SettingsDialog::saveOldSettings()
173174
{
174175
QSettings settings;
175-
176+
176177
m_oldStylesheetFilePath = settings.value("settings/stylesheet", "").toString();
177178
}
178179

@@ -197,10 +198,11 @@ SettingsDialog::setupStylesheetsCombo()
197198
stylesheetPaths.removeDuplicates();
198199
stylesheetPaths.sort();
199200

200-
for (const QString& stylesheetPath : stylesheetPaths) {
201+
for (const QString& stylesheetPath : stylesheetPaths)
202+
{
201203
QFileInfo stylesheetFileInfo(stylesheetPath);
202204
ui.stylesheetCombo->addItem(
203-
stylesheetFileInfo.baseName(),
205+
stylesheetFileInfo.baseName(),
204206
stylesheetFileInfo.filePath());
205207
}
206208

src/SettingsDialog.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ class SettingsDialog : public QDialog
4141
void stylesheetChanged(const QString stylesheetFilePath);
4242
private slots:
4343
void accept();
44-
44+
4545
void reject();
4646

4747
void on_stylesheetCombo_currentIndexChanged(int index);
4848
private:
4949
void saveOldSettings();
50-
50+
5151
void setupStylesheetsCombo();
5252
private:
5353
Ui::SettingsDialog ui;

src/ThumbnailBase.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ ThumbnailBase::ThumbnailBase(
6464
AbstractImageTransform const& full_size_image_transform,
6565
boost::optional<QRectF> const& transformed_viewport)
6666
: m_ptrThumbnailCache(thumbnail_cache),
67-
m_maxDisplaySize(max_display_size),
68-
m_pageId(page_id),
69-
m_extendedClipArea(false)
67+
m_maxDisplaySize(max_display_size),
68+
m_pageId(page_id),
69+
m_extendedClipArea(false)
7070
{
7171
setFullSizeToVirtualTransform(full_size_image_transform, transformed_viewport);
7272
}

src/dewarping/CylindricalSurfaceDewarper.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ CylindricalSurfaceDewarper::mapGeneratrix(double crv_x, State& state) const
143143
double const pln_straight_line_y = pln_straight_line_frac * 0.5
144144
+ (1.0 - pln_straight_line_frac) * m_plnStraightLineY;
145145
double const img_directrix12f_proj = (1.0 - pln_straight_line_y) * img_directrix1_proj
146-
+ pln_straight_line_y * img_directrix2_proj;
146+
+ pln_straight_line_y * img_directrix2_proj;
147147
double const img_directrix12fd_proj = img_directrix12f_proj - pln_straight_line_y;
148148
//double const curve_coef = 1.0 + 0.5 * (m_curveCorrect - 2.0);
149149
double const curve_coef = (m_curveCorrect < 2.0) ? (1.0 / (3.0 - m_curveCorrect)) : (m_curveCorrect - 1.0);
@@ -201,7 +201,7 @@ CylindricalSurfaceDewarper::mapToDewarpedSpace(QPointF const& img_pt, State& sta
201201
double const pln_straight_line_y = pln_straight_line_frac * 0.5
202202
+ (1.0 - pln_straight_line_frac) * m_plnStraightLineY;
203203
double const img_directrix12f_proj = (1.0 - pln_straight_line_y) * img_directrix1_proj
204-
+ pln_straight_line_y * img_directrix2_proj;
204+
+ pln_straight_line_y * img_directrix2_proj;
205205
double const img_directrix12fd_proj = img_directrix12f_proj - pln_straight_line_y;
206206
//double const curve_coef = 1.0 + 0.5 * (m_curveCorrect - 2.0);
207207
double const curve_coef = (m_curveCorrect < 2.0) ? (1.0 / (3.0 - m_curveCorrect)) : (m_curveCorrect - 1.0);

src/dewarping/DewarpingImageTransform.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ DewarpingImageTransform::toAffine(
225225
QRectF const model_domain(
226226
-dewarped_rect.topLeft(),
227227
QSizeF(m_intrinsicScaleX * m_userScaleX,
228-
m_intrinsicScaleY * m_userScaleY)
228+
m_intrinsicScaleY * m_userScaleY)
229229
);
230230
auto const minmax_densities = calcMinMaxDensities();
231231

@@ -285,8 +285,8 @@ DewarpingImageTransform::materialize(
285285
assert(!target_rect.isEmpty());
286286

287287
QRectF model_domain(0, 0,
288-
m_intrinsicScaleX * m_userScaleX,
289-
m_intrinsicScaleY * m_userScaleY);
288+
m_intrinsicScaleX * m_userScaleX,
289+
m_intrinsicScaleY * m_userScaleY);
290290
model_domain.translate(-target_rect.topLeft());
291291
auto const minmax_densities = calcMinMaxDensities();
292292

@@ -487,7 +487,7 @@ DewarpingImageTransform::constrainCropArea(QPolygonF const& orig_crop_area) cons
487487
double const max_density = minmax_densities.second;
488488

489489
ConstrainedCropAreaBuilder builder(orig_crop_area,
490-
min_density, max_density, m_dewarper);
490+
min_density, max_density, m_dewarper);
491491

492492
builder.sampleCrvXRange(0.0 + 0.3, 0.0 - 0.6, -1.0);
493493
builder.sampleCrvXRange(1.0 - 0.3, 1.0 + 0.6, 1.0);
@@ -521,7 +521,7 @@ DewarpingImageTransform::calcMinMaxDensities() const
521521
auto const minmax_densities = std::minmax_element(
522522
std::begin(corner_densities), std::end(corner_densities)
523523
);
524-
/* return std::make_pair(0.6 * *minmax_densities.first, 1.4 * *minmax_densities.second); // Tulon */
524+
/* return std::make_pair(0.6 * *minmax_densities.first, 1.4 * *minmax_densities.second); // Tulon */
525525
return std::make_pair(0.5 * *minmax_densities.first, 2.0 * *minmax_densities.second); // zvezdochiot (2025-01-11)
526526
}
527527

src/dewarping/DistortionModelBuilder.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -249,16 +249,16 @@ DistortionModelBuilder::tryBuildModel(DebugImages* dbg, QImage const* dbg_backgr
249249
}
250250
}
251251

252-
/*
253-
// Full RANCAS (zvezdochiot)
254-
for (int i = 0; i < (num_curves - 1); i++)
255-
{
256-
for (int j = i + 1; j < num_curves; j++)
252+
/*
253+
// Full RANCAS (zvezdochiot)
254+
for (int i = 0; i < (num_curves - 1); i++)
257255
{
258-
ransac.buildAndAssessModel(&ordered_curves[i], &ordered_curves[j]);
256+
for (int j = i + 1; j < num_curves; j++)
257+
{
258+
ransac.buildAndAssessModel(&ordered_curves[i], &ordered_curves[j]);
259+
}
259260
}
260-
}
261-
*/
261+
*/
262262
if (dbg && dbg_background)
263263
{
264264
dbg->add(visualizeTrimmedPolylines(*dbg_background, ordered_curves), "trimmed_polylines");

src/foundation/MultipleTargetsSupport.h

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ static const QString::SplitBehavior QStringSkipEmptyParts = QString::SkipEmptyPa
2525
static const Qt::SplitBehavior QStringSkipEmptyParts = Qt::SkipEmptyParts;
2626
#endif
2727

28-
static inline int QLineIntersect(const QLineF &line1, const QLineF &line2, QPointF *intersectionPoint) {
28+
static inline int QLineIntersect(const QLineF &line1, const QLineF &line2, QPointF *intersectionPoint)
29+
{
2930
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
3031
return line1.intersect(line2, intersectionPoint);
3132
#else
@@ -36,13 +37,14 @@ static inline int QLineIntersect(const QLineF &line1, const QLineF &line2, QPoin
3637
static inline QPointF QWheelEventPosF(const QWheelEvent *event)
3738
{
3839
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
39-
return event->posF();
40+
return event->posF();
4041
#else
41-
return event->position();
42+
return event->position();
4243
#endif
4344
}
4445

45-
static inline Qt::Orientation QWheelEventOrientation(QWheelEvent* event) {
46+
static inline Qt::Orientation QWheelEventOrientation(QWheelEvent* event)
47+
{
4648
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
4749
return event->orientation();
4850
#else
@@ -53,9 +55,10 @@ static inline Qt::Orientation QWheelEventOrientation(QWheelEvent* event) {
5355
else
5456
return Qt::Vertical;
5557
#endif
56-
}
57-
58-
static inline int QWheelEventDelta(QWheelEvent* event) {
58+
}
59+
60+
static inline int QWheelEventDelta(QWheelEvent* event)
61+
{
5962
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
6063
return event->delta();
6164
#else
@@ -66,23 +69,23 @@ static inline int QWheelEventDelta(QWheelEvent* event) {
6669
else
6770
return angle_delta.y();
6871
#endif
69-
}
72+
}
7073

7174
template <class T>
7275
static inline QVector<T> QVectorFromStdVector(const std::vector<T> &vector)
7376
{
7477
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
75-
return QVector<T>::fromStdVector(vector);
78+
return QVector<T>::fromStdVector(vector);
7679
#else
77-
return QVector<T>(vector.begin(), vector.end());
80+
return QVector<T>(vector.begin(), vector.end());
7881
#endif
7982
}
8083

8184
static inline qint64 QDateTimeToSecsSinceEpoch(const QDateTime &datetime)
8285
{
8386
#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
8487
uint t = datetime.toTime_t();
85-
88+
8689
if(t == (uint)-1) return -1;
8790
else return t;
8891
#else

src/imageproc/GrayImage.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ GrayImage grayBiModalTiledMap(
561561
double const t22 = tlocal_line[y2 * tlocal_stride + x2];
562562

563563
double bml = dy2 * (dx2 * t11 + dx1 * t12)
564-
+ dy1 * (dx2 * t21 + dx1 * t22);
564+
+ dy1 * (dx2 * t21 + dx1 * t22);
565565
double t = coef * bml + (1.0 - coef) * bmg + 0.5;
566566
t = (t < 0.0) ? 0.0 : ((t < 255.0) ? t : 255.0);
567567
gray_line[x] = (uint8_t) t;

src/main.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,14 +190,16 @@ int main(int argc, char** argv)
190190
}
191191
absolute_path += QChar('/');
192192

193-
if(!found_translation) {
193+
if(!found_translation)
194+
{
194195
if (translator.load(absolute_path+translation))
195196
{
196197
found_translation = true;
197198
}
198199
}
199200

200-
if(!found_translation_qtbase) {
201+
if(!found_translation_qtbase)
202+
{
201203
if (translator_qtbase.load(absolute_path+translation_qtbase))
202204
{
203205
found_translation_qtbase = true;

src/math/XSpline.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -366,13 +366,13 @@ XSpline::linearCombinationFor(LinearCoefficient* coeffs, int segment, double t)
366366

367367
/*
368368
* fix #17 for GCC 12.3 (https://github.com/ImageProcessing-ElectronicPublications/scantailor-experimental/issues/17)
369-
*
369+
*
370370
* origin:
371-
*
371+
*
372372
* Vec4d A;
373-
*
373+
*
374374
* alternative:
375-
*
375+
*
376376
* static ControlPoint pts[4];
377377
* ...
378378
* static Vec4d A;

src/stages/deskew/RotationThumbnail.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ RotationThumbnail::RotationThumbnail(
4141
thumbnail_cache, max_display_size, page_id,
4242
full_size_image_transform.adjusted(
4343
[compensation_angle_deg](AffineImageTransform& xform)
44-
{
45-
xform.rotate(compensation_angle_deg);
46-
}
44+
{
45+
xform.rotate(compensation_angle_deg);
46+
}
4747
)
4848
)
4949
, m_drawGrid(draw_grid)

src/stages/output/OutputGenerator.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -691,18 +691,18 @@ OutputGenerator::process(
691691
}
692692

693693
mse_kmeans = hsvKMeansInPlace(
694-
dst,
695-
transformed_image,
696-
bw_content,
697-
bw_mask,
698-
black_kmeans_options.kmeansCount(),
699-
black_kmeans_options.kmeansValueStart(),
700-
color_space_val,
701-
black_kmeans_options.kmeansSat(),
702-
black_kmeans_options.kmeansNorm(),
703-
black_kmeans_options.kmeansBG(),
704-
black_kmeans_options.getFindBlack(),
705-
black_kmeans_options.getFindWhite());
694+
dst,
695+
transformed_image,
696+
bw_content,
697+
bw_mask,
698+
black_kmeans_options.kmeansCount(),
699+
black_kmeans_options.kmeansValueStart(),
700+
color_space_val,
701+
black_kmeans_options.kmeansSat(),
702+
black_kmeans_options.kmeansNorm(),
703+
black_kmeans_options.kmeansBG(),
704+
black_kmeans_options.getFindBlack(),
705+
black_kmeans_options.getFindWhite());
706706
/* deprecated: maskMorphological(dst, bw_content, black_kmeans_options.kmeansMorphology()); */
707707
}
708708
}

src/version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@
2020
#define SCANTAILOR_VERSION_H_
2121

2222
#define STFAMILY "experimental"
23-
#define VERSION "1.2025.01.30" // Must be "x.x.x.x" or an empty string.
23+
#define VERSION "1.2025.02.04" // Must be "x.x.x.x" or an empty string.
2424

2525
#endif

0 commit comments

Comments
 (0)