void tst_q3buttongroup::buttonId() { Q3ButtonGroup bg; QPushButton *button = new QPushButton("Foo", &bg); int id = bg.insert(button, 1); QApplication::instance()->processEvents(); QCOMPARE(id, bg.id(button)); }
void tst_q3buttongroup::task198864_insert() { #if 0 Q3ButtonGroup *group = new Q3ButtonGroup; QWidget *parent = new QWidget; const int id1 = group->insert(new QPushButton(parent)); QCOMPARE(id1, 0); const int id2 = group->insert(new QPushButton(parent)); QCOMPARE(id2, 1); delete parent; parent = new QWidget; const int id3 = group->insert(new QPushButton(parent)); QCOMPARE(id3, 0); #endif Q3ButtonGroup *group = new Q3ButtonGroup; QPushButton *button1 = new QPushButton; const int id1 = group->insert(button1); QCOMPARE(id1, 0); QPushButton *button2 = new QPushButton; const int id2 = group->insert(button2); QCOMPARE(id2, 1); delete button1; delete button2; QPushButton *button3 = new QPushButton; const int id3 = group->insert(button3); QCOMPARE(id3, 0); }
DeviceConfigureDialog::DeviceConfigureDialog( MediaDevice *device ) : KDialog( Amarok::mainWindow() ) , m_device( device ) { setCaption( i18n("Select Plugin for %1", m_device->name() ) ); setModal( true ); setButtons( Ok | Cancel ); showButtonSeparator( true ); kapp->setTopWidget( this ); setCaption( KDialog::makeStandardCaption( i18n( "Configure Media Device" ) ) ); showButton( KDialog::Apply, false ); KVBox* vbox = new KVBox( this ); setMainWidget( vbox ); vbox->setSpacing( KDialog::spacingHint() ); QLabel *connectLabel = 0; m_connectEdit = 0; QLabel *disconnectLabel = 0; m_disconnectEdit = 0; m_transcodeCheck = 0; Q3ButtonGroup *transcodeGroup = 0; m_transcodeAlways = 0; m_transcodeWhenNecessary = 0; m_transcodeRemove = 0; if( device ) { device->loadConfig(); // pre-connect/post-disconnect (mount/umount) connectLabel = new QLabel( vbox ); connectLabel->setText( i18n( "Pre-&connect command:" ) ); m_connectEdit = new HintLineEdit( device->m_preconnectcmd, vbox ); m_connectEdit->setHint( i18n( "Example: mount %d" ) ); connectLabel->setBuddy( m_connectEdit ); m_connectEdit->setToolTip( i18n( "Set a command to be run before connecting to your device (e.g. a mount command) here.\n%d is replaced by the device node, %m by the mount point.\nEmpty commands are not executed." ) ); disconnectLabel = new QLabel( vbox ); disconnectLabel->setText( i18n( "Post-&disconnect command:" ) ); m_disconnectEdit = new HintLineEdit( device->m_postdisconnectcmd, vbox ); disconnectLabel->setBuddy( m_disconnectEdit ); m_disconnectEdit->setHint( i18n( "Example: eject %d" ) ); m_disconnectEdit->setToolTip( i18n( "Set a command to be run after disconnecting from your device (e.g. an eject command) here.\n%d is replaced by the device node, %m by the mount point.\nEmpty commands are not executed." ) ); // transcode m_transcodeCheck = new QCheckBox( vbox ); m_transcodeCheck->setText( i18n( "&Transcode before transferring to device" ) ); m_transcodeCheck->setChecked( device->m_transcode ); transcodeGroup = new Q3VButtonGroup( vbox ); QString format = "mp3"; if( !device->supportedFiletypes().isEmpty() ) format = device->supportedFiletypes().first(); transcodeGroup->setTitle( i18n( "Transcode to preferred format (%1) for device", format ) ); m_transcodeAlways = new QRadioButton( transcodeGroup ); m_transcodeAlways->setText( i18n( "Whenever possible" ) ); m_transcodeAlways->setChecked( device->m_transcodeAlways ); m_transcodeWhenNecessary = new QRadioButton( transcodeGroup ); m_transcodeWhenNecessary->setText( i18n( "When necessary" ) ); m_transcodeWhenNecessary->setChecked( !device->m_transcodeAlways ); connect( m_transcodeCheck, SIGNAL(toggled(bool)), transcodeGroup, SLOT(setEnabled(bool)) ); transcodeGroup->insert( m_transcodeAlways ); transcodeGroup->insert( m_transcodeWhenNecessary ); m_transcodeRemove = new QCheckBox( transcodeGroup ); m_transcodeRemove->setText( i18n( "Remove transcoded files after transfer" ) ); m_transcodeRemove->setChecked( device->m_transcodeRemove ); const ScriptManager *sm = ScriptManager::instance(); m_transcodeCheck->setEnabled( !sm->transcodeScriptRunning().isEmpty() ); transcodeGroup->setEnabled( !sm->transcodeScriptRunning().isEmpty() && device->m_transcode ); if( sm->transcodeScriptRunning().isNull() ) { m_transcodeCheck->setToolTip( i18n( "For this feature, a script of type \"Transcode\" has to be running" ) ); transcodeGroup->setToolTip( i18n( "For this feature, a script of type \"Transcode\" has to be running" ) ); } device->addConfigElements( vbox ); } m_accepted = false; }
void ShortcutsModule::initGUI() { kDebug(125) << "A-----------"; KActionCollection* actionCollection = m_actionsGeneral; // see also KShortcutsModule::init() below !!! QAction* a = 0L; #define NOSLOTS //#define KICKER_ALL_BINDINGS #include "../../kwin/kwinbindings.cpp" //#include "../../kicker/kicker/core/kickerbindings.cpp" //#include "../../kicker/taskbar/taskbarbindings.cpp" //#include "../../kdesktop/kdesktopbindings.cpp" #include "../../klipper/klipperbindings.cpp" #include "../kxkb/kxkbbindings.cpp" kDebug(125) << "B-----------"; kDebug(125) << "C-----------"; createActionsGeneral(); kDebug(125) << "D-----------"; createActionsSequence(); kDebug(125) << "E-----------"; kDebug(125) << "F-----------"; QVBoxLayout* pVLayout = new QVBoxLayout( this ); pVLayout->addSpacing( KDialog::marginHint() ); // (o) [Current ] <Remove> ( ) New <Save> QHBoxLayout *pHLayout = new QHBoxLayout(); pVLayout->addItem( pHLayout ); Q3ButtonGroup* pGroup = new Q3ButtonGroup( this ); pGroup->hide(); m_prbPre = new QRadioButton( "", this ); connect( m_prbPre, SIGNAL(clicked()), SLOT(slotSchemeCur()) ); pGroup->insert( m_prbPre ); pHLayout->addWidget( m_prbPre ); m_pcbSchemes = new QComboBox( this ); m_pcbSchemes->setMinimumWidth( 100 ); m_pcbSchemes->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Fixed ); connect( m_pcbSchemes, SIGNAL(activated(int)), SLOT(slotSelectScheme(int)) ); pHLayout->addWidget( m_pcbSchemes ); pHLayout->addSpacing( KDialog::marginHint() ); m_pbtnRemove = new QPushButton( i18n("&Remove"), this ); m_pbtnRemove->setEnabled( false ); connect( m_pbtnRemove, SIGNAL(clicked()), SLOT(slotRemoveScheme()) ); m_pbtnRemove->setWhatsThis( i18n("Click here to remove the selected key bindings scheme. You cannot" " remove the standard system-wide schemes 'Current scheme' and 'KDE default'.") ); pHLayout->addWidget( m_pbtnRemove ); pHLayout->addSpacing( KDialog::marginHint() * 3 ); m_prbNew = new QRadioButton( i18n("New scheme"), this ); m_prbNew->setEnabled( false ); pGroup->insert( m_prbNew ); pHLayout->addWidget( m_prbNew ); m_pbtnSave = new QPushButton( i18n("&Save..."), this ); m_pbtnSave->setEnabled( false ); m_pbtnSave->setWhatsThis( i18n("Click here to add a new key bindings scheme. You will be prompted for a name.") ); connect( m_pbtnSave, SIGNAL(clicked()), SLOT(slotSaveSchemeAs()) ); pHLayout->addWidget( m_pbtnSave ); pHLayout->addStretch( 1 ); m_pTab = new QTabWidget( this ); pVLayout->addWidget( m_pTab ); m_listGeneral = new KActionCollection( this ); //m_listGeneral->addActions(m_actionsGeneral); m_pseGeneral = new KShortcutsEditor( m_listGeneral, this, false ); m_pTab->addTab( m_pseGeneral, i18n("&Global Shortcuts") ); //connect( m_pseGeneral, SIGNAL(keyChange()), SLOT(slotKeyChange()) ); m_listSequence = new KActionCollection( this ); m_pseSequence = new KShortcutsEditor( m_listSequence, this, false ); m_pTab->addTab( m_pseSequence, i18n("Shortcut Se&quences") ); //connect( m_pseSequence, SIGNAL(keyChange()), SLOT(slotKeyChange()) ); m_listApplication = new KActionCollection( this ); m_pseApplication = new KShortcutsEditor( m_listApplication, this, false ); m_pTab->addTab( m_pseApplication, i18n("App&lication Shortcuts") ); //connect( m_pseApplication, SIGNAL(keyChange()), SLOT(slotKeyChange()) ); kDebug(125) << "G-----------"; readSchemeNames(); kDebug(125) << "I-----------"; slotSchemeCur(); kDebug(125) << "J-----------"; }