Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions src/appshell/qml/Preferences/CanvasPreferencesPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -66,18 +66,13 @@ PreferencesPage {

ScrollPagesSection {
orientation: preferencesModel.scrollPagesOrientation
limitScrollArea: preferencesModel.limitScrollArea

navigation.section: root.navigationSection
navigation.order: root.navigationOrderStart + 2

onOrientationChangeRequested: function(orientation) {
preferencesModel.scrollPagesOrientation = orientation
}

onLimitScrollAreaChangeRequested: function(limit) {
preferencesModel.limitScrollArea = limit
}
}

SeparatorLine { }
Expand Down
17 changes: 0 additions & 17 deletions src/appshell/qml/Preferences/internal/ScrollPagesSection.qml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,8 @@ BaseSection {
title: qsTrc("appshell/preferences", "Scroll pages")

property int orientation: Qt.Horizontal
property alias limitScrollArea: limitScrollAreaBox.checked

signal orientationChangeRequested(int orientation)
signal limitScrollAreaChangeRequested(bool limit)

RadioButtonGroup {
id: radioButtonList
Expand Down Expand Up @@ -72,19 +70,4 @@ BaseSection {
}
}
}

CheckBox {
id: limitScrollAreaBox
width: parent.width

text: qsTrc("appshell/preferences", "Limit scroll area to page borders")

navigation.name: "LimitScrollAreaBox"
navigation.panel: root.navigation
navigation.row: radioButtonList.model.length

onClicked: {
root.limitScrollAreaChangeRequested(!checked)
}
}
}
18 changes: 0 additions & 18 deletions src/appshell/view/preferences/canvaspreferencesmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ void CanvasPreferencesModel::setupConnections()
notationConfiguration()->canvasOrientation().ch.onReceive(this, [this](muse::Orientation) {
emit scrollPagesOrientationChanged();
});
notationConfiguration()->isLimitCanvasScrollAreaChanged().onNotify(this, [this]() {
emit limitScrollAreaChanged();
});
notationConfiguration()->selectionProximityChanged().onReceive(this, [this](int selectionProximity) {
emit selectionProximityChanged(selectionProximity);
});
Expand Down Expand Up @@ -89,11 +86,6 @@ int CanvasPreferencesModel::scrollPagesOrientation() const
return static_cast<int>(notationConfiguration()->canvasOrientation().val);
}

bool CanvasPreferencesModel::limitScrollArea() const
{
return notationConfiguration()->isLimitCanvasScrollArea();
}

int CanvasPreferencesModel::selectionProximity() const
{
return notationConfiguration()->selectionProximity();
Expand Down Expand Up @@ -139,16 +131,6 @@ void CanvasPreferencesModel::setScrollPagesOrientation(int orientation)
notationConfiguration()->setCanvasOrientation(static_cast<muse::Orientation>(orientation));
}

void CanvasPreferencesModel::setLimitScrollArea(bool limit)
{
if (limitScrollArea() == limit) {
return;
}

notationConfiguration()->setIsLimitCanvasScrollArea(limit);
emit limitScrollAreaChanged();
}

