ckb-next
v0.2.8 at branch master
ckb-next driver for corsair devices
|
#include <src/ckb/kb.h>
Public Slots | |
void | frameUpdate () |
void | autoSave () |
Signals | |
void | infoUpdated () |
void | profileAdded () |
void | profileRenamed () |
void | modeRenamed () |
void | profileChanged () |
void | modeChanged (bool spontaneous) |
void | fwUpdateProgress (int current, int total) |
void | fwUpdateFinished (bool succeeded) |
Public Member Functions | |
KeyMap::Model | model () const |
bool | isKeyboard () const |
bool | isMouse () const |
KbProfile * | hwProfile () |
void | hwProfile (KbProfile *newHwProfile) |
void | fwUpdate (const QString &path) |
KbProfile * | currentProfile () |
const QList< KbProfile * > & | profiles () const |
void | profiles (const QList< KbProfile * > &newProfiles) |
void | appendProfile (KbProfile *newProfile) |
int | indexOf (KbProfile *profile) |
KbProfile * | find (const QUuid &id) |
KbMode * | currentMode () |
KbLight * | currentLight () |
KbBind * | currentBind () |
KbPerf * | currentPerf () |
void | setCurrentProfile (KbProfile *profile, bool spontaneous=true) |
void | setCurrentMode (KbProfile *profile, KbMode *mode, bool spontaneous=true) |
void | setCurrentMode (KbProfile *profile, int index, bool spontaneous=true) |
void | setCurrentMode (KbMode *mode, bool spontaneous=true) |
KbProfile * | newProfile () |
KbProfile * | newProfile (KbProfile *other) |
KbMode * | newMode () |
KbMode * | newMode (KbMode *other) |
void | load () |
void | save () |
bool | needsSave () const |
void | hwSave () |
int | getMacroNumber () |
For usage with macro definions, these two params must only be readable. So there are no setters. More... | |
QString | getMacroPath () |
getMacroPath returns the macroPath (e.g. /dev/input/ckb1/notify), which we have saved in the constructor. For usage with macro definions, this param must only be readable. So there is no setter. More... | |
~Kb () | |
Static Public Member Functions | |
static int | frameRate () |
static void | frameRate (int newFrameRate) |
static KeyMap::Layout | layout () |
static void | layout (KeyMap::Layout newLayout) |
static bool | dither () |
static void | dither (bool newDither) |
static bool | macroDelay () |
static void | macroDelay (bool flag) |
Kb::macroDelay handles the UI-Element macroBox. Sends a command to the keyboard to switch on or off the delay function on very large macros. More... | |
static bool | mouseAccel () |
static void | mouseAccel (bool newAccel) |
static int | scrollSpeed () |
static void | scrollSpeed (int newSpeed) |
Data Fields | |
QString | usbModel |
QString | usbSerial |
QString | features |
QString | firmware |
QString | pollrate |
bool | monochrome |
int | hwModeCount |
Static Public Attributes | |
static const int | HWMODE_MAX = 3 |
Private Slots | |
void | readNotify (QString line) |
void | deleteHw () |
void | deletePrevious () |
Private Member Functions | |
Kb (QObject *parent, const QString &path) | |
bool | isOpen () const |
bool | matches (const QString &path, const QString &serial) |
void | updateLayout () |
void | writeProfileHeader () |
KeyMap | getKeyMap () |
void | run () |
Private Attributes | |
QString | devpath |
pathVars devpath is the device root path (e.g. /dev/device/ckb1), cmdpath leads to the daemon input pipe for daemon commands, notifyPath is the standard input monitor for general purpose, macroPath added for a second thread to read macro input. More... | |
QString | cmdpath |
QString | notifyPath |
QString | macroPath |
KbProfile * | _currentProfile |
QList< KbProfile * > | _profiles |
KbMode * | _currentMode |
KeyMap::Model | _model |
bool | iState [KbPerf::HW_I_COUNT] |
QString | prefsPath |
quint64 | lastAutoSave |
QString | fwUpdPath |
KbProfile * | _hwProfile |
KbProfile * | prevProfile |
KbMode * | prevMode |
QFile | cmd |
int | notifyNumber |
notifyNumber is the trailing number in the device path. More... | |
int | macroNumber |
bool | _needsSave |
bool | hwLoading [HWMODE_MAX+1] |
Static Private Attributes | |
static KeyMap::Layout | _layout = KeyMap::NO_LAYOUT |
static int | _frameRate = 30 |
static int | _scrollSpeed = 0 |
static bool | _dither = false |
static bool | _mouseAccel = true |
static bool | _delay = false |
Friends | |
class | KbManager |
Kb::~Kb | ( | ) |
<
Definition at line 141 of file kb.cpp.
References activeDevices, isOpen(), macroPath, notifyNumber, notifyPaths, and save().
|
private |
<
Definition at line 19 of file kb.cpp.
References _delay, _dither, _frameRate, _layout, _mouseAccel, _scrollSpeed, activeDevices, cmdpath, features, firmware, KeyMap::getModel(), hwLoading, hwModeCount, infoUpdated(), KeyMap::isISO(), iState, KeyMap::K95, macroNumber, macroPath, monochrome, KeyMap::NO_MODEL, notifyNumber, notifyPath, notifyPathMutex, notifyPaths, pollrate, prefsPath, usbModel, and usbSerial.
|
inline |
Definition at line 60 of file kb.h.
References _needsSave, and _profiles.
Referenced by KbProfileDialog::on_profileList_itemClicked().
|
slot |
Definition at line 289 of file kb.cpp.
References CkbSettings::isBusy(), lastAutoSave, needsSave(), and save().
|
inline |
Definition at line 67 of file kb.h.
References _currentMode, and KbMode::bind().
Referenced by KbWidget::modeChanged().
|
inline |
Definition at line 66 of file kb.h.
References _currentMode, and KbMode::light().
Referenced by KbWidget::modeChanged().
|
inline |
Definition at line 65 of file kb.h.
References _currentMode.
Referenced by KbWidget::modeChanged().
|
inline |
Definition at line 68 of file kb.h.
References _currentMode, and KbMode::perf().
Referenced by KbWidget::modeChanged().
|
inline |
Definition at line 56 of file kb.h.
References _currentProfile.
Referenced by KeyAction::keyEvent(), KbWidget::modeChanged(), KbWidget::modeIcon(), KbWidget::modesList_reordered(), KbWidget::on_modesList_currentItemChanged(), KbWidget::on_modesList_customContextMenuRequested(), KbWidget::on_modesList_itemClicked(), KbProfileDialog::on_profileList_customContextMenuRequested(), KbProfileDialog::on_profileList_itemChanged(), KbWidget::profileChanged(), KbProfileDialog::repopulate(), and KbWidget::updateProfileList().
|
privateslot |
Definition at line 441 of file kb.cpp.
References _hwProfile.
Referenced by hwProfile().
|
privateslot |
Definition at line 426 of file kb.cpp.
References prevMode.
Referenced by frameUpdate(), and hwSave().
|
inlinestatic |
Definition at line 33 of file kb.h.
References _dither.
Referenced by ExtraSettingsWidget::ExtraSettingsWidget(), and ExtraSettingsWidget::on_ditherBox_clicked().
|
static |
|
inline |
Definition at line 62 of file kb.h.
References _profiles, UsbId::guid, and KbProfile::id().
Referenced by KbProfileDialog::on_profileList_currentItemChanged(), KbProfileDialog::on_profileList_customContextMenuRequested(), and KbProfileDialog::profileList_reordered().
|
inlinestatic |
Definition at line 27 of file kb.h.
References _frameRate.
Referenced by ExtraSettingsWidget::ExtraSettingsWidget(), and ExtraSettingsWidget::on_fpsBox_valueChanged().
|
static |
Definition at line 165 of file kb.cpp.
References _frameRate, activeDevices, cmd, and KbManager::fps().
|
slot |
Definition at line 375 of file kb.cpp.
References _currentMode, _currentProfile, KbPerf::applyIndicators(), KbMode::bind(), KbLight::close(), deletePrevious(), KbLight::frameUpdate(), KbProfile::indexOf(), KbLight::isStarted(), iState, KbMode::light(), monochrome, notifyNumber, KbLight::open(), KbMode::perf(), prevMode, prevProfile, KbBind::update(), KbPerf::update(), and writeProfileHeader().
void Kb::fwUpdate | ( | const QString & | path | ) |
Definition at line 365 of file kb.cpp.
References fwUpdPath, and notifyNumber.
Referenced by FwUpgradeDialog::on_actionButton_clicked().
|
signal |
Definition at line 277 of file moc_kb.cpp.
Referenced by readNotify().
|
signal |
Definition at line 270 of file moc_kb.cpp.
Referenced by readNotify().
|
private |
Definition at line 756 of file kb.cpp.
References _layout.
Referenced by hwSave(), load(), newMode(), newProfile(), readNotify(), setCurrentProfile(), and updateLayout().
|
inline |
getMacroNumber returns the macroNumber, which we have saved in the constructor. For usage with macro definions, this param must only be readable. So there is no setter.
Definition at line 97 of file kb.h.
References macroNumber.
Referenced by KbBind::getMacroNumber().
|
inline |
Definition at line 106 of file kb.h.
References macroPath.
Referenced by KbBind::getMacroPath().
|
inline |
Definition at line 46 of file kb.h.
References _hwProfile.
Referenced by hwSave(), KbWidget::modeIcon(), KbProfileDialog::on_profileList_customContextMenuRequested(), readNotify(), KbProfileDialog::repopulate(), and KbWidget::updateProfileList().
void Kb::hwProfile | ( | KbProfile * | newHwProfile | ) |
Definition at line 431 of file kb.cpp.
References _hwProfile, and deleteHw().
void Kb::hwSave | ( | ) |
Definition at line 297 of file kb.cpp.
References _currentMode, _currentProfile, _hwProfile, KbProfile::append(), KbLight::base(), KbLight::close(), deletePrevious(), getKeyMap(), UsbId::guidString(), hwModeCount, UsbId::hwModified, hwProfile(), KbProfile::id(), KbMode::id(), KbMode::light(), KbProfile::modeCount(), KbProfile::modes(), UsbId::modified, UsbId::modifiedString(), monochrome, KbMode::name(), notifyNumber, KbMode::perf(), prevMode, KbProfile::setNeedsSave(), KbMode::setNeedsSave(), KbPerf::update(), and writeProfileHeader().
Referenced by KbWidget::on_hwSaveButton_clicked(), and KbProfileDialog::on_profileList_customContextMenuRequested().
|
inline |
Definition at line 61 of file kb.h.
References _profiles.
Referenced by KbProfileDialog::on_profileList_customContextMenuRequested().
|
signal |
Definition at line 233 of file moc_kb.cpp.
Referenced by Kb(), load(), and updateLayout().
|
inline |
Definition at line 23 of file kb.h.
References KeyMap::isKeyboard().
Referenced by KbWidget::KbWidget().
|
inline |
Definition at line 24 of file kb.h.
References KeyMap::isMouse().
Referenced by KbWidget::KbWidget(), and readNotify().
|
inlineprivate |
Definition at line 147 of file kb.h.
Referenced by KbManager::scanKeyboards(), and ~Kb().
|
inlinestatic |
Definition at line 30 of file kb.h.
References _layout.
Referenced by LayoutDialog::LayoutDialog(), SettingsWidget::on_layoutBox_activated(), and SettingsWidget::SettingsWidget().
|
static |
Definition at line 177 of file kb.cpp.
References _layout, activeDevices, KeyMap::NO_LAYOUT, and updateLayout().
void Kb::load | ( | ) |
Definition at line 241 of file kb.cpp.
References _needsSave, _profiles, current, getKeyMap(), infoUpdated(), prefsPath, profileAdded(), setCurrentProfile(), and CkbSettings::value().
Referenced by KbManager::scanKeyboards().
|
inlinestatic |
Definition at line 36 of file kb.h.
References _delay.
Referenced by ExtraSettingsWidget::ExtraSettingsWidget(), and ExtraSettingsWidget::on_delayBox_clicked().
|
static |
flag | true: Switch on delay function, else switch off |
Definition at line 787 of file kb.cpp.
References _delay, activeDevices, and cmd.
|
inlineprivate |
|
signal |
Definition at line 263 of file moc_kb.cpp.
Referenced by setCurrentMode().
|
inline |
|
signal |
Definition at line 251 of file moc_kb.cpp.
Referenced by readNotify().
|
inlinestatic |
Definition at line 39 of file kb.h.
References _mouseAccel.
Referenced by ExtraSettingsWidget::ExtraSettingsWidget(), and ExtraSettingsWidget::on_mAccelBox_clicked().
|
static |
bool Kb::needsSave | ( | ) | const |
Definition at line 344 of file kb.cpp.
References _needsSave, _profiles, and KbProfile::needsSave().
Referenced by autoSave().
|
inline |
Definition at line 79 of file kb.h.
References getKeyMap().
Referenced by KbWidget::on_modesList_customContextMenuRequested(), and KbWidget::on_modesList_itemClicked().
Definition at line 80 of file kb.h.
References getKeyMap().
|
inline |
Definition at line 77 of file kb.h.
References getKeyMap().
Referenced by KbProfileDialog::on_profileList_customContextMenuRequested(), KbProfileDialog::on_profileList_itemClicked(), and readNotify().
Definition at line 78 of file kb.h.
References getKeyMap().
|
signal |
Definition at line 239 of file moc_kb.cpp.
Referenced by load(), and readNotify().
|
signal |
Definition at line 257 of file moc_kb.cpp.
Referenced by readNotify(), and setCurrentMode().
|
signal |
Definition at line 245 of file moc_kb.cpp.
Referenced by readNotify().
|
inline |
Definition at line 58 of file kb.h.
References _profiles.
Referenced by KbWidget::on_profileBox_activated(), KbProfileDialog::on_profileList_customContextMenuRequested(), KbProfileDialog::profileList_reordered(), KbProfileDialog::repopulate(), and KbWidget::updateProfileList().
|
inline |
|
privateslot |
Definition at line 471 of file kb.cpp.
References _currentMode, _currentProfile, _hwProfile, _needsSave, _profiles, KbPerf::angleSnap(), KbLight::animKeypress(), KbProfile::append(), KbPerf::baseDpiIdx(), KbMode::bind(), KbLight::color(), KbPerf::dpi(), KbPerf::DPI_COUNT, KbPerf::dpiColor(), KbPerf::dpiEnabled(), fwUpdateFinished(), fwUpdateProgress(), fwUpdPath, getKeyMap(), UsbId::guid, hwLoading, HWMODE_MAX, hwModeCount, UsbId::hwModifiedString(), hwProfile(), KbProfile::id(), KbMode::id(), KbProfile::indexOf(), isMouse(), iState, KbBind::keyEvent(), KbPerf::liftHeight(), KbMode::light(), KbProfile::modeCount(), modeRenamed(), KbProfile::modes(), UsbId::modifiedString(), KbProfile::move(), KbProfile::name(), KbMode::name(), newProfile(), notifyNumber, KbMode::perf(), profileAdded(), profileChanged(), profileRenamed(), setCurrentProfile(), KbProfile::setNeedsSave(), KbMode::setNeedsSave(), x, and y.
|
private |
void Kb::save | ( | ) |
Definition at line 273 of file kb.cpp.
References _currentProfile, _needsSave, _profiles, UsbId::guidString(), KbProfile::id(), prefsPath, KbProfile::save(), and CkbSettings::setValue().
Referenced by autoSave(), KbWidget::on_hwSaveButton_clicked(), KbManager::scanKeyboards(), and ~Kb().
|
inlinestatic |
Definition at line 42 of file kb.h.
References _scrollSpeed.
Referenced by ExtraSettingsWidget::ExtraSettingsWidget(), ExtraSettingsWidget::on_sAccelBox_clicked(), and ExtraSettingsWidget::on_sSpeedBox_valueChanged().
|
static |
Definition at line 769 of file kb.cpp.
References _currentMode, _currentProfile, _needsSave, KbProfile::currentMode(), modeChanged(), and profileChanged().
Referenced by KeyAction::keyEvent(), KbWidget::on_modesList_currentItemChanged(), KbWidget::on_modesList_customContextMenuRequested(), KbWidget::on_modesList_itemClicked(), and setCurrentProfile().
|
inline |
Definition at line 73 of file kb.h.
References KbProfile::modes(), and setCurrentMode().
Referenced by setCurrentMode().
|
inline |
Definition at line 74 of file kb.h.
References _currentProfile, and setCurrentMode().
Referenced by setCurrentMode().
void Kb::setCurrentProfile | ( | KbProfile * | profile, |
bool | spontaneous = true |
||
) |
Definition at line 760 of file kb.cpp.
References KbProfile::append(), KbProfile::currentMode(), getKeyMap(), hwModeCount, KbProfile::modeCount(), KbProfile::modes(), and setCurrentMode().
Referenced by load(), KbWidget::on_profileBox_activated(), KbProfileDialog::on_profileList_currentItemChanged(), KbProfileDialog::on_profileList_customContextMenuRequested(), KbProfileDialog::on_profileList_itemClicked(), and readNotify().
|
private |
Definition at line 186 of file kb.cpp.
References _currentProfile, _hwProfile, _layout, _profiles, KbLight::close(), getKeyMap(), infoUpdated(), KeyMap::isISO(), KbProfile::keyMap(), KbMode::light(), and KbProfile::modes().
Referenced by layout().
|
private |
Definition at line 354 of file kb.cpp.
References _currentProfile, UsbId::guidString(), KbProfile::id(), UsbId::modifiedString(), and KbProfile::name().
Referenced by frameUpdate(), and hwSave().
|
private |
Definition at line 169 of file kb.h.
Referenced by currentBind(), currentLight(), currentMode(), currentPerf(), frameUpdate(), hwSave(), readNotify(), and setCurrentMode().
|
private |
Definition at line 167 of file kb.h.
Referenced by currentProfile(), frameUpdate(), hwSave(), readNotify(), save(), setCurrentMode(), updateLayout(), and writeProfileHeader().
|
staticprivate |
Definition at line 198 of file kb.h.
Referenced by Kb(), and macroDelay().
|
staticprivate |
|
staticprivate |
Definition at line 164 of file kb.h.
Referenced by frameRate(), and Kb().
|
private |
Definition at line 183 of file kb.h.
Referenced by deleteHw(), hwProfile(), hwSave(), readNotify(), and updateLayout().
|
staticprivate |
Definition at line 161 of file kb.h.
Referenced by getKeyMap(), Kb(), layout(), and updateLayout().
|
private |
|
staticprivate |
Definition at line 165 of file kb.h.
Referenced by Kb(), and mouseAccel().
|
private |
Definition at line 201 of file kb.h.
Referenced by appendProfile(), load(), needsSave(), profiles(), readNotify(), save(), and setCurrentMode().
|
private |
Definition at line 168 of file kb.h.
Referenced by appendProfile(), find(), indexOf(), load(), needsSave(), profiles(), readNotify(), save(), and updateLayout().
|
staticprivate |
Definition at line 164 of file kb.h.
Referenced by Kb(), and scrollSpeed().
|
private |
Definition at line 191 of file kb.h.
Referenced by dither(), frameRate(), macroDelay(), mouseAccel(), and scrollSpeed().
QString Kb::features |
Definition at line 18 of file kb.h.
Referenced by MainWindow::checkFwUpdates(), FwUpgradeDialog::exec(), Kb(), KbWidget::KbWidget(), KbWidget::on_fwUpdButton_clicked(), and KbWidget::updateFwButton().
QString Kb::firmware |
Definition at line 18 of file kb.h.
Referenced by MainWindow::checkFwUpdates(), KbWidget::devUpdate(), FwUpgradeDialog::FwUpgradeDialog(), Kb(), KbWidget::on_fwUpdButton_clicked(), and KbWidget::updateFwButton().
|
private |
Definition at line 181 of file kb.h.
Referenced by fwUpdate(), and readNotify().
|
private |
Definition at line 205 of file kb.h.
Referenced by Kb(), and readNotify().
|
static |
Definition at line 50 of file kb.h.
Referenced by KbPerf::applyIndicators(), and readNotify().
int Kb::hwModeCount |
Definition at line 49 of file kb.h.
Referenced by hwSave(), Kb(), KbWidget::modeIcon(), KbWidget::on_modesList_customContextMenuRequested(), readNotify(), and setCurrentProfile().
|
private |
Definition at line 174 of file kb.h.
Referenced by frameUpdate(), Kb(), and readNotify().
|
private |
Definition at line 178 of file kb.h.
Referenced by autoSave().
|
private |
Definition at line 196 of file kb.h.
Referenced by getMacroNumber(), and Kb().
|
private |
Definition at line 155 of file kb.h.
Referenced by getMacroPath(), Kb(), and ~Kb().
bool Kb::monochrome |
Definition at line 19 of file kb.h.
Referenced by frameUpdate(), hwSave(), Kb(), and KbWidget::KbWidget().
|
private |
Definition at line 194 of file kb.h.
Referenced by frameUpdate(), fwUpdate(), hwSave(), Kb(), readNotify(), and ~Kb().
QString Kb::pollrate |
Definition at line 18 of file kb.h.
Referenced by KbWidget::devUpdate(), and Kb().
|
private |
|
private |
Definition at line 186 of file kb.h.
Referenced by deletePrevious(), frameUpdate(), and hwSave().
|
private |
Definition at line 185 of file kb.h.
Referenced by frameUpdate().
QString Kb::usbModel |
Definition at line 16 of file kb.h.
Referenced by FwUpgradeDialog::FwUpgradeDialog(), Kb(), KbWidget::name(), and MainWindow::showFwUpdateNotification().
QString Kb::usbSerial |
Definition at line 16 of file kb.h.
Referenced by KbWidget::devUpdate(), Kb(), and matches().