ckb-next  v0.2.8 at branch master
ckb-next driver for corsair devices
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
KeyMap Class Reference

#include <src/ckb/keymap.h>

+ Collaboration diagram for KeyMap:

Public Types

enum  Model {
  NO_MODEL = -1, K63, K65, K68,
  K70, K95, K95P, STRAFE,
  M65, SABRE, SCIMITAR, HARPOON,
  GLAIVE, _MODEL_MAX
}
 
enum  Layout {
  NO_LAYOUT = -1, DK, EU, EU_DVORAK,
  GB, GB_DVORAK, US, US_DVORAK,
  FR, DE, IT, JP,
  NO, PL, PT_BR, MX,
  ES, SE, _LAYOUT_MAX
}
 

Public Member Functions

bool isISO () const
 
bool isJP () const
 
bool isPTBR () const
 
bool isKeyboard () const
 
bool isMouse () const
 
 KeyMap ()
 
 KeyMap (Model _keyModel, Layout _keyLayout)
 
QString strLayout () const
 
QString strModel () const
 
Model model () const
 
Layout layout () const
 
QString name () const
 
uint count () const
 
uint width () const
 
uint height () const
 
Key key (const QString &name) const
 
Key operator[] (const QString &name) const
 
bool contains (const QString &name) const
 
const QHash< QString, Key > & map () const
 
 operator const QHash< QString, Key > & () const
 
QStringList keys () const
 
QList< Keypositions () const
 
QString toStorage (const QString &name)
 
QString fromStorage (const QString &storage)
 
QStringList byPosition () const
 

Static Public Member Functions

static QStringList layoutNames ()
 
static bool isISO (Layout layout)
 
static bool isJP (Layout layout)
 
static bool isPTBR (Layout layout)
 
static Layout locale ()
 
static bool isKeyboard (Model model)
 
static bool isMouse (Model model)
 
static KeyMap fromName (const QString &name)
 
static Layout getLayout (const QString &name)
 
static QString getLayout (Layout layout)
 
static Model getModel (const QString &name)
 
static QString getModel (Model model)
 
static QString friendlyName (const QString &key, Layout layout=US)
 

Static Private Member Functions

static int modelWidth (Model model)
 
static int modelHeight (Model model)
 

Private Attributes

QHash< QString, Key_keys
 
short keyWidth
 
short keyHeight
 
Model keyModel:8
 
Layout keyLayout:8
 

Detailed Description

Definition at line 49 of file keymap.h.

Member Enumeration Documentation

Enumerator
NO_LAYOUT 
DK 
EU 
EU_DVORAK 
GB 
GB_DVORAK 
US 
US_DVORAK 
FR 
DE 
IT 
JP 
NO 
PL 
PT_BR 
MX 
ES 
SE 
_LAYOUT_MAX 

Definition at line 70 of file keymap.h.

70  {
71  NO_LAYOUT = -1,
72  DK, // Danish
73  EU, // English (EU)
74  EU_DVORAK,
75  GB, // English (UK)
76  GB_DVORAK,
77  US, // English (US)
78  US_DVORAK,
79  FR, // French
80  DE, // German
81  IT, // Italian
82  JP, // Japanese
83  NO, // Norwegian
84  PL, // Polish (identical to US)
85  PT_BR, // Portuguese (Brazil)
86  MX, // Spanish (Mexico/Latin America)
87  ES, // Spanish (Spain)
88  SE, // Swedish
90  };
Enumerator
NO_MODEL 
K63 
K65 
K68 
K70 
K95 
K95P 
STRAFE 
M65 
SABRE 
SCIMITAR 
HARPOON 
GLAIVE 
_MODEL_MAX 

Definition at line 51 of file keymap.h.

51  {
52  NO_MODEL = -1,
53  // Keyboard models
54  K63,
55  K65,
56  K68,
57  K70,
58  K95,
59  K95P,
60  STRAFE,
61  // Mouse models
62  M65,
63  SABRE,
64  SCIMITAR,
65  HARPOON,
66  GLAIVE,
68  };

Constructor & Destructor Documentation

KeyMap::KeyMap ( )

Definition at line 897 of file keymap.cpp.

Referenced by friendlyName(), and fromName().

