summaryrefslogtreecommitdiff
path: root/src/settings.h
blob: 1a9b256746cf9a3abd3cd86af0815c16160d1a24 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/*
Copyright (c) 2008-2012
	Lars-Dominik Braun <lars@6xq.net>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/

#pragma once

#include <stdbool.h>

#include <piano.h>

/* update structure in ui_dispatch.h if you add shortcuts here */
typedef enum {
	BAR_KS_HELP = 0,
	BAR_KS_LOVE = 1,
	BAR_KS_BAN = 2,
	BAR_KS_ADDMUSIC = 3,
	BAR_KS_CREATESTATION = 4,
	BAR_KS_DELETESTATION = 5,
	BAR_KS_EXPLAIN = 6,
	BAR_KS_GENRESTATION = 7,
	BAR_KS_HISTORY = 8,
	BAR_KS_INFO = 9,
	BAR_KS_ADDSHARED = 10,
	BAR_KS_SKIP = 11,
	BAR_KS_PLAYPAUSE = 12,
	BAR_KS_QUIT = 13,
	BAR_KS_RENAMESTATION = 14,
	BAR_KS_SELECTSTATION = 15,
	BAR_KS_TIRED = 16,
	BAR_KS_UPCOMING = 17,
	BAR_KS_SELECTQUICKMIX = 18,
	BAR_KS_DEBUG = 19,
	BAR_KS_BOOKMARK = 20,
	BAR_KS_VOLDOWN = 21,
	BAR_KS_VOLUP = 22,
	BAR_KS_MANAGESTATION = 23,
	BAR_KS_PLAYPAUSE2 = 24,
	BAR_KS_CREATESTATIONFROMSONG = 25,
	BAR_KS_PLAY = 26,
	BAR_KS_PAUSE = 27,
	BAR_KS_VOLRESET = 28,
	BAR_KS_SETTINGS = 29,
	/* insert new shortcuts _before_ this element and increase its value */
	BAR_KS_COUNT = 30,
} BarKeyShortcutId_t;

#define BAR_KS_DISABLED '\x00'

typedef enum {
	BAR_SORT_NAME_AZ = 0,
	BAR_SORT_NAME_ZA = 1,
	BAR_SORT_QUICKMIX_01_NAME_AZ = 2,
	BAR_SORT_QUICKMIX_01_NAME_ZA = 3,
	BAR_SORT_QUICKMIX_10_NAME_AZ = 4,
	BAR_SORT_QUICKMIX_10_NAME_ZA = 5,
	BAR_SORT_COUNT = 6,
} BarStationSorting_t;

typedef struct {
	char *prefix;
	char *postfix;
} BarMsgFormatStr_t;

#include "ui_types.h"

typedef struct {
	bool autoselect;
	unsigned int history, maxRetry, timeout, bufferSecs;
	int volume;
	float gainMul;
	BarStationSorting_t sortOrder;
	PianoAudioQuality_t audioQuality;
	char *username;
	char *password, *passwordCmd;
	char *controlProxy; /* non-american listeners need this */
	char *proxy;
	char *bindTo;
	char *autostartStation;
	char *eventCmd;
	char *loveIcon, *banIcon, *tiredIcon;
	char *atIcon;
	char *npSongFormat;
	char *npStationFormat;
	char *listSongFormat;
	char *fifo;
	char *rpcHost, *rpcTlsPort, *partnerUser, *partnerPassword, *device, *inkey, *outkey, *caBundle;
	char *audioPipe;
	char keys[BAR_KS_COUNT];
	int sampleRate;
	BarMsgFormatStr_t msgFormat[MSG_COUNT];
} BarSettings_t;

#include <piano.h>

void BarSettingsInit (BarSettings_t *);
void BarSettingsDestroy (BarSettings_t *);
void BarSettingsRead (BarSettings_t *);
void BarSettingsWrite (PianoStation_t *, BarSettings_t *);