Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
rockodi
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
CeRiAl
rockodi
Commits
a988ce27
Commit
a988ce27
authored
Mar 09, 2016
by
CeRiAl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Strip trailing whitespace
parent
54151a3d
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
36 additions
and
36 deletions
+36
-36
addons.c
src/addons.c
+2
-2
basic_menu_layer.c
src/basic_menu_layer.c
+6
-6
basic_menu_layer.h
src/basic_menu_layer.h
+2
-2
buttons_window.c
src/buttons_window.c
+6
-6
common.h
src/common.h
+2
-2
goto.c
src/goto.c
+3
-3
main.c
src/main.c
+2
-2
player.c
src/player.c
+9
-9
playlists.c
src/playlists.c
+2
-2
power.c
src/power.c
+1
-1
remote.c
src/remote.c
+1
-1
No files found.
src/addons.c
View file @
a988ce27
...
...
@@ -37,7 +37,7 @@ static DictionaryIterator items_iter;
static
void
lyr_loading_update_proc
(
Layer
*
layer
,
GContext
*
ctx
)
{
GRect
bounds
=
layer_get_bounds
(
layer
);
graphics_fill_rect
(
ctx
,
bounds
,
0
,
GCornerNone
);
graphics_draw_text
(
ctx
,
"Loading..."
,
fonts_get_system_font
(
FONT_KEY_GOTHIC_24_BOLD
),
graphics_draw_text
(
ctx
,
"Loading..."
,
fonts_get_system_font
(
FONT_KEY_GOTHIC_24_BOLD
),
GRect
(
0
,
10
,
bounds
.
size
.
w
,
28
),
GTextOverflowModeTrailingEllipsis
,
GTextAlignmentCenter
,
NULL
);
}
...
...
@@ -114,7 +114,7 @@ void show_addons(void) {
.
unload
=
handle_window_unload
,
});
window_stack_push
(
s_window
,
true
);
outbox_send
(
"GET_ADDONS"
);
}
...
...
src/basic_menu_layer.c
View file @
a988ce27
...
...
@@ -21,11 +21,11 @@
#include <pebble.h>
#include "basic_menu_layer.h"
#include "common.h"
BasicMenuModel
*
basic_menu_model_create
(
void
)
{
BasicMenuModel
*
model
=
malloc
(
sizeof
*
model
);
model
->
item_count
=
0
;
return
model
;
}
...
...
@@ -37,7 +37,7 @@ void basic_menu_model_destroy(BasicMenuModel *model) {
}
void
basic_menu_model_add_item
(
BasicMenuModel
*
model
,
char
*
label
,
GBitmap
*
icon
,
void
*
value
)
{
BasicMenuItem
*
item
=
malloc
(
sizeof
*
item
);
BasicMenuItem
*
item
=
malloc
(
sizeof
*
item
);
item
->
label
=
label
;
item
->
icon
=
icon
;
item
->
value
=
value
;
...
...
@@ -78,7 +78,7 @@ static void menu_draw_row_cb(GContext* ctx, const Layer *cell_layer, MenuIndex *
BasicMenuModel
*
model
=
(
BasicMenuModel
*
)
data
;
GRect
bounds
=
layer_get_frame
(
cell_layer
);
GBitmap
*
icon
=
model
->
items
[
cell_index
->
row
]
->
icon
;
graphics_context_set_fill_color
(
ctx
,
GColorBlack
);
#ifdef PBL_COLOR
graphics_context_set_fill_color
(
ctx
,
GColorVividCerulean
);
...
...
@@ -92,7 +92,7 @@ static void menu_draw_row_cb(GContext* ctx, const Layer *cell_layer, MenuIndex *
offset
=
44
;
graphics_draw_bitmap_in_rect
(
ctx
,
model
->
items
[
cell_index
->
row
]
->
icon
,
GRect
(
4
,
8
,
28
,
28
));
}
graphics_draw_text
(
ctx
,
model
->
items
[
cell_index
->
row
]
->
label
,
fonts_get_system_font
(
FONT_KEY_GOTHIC_24
),
graphics_draw_text
(
ctx
,
model
->
items
[
cell_index
->
row
]
->
label
,
fonts_get_system_font
(
FONT_KEY_GOTHIC_24
),
GRect
(
offset
,
4
,
bounds
.
size
.
w
-
offset
,
16
),
GTextOverflowModeTrailingEllipsis
,
GTextAlignmentLeft
,
NULL
);
}
...
...
@@ -119,4 +119,4 @@ BasicMenuLayer* basic_menu_layer_create(GRect rect, BasicMenuModel* model) {
void
basic_menu_layer_destroy
(
BasicMenuLayer
*
layer
)
{
menu_layer_destroy
((
MenuLayer
*
)
layer
);
}
\ No newline at end of file
}
src/basic_menu_layer.h
View file @
a988ce27
...
...
@@ -40,6 +40,6 @@ BasicMenuModel* basic_menu_model_create(void);
void
basic_menu_model_destroy
(
BasicMenuModel
*
model
);
void
basic_menu_model_add_item
(
BasicMenuModel
*
model
,
char
*
label
,
GBitmap
*
icon
,
void
*
value
);
void
basic_menu_model_set_select_callback
(
BasicMenuModel
*
model
,
BasicMenuSelectCallback
cb
);
BasicMenuLayer
*
basic_menu_layer_create
(
GRect
rect
,
BasicMenuModel
*
model
);
void
basic_menu_layer_destroy
(
BasicMenuLayer
*
layer
);
\ No newline at end of file
void
basic_menu_layer_destroy
(
BasicMenuLayer
*
layer
);
src/buttons_window.c
View file @
a988ce27
...
...
@@ -42,12 +42,12 @@ static void lyr_background_update_proc(Layer *layer, GContext *ctx) {
graphics_fill_rect
(
ctx
,
GRect
(
1
,
101
,
layer_bounds
.
size
.
w
,
48
),
12
,
GCornersLeft
);
graphics_context_set_fill_color
(
ctx
,
GColorWhite
);
graphics_fill_rect
(
ctx
,
GRect
(
layer_bounds
.
size
.
w
-
21
,
2
,
21
,
layer_bounds
.
size
.
h
-
4
),
4
,
GCornersLeft
);
graphics_draw_text
(
ctx
,
data
->
buttons
[
0
].
label
,
fonts_get_system_font
(
FONT_KEY_GOTHIC_24
),
graphics_draw_text
(
ctx
,
data
->
buttons
[
0
].
label
,
fonts_get_system_font
(
FONT_KEY_GOTHIC_24
),
GRect
(
0
,
10
,
layer_bounds
.
size
.
w
-
28
,
16
),
GTextOverflowModeTrailingEllipsis
,
GTextAlignmentRight
,
NULL
);
graphics_draw_text
(
ctx
,
data
->
buttons
[
1
].
label
,
fonts_get_system_font
(
FONT_KEY_GOTHIC_24
),
graphics_draw_text
(
ctx
,
data
->
buttons
[
1
].
label
,
fonts_get_system_font
(
FONT_KEY_GOTHIC_24
),
GRect
(
0
,
59
,
layer_bounds
.
size
.
w
-
28
,
16
),
GTextOverflowModeTrailingEllipsis
,
GTextAlignmentRight
,
NULL
);
graphics_draw_text
(
ctx
,
data
->
buttons
[
2
].
label
,
fonts_get_system_font
(
FONT_KEY_GOTHIC_24
),
graphics_draw_text
(
ctx
,
data
->
buttons
[
2
].
label
,
fonts_get_system_font
(
FONT_KEY_GOTHIC_24
),
GRect
(
0
,
108
,
layer_bounds
.
size
.
w
-
28
,
16
),
GTextOverflowModeTrailingEllipsis
,
GTextAlignmentRight
,
NULL
);
}
...
...
@@ -58,7 +58,7 @@ ButtonsWindow* buttons_window_create() {
button_2
.
label
=
"Button 2"
;
static
struct
ButtonsWindowButton
button_3
;
button_3
.
label
=
"Button 3"
;
buttonsWindowData
.
buttons
[
0
]
=
button_1
;
buttonsWindowData
.
buttons
[
1
]
=
button_2
;
buttonsWindowData
.
buttons
[
2
]
=
button_3
;
...
...
@@ -72,7 +72,7 @@ ButtonsWindow* buttons_window_create() {
s_lyr_background
=
layer_create
(
bounds
);
layer_set_update_proc
(
s_lyr_background
,
lyr_background_update_proc
);
layer_add_child
(
window_layer
,
(
Layer
*
)
s_lyr_background
);
return
window
;
}
...
...
src/common.h
View file @
a988ce27
...
...
@@ -25,7 +25,7 @@
#define MSG_KEY_TITLE 101
#define MSG_KEY_ARTIST 102
#define MSG_KEY_PLAY_STATE 103
// convenient macros courtesy of Matthew Tole: github.com/smallstoneapps/pebble-assist
#define DEBUG(...) app_log(APP_LOG_LEVEL_DEBUG, __FILE__, __LINE__, __VA_ARGS__)
#define INFO(...) app_log(APP_LOG_LEVEL_INFO, __FILE__, __LINE__, __VA_ARGS__)
...
...
@@ -36,4 +36,4 @@ void outbox_send(char* button_code);
void
outbox_send_with_data
(
char
*
send_code
,
char
*
send_data
);
char
*
translate_app_message_result
(
AppMessageResult
app_message_error
);
char
*
split_id_name_pair
(
char
*
pair
);
void
strip_ext
(
char
*
str
);
\ No newline at end of file
void
strip_ext
(
char
*
str
);
src/goto.c
View file @
a988ce27
...
...
@@ -63,10 +63,10 @@ static void initialize_ui(void) {
basic_menu_model_add_item
(
s_model
,
"Video"
,
s_icon_video
,
"GO_VIDEO"
);
basic_menu_model_add_item
(
s_model
,
"Pictures"
,
s_icon_pics
,
"GO_PICS"
);
basic_menu_model_add_item
(
s_model
,
"Weather"
,
s_icon_weather
,
"GO_WEATHER"
);
s_menu
=
basic_menu_layer_create
(
bounds
,
s_model
);
basic_menu_model_set_select_callback
(
s_model
,
menu_select_cb
);
menu_layer_set_click_config_onto_window
(
s_menu
,
s_window
);
layer_add_child
(
window_layer
,
menu_layer_get_layer
(
s_menu
));
}
...
...
@@ -98,4 +98,4 @@ void show_goto(void) {
void
hide_goto
(
void
)
{
window_stack_remove
(
s_window
,
true
);
}
\ No newline at end of file
}
src/main.c
View file @
a988ce27
...
...
@@ -20,7 +20,7 @@
//
#include <pebble.h>
#include "main_menu.h"
static
void
init
()
{
app_message_open
(
app_message_inbox_size_maximum
(),
app_message_outbox_size_maximum
());
show_main_menu
();
...
...
@@ -33,4 +33,4 @@ int main(void) {
init
();
app_event_loop
();
deinit
();
}
\ No newline at end of file
}
src/player.c
View file @
a988ce27
...
...
@@ -21,7 +21,7 @@
#include <pebble.h>
#include "player.h"
#include "common.h"
static
Window
*
s_window
;
static
GBitmap
*
s_icon_vol_up
;
static
GBitmap
*
s_icon_pause
;
...
...
@@ -73,24 +73,24 @@ static void lyr_volume_update_proc(Layer *layer, GContext *ctx) {
static
void
inbox_received_callback
(
DictionaryIterator
*
iterator
,
void
*
context
)
{
uint32_t
*
layer_data
;
Tuple
*
t
=
dict_read_first
(
iterator
);
while
(
t
!=
NULL
)
{
switch
(
t
->
key
)
{
case
MSG_KEY_TITLE
:
case
MSG_KEY_TITLE
:
strncpy
(
s_title
,
t
->
value
->
cstring
,
sizeof
(
s_title
));
text_layer_set_text
(
s_txt_title
,
s_title
);
break
;
case
MSG_KEY_ARTIST
:
case
MSG_KEY_ARTIST
:
strncpy
(
s_artist
,
t
->
value
->
cstring
,
sizeof
(
s_artist
));
text_layer_set_text
(
s_txt_artist
,
s_artist
);
break
;
case
MSG_KEY_VOLUME
:
case
MSG_KEY_VOLUME
:
layer_data
=
(
uint32_t
*
)
layer_get_data
(
s_lyr_volume
);
*
layer_data
=
t
->
value
->
int32
;
layer_mark_dirty
(
s_lyr_volume
);
break
;
case
MSG_KEY_PLAY_STATE
:
case
MSG_KEY_PLAY_STATE
:
if
(
t
->
value
->
int32
>
0
)
{
action_bar_layer_set_icon
(
s_action_bar
,
BUTTON_ID_SELECT
,
s_icon_pause
);
}
else
{
...
...
@@ -113,10 +113,10 @@ static void player_tap_cb(AccelAxisType axis, int32_t direction) {
static
void
window_load
(
Window
*
window
)
{
// window_set_fullscreen(s_window, false);
Layer
*
window_layer
=
window_get_root_layer
(
window
);
GRect
bounds
=
layer_get_frame
(
window_layer
);
s_icon_vol_up
=
gbitmap_create_with_resource
(
RESOURCE_ID_ICON_VOL_UP
);
s_icon_pause
=
gbitmap_create_with_resource
(
RESOURCE_ID_ICON_PAUSE
);
s_icon_play
=
gbitmap_create_with_resource
(
RESOURCE_ID_ICON_PLAY
);
...
...
@@ -159,7 +159,7 @@ static void window_load(Window *window) {
uint32_t
*
len
=
(
uint32_t
*
)
layer_get_data
(
s_lyr_volume
);
*
len
=
0
;
layer_add_child
(
window_layer
,
(
Layer
*
)
s_lyr_volume
);
app_message_register_inbox_received
(
inbox_received_callback
);
app_message_register_inbox_dropped
(
inbox_dropped_callback
);
...
...
src/playlists.c
View file @
a988ce27
...
...
@@ -35,7 +35,7 @@ static DictionaryIterator items_iter;
static
void
lyr_loading_update_proc
(
Layer
*
layer
,
GContext
*
ctx
)
{
GRect
bounds
=
layer_get_bounds
(
layer
);
graphics_fill_rect
(
ctx
,
bounds
,
0
,
GCornerNone
);
graphics_draw_text
(
ctx
,
"Loading..."
,
fonts_get_system_font
(
FONT_KEY_GOTHIC_24_BOLD
),
graphics_draw_text
(
ctx
,
"Loading..."
,
fonts_get_system_font
(
FONT_KEY_GOTHIC_24_BOLD
),
GRect
(
0
,
10
,
bounds
.
size
.
w
,
28
),
GTextOverflowModeTrailingEllipsis
,
GTextAlignmentCenter
,
NULL
);
}
...
...
@@ -111,7 +111,7 @@ void show_playlists(void) {
.
unload
=
handle_window_unload
,
});
window_stack_push
(
s_window
,
true
);
outbox_send
(
"GET_MUSIC_PLAYLISTS"
);
}
...
...
src/power.c
View file @
a988ce27
...
...
@@ -44,7 +44,7 @@ static void initialize_ui(void) {
basic_menu_model_add_item
(
s_model
,
"Reboot"
,
NULL
,
"PWR_REBOOT"
);
basic_menu_model_add_item
(
s_model
,
"Suspend"
,
NULL
,
"PWR_SUSPEND"
);
basic_menu_model_add_item
(
s_model
,
"Hibernate"
,
NULL
,
"PWR_HIBERNATE"
);
s_menu
=
basic_menu_layer_create
(
bounds
,
s_model
);
basic_menu_model_set_select_callback
(
s_model
,
menu_select_cb
);
menu_layer_set_click_config_onto_window
(
s_menu
,
s_window
);
...
...
src/remote.c
View file @
a988ce27
...
...
@@ -63,7 +63,7 @@ static void initialize_ui() {
action_bar_layer_set_icon
(
s_action_bar
,
BUTTON_ID_DOWN
,
s_icon_cursor_down
);
action_bar_layer_set_click_config_provider
(
s_action_bar
,
click_provider
);
layer_add_child
(
window_layer
,
(
Layer
*
)
s_action_bar
);
buttons_window_set_label
(
BUTTON_ID_UP
,
"Up / Left"
);
buttons_window_set_label
(
BUTTON_ID_SELECT
,
"Select / Back"
);
buttons_window_set_label
(
BUTTON_ID_DOWN
,
"Down / Right"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment