6 QString
devpath =
"/var/run/ckb%1";
43 timer->setInterval(1000 / framerate);
45 timer->start(1000 / framerate);
50 QStringList dots = version.replace(QRegExp(
"\\+.+"),
"").replace(QRegExp(
"[^\\d\\.]"),
"").split(
".");
55 foreach(
const QString& dot, dots){
56 res += dot.toFloat() * base;
63 QString rootdev =
devpath.arg(0);
64 QFile connected(rootdev +
"/connected");
65 if(!connected.open(QIODevice::ReadOnly)){
80 QFile version(rootdev +
"/version");
82 if(version.open(QIODevice::ReadOnly)){
83 vString = QString::fromUtf8(version.readLine()).trimmed();
93 QList<QStringList> lines;
95 QString line = connected.readLine().trimmed();
98 QStringList components = line.split(
" ");
99 if(components.length() < 2)
101 lines.append(components);
106 QMutableSetIterator<Kb*> i(
_devices);
109 bool matched =
false;
110 foreach(
const QStringList& line, lines){
111 if(kb->
matches(line[0], line[1])){
126 foreach(
const QStringList& line, lines){
127 bool matched =
false;
129 if(kb->
matches(line[0], line[1])){
137 Kb* kb =
new Kb(
this, line[0]);
146 connect(
_eventTimer, SIGNAL(timeout()), kb, SLOT(frameUpdate()));
147 connect(
_scanTimer, SIGNAL(timeout()), kb, SLOT(autoSave()));
bool matches(const QString &path, const QString &serial)
static QTimer * eventTimer()
static QString _daemonVersion
static float parseVersionString(QString version)
void kbDisconnected(Kb *device)
void kbConnected(Kb *device)
static void init(QString guiVersion)
#define DAEMON_UNAVAILABLE_STR
KbManager(QObject *parent=0)
static QString _guiVersion
static KbManager * _kbManager
static void fps(int framerate)