897  :
898  keyWidth(0), keyHeight(0),
900 {}
short keyHeight
Definition: keymap.h:164
short keyWidth
Definition: keymap.h:164
Layout keyLayout
Definition: keymap.h:166
Model keyModel
Definition: keymap.h:165

+ Here is the caller graph for this function:

KeyMap::KeyMap ( Model  _keyModel,
Layout  _keyLayout 
)

Definition at line 891 of file keymap.cpp.

891  :
892  _keys(getMap(_keyModel, _keyLayout)),
893  keyWidth(modelWidth(_keyModel)), keyHeight(modelHeight(_keyModel)),
894  keyModel(_keyModel), keyLayout(_keyLayout)
895 {}
static QHash< QString, Key > getMap(KeyMap::Model model, KeyMap::Layout layout)
Definition: keymap.cpp:344
short keyHeight
Definition: keymap.h:164
short keyWidth
Definition: keymap.h:164
Layout keyLayout
Definition: keymap.h:166
QHash< QString, Key > _keys
Definition: keymap.h:163
Model keyModel
Definition: keymap.h:165
static int modelWidth(Model model)
Definition: keymap.cpp:842
static int modelHeight(Model model)
Definition: keymap.cpp:869

Member Function Documentation

QStringList KeyMap::byPosition ( ) const

Definition at line 902 of file keymap.cpp.

References Key::x, x, Key::y, and y.

Referenced by RebindWidget::setBind().

902  {
903  // Use QMaps to order the keys
904  QMap<int, QMap<int, QString> > ordered;
905  QHashIterator<QString, Key> i(*this);
906  while(i.hasNext()){
907  i.next();
908  const Key& key = i.value();
909  ordered[key.y][key.x] = i.key();
910  }
911  // Merge them into a single list
912  QStringList result;
913  QMapIterator<int, QMap<int, QString> > y(ordered);
914  while(y.hasNext()){
915  y.next();
916  QMapIterator<int, QString> x(y.value());
917  while(x.hasNext()){
918  x.next();
919  result << x.value();
920  }
921  }
922  return result;
923 }
float y
Definition: main.c:66
float x
Definition: main.c:66
Definition: keymap.h:49
short x
Definition: keymap.h:16
Definition: keymap.h:8
short y
Definition: keymap.h:16

+ Here is the caller graph for this function:

bool KeyMap::contains ( const QString &  name) const
inline

Definition at line 143 of file keymap.h.

References _keys.

Referenced by friendlyName(), and KbAnimWidget::on_keyButton_clicked().

143 { return _keys.contains(name); }
QHash< QString, Key > _keys
Definition: keymap.h:163
QString name() const
Definition: keymap.h:131

+ Here is the caller graph for this function:

uint KeyMap::count ( ) const
inline

Definition at line 134 of file keymap.h.

References _keys.

Referenced by KeyWidget::map(), KbBindWidget::on_copyButton_clicked(), and KbBindWidget::on_resetButton_clicked().

134 { return _keys.count(); }
QHash< QString, Key > _keys
Definition: keymap.h:163

+ Here is the caller graph for this function:

QString KeyMap::friendlyName ( const QString &  key,
Layout  layout = US 
)
static

Definition at line 925 of file keymap.cpp.

References contains(), HARPOON, K95, KeyMap(), M65, map(), SCIMITAR, and STRAFE.

Referenced by KeyAction::friendlyName(), and RebindWidget::RebindWidget().

