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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
crate::ix!();
//-------------------------------------------[.cpp/bitcoin/src/qt/networkstyle.h]
/**
| Coin network-specific GUI style information
|
*/
pub struct NetworkStyle {
app_name: String,
app_icon: QIcon,
tray_and_window_icon: QIcon,
title_add_text: String,
}
impl NetworkStyle {
pub fn get_app_name(&self) -> &String {
todo!();
/*
return appName;
*/
}
pub fn get_app_icon(&self) -> &QIcon {
todo!();
/*
return appIcon;
*/
}
pub fn get_tray_and_window_icon(&self) -> &QIcon {
todo!();
/*
return trayAndWindowIcon;
*/
}
pub fn get_title_add_text(&self) -> &String {
todo!();
/*
return titleAddText;
*/
}
/**
| titleAddText needs to be const char*
| for tr()
|
*/
pub fn new(
app_name: &String,
icon_color_hue_shift: i32,
icon_color_saturation_reduction: i32,
title_add_text: *const u8) -> Self {
todo!();
/*
:
appName(_appName),
titleAddText(qApp->translate("SplashScreen", _titleAddText))
// load pixmap
QPixmap pixmap(":/icons/bitcoin");
if(iconColorHueShift != 0 && iconColorSaturationReduction != 0)
{
// generate QImage from QPixmap
QImage img = pixmap.toImage();
int h,s,l,a;
// traverse though lines
for(int y=0;y<img.height();y++)
{
QRgb *scL = reinterpret_cast< QRgb *>( img.scanLine( y ) );
// loop through pixels
for(int x=0;x<img.width();x++)
{
// preserve alpha because QColor::getHsl doesn't return the alpha value
a = qAlpha(scL[x]);
QColor col(scL[x]);
// get hue value
col.getHsl(&h,&s,&l);
// rotate color on RGB color circle
// 70° should end up with the typical "testnet" green
h+=iconColorHueShift;
// change saturation value
if(s>iconColorSaturationReduction)
{
s -= iconColorSaturationReduction;
}
col.setHsl(h,s,l,a);
// set the pixel
scL[x] = col.rgba();
}
}
//convert back to QPixmap
pixmap.convertFromImage(img);
}
appIcon = QIcon(pixmap);
trayAndWindowIcon = QIcon(pixmap.scaled(QSize(256,256)));
*/
}
/**
| Get style associated with provided
| network id, or 0 if not known
|
*/
pub fn instantiate(&mut self, network_id: &String) -> *const NetworkStyle {
todo!();
/*
std::string titleAddText = networkId == CBaseChainParams::MAIN ? "" : strprintf("[%s]", networkId);
for (const auto& network_style : network_styles) {
if (networkId == network_style.networkId) {
return new NetworkStyle(
network_style.appName,
network_style.iconColorHueShift,
network_style.iconColorSaturationReduction,
titleAddText.c_str());
}
}
return nullptr;
*/
}
}
//-------------------------------------------[.cpp/bitcoin/src/qt/networkstyle.cpp]
pub struct NetworkStyleDescriptor {
network_id: *const u8,
app_name: *const u8,
icon_color_hue_shift: i32,
icon_color_saturation_reduction: i32,
}
lazy_static!{
/*
network_styles[] = {
{"main", QAPP_APP_NAME_DEFAULT, 0, 0},
{"test", QAPP_APP_NAME_TESTNET, 70, 30},
{"signet", QAPP_APP_NAME_SIGNET, 35, 15},
{"regtest", QAPP_APP_NAME_REGTEST, 160, 30},
};
*/
}