Skip to content

Commit

Permalink
♻️Refactoring: Static analysis - part #5
Browse files Browse the repository at this point in the history
  • Loading branch information
vookimedlo committed Mar 1, 2024
1 parent d61015d commit ad900e9
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ VookiImageViewer - a tool for showing images.
#include "../ImageTransformationBase.h"

template<typename T> requires std::is_same_v<QImage, T> || std::is_same_v<QTransform, T>
class ImageTransformationBaseHelper : public ImageTransformationBase<T>
class ImageTransformationBaseHelper final : public ImageTransformationBase<T>
{
public:
[[nodiscard]] const T &getOriginalObject() const { return ImageTransformationBase<T>::getOriginalObject(); }
Expand Down
8 changes: 4 additions & 4 deletions src/processing/transformation/test/ImageZoomTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ VookiImageViewer - a tool for showing images.

void ImageZoomTest::areaSize() const
{
const QSize size{10, 20};
constexpr QSize size{10, 20};
ImageZoom<QTransform> imageZoom;
QCOMPARE(imageZoom.getAreaSize(), QSize(0, 0));
QCOMPARE(imageZoom.isCacheDirty(), true);
Expand Down Expand Up @@ -46,7 +46,7 @@ void ImageZoomTest::fitToArea() const

void ImageZoomTest::originalImageSize() const
{
const QSize size{10, 20};
constexpr QSize size{10, 20};
ImageZoom<QTransform> imageZoom;
QCOMPARE(imageZoom.isCacheDirty(), true);
QCOMPARE(imageZoom.getOriginalImageSize(), QSize());
Expand All @@ -58,7 +58,7 @@ void ImageZoomTest::originalImageSize() const

void ImageZoomTest::scaleFactor() const
{
const double scaleFactor = 2;
constexpr double scaleFactor = 2;
ImageZoom<QTransform> imageZoom;
QCOMPARE(imageZoom.isCacheDirty(), true);
QCOMPARE(imageZoom.getScaleFactor(), 1);
Expand All @@ -70,7 +70,7 @@ void ImageZoomTest::scaleFactor() const

void ImageZoomTest::resetProperties() const
{
const QSize size{10, 20};
constexpr QSize size{10, 20};
ImageZoom<QTransform> imageZoom;
imageZoom.setIsCacheDirty(false);
imageZoom.setAreaSize(size);
Expand Down
2 changes: 1 addition & 1 deletion src/ui/ImageAreaWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ void ImageAreaWidget::nativeGestureEvent(QNativeGestureEvent *event)
}
break;
case Qt::SmartZoomNativeGesture: {
const double factor = 1000;
constexpr double factor = 1000;
if (event->value() != 0)
onZoomImageInTriggered(factor);
else
Expand Down
10 changes: 5 additions & 5 deletions src/ui/SettingsDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@ void SettingsDialog::initializeUI(const QSettings * const settings)
m_backgroundColor = settings->value(SETTINGS_IMAGE_BACKGROUND_COLOR).value<QColor>();
m_languageCode = settings->value(SETTINGS_LANGUAGE_CODE).value<QString>();

if (std::input_iterator auto findIt = std::ranges::find_if(begin(Languages::m_localizations),
end(Languages::m_localizations),
[&languageCode = m_languageCode](const Languages::Record &record){
return languageCode == record.m_code;
}); findIt != std::end(Languages::m_localizations))
if (const auto findIt = std::ranges::find_if(begin(Languages::m_localizations),
end(Languages::m_localizations),
[&languageCode = m_languageCode](const Languages::Record &record){
return languageCode == record.m_code;
}); findIt != std::end(Languages::m_localizations))
{
const auto position = std::distance(Languages::m_localizations.begin(), findIt);
m_uiSettingsDialog.comboBoxLanguage->setCurrentIndex(position);
Expand Down
2 changes: 1 addition & 1 deletion src/ui/forms/AboutSupportedFormatsDialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@
</item>
<item row="33" column="0">
<property name="text">
<string>[MacOS/Win only] HEIC</string>
<string>[macOS/win only] HEIC</string>
</property>
</item>
<item row="33" column="1">
Expand Down
3 changes: 1 addition & 2 deletions src/ui/support/SettingsShortcutsTableWidgetItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ VookiImageViewer - a tool for showing images.
#include "SettingsShortcutsTableWidgetItem.h"

SettingsShortcutsTableWidgetItem::SettingsShortcutsTableWidgetItem(QAction &action)
: QObject()
, QTableWidgetItem(SettingsShortcutsTableWidgetItem::type)
: QTableWidgetItem(SettingsShortcutsTableWidgetItem::type)
, m_action(action)
, m_keySequence(action.shortcut())
{
Expand Down
2 changes: 1 addition & 1 deletion src/ui/test/SettingsDialogTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ void SettingsDialogTest::shortcuts() const
QCOMPARE(userSettingsOnAccepted, userSettingsInitializedFromMenu);

// Test the SettingsShortcutsTableWidgetItem::onKeySequenceChanged()
const auto standardKey = QKeySequence::StandardKey::MoveToNextPage;
constexpr auto standardKey = QKeySequence::StandardKey::MoveToNextPage;
for (int i = 0; i < tableWidget->rowCount(); ++i)
dynamic_cast<QKeySequenceEdit *>(tableWidget->cellWidget(i, 0))->setKeySequence(standardKey);

Expand Down

0 comments on commit ad900e9

Please sign in to comment.