925  {
926  // Try K95 map first
927  // FIXME: This is an odd function and probably should be refactored
928  // it would probably be best to remove the friendly names from the maps and have a completely separate name->friendlyName store
929  KeyMap map(K95, layout);
930  if(map.contains(key))
931  return map[key].friendlyName();
932 
933  // The only key missing from it should be Fn, which is found on STRAFE
934  map = KeyMap(STRAFE, layout);
935  if(map.contains(key))
936  return map[key].friendlyName();
937 
938  // Additionally, there are a handful of keys not present on any physical keyboard, but we need names for them
939  if(key == "f13" || key == "f14" || key == "f15" || key == "f16" || key == "f17" || key == "f18" || key == "f19" || key == "f20")
940  return key.toUpper();
941  else if(key == "lightup")
942  return "Screen Brightness Up";
943  else if(key == "lightdn")
944  return "Screen Brightness Down";
945  else if(key == "eject" || key == "power")
946  return key[0].toUpper() + key.mid(1); // capitalize first letter
947 
948  // All other names are found on mice
950  if(map.contains(key))
951  return map[key].friendlyName();
952  map = KeyMap(M65, layout);
953  if(map.contains(key))
954  return map[key].friendlyName();
955  map = KeyMap(HARPOON, layout);
956  if(map.contains(key))
957  return map[key].friendlyName();
958 
959  // Not found at all
960  return "";
961 }
KeyMap()
Definition: keymap.cpp:897
static QString friendlyName(const QString &key, Layout layout=US)
Definition: keymap.cpp:925
Definition: keymap.h:49
const QHash< QString, Key > & map() const
Definition: keymap.h:145
Layout layout() const
Definition: keymap.h:130
Definition: keymap.h:49

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

KeyMap KeyMap::fromName ( const QString &  name)
static

Definition at line 835 of file keymap.cpp.

References getLayout(), getModel(), and KeyMap().

Referenced by KbBind::load(), and KbLight::load().

835  {
836  QStringList list = name.trimmed().split(" ");
837  if(list.length() != 2)
838  return KeyMap();
839  return KeyMap(getModel(list[0]), getLayout(list[1]));
840 }
KeyMap()
Definition: keymap.cpp:897
static Model getModel(const QString &name)
Definition: keymap.cpp:775
static Layout getLayout(const QString &name)
Definition: keymap.cpp:677
QString name() const
Definition: keymap.h:131

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

QString KeyMap::fromStorage ( const QString &  storage)
inline

Definition at line 151 of file keymap.h.

Referenced by KbAnim::KbAnim(), KbBind::load(), and KbLight::load().

151 { QHashIterator<QString, Key> i(*this); while(i.hasNext()) { i.next(); const char* s = i.value().storageName(); if(s == storage) return i.value().name; } return storage; }

+ Here is the caller graph for this function:

KeyMap::Layout KeyMap::getLayout ( const QString &  name)
static

Definition at line 677 of file keymap.cpp.

References DE, DK, ES, EU, EU_DVORAK, FR, GB, GB_DVORAK, IT, JP, MX, NO, NO_LAYOUT, PL, PT_BR, SE, US, and US_DVORAK.

Referenced by fromName(), SettingsWidget::on_layoutBox_activated(), SettingsWidget::SettingsWidget(), and strLayout().

677  {
678  QString lower = name.toLower();
679  if(lower == "dk")
680  return DK;
681  if(lower == "eu")
682  return EU;
683  if(lower == "eu_dvorak")
684  return EU_DVORAK;
685  if(lower == "gb_dvorak")
686  return GB_DVORAK;
687  if(lower == "us")
688  return US;
689  if(lower == "us_dvorak")
690  return US_DVORAK;
691  if(lower == "fr")
692  return FR;
693  if(lower == "de")
694  return DE;
695  if(lower == "it")
696  return IT;
697  if(lower == "no")
698  return NO;
699  if(lower == "jp")
700  return JP;
701  if(lower == "pl")
702  return PL;
703  if(lower == "pt_br")
704  return PT_BR;
705  if(lower == "mx")
706  return MX;
707  if(lower == "es")
708  return ES;
709  if(lower == "se")
710  return SE;
711  if(lower == "gb")
712  return GB;
713  return NO_LAYOUT;
714 }
QString name() const
Definition: keymap.h:131

+ Here is the caller graph for this function:

QString KeyMap::getLayout ( KeyMap::Layout  layout)
static

Definition at line 716 of file keymap.cpp.

References DE, DK, ES, EU, EU_DVORAK, FR, GB, GB_DVORAK, IT, JP, MX, NO, PL, PT_BR, SE, US, and US_DVORAK.

