* Add some more icons for better testing
* Use the country name instead of the language name to identify each icon * Cleanup, fixed copyrights, and some more checks to avoid crashing in case of a missing icon git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36321 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
35ca8fd8aa
commit
0638c3ab4c
BIN
data/artwork/icons/flags/Algeria
Normal file
BIN
data/artwork/icons/flags/Algeria
Normal file
Binary file not shown.
BIN
data/artwork/icons/flags/Antigua_and_Barbuda
Normal file
BIN
data/artwork/icons/flags/Antigua_and_Barbuda
Normal file
Binary file not shown.
BIN
data/artwork/icons/flags/Armenia
Normal file
BIN
data/artwork/icons/flags/Armenia
Normal file
Binary file not shown.
BIN
data/artwork/icons/flags/Austia
Normal file
BIN
data/artwork/icons/flags/Austia
Normal file
Binary file not shown.
BIN
data/artwork/icons/flags/Australia
Normal file
BIN
data/artwork/icons/flags/Australia
Normal file
Binary file not shown.
BIN
data/artwork/icons/flags/Azerbaijan
Normal file
BIN
data/artwork/icons/flags/Azerbaijan
Normal file
Binary file not shown.
BIN
data/artwork/icons/flags/Bahrain
Normal file
BIN
data/artwork/icons/flags/Bahrain
Normal file
Binary file not shown.
@ -91,18 +91,25 @@ BCountry::Code() const
|
||||
status_t
|
||||
BCountry::GetIcon(BBitmap* result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return B_BAD_DATA;
|
||||
// TODO: a proper way to locate the library being used ?
|
||||
BResources storage("/boot/system/lib/liblocale.so");
|
||||
if (storage.InitCheck() != B_OK)
|
||||
return B_ERROR;
|
||||
size_t size;
|
||||
const void* buffer = storage.LoadResource(B_VECTOR_ICON_TYPE, Code(),
|
||||
&size);
|
||||
if (buffer != NULL && size != 0) {
|
||||
return BIconUtils::GetVectorIcon(static_cast<const uint8*>(buffer),
|
||||
size, result);
|
||||
} else
|
||||
return B_BAD_DATA;
|
||||
const char* code = fICULocale->getCountry();
|
||||
if (code != NULL) {
|
||||
printf("this is %s drawing\n",code);
|
||||
const void* buffer = storage.LoadResource(B_VECTOR_ICON_TYPE, code,
|
||||
&size);
|
||||
if (buffer != NULL && size != 0) {
|
||||
puts(" icon found!");
|
||||
return BIconUtils::GetVectorIcon(static_cast<const uint8*>(buffer),
|
||||
size, result);
|
||||
}
|
||||
}
|
||||
return B_BAD_DATA;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,5 +1,97 @@
|
||||
|
||||
resource(2, "fr") #'VICN' array {
|
||||
resource(1, "AG") #'VICN' array {
|
||||
$"6E63696605050003FCD116030072C605FF03CE1126060A041F20D93F20D93F60"
|
||||
$"1F600A20C61FC54BC550C10EC2F1C4A9C3D0C06FC03EC2DBC2ABBF49BE71C029"
|
||||
$"C20CBDCABDCFBCFAC20C37BE71B9CBC2ABBAABC03EB719C3D0B985C2F1B54BC5"
|
||||
$"50B8E6C61FB4A9C6EFB8E6C94EB54BC86FB985CC01B719C994BAABCDCEB9CBCA"
|
||||
$"3337CE70BCFACA33BDCACDCEC029C994BF49CC01C2DBC86FC06FC94EC4A9C6EF"
|
||||
$"C10E0A041FBCFAD93FBCFAD93F601F600A041FC285D93FC285D93F601F600A03"
|
||||
$"1F601F20C61F600A03D93F60D93F20C61F60060A000100023ECAC10000000000"
|
||||
$"003ECAC1BAB068461FBB0A010101023ECAC10000000000003ECAC1BAB068461F"
|
||||
$"BB0A020102023ECAC10000000000003ECAC1BAB068461FBB0A030103023ECAC1"
|
||||
$"0000000000003ECAC1BAB068461FBB0A040104023ECAC10000000000003ECAC1"
|
||||
$"BAB068461FBB0A040105023ECAC10000000000003ECAC1BAB068461FBB"
|
||||
};
|
||||
|
||||
resource(2, "AM") #'VICN' array {
|
||||
$"6E6369660303EF6B00035575C403D81B3E030A04201FE6001FE600CC7F20CC7F"
|
||||
$"0A04201FE6001FE600C3FF20C3FF0A04201FE6001FE600BB7F20BB7F030A0001"
|
||||
$"00023E01B30000000000003E01B3B766E9477C990A010101023E01B300000000"
|
||||
$"00003E01B3B766E9477C990A020102023E01B30000000000003E01B3B766E947"
|
||||
$"7C99"
|
||||
};
|
||||
|
||||
resource(3, "AT") #'VICN' array {
|
||||
$"6E6369660203D81E0505FF020A04201FD9401FD9406020600A0420BB7FD940BB"
|
||||
$"7FD940C3FF20C3FF020A000100023EC1100000000000003EC110B62046467DDF"
|
||||
$"0A010101023EC1100000000000003EC110B62046467DDF"
|
||||
};
|
||||
|
||||
resource(4, "AU") #'VICN' array {
|
||||
$"6E6369660403002B7F050005FF03CE1126110A04201FE6001FE6006020600A0E"
|
||||
$"40C24CBF03C497BCC2C3BDBE17C5BFBC05C6F9BE6BC72FBE17C99240C7D3C168"
|
||||
$"C992C114C72FC37AC6F9C168C5BFC2BDC3BDC07CC4970A0ED8F2C6E9D898C801"
|
||||
$"D785C799D828C88DD72BC923D850C93DD827CA5FD8F2C98BD9BCCA5FD994C93D"
|
||||
$"DAB8C923D9BCC88DDA5EC799D94CC8010A0ED8F2B5BBD898B6D3D785B66BD828"
|
||||
$"B75FD72BB7F5D850B80ED827B931D8F2B85CD9BCB931D994B80EDAB8B7F5D9BC"
|
||||
$"B75FDA5EB66BD94CB6D30A0ED2DFBD7BD285BE93D173BE2BD215BF1FD119BFB5"
|
||||
$"D23DBFCFD21543D2DFC01DD3AA43D381BFCFD4A6BFB5D3A9BF1FD44CBE2BD339"
|
||||
$"BE930A0EDEEABAA2DE90BBBADD7DBB52DE20BC46DD23BCDCDE4839DE20BE19DE"
|
||||
$"EABD44DFB4BE19DF8C39E0B0BCDCDFB4BC46E056BB52DF44BBBA0A0ADBCCBFBF"
|
||||
$"DB85C06DDACAC07BDB59C0F5DB2DC1ABDBCCC148DC6CC1ABDC3FC0F5DCCFC07B"
|
||||
$"DC14C06D0A062040B5D94060B46C6020C9A62020BE530A066040C9A64020B46C"
|
||||
$"2020B5D92060BE530A04BDA020C1E020C1E040BDA0400A0420B74060B74060BB"
|
||||
$"8020BB800A0420B81960B81960BAA620BAA60A04BE7920C10620C10640BE7940"
|
||||
$"0A042040B4E640BD66BB80BB80BB800A04C219B740C400B7406020CA99200A04"
|
||||
$"604060BECCC5E6BB80C400BB800A04202020B3F3B999B740BB80B740110A0001"
|
||||
$"00023E021E0000000000003E021EBABC7E47FB990A020101023E021E00000000"
|
||||
$"00003E021EBABC7E47FB990A020102023E021E0000000000003E021EBABC7E47"
|
||||
$"FB990A020103023E021E0000000000003E021EBABC7E47FB990A020104023E02"
|
||||
$"1E0000000000003E021EBABC7E47FB990A020105023E021E0000000000003E02"
|
||||
$"1EBABC7E47FB990A020106023E021E0000000000003E021EBABC7E47FB990A02"
|
||||
$"0107023E021E0000000000003E021EBABC7E47FB990A020108023E021E000000"
|
||||
$"0000003E021EBABC7E47FB990A020109023E021E0000000000003E021EBABC7E"
|
||||
$"47FB990A02010A023E021E0000000000003E021EBABC7E47FB990A03010B023E"
|
||||
$"021E0000000000003E021EBABC7E47FB990A03010C023E021E0000000000003E"
|
||||
$"021EBABC7E47FB990A03010D023E021E0000000000003E021EBABC7E47FB990A"
|
||||
$"03010E023E021E0000000000003E021EBABC7E47FB990A03010F023E021E0000"
|
||||
$"000000003E021EBABC7E47FB990A030110023E021E0000000000003E021EBABC"
|
||||
$"7E47FB99"
|
||||
};
|
||||
|
||||
resource(5, "AZ") #'VICN' array {
|
||||
$"6E6369660403009E4903D62828030091C905FF060A042020E60020E600602060"
|
||||
$"0A042020E60020E600C40020C4000A042020E60020E600BB8020BB800204CF0C"
|
||||
$"40CF0CC1DCCF0CBDA3CB39BBECCD56BBECC91CBBECC76640C766BDA3C766C1DC"
|
||||
$"CB39C393C91CC393CD56C3930204CF4340CF43C182CF43BDFDCC1338CDD538CA"
|
||||
$"5038C8E340C8E3BDFDC8E3C182CC1348CA5048CDD5480A10CF79C1E0CF11C0BB"
|
||||
$"CDF8C14065C028CD594065BF57CDF8BE3FCF11BEC4CF79BDA0CFE1BEC4D0FABE"
|
||||
$"3FD074BF57D19940D074C028D0FAC140CFE1C0BB060A000100023E0364000000"
|
||||
$"0000003E0364B9640647F9380A010101023E03640000000000003E0364B96406"
|
||||
$"47F9380A020102023E03640000000000003E0364B9640647F9380A030103023E"
|
||||
$"03640000000000003E0364B9640647F9380A010104023E03640000000000003E"
|
||||
$"0364B9640647F9380A030105023E03640000000000003E0364B9640647F938"
|
||||
};
|
||||
|
||||
resource(6, "BH") #'VICN' array {
|
||||
$"6E6369660203CE112605FF020A04201FDD7F1FDD7FCC7F20CC7F0A0D201FBD9F"
|
||||
$"1FC400B58CBD9FB819C400BAA6BD9FBD33C400BFBFBD9FC24CC400C4D9BD9FC7"
|
||||
$"66C400C9F3BD9FCC7F20CC7F020A000100023E850D0000000000003E850DBA86"
|
||||
$"BC46F5E40A010101023E850D0000000000003E850DBA86BC46F5E4"
|
||||
};
|
||||
|
||||
resource(7, "DZ") #'VICN' array {
|
||||
$"6E6369660303007A3D05FF03CE1126040A042020D94020D9406020600A045020"
|
||||
$"D94020D94060506002085030C88530C29B30404040BC3B40C3455050C29B50C8"
|
||||
$"8650CBB3C2D6CA9CC4CCCAC4C40DC7AAC4D958C4D9C4D9C4D9C29040C290C291"
|
||||
$"C290BCEFC7AABAA6C4D9BAA6C94FBAA6CBB1BCA7CAC2BB71CA9ABAB30A0AC9B0"
|
||||
$"BCB7C9B0BF08CBE440C9B0C077C9B0C2C8C853C0E850C19FC77C4050BDE0C853"
|
||||
$"BE97040A000100023EC1460000000000003EC146B68CBF467D730A010101023E"
|
||||
$"C1460000000000003EC146B68CBF467D730A020102023EC1460000000000003E"
|
||||
$"C146B68CBF467D730A020103023EC1460000000000003EC146B68CBF467D73"
|
||||
};
|
||||
|
||||
resource(8, "FR") #'VICN' array {
|
||||
$"6E636966030300335B05FF03D81C3F030A04B2FBB75DCC84B75DCC84C863B2FB"
|
||||
$"C8630A04BB7EB75DCC84B75DCC84C863BB7EC8630A04C401B75DCC84B75DCC84"
|
||||
$"C863C401C863030A000100000A010101000A02010200"
|
||||
|
@ -142,8 +142,6 @@ BLanguage::GetName(BString* name)
|
||||
|
||||
preferredLanguage.FindString("language", 0, &appLanguage);
|
||||
|
||||
printf("lang : %s\n",appLanguage.String());
|
||||
|
||||
UnicodeString s;
|
||||
fICULocale->getDisplayName(Locale(appLanguage), s);
|
||||
BStringByteSink converter(name);
|
||||
|
@ -1,14 +1,20 @@
|
||||
/*
|
||||
* Copyright 2010, Adrien Destugues, pulkomandy@gmail.com
|
||||
* Copyright 2006-2010, Haiku.
|
||||
* All rights reserved. Distributed under the terms of the MIT License.
|
||||
* Authors:
|
||||
* Adrien Destugues <pulkomandy@gmail.com>
|
||||
* Stephan Aßmus <superstippi@gmx.de>
|
||||
*/
|
||||
|
||||
#include "LanguageListView.h"
|
||||
#include "Locale.h"
|
||||
|
||||
#include <Bitmap.h>
|
||||
#include <Country.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <new>
|
||||
|
||||
|
||||
#define MAX_DRAG_HEIGHT 200.0
|
||||
#define ALPHA 170
|
||||
@ -23,8 +29,17 @@ LanguageListItem::LanguageListItem(const char* text, const char* code)
|
||||
// TODO: should probably keep the BCountry as a member of the class
|
||||
BCountry myCountry(code);
|
||||
BRect bounds(0, 0, 15, 15);
|
||||
icon = new BBitmap(bounds, B_RGBA32);
|
||||
myCountry.GetIcon(icon);
|
||||
fIcon = new(std::nothrow) BBitmap(bounds, B_RGBA32);
|
||||
if (fIcon && myCountry.GetIcon(fIcon) != B_OK) {
|
||||
delete fIcon;
|
||||
fIcon = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
LanguageListItem::~LanguageListItem()
|
||||
{
|
||||
delete fIcon;
|
||||
}
|
||||
|
||||
|
||||
@ -56,9 +71,11 @@ LanguageListItem::DrawItem(BView *owner, BRect frame, bool complete)
|
||||
BRect iconFrame(frame);
|
||||
iconFrame.Set(iconFrame.left, iconFrame.top+1, iconFrame.left+15, iconFrame.top+16);
|
||||
|
||||
owner->SetDrawingMode(B_OP_OVER);
|
||||
owner->DrawBitmap(icon, iconFrame);
|
||||
owner->SetDrawingMode(B_OP_COPY);
|
||||
if (fIcon && fIcon->IsValid()) {
|
||||
owner->SetDrawingMode(B_OP_OVER);
|
||||
owner->DrawBitmap(fIcon, iconFrame);
|
||||
owner->SetDrawingMode(B_OP_COPY);
|
||||
}
|
||||
|
||||
frame.left += 16 * (OutlineLevel() + 1);
|
||||
owner->SetHighColor(kBlack);
|
||||
|
@ -1,6 +1,9 @@
|
||||
/*
|
||||
* Copyright 2010, Adrien Destugues, pulkomandy@gmail.com
|
||||
* Copyright 2006-2010, Haiku.
|
||||
* All rights reserved. Distributed under the terms of the MIT License.
|
||||
* Authors:
|
||||
* Adrien Destugues <pulkomandy@gmail.com>
|
||||
* Stephan Aßmus <superstippi@gmx.de>
|
||||
*/
|
||||
|
||||
|
||||
@ -20,19 +23,18 @@ class LanguageListItem: public BStringItem {
|
||||
LanguageListItem(const LanguageListItem& other)
|
||||
:
|
||||
BStringItem(other.Text()),
|
||||
fLanguageCode(other.fLanguageCode)
|
||||
fLanguageCode(other.fLanguageCode),
|
||||
fIcon(other.fIcon)
|
||||
{}
|
||||
|
||||
~LanguageListItem() {};
|
||||
~LanguageListItem();
|
||||
|
||||
const inline BString LanguageCode() { return fLanguageCode; }
|
||||
|
||||
//virtual void Update(BView *owner, const BFont *finfo);
|
||||
virtual void DrawItem(BView *owner, BRect frame, bool complete = false);
|
||||
void DrawItem(BView *owner, BRect frame, bool complete = false);
|
||||
|
||||
private:
|
||||
const BString fLanguageCode;
|
||||
BBitmap* icon;
|
||||
BBitmap* fIcon;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user