status_t BnSensorEventConnection::onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { switch(code) { case GET_SENSOR_CHANNEL: { CHECK_INTERFACE(ISensorEventConnection, data, reply); sp<BitTube> channel(getSensorChannel()); channel->writeToParcel(reply); return NO_ERROR; } break; case ENABLE_DISABLE: { CHECK_INTERFACE(ISensorEventConnection, data, reply); int handle = data.readInt32(); int enabled = data.readInt32(); status_t result = enableDisable(handle, enabled); reply->writeInt32(result); return NO_ERROR; } break; case SET_EVENT_RATE: { CHECK_INTERFACE(ISensorEventConnection, data, reply); int handle = data.readInt32(); int ns = data.readInt64(); status_t result = setEventRate(handle, ns); reply->writeInt32(result); return NO_ERROR; } break; } return BBinder::onTransact(code, data, reply, flags); }
void PhraseBookBox::removePhrase() { QListViewItem *item = lv->currentItem(); QListViewItem *next = item->itemBelow() != 0 ? item->itemBelow() : item->itemAbove(); delete item; if ( next != 0 ) selectItem( next ); enableDisable(); }
QT_BEGIN_NAMESPACE PhraseBookBox::PhraseBookBox(PhraseBook *phraseBook, QWidget *parent) : QDialog(parent), m_phraseBook(phraseBook), m_translationSettingsDialog(0) { // This definition needs to be within class context for lupdate to find it #define NewPhrase tr("(New Entry)") setupUi(this); setWindowTitle(tr("%1[*] - Qt Linguist").arg(m_phraseBook->friendlyPhraseBookName())); setWindowModified(m_phraseBook->isModified()); phrMdl = new PhraseModel(this); m_sortedPhraseModel = new QSortFilterProxyModel(this); m_sortedPhraseModel->setSortCaseSensitivity(Qt::CaseInsensitive); m_sortedPhraseModel->setSortLocaleAware(true); m_sortedPhraseModel->setDynamicSortFilter(true); m_sortedPhraseModel->setSourceModel(phrMdl); phraseList->setModel(m_sortedPhraseModel); phraseList->header()->setDefaultSectionSize(150); phraseList->header()->setSectionResizeMode(QHeaderView::Interactive); connect(sourceLed, SIGNAL(textChanged(QString)), this, SLOT(sourceChanged(QString))); connect(targetLed, SIGNAL(textChanged(QString)), this, SLOT(targetChanged(QString))); connect(definitionLed, SIGNAL(textChanged(QString)), this, SLOT(definitionChanged(QString))); connect(phraseList->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), this, SLOT(selectionChanged())); connect(newBut, SIGNAL(clicked()), this, SLOT(newPhrase())); connect(removeBut, SIGNAL(clicked()), this, SLOT(removePhrase())); connect(settingsBut, SIGNAL(clicked()), this, SLOT(settings())); connect(saveBut, SIGNAL(clicked()), this, SLOT(save())); connect(m_phraseBook, SIGNAL(modifiedChanged(bool)), this, SLOT(setWindowModified(bool))); sourceLed->installEventFilter(this); targetLed->installEventFilter(this); definitionLed->installEventFilter(this); foreach (Phrase *p, phraseBook->phrases()) phrMdl->addPhrase(p); phraseList->sortByColumn(0, Qt::AscendingOrder); enableDisable(); }
status_t BnSensorEventConnection::onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { switch(code) { case GET_SENSOR_CHANNEL: { CHECK_INTERFACE(ISensorEventConnection, data, reply); sp<BitTube> channel(getSensorChannel()); channel->writeToParcel(reply); return NO_ERROR; } case ENABLE_DISABLE: { CHECK_INTERFACE(ISensorEventConnection, data, reply); int handle = data.readInt32(); int enabled = data.readInt32(); nsecs_t samplingPeriodNs = data.readInt64(); nsecs_t maxBatchReportLatencyNs = data.readInt64(); int reservedFlags = data.readInt32(); status_t result = enableDisable(handle, enabled, samplingPeriodNs, maxBatchReportLatencyNs, reservedFlags); reply->writeInt32(result); return NO_ERROR; } case SET_EVENT_RATE: { CHECK_INTERFACE(ISensorEventConnection, data, reply); int handle = data.readInt32(); nsecs_t ns = data.readInt64(); status_t result = setEventRate(handle, ns); reply->writeInt32(result); return NO_ERROR; } case FLUSH_SENSOR: { CHECK_INTERFACE(ISensorEventConnection, data, reply); status_t result = flush(); reply->writeInt32(result); return NO_ERROR; } case CONFIGURE_CHANNEL: { CHECK_INTERFACE(ISensorEventConnection, data, reply); int handle = data.readInt32(); int rateLevel = data.readInt32(); status_t result = configureChannel(handle, rateLevel); reply->writeInt32(result); return NO_ERROR; } case DESTROY: { destroy(); return NO_ERROR; } } return BBinder::onTransact(code, data, reply, flags); }
void Settings::CategoryPage::slotNewItem() { _current = new Settings::CategoryItem( QString(), QString(), QString(), DB::Category::TreeView, 64, _categories ); _text->setText( QString::fromLatin1( "" ) ); _positionable->setChecked(false); _icon->setIcon( QIcon() ); _thumbnailSizeInCategory->setValue( 64 ); enableDisable( true ); _current->setSelected( true ); _text->setFocus(); }
void Settings::CategoryPage::slotDeleteCurrent() { int answer = KMessageBox::questionYesNo( this, i18n("<p>Really delete category '%1'?</p>", _current->text()) ); if ( answer == KMessageBox::No ) return; _deleted.append( _current ); _categories->takeItem( _categories->row(_current) ); _current = 0; _text->setText( QString::fromLatin1( "" ) ); _positionable->setChecked(false); _icon->setIcon( QIcon() ); _thumbnailSizeInCategory->setValue(64); enableDisable(false); }
void Settings::CategoryPage::edit( QListWidgetItem* i ) { if ( i == 0 ) return; Settings::CategoryItem* item = static_cast<Settings::CategoryItem*>(i); _current = item; _text->setText( item->text() ); _positionable->setChecked(item->positionable()); _icon->setIcon( item->icon() ); _thumbnailSizeInCategory->setValue( item->thumbnailSize() ); _preferredView->setCurrentIndex( static_cast<int>(item->viewType()) ); enableDisable( true ); }
void PhraseBookBox::selectionChanged() { enableDisable(); }
PhraseBookBox::PhraseBookBox( const QString& filename, const PhraseBook& phraseBook, QWidget *parent, const char *name, bool modal ) : QDialog( parent, name, modal ), fn( filename ), pb( phraseBook ) { QGridLayout *gl = new QGridLayout( this, 4, 3, 11, 11, "phrase book outer layout" ); QVBoxLayout *bl = new QVBoxLayout( 6, "phrase book button layout" ); sourceLed = new QLineEdit( this, "source line edit" ); QLabel *source = new QLabel( sourceLed, tr("S&ource phrase:"), this, "source label" ); targetLed = new QLineEdit( this, "target line edit" ); QLabel *target = new QLabel( targetLed, tr("&Translation:"), this, "target label" ); definitionLed = new QLineEdit( this, "definition line edit" ); QLabel *definition = new QLabel( definitionLed, tr("&Definition:"), this, "target label" ); lv = new PhraseLV( this, "phrase book list view" ); newBut = new QPushButton( tr("&New Phrase"), this ); newBut->setDefault( TRUE ); removeBut = new QPushButton( tr("&Remove Phrase"), this ); removeBut->setEnabled( FALSE ); QPushButton *saveBut = new QPushButton( tr("&Save"), this ); QPushButton *closeBut = new QPushButton( tr("Close"), this ); gl->addWidget( source, 0, 0 ); gl->addWidget( sourceLed, 0, 1 ); gl->addWidget( target, 1, 0 ); gl->addWidget( targetLed, 1, 1 ); gl->addWidget( definition, 2, 0 ); gl->addWidget( definitionLed, 2, 1 ); gl->addMultiCellWidget( lv, 3, 3, 0, 1 ); gl->addMultiCell( bl, 0, 3, 2, 2 ); bl->addWidget( newBut ); bl->addWidget( removeBut ); bl->addWidget( saveBut ); bl->addWidget( closeBut ); bl->addStretch( 1 ); connect( sourceLed, SIGNAL(textChanged(const QString&)), this, SLOT(sourceChanged(const QString&)) ); connect( targetLed, SIGNAL(textChanged(const QString&)), this, SLOT(targetChanged(const QString&)) ); connect( definitionLed, SIGNAL(textChanged(const QString&)), this, SLOT(definitionChanged(const QString&)) ); connect( lv, SIGNAL(selectionChanged(QListViewItem *)), this, SLOT(selectionChanged(QListViewItem *)) ); connect( newBut, SIGNAL(clicked()), this, SLOT(newPhrase()) ); connect( removeBut, SIGNAL(clicked()), this, SLOT(removePhrase()) ); connect( saveBut, SIGNAL(clicked()), this, SLOT(save()) ); connect( closeBut, SIGNAL(clicked()), this, SLOT(accept()) ); PhraseBook::ConstIterator it; for ( it = phraseBook.begin(); it != phraseBook.end(); ++it ) (void) new PhraseLVI( lv, (*it) ); enableDisable(); QWhatsThis::add( this, tr("This window allows you to add, modify, or delete" " phrases in a phrase book.") ); QWhatsThis::add( sourceLed, tr("This is the phrase in the source" " language.") ); QWhatsThis::add( targetLed, tr("This is the phrase in the target language" " corresponding to the source phrase.") ); QWhatsThis::add( definitionLed, tr("This is a definition for the source" " phrase.") ); QWhatsThis::add( newBut, tr("Click here to add the phrase to the phrase" " book.") ); QWhatsThis::add( removeBut, tr("Click here to remove the phrase from the" " phrase book.") ); QWhatsThis::add( saveBut, tr("Click here to save the changes made.") ); QWhatsThis::add( closeBut, tr("Click here to close this window.") ); }
void PhraseBookBox::selectionChanged( QListViewItem * /* item */ ) { enableDisable(); }