716  {
717  switch(layout){
718  case DK:
719  return "dk";
720  case EU:
721  return "eu";
722  case EU_DVORAK:
723  return "eu_dvorak";
724  case GB:
725  return "gb";
726  case GB_DVORAK:
727  return "gb_dvorak";
728  case US:
729  return "us";
730  case US_DVORAK:
731  return "us_dvorak";
732  case FR:
733  return "fr";
734  case DE:
735  return "de";
736  case IT:
737  return "it";
738  case JP:
739  return "jp";
740  case NO:
741  return "no";
742  case PL:
743  return "pl";
744  case PT_BR:
745  return "pt_br";
746  case MX:
747  return "mx";
748  case ES:
749  return "es";
750  case SE:
751  return "se";
752  default:
753  return "";
754  }
755 }
Layout layout() const
Definition: keymap.h:130
KeyMap::Model KeyMap::getModel ( const QString &  name)
static

Definition at line 775 of file keymap.cpp.

References GLAIVE, HARPOON, K63, K65, K68, K70, K95, K95P, M65, NO_MODEL, SABRE, SCIMITAR, and STRAFE.

Referenced by fromName(), Kb::Kb(), and strModel().

775  {
776  QString lower = name.toLower();
777  if(lower == "k63")
778  return K63;
779  if(lower == "k65")
780  return K65;
781  if(lower == "k68")
782  return K68;
783  if(lower == "k70")
784  return K70;
785  if(lower == "k95")
786  return K95;
787  if(lower == "k95p")
788  return K95P;
789  if(lower == "strafe")
790  return STRAFE;
791  if(lower == "m65")
792  return M65;
793  if(lower == "sabre")
794  return SABRE;
795  if(lower == "scimitar")
796  return SCIMITAR;
797  if(lower == "harpoon")
798  return HARPOON;
799  if(lower == "glaive")
800  return GLAIVE;
801  return NO_MODEL;
802 }
QString name() const
Definition: keymap.h:131

+ Here is the caller graph for this function:

QString KeyMap::getModel ( KeyMap::Model  model)
static

Definition at line 804 of file keymap.cpp.

References GLAIVE, HARPOON, K63, K65, K68, K70, K95, K95P, M65, SABRE, SCIMITAR, and STRAFE.

804  {
805  switch(model){
806  case K63:
807  return "k63";
808  case K65:
809  return "k65";
810  case K68:
811  return "k68";
812  case K70:
813  return "k70";
814  case K95:
815  return "k95";
816  case K95P:
817  return "k95P";
818  case STRAFE:
819  return "strafe";
820  case M65:
821  return "m65";
822  case SABRE:
823  return "sabre";
824  case SCIMITAR:
825  return "scimitar";
826  case HARPOON:
827  return "harpoon";
828  case GLAIVE:
829  return "glaive";
830  default:
831  return "";
832  }
833 }
Model model() const
Definition: keymap.h:129
uint KeyMap::height ( ) const
inline

Definition at line 138 of file keymap.h.

References keyHeight.

Referenced by KeyWidget::drawInfo(), and KeyWidget::map().

138 { return keyHeight; }
short keyHeight
Definition: keymap.h:164

+ Here is the caller graph for this function:

static bool KeyMap::isISO ( Layout  layout)
inlinestatic

Definition at line 94 of file keymap.h.

References PL, US, and US_DVORAK.

Referenced by KbBind::isISO(), and RebindWidget::setBind().

94 { return layout != US && layout != US_DVORAK && layout != PL; }
Layout layout() const
Definition: keymap.h:130

+ Here is the caller graph for this function:

bool KeyMap::isISO ( ) const
inline

Definition at line 95 of file keymap.h.

References isISO(), and keyLayout.

Referenced by getMap(), isISO(), Kb::Kb(), and Kb::updateLayout().

95 { return isISO(keyLayout); }
Layout keyLayout
Definition: keymap.h:166
bool isISO() const
Definition: keymap.h:95

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool KeyMap::isJP ( Layout  layout)
inlinestatic

Definition at line 98 of file keymap.h.

References JP.

98 { return layout == JP; }
Layout layout() const
Definition: keymap.h:130
bool KeyMap::isJP ( ) const
inline

Definition at line 99 of file keymap.h.

References isJP(), and keyLayout.

Referenced by getMap(), and isJP().

99 { return isJP(keyLayout); }
Layout keyLayout
Definition: keymap.h:166
bool isJP() const
Definition: keymap.h:99

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool KeyMap::isKeyboard ( Model  model)
inlinestatic

Definition at line 109 of file keymap.h.

