1/*
2 * Copyright 2018-2024, 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
8enum {
9	MSG_PACKAGE_ACTION_DONE					= 'mpad',
10	MSG_BULK_LOAD_DONE						= 'mmwd',
11	MSG_MAIN_WINDOW_CLOSED					= 'mwcl',
12	MSG_PACKAGE_SELECTED					= 'pkgs',
13	MSG_PACKAGE_WORKER_BUSY					= 'pkwb',
14	MSG_PACKAGE_WORKER_IDLE					= 'pkwi',
15	MSG_CLIENT_TOO_OLD						= 'oldc',
16	MSG_NETWORK_TRANSPORT_ERROR				= 'nett',
17	MSG_SERVER_ERROR						= 'svre',
18	MSG_SERVER_DATA_CHANGED					= 'svdc',
19	MSG_ALERT_SIMPLE_ERROR					= 'nser',
20	MSG_DID_ADD_USER_RATING					= 'adur',
21	MSG_DID_UPDATE_USER_RATING				= 'upur',
22	MSG_LANGUAGE_SELECTED					= 'lngs',
23	MSG_VIEW_LATEST_USER_USAGE_CONDITIONS	= 'vluc',
24	MSG_VIEW_USERS_USER_USAGE_CONDITIONS	= 'vuuc',
25	MSG_USER_USAGE_CONDITIONS_DATA			= 'uucd',
26	MSG_USER_USAGE_CONDITIONS_ERROR			= 'uuce',
27	MSG_USER_USAGE_CONDITIONS_NOT_LATEST	= 'uucl',
28	MSG_LOG_OUT								= 'lgot',
29	MSG_PKG_INSTALL							= 'pkgi',
30	MSG_PKG_UNINSTALL						= 'pkgu',
31	MSG_PKG_OPEN							= 'pkgo'
32};
33
34enum BitmapSize {
35	BITMAP_SIZE_16							= 0,
36	BITMAP_SIZE_22							= 1,
37	BITMAP_SIZE_32							= 2,
38	BITMAP_SIZE_64							= 3,
39	BITMAP_SIZE_ANY							= 4
40};
41
42// when somebody rates a package, there is a numerical
43// rating which is expressed in a float 0 --> 5.  This
44// is visualized by a series of colored stars.  These
45// constants are related to the geometry of the layout
46// of the stars.
47
48#define SIZE_RATING_STAR					16.0
49#define WIDTH_RATING_STAR_SPACING			2.0
50#define BOUNDS_RATING						BRect(0, 0, \
51	5 * SIZE_RATING_STAR + 4 * WIDTH_RATING_STAR_SPACING, \
52	SIZE_RATING_STAR)
53
54#define RATING_MISSING						-1.0f
55#define RATING_MIN							0.0f
56
57
58#define kProgressIndeterminate				-1.0f
59
60
61#define RGB_COLOR_WHITE						(rgb_color) { 255, 255, 255, 255 }
62
63
64#define HD_ERROR_BASE						(B_ERRORS_END + 1)
65#define HD_NETWORK_INACCESSIBLE				(HD_ERROR_BASE + 1)
66#define HD_CLIENT_TOO_OLD					(HD_ERROR_BASE + 2)
67#define HD_ERR_NOT_MODIFIED					(HD_ERROR_BASE + 3)
68#define HD_ERR_NO_DATA						(HD_ERROR_BASE + 4)
69
70
71#define REPOSITORY_NAME_SYSTEM				"system"
72#define REPOSITORY_NAME_INSTALLED			"installed"
73
74
75#define KEY_ALERT_TEXT						"alert_text"
76#define KEY_ALERT_TITLE						"alert_title"
77#define KEY_ALERT_TYPE						"alert_type"
78#define KEY_WORK_STATUS_TEXT				"work_status_text"
79#define KEY_WORK_STATUS_PROGRESS			"work_status_progress"
80#define KEY_WINDOW_SETTINGS					"window_settings"
81#define KEY_MAIN_SETTINGS					"main_settings"
82#define KEY_PACKAGE_NAME					"package_name"
83#define KEY_TITLE							"title"
84#define KEY_DESKBAR_LINK					"deskbar_link"
85
86
87#define SETTING_SHOW_AVAILABLE_PACKAGES			"show available packages"
88#define SETTING_SHOW_INSTALLED_PACKAGES			"show installed packages"
89#define SETTING_SHOW_DEVELOP_PACKAGES			"show develop packages"
90#define SETTING_SHOW_SOURCE_PACKAGES			"show source packages"
91#define SETTING_CAN_SHARE_ANONYMOUS_USER_DATA	"can share anonymous usage data"
92#define SETTING_PACKAGE_LIST_VIEW_MODE			"packageListViewMode"
93	// unfortunately historical difference in casing.
94
95
96// These constants reference resources in 'HaikuDepot.ref'
97enum {
98	RSRC_STAR_BLUE							= 510,
99	RSRC_STAR_GREY							= 520,
100	RSRC_INSTALLED							= 530,
101	RSRC_ARROW_LEFT							= 540,
102	RSRC_ARROW_RIGHT						= 550,
103};
104
105
106enum UserUsageConditionsSelectionMode {
107	LATEST									= 1,
108	USER									= 2,
109	FIXED									= 3
110		// means that the user usage conditions are supplied to the window.
111};
112
113
114#define LANGUAGE_DEFAULT_ID "en"
115#define LANGUAGE_DEFAULT Language(LANGUAGE_DEFAULT_ID, "English", true)
116
117
118#define PACKAGE_INFO_MAX_USER_RATINGS 250
119
120#define STR_MDASH "\xE2\x80\x94"
121
122#define ALERT_MSG_LOGS_USER_GUIDE "\nInformation about how to view the logs " \
123	"is available in the HaikuDepot section of the Haiku User Guide."
124
125#define CACHE_DIRECTORY_APP "HaikuDepot"
126
127#define PROMINANCE_ORDERING_PROMINENT_MAX	200
128	// any prominence ordering value greater than this is not prominent.
129#define PROMINANCE_ORDERING_MAX				1000
130	// this is the highest prominence value possible.
131
132#endif // HAIKU_DEPOT_CONSTANTS_H
133