xref: /haiku/src/apps/haikudepot/HaikuDepotConstants.h (revision 8c78892580f132d10e624aef96f835df8d94bf19)
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 enum BitmapSize {
31 	BITMAP_SIZE_16							= 0,
32 	BITMAP_SIZE_22							= 1,
33 	BITMAP_SIZE_32							= 2,
34 	BITMAP_SIZE_64							= 3,
35 	BITMAP_SIZE_ANY							= 4
36 };
37 
38 // when somebody rates a package, there is a numerical
39 // rating which is expressed in a float 0 --> 5.  This
40 // is visualized by a series of colored stars.  These
41 // constants are related to the geometry of the layout
42 // of the stars.
43 
44 #define SIZE_RATING_STAR				16.0
45 #define WIDTH_RATING_STAR_SPACING		2.0
46 #define BOUNDS_RATING					BRect(0, 0, \
47 	5 * SIZE_RATING_STAR + 4 * WIDTH_RATING_STAR_SPACING, \
48 	SIZE_RATING_STAR)
49 
50 #define RATING_MISSING					-1.0f
51 #define RATING_MIN						0.0f
52 
53 
54 #define RGB_COLOR_WHITE						(rgb_color) { 255, 255, 255, 255 }
55 
56 
57 #define HD_ERROR_BASE						(B_ERRORS_END + 1)
58 #define HD_NETWORK_INACCESSIBLE				(HD_ERROR_BASE + 1)
59 #define HD_CLIENT_TOO_OLD					(HD_ERROR_BASE + 2)
60 #define HD_ERR_NOT_MODIFIED					(HD_ERROR_BASE + 3)
61 #define HD_ERR_NO_DATA						(HD_ERROR_BASE + 4)
62 
63 
64 #define REPOSITORY_NAME_SYSTEM			"system"
65 #define REPOSITORY_NAME_INSTALLED		"installed"
66 
67 
68 #define KEY_ALERT_TEXT					"alert_text"
69 #define KEY_ALERT_TITLE					"alert_title"
70 #define KEY_WORK_STATUS_TEXT			"work_status_text"
71 #define KEY_WORK_STATUS_PROGRESS		"work_status_progress"
72 #define KEY_WINDOW_SETTINGS				"window_settings"
73 #define KEY_MAIN_SETTINGS				"main_settings"
74 
75 
76 // These constants reference resources in 'HaikuDepot.ref'
77 enum {
78 	RSRC_STAR_BLUE		= 510,
79 	RSRC_STAR_GREY		= 520,
80 	RSRC_INSTALLED		= 530,
81 	RSRC_ARROW_LEFT		= 540,
82 	RSRC_ARROW_RIGHT	= 550,
83 };
84 
85 
86 enum UserUsageConditionsSelectionMode {
87 	LATEST		= 1,
88 	USER		= 2,
89 	FIXED		= 3
90 		// means that the user usage conditions are supplied to the window.
91 };
92 
93 #define LANGUAGE_DEFAULT_CODE "en"
94 #define LANGUAGE_DEFAULT Language(LANGUAGE_DEFAULT_CODE, "English", true)
95 
96 
97 #define PACKAGE_INFO_MAX_USER_RATINGS 250
98 
99 #define STR_MDASH "\xE2\x80\x94"
100 
101 #define ALERT_MSG_LOGS_USER_GUIDE "\nInformation about how to view the logs " \
102 	"is available in the HaikuDepot section of the user guide."
103 
104 #define CACHE_DIRECTORY_APP "HaikuDepot"
105 
106 #define PROMINANCE_ORDERING_PROMINENT_MAX	200
107 	// any prominence ordering value greater than this is not prominent.
108 #define PROMINANCE_ORDERING_MAX				1000
109 	// this is the highest prominence value possible.
110 
111 #endif // HAIKU_DEPOT_CONSTANTS_H