References isMouse(), and NO_MODEL.

Referenced by KbBind::isKeyboard().

109 { return !isMouse(model) && model != NO_MODEL; }
bool isMouse() const
Definition: keymap.h:112
Model model() const
Definition: keymap.h:129

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool KeyMap::isKeyboard ( ) const
inline

Definition at line 110 of file keymap.h.

References isKeyboard(), and keyModel.

Referenced by Kb::isKeyboard(), and isKeyboard().

110 { return isKeyboard(keyModel); }
bool isKeyboard() const
Definition: keymap.h:110
Model keyModel
Definition: keymap.h:165

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool KeyMap::isMouse ( Model  model)
inlinestatic

Definition at line 111 of file keymap.h.

References GLAIVE, HARPOON, M65, SABRE, and SCIMITAR.

Referenced by KbBind::isMouse(), KeyWidget::map(), KbLightWidget::newSelection(), and KeyWidget::paintEvent().

111 { return model == M65 || model == SABRE || model == SCIMITAR || model == HARPOON || model == GLAIVE; }
Model model() const
Definition: keymap.h:129

+ Here is the caller graph for this function:

bool KeyMap::isMouse ( ) const
inline

Definition at line 112 of file keymap.h.

References isMouse(), and keyModel.

Referenced by isKeyboard(), Kb::isMouse(), isMouse(), and KeyWidget::paintEvent().

112 { return isMouse(keyModel); }
bool isMouse() const
Definition: keymap.h:112
Model keyModel
Definition: keymap.h:165

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool KeyMap::isPTBR ( Layout  layout)
inlinestatic

Definition at line 102 of file keymap.h.

References PT_BR.

102 { return layout == PT_BR; }
Layout layout() const
Definition: keymap.h:130
bool KeyMap::isPTBR ( ) const
inline

Definition at line 103 of file keymap.h.

References isPTBR(), and keyLayout.

Referenced by getMap(), and isPTBR().

103 { return isPTBR(keyLayout); }
Layout keyLayout
Definition: keymap.h:166
bool isPTBR() const
Definition: keymap.h:103

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Key KeyMap::key ( const QString &  name) const
inline

Definition at line 141 of file keymap.h.

References _keys.

Referenced by AnimScript::begin(), AnimScript::keypress(), KbBind::noAction(), operator[](), KbBind::setAction(), and toStorage().

141 { Key empty = {0,0,0,0,0,0,0,0,0}; return _keys.value(name, empty); }
QHash< QString, Key > _keys
Definition: keymap.h:163
Definition: keymap.h:8
QString name() const
Definition: keymap.h:131

+ Here is the caller graph for this function:

QStringList KeyMap::keys ( ) const
inline

Definition at line 147 of file keymap.h.

References _keys.

Referenced by KeyWidget::mouseReleaseEvent(), KbBindWidget::on_copyButton_clicked(), KbBindWidget::on_resetButton_clicked(), KeyWidget::setAnimation(), KeyWidget::setSelection(), and KbBindWidget::updateBind().

147 { return _keys.keys(); }
QHash< QString, Key > _keys
Definition: keymap.h:163

+ Here is the caller graph for this function:

Layout KeyMap::layout ( ) const
inline

Definition at line 130 of file keymap.h.

References keyLayout.

Referenced by KeyAction::friendlyName(), KeyWidget::paintEvent(), and RebindWidget::setBind().

130 { return keyLayout; }
Layout keyLayout
Definition: keymap.h:166

+ Here is the caller graph for this function:

QStringList KeyMap::layoutNames ( )
static

Definition at line 757 of file keymap.cpp.

Referenced by LayoutDialog::LayoutDialog(), and SettingsWidget::SettingsWidget().

757  {
758  return QStringList()
759  << "Danish"
760  << "English (ISO/European)" << "English (ISO/European, Dvorak)"
761  << "English (United Kingdom)" << "English (United Kingdom, Dvorak)"
762  << "English (United States)" << "English (United States, Dvorak)"
763  << "French"
764  << "German"
765  << "Italian"
766  << "Japanese"
767  << "Norwegian"
768  << "Polish"
769  << "Portuguese (Brazil)"
770  << "Spanish (Latin America)"
771  << "Spanish (Spain)"
772  << "Swedish";
773 }

