Example #1
0
void ScanDialog::slotScanStart( )
{
   if( m_scanParams )
   {
      m_scanParams->setEnabled( false );
      KLed *led = m_scanParams->operationLED();
      if( led )
      {
	 led->setColor( Qt::red );
	 led->setState( KLed::On );
      }

   }
}
Example #2
0
void ScanDialog::slotScanFinished( KScanStat status )
{
   kdDebug(29000) << "Scan finished with status " << status << endl;
   if( m_scanParams )
   {
      m_scanParams->setEnabled( true );
      KLed *led = m_scanParams->operationLED();
      if( led )
      {
	 led->setColor( Qt::green );
	 led->setState( KLed::Off );
      }

   }
}
Example #3
0
TestWidget::TestWidget() : QWidget(0), m_lock(this)
{
    QMap<Qt::Key, QString> mods;
    mods.insert(Qt::Key_Shift, "Shift");
    mods.insert(Qt::Key_Control, "Ctrl");
    mods.insert(Qt::Key_Alt, "Alt");
    mods.insert(Qt::Key_Meta, "Meta");
    mods.insert(Qt::Key_Super_L, "Super");
    mods.insert(Qt::Key_Hyper_L, "Hyper");
    mods.insert(Qt::Key_AltGr, "AltGr");
    mods.insert(Qt::Key_NumLock, "NumLock");
    mods.insert(Qt::Key_CapsLock, "CapsLock");
    mods.insert(Qt::Key_ScrollLock, "ScrollLock");

    QMap<Qt::MouseButton, QString> buttons;
    buttons.insert(Qt::LeftButton, "Left Button");
    buttons.insert(Qt::RightButton, "Right Button");
    buttons.insert(Qt::MidButton, "Middle Button");
    buttons.insert(Qt::XButton1, "First X Button");
    buttons.insert(Qt::XButton2, "Second X Button");

    QVBoxLayout *layout = new QVBoxLayout(this);
    
    QMap<Qt::Key, QString>::const_iterator it;
    QMap<Qt::Key, QString>::const_iterator end = mods.constEnd();
    for (it = mods.constBegin(); it != end; ++it) {
        if (m_lock.knowsKey(it.key())) {
            QHBoxLayout *hlayout = new QHBoxLayout;
            KLed *pressed = new KLed(this);
            KLed *latched = new KLed(this);
            KLed *locked = new KLed(this);
            QPushButton *latch = new QPushButton("latch", this);
            latch->setProperty("modifier", it.key());
            connect(latch, SIGNAL(clicked()), SLOT(latch()));
            QPushButton *lock = new QPushButton("lock", this);
            lock->setProperty("modifier", it.key());
            connect(lock, SIGNAL(clicked()), SLOT(lock()));
            pressed->setState(m_lock.isKeyPressed(it.key()) ? KLed::On : KLed::Off);
            latched->setState(m_lock.isKeyLatched(it.key()) ? KLed::On : KLed::Off);
            locked->setState(m_lock.isKeyLocked(it.key()) ? KLed::On : KLed:: Off);
            m_leds.insert(it.key(), Triple<KLed*,KLed*,KLed*>(pressed, latched, locked));
            hlayout->addWidget(pressed);
            hlayout->addWidget(latched);
            hlayout->addWidget(locked);
            hlayout->addWidget(new QLabel(it.value()));
            hlayout->addWidget(latch);
            hlayout->addWidget(lock);
            layout->addLayout(hlayout);
        }
    }

    QMap<Qt::MouseButton, QString>::const_iterator it2;
    QMap<Qt::MouseButton, QString>::const_iterator end2 = buttons.constEnd();
    for (it2 = buttons.constBegin(); it2 != end2; ++it2) {
        QHBoxLayout *hlayout = new QHBoxLayout;
        KLed *pressed = new KLed(this);
        pressed->setState(m_lock.isButtonPressed(it2.key()) ? KLed::On : KLed::Off);
        m_mouseLeds.insert(it2.key(), pressed);
        hlayout->addWidget(pressed);
        hlayout->addWidget(new QLabel(it2.value()));
        layout->addLayout(hlayout);
    }
    
    setLayout(layout);

    connect(&m_lock, SIGNAL(keyPressed(Qt::Key, bool)), SLOT(keyPressed(Qt::Key, bool)));
    connect(&m_lock, SIGNAL(keyLatched(Qt::Key, bool)), SLOT(keyLatched(Qt::Key, bool)));
    connect(&m_lock, SIGNAL(keyLocked(Qt::Key, bool)), SLOT(keyLocked(Qt::Key, bool)));
    connect(&m_lock, SIGNAL(buttonPressed(Qt::MouseButton, bool)),
                     SLOT(mouseButtonPressed(Qt::MouseButton, bool)));
    connect(&m_lock, SIGNAL(keyAdded(Qt::Key)), SLOT(keyAdded(Qt::Key)));
    connect(&m_lock, SIGNAL(keyRemoved(Qt::Key)), SLOT(keyRemoved(Qt::Key)));
}