xref: /haiku/src/apps/haikudepot/HaikuDepotConstants.h (revision 68ea01249e1e2088933cb12f9c28d4e5c5d1c9ef)
1 /*
2  * Copyright 2018-2020, Andrew Lindesay <apl@lindesay.co.nz>.
3  * All rights reserved. Distributed under the terms of the MIT License.
4  */
5 #ifndef HAIKU_DEPOT_CONSTANTS_H
6 #define HAIKU_DEPOT_CONSTANTS_H
7 
8 enum {
9 	MSG_BULK_LOAD_DONE						= 'mmwd',
10 	MSG_MAIN_WINDOW_CLOSED					= 'mwcl',
11 	MSG_PACKAGE_SELECTED					= 'pkgs',
12 	MSG_PACKAGE_WORKER_BUSY					= 'pkwb',
13 	MSG_PACKAGE_WORKER_IDLE					= 'pkwi',
14 	MSG_CLIENT_TOO_OLD						= 'oldc',
15 	MSG_NETWORK_TRANSPORT_ERROR				= 'nett',
16 	MSG_SERVER_ERROR						= 'svre',
17 	MSG_SERVER_DATA_CHANGED					= 'svdc',
18 	MSG_ALERT_SIMPLE_ERROR					= 'nser',
19 	MSG_DID_ADD_USER_RATING					= 'adur',
20 	MSG_DID_UPDATE_USER_RATING				= 'upur',
21 	MSG_LANGUAGE_SELECTED					= 'lngs',
22 	MSG_VIEW_LATEST_USER_USAGE_CONDITIONS	= 'vluc',
23 	MSG_VIEW_USERS_USER_USAGE_CONDITIONS	= 'vuuc',
24 	MSG_USER_USAGE_CONDITIONS_DATA			= 'uucd',
25 	MSG_USER_USAGE_CONDITIONS_ERROR			= 'uuce',
26 	MSG_USER_USAGE_CONDITIONS_NOT_LATEST	= 'uucl',
27 	MSG_LOG_OUT								= 'lgot',
28 };
29 
30 // when somebody rates a package, there is a numerical
31 // rating which is expressed in a float 0 --> 5.  This
32 // is visualized by a series of colored stars.  These
33 // constants are related to the geometry of the layout
34 // of the stars.
35 
36 #define SIZE_RATING_STAR				16.0
37 #define WIDTH_RATING_STAR_SPACING		2.0
38 #define BOUNDS_RATING					BRect(0, 0, \
39 	5 * SIZE_RATING_STAR + 4 * WIDTH_RATING_STAR_SPACING, \
40 	SIZE_RATING_STAR)
41 
42 #define RATING_MISSING					-1.0f
43 #define RATING_MIN						0.0f
44 
45 
46 #define RGB_COLOR_WHITE						(rgb_color) { 255, 255, 255, 255 }
47 
48 
49 #define HD_ERROR_BASE						(B_ERRORS_END + 1)
50 #define HD_NETWORK_INACCESSIBLE				(HD_ERROR_BASE + 1)
51 #define HD_CLIENT_TOO_OLD					(HD_ERROR_BASE + 2)
52 #define HD_ERR_NOT_MODIFIED					(HD_ERROR_BASE + 3)
53 #define HD_ERR_NO_DATA						(HD_ERROR_BASE + 4)
54 
55 
56 #define REPOSITORY_NAME_SYSTEM			"system"
57 #define REPOSITORY_NAME_INSTALLED		"installed"
58 
59 
60 #define KEY_ALERT_TEXT					"alert_text"
61 #define KEY_ALERT_TITLE					"alert_title"
62 #define KEY_WORK_STATUS_TEXT			"work_status_text"
63 #define KEY_WORK_STATUS_PROGRESS		"work_status_progress"
64 #define KEY_WINDOW_SETTINGS				"window_settings"
65 #define KEY_MAIN_SETTINGS				"main_settings"
66 
67 
68 // These constants reference resources in 'HaikuDepot.ref'
69 enum {
70 	RSRC_STAR_BLUE		= 510,
71 	RSRC_STAR_GREY		= 520,
72 	RSRC_INSTALLED		= 530,
73 	RSRC_ARROW_LEFT		= 540,
74 	RSRC_ARROW_RIGHT	= 550,
75 };
76 
77 
78 enum UserUsageConditionsSelectionMode {
79 	LATEST		= 1,
80 	USER		= 2,
81 	FIXED		= 3
82 		// means that the user usage conditions are supplied to the window.
83 };
84 
85 #define LANGUAGE_DEFAULT_CODE "en"
86 #define LANGUAGE_DEFAULT Language(LANGUAGE_DEFAULT_CODE, "English", true)
87 
88 
89 #define PACKAGE_INFO_MAX_USER_RATINGS 250
90 
91 #define STR_MDASH "\xE2\x80\x94"
92 
93 #define ALERT_MSG_LOGS_USER_GUIDE "\nInformation about how to view the logs is " \
94 	"available in the HaikuDepot section of the user guide."
95 
96 #define CACHE_DIRECTORY_APP "HaikuDepot"
97 
98 #endif // HAIKU_DEPOT_CONSTANTS_H