+ Here is the caller graph for this function:

KeyMap::Layout KeyMap::locale ( )
static

Definition at line 641 of file keymap.cpp.

References DE, DK, ES, FR, GB, IT, JP, MX, NO, PL, PT_BR, SE, and US.

Referenced by SettingsWidget::SettingsWidget().

641  {
642  setlocale(LC_ALL, "");
643  QString loc = setlocale(LC_CTYPE, 0);
644  loc = loc.toLower().replace('_', '-');
645  if(loc.startsWith("dk-"))
646  return KeyMap::DK;
647  else if(loc.startsWith("fr-"))
648  return KeyMap::FR;
649  else if(loc.startsWith("de-"))
650  return KeyMap::DE;
651  else if(loc.startsWith("it-"))
652  return KeyMap::IT;
653  else if(loc.startsWith("ja-"))
654  return KeyMap::JP;
655  else if(loc.startsWith("pl-"))
656  return KeyMap::PL;
657  else if(loc.startsWith("pt-br"))
658  return KeyMap::PT_BR;
659  else if(loc.startsWith("no-"))
660  return KeyMap::NO;
661  else if(loc.startsWith("es-es"))
662  // Spain uses the ES layout
663  return KeyMap::ES;
664  else if(loc.startsWith("es-"))
665  // Other Spanish locales use MX
666  return KeyMap::MX;
667  else if(loc.startsWith("se-"))
668  return KeyMap::SE;
669  else if(loc.startsWith("en-us") || loc.startsWith("en-au") || loc.startsWith("en-ca") || loc.startsWith("en-hk") || loc.startsWith("en-in") || loc.startsWith("en-nz") || loc.startsWith("en-ph") || loc.startsWith("en-sg") || loc.startsWith("en-za"))
670  // Most English locales use US
671  return KeyMap::US;
672  else
673  // Default to GB
674  return KeyMap::GB;
675 }

+ Here is the caller graph for this function:

const QHash<QString, Key>& KeyMap::map ( ) const
inline

Definition at line 145 of file keymap.h.

References _keys.

Referenced by friendlyName().

145 { return _keys; }
QHash< QString, Key > _keys
Definition: keymap.h:163

+ Here is the caller graph for this function:

Model KeyMap::model ( ) const
inline

Definition at line 129 of file keymap.h.

References keyModel.

Referenced by KeyWidget::mouseMoveEvent(), KeyWidget::paintEvent(), and KPerfWidget::setPerf().

129 { return keyModel; }
Model keyModel
Definition: keymap.h:165

+ Here is the caller graph for this function:

int KeyMap::modelHeight ( Model  model)
staticprivate

Definition at line 869 of file keymap.cpp.

References GLAIVE, HARPOON, K63, K65, K68, K70, K95, K95_HEIGHT, K95P, K95P_HEIGHT, M65, M65_HEIGHT, SABRE, SCIMITAR, and STRAFE.

869  {
870  switch(model){
871  case K63:
872  case K65:
873  case K68:
874  case K70:
875  case K95:
876  case STRAFE:
877  return K95_HEIGHT;
878  case K95P:
879  return K95P_HEIGHT;
880  case M65:
881  case SABRE:
882  case SCIMITAR:
883  case HARPOON:
884  case GLAIVE:
885  return M65_HEIGHT;
886  default:
887  return 0;
888  }
889 }
#define K95P_HEIGHT
Definition: keymap.cpp:215
#define K95_HEIGHT
Definition: keymap.cpp:213
Model model() const
Definition: keymap.h:129
#define M65_HEIGHT
Definition: keymap.cpp:273
int KeyMap::modelWidth ( Model  model)
staticprivate

Definition at line 842 of file keymap.cpp.

References GLAIVE, HARPOON, K63, K63_WIDTH, K65, K65_WIDTH, K68, K68_WIDTH, K70, K70_WIDTH, K95, K95_WIDTH, K95P, K95P_WIDTH, KSTRAFE_WIDTH, M65, M65_WIDTH, SABRE, SCIMITAR, and STRAFE.

