Skip to content

Conversation

@nhnt
Copy link
Contributor

@nhnt nhnt commented Sep 28, 2021

This adds an option to the settings popup allowing users to configure
a custom swipe length. The default of 30 is retained.

Let me know if this needs any changes; It's my first time working on a Qt codebase.

Copy link
Collaborator

@Eeems Eeems left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getting close!

@nhnt nhnt force-pushed the user_gesture_length_squash branch from 2e5c86d to 15b603a Compare September 28, 2021 17:30
@nhnt
Copy link
Contributor Author

nhnt commented Sep 28, 2021

I've removed the setAllSwipeLengths API in favor of a swipeLengthSetting property. I thought it would be odd to have a getter called getAllSwipeLengths that returns a single value.

This is buildable but it depends on #225 to work properly.

@Eeems
Copy link
Collaborator

Eeems commented Sep 28, 2021

I've removed the setAllSwipeLengths API in favor of a swipeLengthSetting property. I thought it would be odd to have a getter called getAllSwipeLengths that returns a single value.

This is buildable but it depends on #225 to work properly.

Hmm, I'm not completely sold on swipeLengthSetting for various reasons. If I set one swipe to be a different length, it's no longer valid. It also doesn't follow the same naming standards that the other properties follow, which would be to name it swipeLength.
Perhaps the launcher settings should split this out into the four different lengths and have it manage making them all the same length in the launcher settings dialog instead? That way the API can keep the lengths separate to avoid making it complicated, and have the more complicated side of things on the launcher UI side.

@nhnt
Copy link
Contributor Author

nhnt commented Sep 28, 2021

Do you mean have all four settings in the UI? or keep it as is with one setting but make four calls? For the latter I'm not sure what to display If the lengths are different.

@Eeems
Copy link
Collaborator

Eeems commented Sep 28, 2021

Do you mean have all four settings in the UI? or keep it as is with one setting but make four calls? For the latter I'm not sure what to display If the lengths are different.

Longer term I'd probably want to support both options. For now it would probably make sense to just display them as separate options.

This adds an option to the settings popup allowing users to configure
a custom swipe length. The default of 30 is retained.

Co-authored-by: Nathaniel van Diepen <Eeems@users.noreply.github.com>
@nhnt nhnt force-pushed the user_gesture_length_squash branch from 15b603a to b1931db Compare September 28, 2021 20:25
Comment on lines 404 to 440
switch (direction){
case 1:
m_swipeLengthRight = length;
emit swipeLengthRightChanged(length);
break;
case 2:
m_swipeLengthLeft = length;
emit swipeLengthLeftChanged(length);
break;
case 3:
m_swipeLengthUp = length;
emit swipeLengthUpChanged(length);
break;
case 4:
m_swipeLengthDown = length;
emit swipeLengthDownChanged(length);
break;
default:
qDebug() << "Invalid swipe direction: " << direction;
break;
}
}
int Controller::getSwipeLength(int direction){
switch (direction){
case 1:
return swipeLengthRight();
case 2:
return swipeLengthLeft();
case 3:
return swipeLengthUp();
case 4:
return swipeLengthDown();
default:
qDebug() << "Invalid swipe direction: " << direction;
return -1;
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer to use an enum here for readability instead of the raw integer values. Similar to what I do for WifiStatus etc: https://github.com/Eeems/oxide/blob/master/applications/launcher/controller.h#L28-L31

@Eeems
Copy link
Collaborator

Eeems commented Sep 28, 2021

Looking good! I'll make sure to test/tweak it this evening and get it merged.

@Eeems Eeems force-pushed the user_gesture_length_squash branch from b3c34aa to c453c8b Compare September 28, 2021 22:10
@qlty-cloud-legacy
Copy link

Code Climate has analyzed commit 4cab8c1 and detected 0 issues on this pull request.

View more on Code Climate.

@Eeems Eeems added this to the v2.3 milestone Sep 28, 2021
@Eeems Eeems merged commit 2a834f3 into Eeems-Org:master Sep 28, 2021
@nhnt nhnt deleted the user_gesture_length_squash branch September 28, 2021 22:27
@nhnt
Copy link
Contributor Author

nhnt commented Sep 28, 2021

Thanks!

@Eeems
Copy link
Collaborator

Eeems commented Sep 28, 2021

Thanks!

Thank you for submitting the PR and getting the ball rolling on this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants