| 1 | # | ||||||||||||
| 2 | # This file is part of App-KeePass2 | ||||||||||||
| 3 | # | ||||||||||||
| 4 | # This software is copyright (c) 2013 by celogeek <me@celogeek.com>. | ||||||||||||
| 5 | # | ||||||||||||
| 6 | # This is free software; you can redistribute it and/or modify it under | ||||||||||||
| 7 | # the same terms as the Perl 5 programming language system itself. | ||||||||||||
| 8 | # | ||||||||||||
| 9 | package App::KeePass2::Icons; | ||||||||||||
| 10 | |||||||||||||
| 11 | # ABSTRACT: Built in icon pack from app KeePass2 | ||||||||||||
| 12 | 3 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 13 | 3 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 14 | |||||||||||||
| 15 | 3 | our $VERSION = '0.04'; # VERSION | |||||||||||
| 16 | 3 | ▶ | use utf8::all; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 17 | 3 | ▶ | use Moo::Role; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 18 | |||||||||||||
| 19 | 3 | has '_icons' => ( is => 'lazy', ); | |||||||||||
| 20 | |||||||||||||
| 21 | 3 | has '_icon_id_to_key' => ( is => 'lazy', ); | |||||||||||
| 22 | |||||||||||||
| 23 | 1 | ▶ | sub _build__icons { | ||||||||||
|
Subroutine
_build__icons: called CC=1 SCAR=0.0
| |||||||||||||
| 24 | return { | ||||||||||||
| 25 | 1 | key => { id => 0, utf8 => "🔑" }, | |||||||||||
| 26 | internet => { id => 1, utf8 => "🌍" }, | ||||||||||||
| 27 | warning => { id => 2, utf8 => "🚧" }, | ||||||||||||
| 28 | network => { id => 3, utf8 => "💻" }, | ||||||||||||
| 29 | note => { id => 4, utf8 => "📝" }, | ||||||||||||
| 30 | talk => { id => 5, utf8 => "💬" }, | ||||||||||||
| 31 | cube => { id => 6, utf8 => "⬜" }, | ||||||||||||
| 32 | note2 => { id => 7, utf8 => "📄" }, | ||||||||||||
| 33 | internet2 => { id => 8, utf8 => "🌎" }, | ||||||||||||
| 34 | card => { id => 9, utf8 => "💳" }, | ||||||||||||
| 35 | note3 => { id => 10, utf8 => "📄" }, | ||||||||||||
| 36 | camera => { id => 11, utf8 => "📷" }, | ||||||||||||
| 37 | wifi => { id => 12, utf8 => "📡" }, | ||||||||||||
| 38 | key2 => { id => 13, utf8 => "🔐" }, | ||||||||||||
| 39 | wire => { id => 14, utf8 => "🔌" }, | ||||||||||||
| 40 | scan => { id => 15, utf8 => "📇" }, | ||||||||||||
| 41 | internet3 => { id => 16, utf8 => "🌏" }, | ||||||||||||
| 42 | disk => { id => 17, utf8 => "💿" }, | ||||||||||||
| 43 | computer => { id => 18, utf8 => "💻" }, | ||||||||||||
| 44 | email => { id => 19, utf8 => "📨" }, | ||||||||||||
| 45 | setting => { id => 20, utf8 => "🔧" }, | ||||||||||||
| 46 | note4 => { id => 21, utf8 => "📃" }, | ||||||||||||
| 47 | server => { id => 22, utf8 => "💻" }, | ||||||||||||
| 48 | screen => { id => 23, utf8 => "💻" }, | ||||||||||||
| 49 | wire2 => { id => 24, utf8 => "⚡" }, | ||||||||||||
| 50 | email2 => { id => 25, utf8 => "📨" }, | ||||||||||||
| 51 | disk2 => { id => 26, utf8 => "💾" }, | ||||||||||||
| 52 | network2 => { id => 27, utf8 => "💻" }, | ||||||||||||
| 53 | video => { id => 28, utf8 => "📹" }, | ||||||||||||
| 54 | key3 => { id => 29, utf8 => "🔐" }, | ||||||||||||
| 55 | terminal => { id => 30, utf8 => "📺" }, | ||||||||||||
| 56 | printer => { id => 31, utf8 => "📠" }, | ||||||||||||
| 57 | cube2 => { id => 32, utf8 => "🔳" }, | ||||||||||||
| 58 | cube3 => { id => 33, utf8 => "🔲" }, | ||||||||||||
| 59 | key4 => { id => 34, utf8 => "🔐" }, | ||||||||||||
| 60 | network3 => { id => 35, utf8 => "💻" }, | ||||||||||||
| 61 | zip => { id => 36, utf8 => "💼" }, | ||||||||||||
| 62 | pourcentage => { id => 37, utf8 => "%" }, | ||||||||||||
| 63 | smb => { id => 38, utf8 => "💻" }, | ||||||||||||
| 64 | time => { id => 39, utf8 => "⏰" }, | ||||||||||||
| 65 | search => { id => 40, utf8 => "🔍" }, | ||||||||||||
| 66 | dress => { id => 41, utf8 => "👗" }, | ||||||||||||
| 67 | memory => { id => 42, utf8 => "📼" }, | ||||||||||||
| 68 | bin => { id => 43, utf8 => "🚽" }, | ||||||||||||
| 69 | sticker => { id => 44, utf8 => "📋" }, | ||||||||||||
| 70 | forbid => { id => 45, utf8 => "❌" }, | ||||||||||||
| 71 | help => { id => 46, utf8 => "❓" }, | ||||||||||||
| 72 | pack => { id => 47, utf8 => "🎒" }, | ||||||||||||
| 73 | folder => { id => 48, utf8 => "📕" }, | ||||||||||||
| 74 | folder2 => { id => 49, utf8 => "📗" }, | ||||||||||||
| 75 | zip2 => { id => 50, utf8 => "👜" }, | ||||||||||||
| 76 | unlock => { id => 51, utf8 => "🔓" }, | ||||||||||||
| 77 | lock => { id => 52, utf8 => "🔒" }, | ||||||||||||
| 78 | valid => { id => 53, utf8 => "☑" }, | ||||||||||||
| 79 | ink => { id => 54, utf8 => "✒" }, | ||||||||||||
| 80 | picture => { id => 55, utf8 => "🎑" }, | ||||||||||||
| 81 | note5 => { id => 56, utf8 => "📑" }, | ||||||||||||
| 82 | card2 => { id => 57, utf8 => "💴" }, | ||||||||||||
| 83 | key5 => { id => 58, utf8 => "🔐" }, | ||||||||||||
| 84 | tools => { id => 59, utf8 => "🔧" }, | ||||||||||||
| 85 | home => { id => 60, utf8 => "🏡" }, | ||||||||||||
| 86 | star => { id => 61, utf8 => "⭐" }, | ||||||||||||
| 87 | linux => { id => 62, utf8 => "🐧" }, | ||||||||||||
| 88 | ink2 => { id => 63, utf8 => "🔏" }, | ||||||||||||
| 89 | apple => { id => 64, utf8 => "🍏" }, | ||||||||||||
| 90 | word => { id => 65, utf8 => "W" }, | ||||||||||||
| 91 | dollar => { id => 66, utf8 => "💰" }, | ||||||||||||
| 92 | card3 => { id => 67, utf8 => "💵" }, | ||||||||||||
| 93 | phone => { id => 68, utf8 => "📱" }, | ||||||||||||
| 94 | }; | ||||||||||||
| 95 | } | ||||||||||||
| 96 | |||||||||||||
| 97 | 1 | ▶ | sub _build__icon_id_to_key { | ||||||||||
|
Subroutine
_build__icon_id_to_key: called CC=2 SCAR=6.9
| |||||||||||||
| 98 | 1 | my ($self) = @_; | |||||||||||
| 99 | 1 | my @res; | |||||||||||
| 100 | |||||||||||||
| 101 | 1 | for my $key ( keys %{ $self->_icons } ) { | |||||||||||
| 102 | 69 | $res[ $self->_icons->{$key}->{id} ] = $key; | |||||||||||
| 103 | } | ||||||||||||
| 104 | |||||||||||||
| 105 | 1 | return \@res; | |||||||||||
| 106 | } | ||||||||||||
| 107 | |||||||||||||
| 108 | 69 | ▶ | sub get_icon_id_from_key { | ||||||||||
|
Subroutine
get_icon_id_from_key: called CC=2 SCAR=7.2
Pod
documented
| |||||||||||||
| 109 | 69 | my ( $self, $key ) = @_; | |||||||||||
| 110 | 69 | ▶ | return $self->_icons->{$key}->{id} // 0; | ||||||||||
|
Condition50%1/2
$self->_icons->{$key}{"id"} // 0
MC/DC0%0/1
$self->_icons->{$key}{"id"} // 0
$self->_icons->{$key}{"id"}
Truth table50%1/2
A
A= $self->_icons->{$key}{"id"}
| |||||||||||||
| 111 | } | ||||||||||||
| 112 | |||||||||||||
| 113 | 69 | ▶ | sub get_icon_key_from_id { | ||||||||||
|
Subroutine
get_icon_key_from_id: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 114 | 69 | my ( $self, $id ) = @_; | |||||||||||
| 115 | 69 | return $self->_icon_id_to_key->[$id]; | |||||||||||
| 116 | } | ||||||||||||
| 117 | |||||||||||||
| 118 | 69 | ▶ | sub get_icon_char_from_key { | ||||||||||
|
Subroutine
get_icon_char_from_key: called CC=2 SCAR=7.2
Pod
documented
| |||||||||||||
| 119 | 69 | my ( $self, $key ) = @_; | |||||||||||
| 120 | 69 | ▶ | return $self->_icons->{$key}->{utf8} // 0; | ||||||||||
|
Condition50%1/2
$self->_icons->{$key}{"utf8"} // 0
MC/DC0%0/1
$self->_icons->{$key}{"utf8"} // 0
$self->_icons->{$key}{"utf8"}
Truth table50%1/2
A
A= $self->_icons->{$key}{"utf8"}
| |||||||||||||
| 121 | } | ||||||||||||
| 122 | |||||||||||||
| 123 | 3 | 1; | |||||||||||
| 124 | |||||||||||||
| 125 | __END__ | ||||||||||||