842  {
843  switch(model){
844  case K63:
845  return K63_WIDTH;
846  case K65:
847  return K65_WIDTH;
848  case K68:
849  return K68_WIDTH;
850  case K70:
851  return K70_WIDTH;
852  case K95:
853  return K95_WIDTH;
854  case K95P:
855  return K95P_WIDTH;
856  case STRAFE:
857  return KSTRAFE_WIDTH;
858  case M65:
859  case SABRE:
860  case SCIMITAR:
861  case HARPOON:
862  case GLAIVE:
863  return M65_WIDTH;
864  default:
865  return 0;
866  }
867 }
#define K95P_WIDTH
Definition: keymap.cpp:217
#define K70_WIDTH
Definition: keymap.cpp:221
#define K68_WIDTH
Definition: keymap.cpp:224
#define K63_WIDTH
Definition: keymap.cpp:232
#define KSTRAFE_WIDTH
Definition: keymap.cpp:252
#define K95_WIDTH
Definition: keymap.cpp:212
#define K65_WIDTH
Definition: keymap.cpp:228
#define M65_WIDTH
Definition: keymap.cpp:272
Model model() const
Definition: keymap.h:129
QString KeyMap::name ( ) const
inline

Definition at line 131 of file keymap.h.

References strLayout(), and strModel().

Referenced by KbBind::save(), KbLight::save(), and toStorage().

131 { return (strModel() + " " + strLayout()).toUpper(); }
QString strLayout() const
Definition: keymap.h:122
QString strModel() const
Definition: keymap.h:126

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

KeyMap::operator const QHash< QString, Key > & ( ) const
inline

Definition at line 146 of file keymap.h.

References _keys.

146 { return _keys; }
QHash< QString, Key > _keys
Definition: keymap.h:163
Key KeyMap::operator[] ( const QString &  name) const
inline

Definition at line 142 of file keymap.h.

References key().

142 { return key(name); }
Key key(const QString &name) const
Definition: keymap.h:141
QString name() const
Definition: keymap.h:131

+ Here is the call graph for this function:

QList<Key> KeyMap::positions ( ) const
inline

Definition at line 148 of file keymap.h.

References _keys.

Referenced by ColorMap::init(), and KeyWidget::selectAll().

148 { return _keys.values(); }
QHash< QString, Key > _keys
Definition: keymap.h:163

+ Here is the caller graph for this function:

QString KeyMap::strLayout ( ) const
inline

Definition at line 122 of file keymap.h.

References getLayout(), and keyLayout.

Referenced by name().

122 { return getLayout(keyLayout); }
Layout keyLayout
Definition: keymap.h:166
static Layout getLayout(const QString &name)
Definition: keymap.cpp:677

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

QString KeyMap::strModel ( ) const
inline

Definition at line 126 of file keymap.h.

References getModel(), and keyModel.

Referenced by name().

126 { return getModel(keyModel); }
static Model getModel(const QString &name)
Definition: keymap.cpp:775
Model keyModel
Definition: keymap.h:165

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

QString KeyMap::toStorage ( const QString &  name)
inline

Definition at line 150 of file keymap.h.

References key(), name(), and Key::storageName().

150 { const char* storage = key(name).storageName(); if(!storage) return name; return storage; }
Key key(const QString &name) const
Definition: keymap.h:141
const char * storageName() const
Definition: keymap.h:11
QString name() const
Definition: keymap.h:131

+ Here is the call graph for this function:

uint KeyMap::width ( ) const
inline

Definition at line 136 of file keymap.h.

References keyWidth.

Referenced by KeyWidget::drawInfo(), and KeyWidget::map().

136 { return keyWidth; }
short keyWidth
Definition: keymap.h:164

+ Here is the caller graph for this function:

Field Documentation

QHash<QString, Key> KeyMap::_keys
private
short KeyMap::keyHeight
private

Definition at line 164 of file keymap.h.

Referenced by height().

Layout KeyMap::keyLayout
private

Definition at line 166 of file keymap.h.

Referenced by isISO(), isJP(), isPTBR(), layout(), and strLayout().

Model KeyMap::keyModel
private

Definition at line 165 of file keymap.h.

Referenced by isKeyboard(), isMouse(), model(), and strModel().

short KeyMap::keyWidth
private

Definition at line 164 of file keymap.h.

Referenced by width().


The documentation for this class was generated from the following files: