Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make user status enum #1086

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open

Conversation

redmanmale
Copy link
Contributor

@redmanmale redmanmale commented Oct 8, 2017

instead of uint.


This change is Reviewable

@redmanmale redmanmale force-pushed the user-status-enum branch 2 times, most recently from 646800b to 5f32f17 Compare October 14, 2017 21:52
@jhert0
Copy link
Member

jhert0 commented Oct 14, 2017

:lgtm:


Reviewed 9 of 9 files at r1.
Review status: all files reviewed at latest revision, all discussions resolved.


Comments from Reviewable

@GrayHatter
Copy link
Member

Reviewed 8 of 9 files at r1.
Review status: all files reviewed at latest revision, 4 unresolved discussions.


src/self.h, line 12 at r1 (raw file):

    USER_STATUS_AWAY_IDLE,
    USER_STATUS_DO_NOT_DISTURB,
    USER_STATUS_OFFLINE

offline should be first (zero)


src/self.h, line 13 at r1 (raw file):

    USER_STATUS_DO_NOT_DISTURB,
    USER_STATUS_OFFLINE
} USER_STATUS;

add an INVALID canary to the end as well, see later comment


src/layout/sidebar.c, line 83 at r1 (raw file):

                  BM_STATUSAREA_WIDTH, BM_STATUSAREA_HEIGHT,
                  button_usr_state.mouseover ? COLOR_BKGRND_LIST_HOVER : COLOR_BKGRND_LIST);
        uint8_t status = tox_connected ? self.status : USER_STATUS_OFFLINE;

BTW pedantic: don't create a u8 here. just drop the ?: into the array selector