void CanvasPreferencesModel::setSelectionProximity(int proximity)
{
if (selectionProximity() == proximity) {
Expand Down
4 changes: 0 additions & 4 deletions src/appshell/view/preferences/canvaspreferencesmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ class CanvasPreferencesModel : public QObject, public muse::Injectable, public m
Q_PROPERTY(int mouseZoomPrecision READ mouseZoomPrecision WRITE setMouseZoomPrecision NOTIFY mouseZoomPrecisionChanged)

Q_PROPERTY(int scrollPagesOrientation READ scrollPagesOrientation WRITE setScrollPagesOrientation NOTIFY scrollPagesOrientationChanged)
Q_PROPERTY(bool limitScrollArea READ limitScrollArea WRITE setLimitScrollArea NOTIFY limitScrollAreaChanged)

Q_PROPERTY(int selectionProximity READ selectionProximity WRITE setSelectionProximity NOTIFY selectionProximityChanged)

Expand All @@ -57,23 +56,20 @@ class CanvasPreferencesModel : public QObject, public muse::Injectable, public m
int mouseZoomPrecision() const;

int scrollPagesOrientation() const;
bool limitScrollArea() const;

int selectionProximity() const;

public slots:
void setMouseZoomPrecision(int precision);

void setScrollPagesOrientation(int orientation);
void setLimitScrollArea(bool limit);

void setSelectionProximity(int proximity);

signals:
void defaultZoomChanged();
void mouseZoomPrecisionChanged();
void scrollPagesOrientationChanged();
void limitScrollAreaChanged();
void selectionProximityChanged(int selectionProximity);

private:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ QQuickItem *DockWidgetQuick::frameVisualItem() const
void DockWidgetQuick::onGeometryUpdated()
{
if (auto frame = qobject_cast<FrameQuick *>(DockWidgetBase::d->frame())) {
frame->updateConstriants();
frame->updateConstraints();
frame->updateGeometry();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ FrameQuick::FrameQuick(QWidgetAdapter *parent, FrameOptions options, int userTyp
: Frame(parent, options, userType)
{
connect(m_tabWidget->asWidget(), SIGNAL(countChanged()), /// clazy:exclude=old-style-connect
this, SLOT(updateConstriants()));
this, SLOT(updateConstraints()));

connect(m_tabWidget->asWidget(), SIGNAL(currentDockWidgetChanged(KDDockWidgets::DockWidgetBase*)), /// clazy:exclude=old-style-connect
this, SIGNAL(currentDockWidgetChanged(KDDockWidgets::DockWidgetBase*)));
Expand Down Expand Up @@ -75,7 +75,7 @@ FrameQuick::~FrameQuick()
}
}

void FrameQuick::updateConstriants()
void FrameQuick::updateConstraints()
{
onDockWidgetCountChanged();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class DOCKS_EXPORT FrameQuick : public Frame
void tabTitlesChanged();

public Q_SLOTS:
void updateConstriants();
void updateConstraints();

private:
QQuickItem *m_stackLayout = nullptr;
Expand Down
5 changes: 4 additions & 1 deletion src/framework/draw/types/geometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class PointX
inline T x() const { return m_x; }
inline T y() const { return m_y; }

//! NOTE I don't like this methods, but now it a lot of using
//! NOTE I don't like these methods, but now they are being used a lot
inline number_t<T>& rx() { return m_x; }
inline number_t<T>& ry() { return m_y; }

Expand Down Expand Up @@ -359,6 +359,9 @@ class RectX
inline void pad(double p) { adjust(-p, -p, p, p); }
inline RectX<T> padded(double p) const { return adjusted(-p, -p, p, p); }

inline void pad(double px, double py) { adjust(-px, -py, px, py); }
inline RectX<T> padded(double px, double py) const { return adjusted(-px, -py, px, py); }

inline RectX<T>& scale(const SizeX<T>& mag)
{
m_x *= mag.width();
Expand Down
4 changes: 0 additions & 4 deletions src/notation/inotationconfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,6 @@ class INotationConfiguration : MODULE_EXPORT_INTERFACE
virtual muse::ValCh<muse::Orientation> canvasOrientation() const = 0;
virtual void setCanvasOrientation(muse::Orientation orientation) = 0;

virtual bool isLimitCanvasScrollArea() const = 0;
virtual void setIsLimitCanvasScrollArea(bool limited) = 0;
virtual muse::async::Notification isLimitCanvasScrollAreaChanged() const = 0;

virtual bool colorNotesOutsideOfUsablePitchRange() const = 0;
virtual void setColorNotesOutsideOfUsablePitchRange(bool value) = 0;
virtual muse::async::Channel<bool> colorNotesOutsideOfUsablePitchRangeChanged() const = 0;
Expand Down
21 changes: 0 additions & 21 deletions src/notation/internal/notationconfiguration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ static const Settings::Key IS_COUNT_IN_ENABLED(module_name, "application/playbac
static const Settings::Key TOOLBAR_KEY(module_name, "ui/toolbar/");

static const Settings::Key IS_CANVAS_ORIENTATION_VERTICAL_KEY(module_name, "ui/canvas/scroll/verticalOrientation");
static const Settings::Key IS_LIMIT_CANVAS_SCROLL_AREA_KEY(module_name, "ui/canvas/scroll/limitScrollArea");

static const Settings::Key COLOR_NOTES_OUTSIDE_OF_USABLE_PITCH_RANGE(module_name, "score/note/warnPitchRange");
static const Settings::Key WARN_GUITAR_BENDS(module_name, "score/note/warnGuitarBends");
Expand Down Expand Up @@ -286,11 +285,6 @@ void NotationConfiguration::init()
m_canvasOrientationChanged.send(canvasOrientation().val);
});

settings()->setDefaultValue(IS_LIMIT_CANVAS_SCROLL_AREA_KEY, Val(false));
settings()->valueChanged(IS_LIMIT_CANVAS_SCROLL_AREA_KEY).onReceive(this, [this](const Val&) {
m_isLimitCanvasScrollAreaChanged.notify();
});

settings()->setDefaultValue(COLOR_NOTES_OUTSIDE_OF_USABLE_PITCH_RANGE, Val(true));
settings()->valueChanged(COLOR_NOTES_OUTSIDE_OF_USABLE_PITCH_RANGE).onReceive(this, [this](const Val& val) {
m_colorNotesOutsideOfUsablePitchRangeChanged.send(val.toBool());
Expand Down Expand Up @@ -948,21 +942,6 @@ void NotationConfiguration::setCanvasOrientation(muse::Orientation orientation)
settings()->setSharedValue(IS_CANVAS_ORIENTATION_VERTICAL_KEY, Val(isVertical));
}

bool NotationConfiguration::isLimitCanvasScrollArea() const
{
return settings()->value(IS_LIMIT_CANVAS_SCROLL_AREA_KEY).toBool();
}

void NotationConfiguration::setIsLimitCanvasScrollArea(bool limited)
{
settings()->setSharedValue(IS_LIMIT_CANVAS_SCROLL_AREA_KEY, Val(limited));
}

Notification NotationConfiguration::isLimitCanvasScrollAreaChanged() const
{
return m_isLimitCanvasScrollAreaChanged;
}

bool NotationConfiguration::colorNotesOutsideOfUsablePitchRange() const
{
return settings()->value(COLOR_NOTES_OUTSIDE_OF_USABLE_PITCH_RANGE).toBool();
Expand Down
5 changes: 0 additions & 5 deletions src/notation/internal/notationconfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,6 @@ class NotationConfiguration : public INotationConfiguration, public muse::async:
muse::ValCh<muse::Orientation> canvasOrientation() const override;
void setCanvasOrientation(muse::Orientation orientation) override;

bool isLimitCanvasScrollArea() const override;
void setIsLimitCanvasScrollArea(bool limited) override;
muse::async::Notification isLimitCanvasScrollAreaChanged() const override;

bool colorNotesOutsideOfUsablePitchRange() const override;
void setColorNotesOutsideOfUsablePitchRange(bool value) override;
muse::async::Channel<bool> colorNotesOutsideOfUsablePitchRangeChanged() const override;
Expand Down Expand Up @@ -294,7 +290,6 @@ class NotationConfiguration : public INotationConfiguration, public muse::async:
muse::async::Channel<muse::io::path_t> m_userStylesPathChanged;
muse::async::Channel<muse::io::path_t> m_userMusicFontsPathChanged;
muse::async::Notification m_scoreOrderListPathsChanged;
muse::async::Notification m_isLimitCanvasScrollAreaChanged;
muse::async::Channel<int> m_selectionProximityChanged;
muse::async::Channel<bool> m_colorNotesOutsideOfUsablePitchRangeChanged;
muse::async::Channel<bool> m_warnGuitarBendsChanged;
Expand Down
6 changes: 3 additions & 3 deletions src/notation/tests/mocks/controlledviewmock.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ class ControlledViewMock : public IControlledView
MOCK_METHOD(qreal, height, (), (const, override));

MOCK_METHOD(muse::PointF, viewportTopLeft, (), (const, override));
MOCK_METHOD(muse::RectF, viewport, (), (const, override));

MOCK_METHOD(bool, moveCanvas, (qreal, qreal), (override));
MOCK_METHOD(void, moveCanvasHorizontal, (qreal), (override));
MOCK_METHOD(void, moveCanvasVertical, (qreal), (override));
MOCK_METHOD(bool, moveCanvas, (qreal, qreal, bool, bool));
MOCK_METHOD(bool, moveCanvasToPosition, (qreal, qreal, bool, bool));

MOCK_METHOD(muse::RectF, notationContentRect, (), (const, override));
MOCK_METHOD(qreal, currentScaling, (), (const, override));
Expand Down
4 changes: 0 additions & 4 deletions src/notation/tests/mocks/notationconfigurationmock.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,6 @@ class NotationConfigurationMock : public INotationConfiguration
MOCK_METHOD(muse::ValCh<muse::Orientation>, canvasOrientation, (), (const, override));
MOCK_METHOD(void, setCanvasOrientation, (muse::Orientation), (override));

MOCK_METHOD(bool, isLimitCanvasScrollArea, (), (const, override));
MOCK_METHOD(void, setIsLimitCanvasScrollArea, (bool), (override));
MOCK_METHOD(muse::async::Notification, isLimitCanvasScrollAreaChanged, (), (const, override));

MOCK_METHOD(bool, colorNotesOutsideOfUsablePitchRange, (), (const, override));
MOCK_METHOD(void, setColorNotesOutsideOfUsablePitchRange, (bool), (override));
MOCK_METHOD((muse::async::Channel<bool>), colorNotesOutsideOfUsablePitchRangeChanged, (), (const, override));
Expand Down
8 changes: 4 additions & 4 deletions src/notation/tests/notationviewinputcontroller_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,14 +201,14 @@ class NotationViewInputControllerTests : public ::testing::Test
TEST_F(NotationViewInputControllerTests, WheelEvent_ScrollVertical)
{
//! [THEN] Should be called vertical scroll with value 180
EXPECT_CALL(m_view, moveCanvas(0, 180))
EXPECT_CALL(m_view, moveCanvas(0, 180, true, false))
.Times(1);

//! [WHEN] User scrolled mouse wheel
m_controller->wheelEvent(make_wheelEvent(QPoint(0, 180), QPoint(0, 120)));

//! [THEN] Should be called vertical scroll with value 80
EXPECT_CALL(m_view, moveCanvas(0, 80))
EXPECT_CALL(m_view, moveCanvas(0, 80, true, false))
.Times(1);

//! [WHEN] User scrolled mouse wheel
Expand All @@ -218,7 +218,7 @@ TEST_F(NotationViewInputControllerTests, WheelEvent_ScrollVertical)
//! dy = (angleDelta.y() * qMax(2.0, m_view->height() / 10.0)) / QWheelEvent::DefaultDeltasPerStep;

//! [THEN] Should be called vertical scroll with value 50 (dy = (120 * 500 / 10) / 120 = 50)
EXPECT_CALL(m_view, moveCanvas(0, 50))
EXPECT_CALL(m_view, moveCanvas(0, 50, true, false))
.Times(1);

EXPECT_CALL(m_view, height())
Expand All @@ -235,7 +235,7 @@ TEST_F(NotationViewInputControllerTests, WheelEvent_ScrollVertical)
TEST_F(NotationViewInputControllerTests, WheelEvent_ScrollHorizontal)
{
//! [THEN] Should be called horizontal scroll with value 120
EXPECT_CALL(m_view, moveCanvasHorizontal(120))
EXPECT_CALL(m_view, moveCanvas(120, 0, true, false))
.Times(1);

//! [WHEN] User scrolled mouse wheel
Expand Down
Loading
Loading