void MarSystemQtWrapper::emitTrackedControls() { // FIXME: this is not safe, because the mutex is not held while the MarSystem is ticked. mutex_.lock(); QVector<MarControlPtr>::iterator vsi; for (vsi = tracked_controls_.begin(); vsi != tracked_controls_.end(); ++vsi) { emit ctrlChanged(*vsi); } mutex_.unlock(); }
keymapping::keymapping(QObject *parent) : QObject(parent) { pressedCode = 0; shift = new modifierHandler("shift"); ctrl = new modifierHandler("ctrl"); alt = new modifierHandler("alt"); sym = new modifierHandler("sym"); connect(shift, SIGNAL(changed()), this, SIGNAL(shiftChanged())); connect(ctrl, SIGNAL(changed()), this, SIGNAL(ctrlChanged())); connect(alt, SIGNAL(changed()), this, SIGNAL(altChanged())); connect(sym, SIGNAL(changed()), this, SIGNAL(symChanged())); }
MarLpcWindow::MarLpcWindow() { frequencyPole_ = 0; amplitudePole_ = .85; QWidget *w = new QWidget; setCentralWidget(w); createActions(); createMenus(); QLabel *breathinessLabel = new QLabel("breathiness"); breathinessSlider_ = new QSlider(Qt::Horizontal); QLabel *cutOffLabel = new QLabel("cutOff"); QSlider *cutOffSlider = new QSlider(Qt::Horizontal); QLabel *frequencyPoleLabel1 = new QLabel("frequencyPole"); QLabel *frequencyPoleLabel2 = new QLabel("frequencyPole"); frequencyPoleSlider_ = new QSlider(Qt::Horizontal); QLabel *amplitudePoleLabel1 = new QLabel("amplitudePole"); QLabel *amplitudePoleLabel2 = new QLabel("amplitudePole"); amplitudePoleSlider_ = new QSlider(Qt::Horizontal); QLabel *tiltLabel = new QLabel("Tilt"); tiltSlider_ = new QSlider(Qt::Horizontal); QLabel *posLabel = new QLabel("Pos"); posSlider_ = new QSlider(Qt::Horizontal); breathinessLabel->setMinimumWidth(150); cutOffLabel->setMinimumWidth(150); frequencyPoleSlider_->setValue(50); amplitudePoleSlider_->setValue(50); tiltSlider_->setValue(50); createNetwork(); QGridLayout *gridLayout = new QGridLayout; gridLayout->addWidget(breathinessLabel, 0, 0); gridLayout->addWidget(breathinessSlider_, 1, 0); gridLayout->addWidget(tiltLabel, 0, 1); gridLayout->addWidget(tiltSlider_, 1, 1); gridLayout->addWidget(frequencyPoleLabel1, 2, 0); gridLayout->addWidget(frequencyPoleSlider_, 3, 0); gridLayout->addWidget(amplitudePoleLabel1, 2, 1); gridLayout->addWidget(amplitudePoleSlider_, 3, 1); gridLayout->addWidget(posLabel, 5, 0); gridLayout->addWidget(posSlider_, 6, 0); gridLayout->addWidget(posControl_, 6, 1); gridLayout->addWidget(frequencyPoleControl_, 4, 0); gridLayout->addWidget(amplitudePoleControl_, 4, 1); connect(breathinessSlider_, SIGNAL(valueChanged(int)), this, SLOT(breathinessChanged(int))); connect(cutOffSlider, SIGNAL(valueChanged(int)), this, SLOT(cutOffChanged(int))); connect(frequencyPoleSlider_, SIGNAL(valueChanged(int)), this, SLOT(frequencyPoleChanged(int))); connect(amplitudePoleSlider_, SIGNAL(valueChanged(int)), this, SLOT(amplitudePoleChanged(int))); connect(tiltSlider_, SIGNAL(valueChanged(int)), this, SLOT(tiltChanged(int))); connect(posSlider_, SIGNAL(sliderReleased()), this, SLOT(posChanged())); connect(mwr_, SIGNAL(ctrlChanged(MarControlPtr)), this, SLOT(ctrlChanged(MarControlPtr))); w->setLayout(gridLayout); startNetwork(); }
/* Main */ Tohkbd::Tohkbd(QObject *parent) : QObject(parent) { dbusRegistered = false; interruptsEnabled = false; vddEnabled = false; capsLockSeq = 0; vkbLayoutIsTohkbd = false; currentActiveLayout = QString(); currentOrientationLock = QString(); keypadIsPresent = false; gpio_fd = -1; displayIsOn = false; keyIsPressed = false; keyRepeat = false; slideEventEmitted = false; taskSwitcherVisible = false; ssNotifyReplacesId = 0; ssFilename = QString(); tohkbd2user = new QDBusInterface("com.kimmoli.tohkbd2user", "/", "com.kimmoli.tohkbd2user", QDBusConnection::sessionBus(), this); tohkbd2user->setTimeout(2000); thread = new QThread(); worker = new Worker(); worker->moveToThread(thread); connect(worker, SIGNAL(gpioInterruptCaptured()), this, SLOT(handleGpioInterrupt())); connect(worker, SIGNAL(workRequested()), thread, SLOT(start())); connect(thread, SIGNAL(started()), worker, SLOT(doWork())); connect(worker, SIGNAL(finished()), thread, SLOT(quit()), Qt::DirectConnection); backlightTimer = new QTimer(this); backlightTimer->setSingleShot(true); connect(backlightTimer, SIGNAL(timeout()), this, SLOT(backlightTimerTimeout())); presenceTimer = new QTimer(this); presenceTimer->setInterval(2000); presenceTimer->setSingleShot(true); connect(presenceTimer, SIGNAL(timeout()), this, SLOT(presenceTimerTimeout())); repeatTimer = new QTimer(this); repeatTimer->setSingleShot(true); connect(repeatTimer, SIGNAL(timeout()), this, SLOT(repeatTimerTimeout())); /* do this automatically at startup */ setVddState(true); setInterruptEnable(true); uinputif = new UinputIf(); uinputif->openUinputDevice(); tca8424 = new tca8424driver(0x3b); keymap = new keymapping(); FKEYS.clear(); FKEYS.append(KEY_F1); FKEYS.append(KEY_F2); FKEYS.append(KEY_F3); FKEYS.append(KEY_F4); FKEYS.append(KEY_F5); FKEYS.append(KEY_F6); FKEYS.append(KEY_F7); FKEYS.append(KEY_F8); FKEYS.append(KEY_F9); FKEYS.append(KEY_F10); FKEYS.append(KEY_F11); FKEYS.append(KEY_F12); reloadSettings(); if (currentActiveLayout.isEmpty()) changeActiveLayout(true); if (currentOrientationLock.isEmpty()) { changeOrientationLock(true); saveOrientation(); } checkKeypadPresence(); connect(keymap, SIGNAL(shiftChanged()), this, SLOT(handleShiftChanged())); connect(keymap, SIGNAL(ctrlChanged()), this, SLOT(handleCtrlChanged())); connect(keymap, SIGNAL(altChanged()), this, SLOT(handleAltChanged())); connect(keymap, SIGNAL(symChanged()), this, SLOT(handleSymChanged())); connect(keymap, SIGNAL(keyPressed(QList< QPair<int, int> >)), this, SLOT(handleKeyPressed(QList< QPair<int, int> >))); connect(keymap, SIGNAL(keyReleased()), this, SLOT(handleKeyReleased())); }
/* Main */ Tohkbd::Tohkbd(QObject *parent) : QObject(parent) { dbusRegistered = false; interruptsEnabled = false; vddEnabled = false; vkbLayoutIsTohkbd = false; currentActiveLayout = QString(); currentOrientationLock = QString(); keypadIsPresent = false; gpio_fd = -1; displayIsOn = false; keyIsPressed = false; keyRepeat = false; slideEventEmitted = false; taskSwitcherVisible = false; selfieLedOn = false; gpioInterruptCounter = 0; actualSailfishVersion = QString(); fix_CapsLock = !checkSailfishVersion("1.1.7.0"); capsLock = false; tohkbd2user = new ComKimmoliTohkbd2userInterface("com.kimmoli.tohkbd2user", "/", QDBusConnection::sessionBus(), this); tohkbd2user->setTimeout(2000); thread = new QThread(); worker = new Worker(); worker->moveToThread(thread); connect(worker, SIGNAL(gpioInterruptCaptured()), this, SLOT(handleGpioInterrupt())); connect(worker, SIGNAL(workRequested()), thread, SLOT(start())); connect(thread, SIGNAL(started()), worker, SLOT(doWork())); connect(worker, SIGNAL(finished()), thread, SLOT(quit()), Qt::DirectConnection); backlightTimer = new QTimer(this); backlightTimer->setSingleShot(true); connect(backlightTimer, SIGNAL(timeout()), this, SLOT(backlightTimerTimeout())); presenceTimer = new QTimer(this); presenceTimer->setInterval(2000); presenceTimer->setSingleShot(true); connect(presenceTimer, SIGNAL(timeout()), this, SLOT(presenceTimerTimeout())); repeatTimer = new QTimer(this); repeatTimer->setSingleShot(true); connect(repeatTimer, SIGNAL(timeout()), this, SLOT(repeatTimerTimeout())); /* do this automatically at startup */ setVddState(true); setInterruptEnable(true); uinputif = new UinputIf(); uinputif->openUinputDevice(); uinputevpoll = new UinputEvPoll(); evpollThread = new QThread(); uinputevpoll->moveToThread(evpollThread); connect(uinputevpoll, SIGNAL(capsLockLedChanged(bool)), this, SLOT(capsLockLedState(bool))); connect(uinputevpoll, SIGNAL(pollingRequested()), evpollThread, SLOT(start())); connect(evpollThread, SIGNAL(started()), uinputevpoll, SLOT(doPoll())); connect(uinputevpoll, SIGNAL(finished()), evpollThread, SLOT(quit()), Qt::DirectConnection); uinputevpoll->requestPolling(uinputif->getFd()); printf("uinputevpoll->requestPolling(uinputif->getFd());\n"); tca8424 = new tca8424driver(0x3b); keymap = new keymapping(); FKEYS.clear(); FKEYS.append(KEY_F1); FKEYS.append(KEY_F2); FKEYS.append(KEY_F3); FKEYS.append(KEY_F4); FKEYS.append(KEY_F5); FKEYS.append(KEY_F6); FKEYS.append(KEY_F7); FKEYS.append(KEY_F8); FKEYS.append(KEY_F9); FKEYS.append(KEY_F10); FKEYS.append(KEY_F11); FKEYS.append(KEY_F12); reloadSettings(); keymap->setLayout(masterLayout); if (currentActiveLayout.isEmpty()) changeActiveLayout(true); if (currentOrientationLock.isEmpty()) { changeOrientationLock(true); saveOrientation(); } checkKeypadPresence(); connect(keymap, SIGNAL(shiftChanged()), this, SLOT(handleShiftChanged())); connect(keymap, SIGNAL(ctrlChanged()), this, SLOT(handleCtrlChanged())); connect(keymap, SIGNAL(altChanged()), this, SLOT(handleAltChanged())); connect(keymap, SIGNAL(symChanged()), this, SLOT(handleSymChanged())); connect(keymap, SIGNAL(toggleCapsLock()), this, SLOT(toggleCapsLock())); connect(keymap, SIGNAL(keyPressed(QList< QPair<int, int> >)), this, SLOT(handleKeyPressed(QList< QPair<int, int> >))); connect(keymap, SIGNAL(keyReleased()), this, SLOT(handleKeyReleased())); connect(keymap, SIGNAL(bogusDetected()), tca8424, SLOT(reset())); }