(you don't really need to change this)


src/layout/userbadge.c, line 75 at r1 (raw file):

static void button_status_on_mup(void) {
    self.status++;
    if (self.status == USER_STATUS_OFFLINE) {

if >= _INVALID; then set AVAILABLE


Comments from Reviewable

@redmanmale
Copy link
Contributor Author

Review status: 5 of 13 files reviewed at latest revision, 4 unresolved discussions.


src/self.h, line 12 at r1 (raw file):

Previously, GrayHatter (Gregory Mullen) wrote…

offline should be first (zero)

Done.


src/self.h, line 13 at r1 (raw file):

Previously, GrayHatter (Gregory Mullen) wrote…

add an INVALID canary to the end as well, see later comment

Done.


src/layout/sidebar.c, line 83 at r1 (raw file):

Previously, GrayHatter (Gregory Mullen) wrote…

BTW pedantic: don't create a u8 here. just drop the ?: into the array selector

(you don't really need to change this)

Done.


src/layout/userbadge.c, line 75 at r1 (raw file):

Previously, GrayHatter (Gregory Mullen) wrote…

if >= _INVALID; then set AVAILABLE

Done.


Comments from Reviewable

@redmanmale
Copy link
Contributor Author

Review status: 5 of 13 files reviewed at latest revision, 4 unresolved discussions.


src/self.c, line 43 at r2 (raw file):

USER_STATUS to_utox_user_status(TOX_USER_STATUS tox_user_status) {
    return (USER_STATUS)(tox_user_status + 1);
}

If you don't mind I create a conversion functions to avoid spreading that logic over all places where it used.


Comments from Reviewable

@jhert0
Copy link
Member

jhert0 commented Oct 22, 2017

:lgtm:


Reviewed 8 of 8 files at r2, 1 of 1 files at r3.
Review status: all files reviewed at latest revision, 4 unresolved discussions.


Comments from Reviewable

@redmanmale redmanmale added this to the v0.17.0 milestone Oct 22, 2017
@GrayHatter
Copy link
Member

Reviewed 1 of 9 files at r1, 7 of 8 files at r2, 1 of 1 files at r3.
Review status: all files reviewed at latest revision, 4 unresolved discussions.


src/self.c, line 43 at r2 (raw file):

Previously, redmanmale (redmanmale) wrote…

If you don't mind I create a conversion functions to avoid spreading that logic over all places where it used.

do you think user_status_to_tox and user_status_to_utox would be better names?


src/theme.c, line 563 at r3 (raw file):

    }

    status_color[0] = COLOR_STATUS_BUSY;

do we not have an offline color defined?

should we?


src/theme.h, line 102 at r3 (raw file):

void theme_load(const THEME loadtheme);

uint32_t status_color[5];

you can use the enum invalid value here, then it'll never go out of date


src/layout/sidebar.c, line 84 at r3 (raw file):

                  button_usr_state.mouseover ? COLOR_BKGRND_LIST_HOVER : COLOR_BKGRND_LIST);

        drawalpha(tox_connected ? self.status : BM_OFFLINE,

tox_connected ? (BM_ONLINE + self.status - 1) : BM_OFFLINE

But that's gross... the best options are: revert this change and add the U8 back, or even better, reorder the enum in svg.h to match the user status enum.

If you reorder the svg.h enum, make sure you do that in it's very own commit. (Touching svg.h is dangerous, so keeping it in it's own commit will allow git bisect to work later on)


Comments from Reviewable

@redmanmale
Copy link
Contributor Author

Review status: all files reviewed at latest revision, 4 unresolved discussions.


src/layout/sidebar.c, line 84 at r3 (raw file):

Previously, GrayHatter (Gregory Mullen) wrote…

tox_connected ? (BM_ONLINE + self.status - 1) : BM_OFFLINE

But that's gross... the best options are: revert this change and add the U8 back, or even better, reorder the enum in svg.h to match the user status enum.

If you reorder the svg.h enum, make sure you do that in it's very own commit. (Touching svg.h is dangerous, so keeping it in it's own commit will allow git bisect to work later on)

Hm, there's not such code here anymore.
But I agreed that reordering colours would be better.


Comments from Reviewable

@redmanmale
Copy link
Contributor Author

Review status: 8 of 14 files reviewed at latest revision, 4 unresolved discussions.


src/self.c, line 43 at r2 (raw file):

Previously, GrayHatter (Gregory Mullen) wrote…

do you think user_status_to_tox and user_status_to_utox would be better names?

Done.


src/theme.c, line 563 at r3 (raw file):

Previously, GrayHatter (Gregory Mullen) wrote…

do we not have an offline color defined?

should we?

Nope for both.


src/theme.h, line 102 at r3 (raw file):

Previously, GrayHatter (Gregory Mullen) wrote…

you can use the enum invalid value here, then it'll never go out of date

Done.


Comments from Reviewable

@jhert0
Copy link
Member

jhert0 commented Oct 24, 2017

Reviewed 6 of 6 files at r4.
Review status: all files reviewed at latest revision, 5 unresolved discussions, some commit checks failed.


src/theme.h, line 102 at r4 (raw file):

void theme_load(const THEME loadtheme);

uint32_t status_color[USER_STATUS_INVALID];

You need to include self.h so USER_STATUS_INVALID can be used.


Comments from Reviewable

@redmanmale
Copy link
Contributor Author

Review status: 13 of 14 files reviewed at latest revision, 5 unresolved discussions.


src/theme.h, line 102 at r4 (raw file):

Previously, endoffile78 (Endoffile) wrote…

You need to include self.h so USER_STATUS_INVALID can be used.

Done.


Comments from Reviewable

@GrayHatter
Copy link
Member

Reviewed 1 of 8 files at r2, 5 of 6 files at r4, 1 of 1 files at r5.
Review status: all files reviewed at latest revision, 2 unresolved discussions.


src/flist.c, line 114 at r5 (raw file):

    x -= BM_STATUS_WIDTH / 2;

    drawalpha(status == USER_STATUS_OFFLINE ? BM_OFFLINE : status,

this could easily go out of scope, we need to do something different here.

same as sidebar.c


Comments from Reviewable

@robinlinden
Copy link
Member

Reviewed 5 of 9 files at r1, 3 of 8 files at r2, 5 of 6 files at r4, 1 of 1 files at r5.
Review status: all files reviewed at latest revision, 2 unresolved discussions, some commit checks failed.


Comments from Reviewable

@robinlinden robinlinden modified the milestones: v0.17.0, v0.18.0 Nov 5, 2017
@jhert0
Copy link
Member

jhert0 commented Nov 6, 2017

Reviewed 1 of 1 files at r5.
Review status: all files reviewed at latest revision, 1 unresolved discussion, some commit checks failed.


Comments from Reviewable

@GrayHatter
Copy link
Member

@redmanmale still waiting on a fix for my comment.

@redmanmale
Copy link
Contributor Author

I'm aware of this, but don't have any ideas yet how to fix it properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants