/** * Constructor, create LED's */ KBinaryClock::KBinaryClock(const QString& configFile, Type type, int actions, QWidget *parent, const char *name) : KPanelApplet(configFile, type, actions, parent, name), ledWidth(6), _calendar(NULL), _disableCalendar(false), prefs( new Prefs(sharedConfig())), m_tooltip(this) { prefs->readConfig(); setBackgroundOrigin(AncestorOrigin); for(int i=0; i < 4; i++){ for(int j=0; j < ledWidth;j++){ KLed *led = new KLed( this ); led->setBackgroundOrigin(AncestorOrigin); ledMatrix[j][i] = led; } } // Why does kicker start out with a size of 800x409? // Kicker bug? resize(60,42); updateClock(); loadSettings(); QTimer *timer=new QTimer(this); connect (timer, SIGNAL (timeout()), this, SLOT (updateClock())); timer->start(500,false); }
void ScanDialog::slotAcquireStart( ) { if( m_scanParams ) { KLed *led = m_scanParams->operationLED(); if( led ) { led->setColor( Qt::green ); } } }
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 ); } } }
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 ); } } }
QPixmap JobModel::statusImage(JobInfo::State state) const { QColor color; if ( state == JobInfo::Running ) color = ( QTime::currentTime().msec() < 500 ) ? Qt::gray : Qt::green; else if ( state == JobInfo::Completed ) color = Qt::red; else color = QColor(Qt::yellow).darker(); KLed led; led.setColor(color); QPalette pal = led.palette(); pal.setColor(QPalette::Window, Qt::white); led.setPalette(pal); return QPixmap::grabWidget(&led); }
QPixmap JobModel::statusImage(JobInfo::State state) const { QColor color; if ( state == JobInfo::Running ) color = blinkStateOn ? Qt::green : Qt::gray; else if ( state == JobInfo::Completed ) color = Qt::red; else color = QColor(Qt::yellow).darker(); KLed led; led.setColor(color); QPalette pal = led.palette(); pal.setColor(QPalette::Window, Qt::white); led.setPalette(pal); return led.grab(); }
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))); }