ConfigGuiSunbird::ConfigGuiSunbird( const QSync::Member &member, QWidget *parent ) : ConfigGui( member, parent ) { QTabWidget *tabWidget = new QTabWidget( this ); topLayout()->addWidget( tabWidget ); mLocalWidget = new QWidget( tabWidget ); mLocalLayout = new QVBoxLayout( mLocalWidget, KDialog::spacingHint() ); mWebdavWidget = new QWidget( tabWidget ); mWebdavLayout = new QVBoxLayout( mWebdavWidget, KDialog::spacingHint() ); tabWidget->addTab( mLocalWidget, i18n( "Local Calendars" ) ); tabWidget->addTab( mWebdavWidget, i18n( "WebDAV Calendars" ) ); KPushButton *mLocalAddButton = new KPushButton( mLocalWidget ); mLocalAddButton->setText( i18n( "Add new calendar" ) ); mLocalAddButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); mLocalLayout->addWidget( mLocalAddButton ); connect( mLocalAddButton, SIGNAL( clicked() ), this, SLOT( addLocalCalendar() ) ); KPushButton *mWebdavAddButton = new KPushButton( mWebdavWidget ); mWebdavAddButton->setText( i18n( "Add new calendar" ) ); mWebdavAddButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); mWebdavLayout->addWidget( mWebdavAddButton ); connect( mWebdavAddButton, SIGNAL( clicked() ), this, SLOT( addWebdavCalendar() ) ); mLocalSpacer = new QSpacerItem( 20, 40, QSizePolicy::Expanding ); mLocalLayout->addItem( mLocalSpacer ); mWebdavSpacer = new QSpacerItem( 20, 40, QSizePolicy::Expanding ); mWebdavLayout->addItem( mWebdavSpacer ); }
MediumPluginManagerDialog::MediumPluginManagerDialog() : KDialogBase( amaroK::mainWindow(), "mediumpluginmanagerdialog", false, QString::null, Ok|Cancel, Ok ) { kapp->setTopWidget( this ); setCaption( kapp->makeStdCaption( i18n( "Manage Devices and Plugins" ) ) ); QVBox* vbox = makeVBoxMainWidget(); vbox->setSpacing( KDialog::spacingHint() ); vbox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) ); m_location = new QGroupBox( 1, Qt::Vertical, i18n( "Devices" ), vbox ); m_location->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred ) ); m_devicesBox = new QVBox( m_location ); m_devicesBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) ); m_manager = new MediumPluginManager( m_devicesBox ); QHBox *hbox = new QHBox( vbox ); KPushButton *detectDevices = new KPushButton( i18n( "Autodetect Devices" ), hbox); detectDevices->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); connect( detectDevices, SIGNAL( clicked() ), m_manager, SLOT( redetectDevices() ) ); KPushButton *addButton = new KPushButton( i18n( "Add Device..." ), hbox ); addButton->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); connect( addButton, SIGNAL( clicked() ), m_manager, SLOT( newDevice() ) ); }
QList<QWidget*> ItemsViewDelegate::createItemWidgets() const { QList<QWidget*> list; GameTextLabel* gameName = new GameTextLabel(); gameName->setOpenExternalLinks( true ); // not so nice - work around constness to install the event filter ItemsViewDelegate* delegate = const_cast<ItemsViewDelegate*>( this ); gameName->installEventFilter( delegate ); list << gameName; connect( gameName, SIGNAL( mouseReleased() ), SLOT( selectGameClicked() ) ); GameTextLabel* gameDescription = new GameTextLabel(); gameDescription->setOpenExternalLinks( true ); list << gameDescription; connect( gameDescription, SIGNAL( mouseReleased() ), SLOT( selectGameClicked() ) ); KPushButton* playButton = new KPushButton(); playButton->setSizePolicy( QSizePolicy::Maximum, QSizePolicy::MinimumExpanding ); list << playButton; setBlockedEventTypes( playButton, QList<QEvent::Type>() << QEvent::MouseButtonPress << QEvent::MouseButtonRelease << QEvent::MouseButtonDblClick ); connect( playButton, SIGNAL( clicked() ), SLOT( slotPlayClicked() ) ); return list; }
AbstractListToolViewDelegate::AbstractListToolViewDelegate(AbstractMovableModel * model, QModelIndex index, AbstractItemsListViewTool * parent) : QWidget(parent), m_parent(parent), m_model(model), m_index(index), m_object(0) { // GUI setup QHBoxLayout * layout = new QHBoxLayout(); layout->setContentsMargins(QMargins()); layout->setSpacing(0); this->setLayout(layout); QStringList registeredDrawers = parent->options(); QComboBox * comboBox = new QComboBox(this); comboBox->addItems(registeredDrawers); comboBox->setCurrentIndex(-1); connect(comboBox,SIGNAL(currentIndexChanged(QString)),this,SLOT(itemSelected(QString))); layout->addWidget(comboBox,1); m_acceptButton = new KPushButton(QIcon::fromTheme(":action_check.png"), "", this); m_acceptButton->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Minimum); m_acceptButton->setEnabled(false); connect(m_acceptButton,SIGNAL(clicked()),this,SLOT(editorAccepted())); layout->addWidget(m_acceptButton); KPushButton * cancelButton = new KPushButton(QIcon::fromTheme(":action_delete.png"), "", this); cancelButton->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Minimum); connect(cancelButton,SIGNAL(clicked()),this,SLOT(editorCancelled())); layout->addWidget(cancelButton); }
void TDMShutdownBase::complete( TQWidget *prevWidget ) { TQSizePolicy fp( TQSizePolicy::Fixed, TQSizePolicy::Fixed ); if (uid && ((willShut && _allowShutdown == SHUT_ROOT) || (mayNuke && _allowNuke == SHUT_ROOT))) { rootlab = new TQLabel( i18n("Root authorization required."), this ); box->addWidget( rootlab ); if (curPlugin < 0) { curPlugin = 0; pluginList = KGVerify::init( _pluginsShutdown ); } verify = new KGStdVerify( this, this, prevWidget, "root", pluginList, KGreeterPlugin::Authenticate, KGreeterPlugin::Shutdown ); verify->selectPlugin( curPlugin ); box->addLayout( verify->getLayout() ); TQAccel *accel = new TQAccel( this ); accel->insertItem( ALT+Key_A, 0 ); connect( accel, TQT_SIGNAL(activated( int )), TQT_SLOT(slotActivatePlugMenu()) ); } box->addWidget( new KSeparator( KSeparator::HLine, this ) ); TQBoxLayout *hlay = new TQHBoxLayout( box, KDsh ); hlay->addStretch( 1 ); if (mayOk) { okButton = new KPushButton( KStdGuiItem::ok(), this ); okButton->setSizePolicy( fp ); okButton->setDefault( true ); hlay->addWidget( okButton ); hlay->addStretch( 1 ); connect( okButton, TQT_SIGNAL(clicked()), TQT_SLOT(accept()) ); } if (maySched) { KPushButton *schedButton = new KPushButton( KGuiItem( i18n("&Schedule...") ), this ); schedButton->setSizePolicy( fp ); hlay->addWidget( schedButton ); hlay->addStretch( 1 ); connect( schedButton, TQT_SIGNAL(clicked()), TQT_SLOT(slotSched()) ); } cancelButton = new KPushButton( KStdGuiItem::cancel(), this ); cancelButton->setSizePolicy( fp ); if (!mayOk) cancelButton->setDefault( true ); hlay->addWidget( cancelButton ); hlay->addStretch( 1 ); connect( cancelButton, TQT_SIGNAL(clicked()), TQT_SLOT(reject()) ); updateNeedRoot(); }
void ItemsViewDelegate::updateItemWidgets( const QList<QWidget*> widgets, const QStyleOptionViewItem& option, const QPersistentModelIndex& index ) const { const GluonPlayer::GameItemsModel* model = qobject_cast<const GluonPlayer::GameItemsModel*>( index.model() ); if( !model ) { kDebug() << "Warning - Invalid Model!"; return; } // setup the install button int margin = option.fontMetrics.height() / 2; int right = option.rect.width(); const_cast<QSize&>( m_buttonSize ) = QSize( 32, 32 ); KPushButton* playButton = qobject_cast<KPushButton*>( widgets.at( DelegatePlayButton ) ); if( playButton ) { playButton->setIcon( KIcon( "media-playback-start" ) ); playButton->setSizePolicy( QSizePolicy::Maximum, QSizePolicy::MinimumExpanding ); playButton->resize( m_buttonSize ); playButton->move( right - playButton->width() - margin, option.fontMetrics.height() + playButton->height() * 0.5 ); } GameTextLabel* gameName = qobject_cast<GameTextLabel*>( widgets.at( DelegateGameName ) ); // gameName->setWordWrap(true); if( gameName ) { gameName->move( margin + m_buttonSize.width() * 3, option.fontMetrics.height() ); gameName->resize( QSize( option.rect.width() - ( margin * 4 ) - m_buttonSize.width() * 4, option.fontMetrics.height() * 2 ) ); gameName->setText( index.data( GluonPlayer::GameItemsModel::GameNameRole ).toString() ); } GameTextLabel* gameDescription = qobject_cast<GameTextLabel*>( widgets.at( DelegateGameDescription ) ); // gameName->setWordWrap(true); if( gameDescription ) { gameDescription->move( margin + m_buttonSize.width() * 3, option.fontMetrics.height() * 1 + gameName->size().height() ); gameDescription->resize( QSize( option.rect.width() - ( margin * 4 ) - m_buttonSize.width() * 4, option.fontMetrics.height() * 2 ) ); gameDescription->setText( index.data( GluonPlayer::GameItemsModel::GameDescriptionRole ).toString() ); } }
void LocalCalendar::initGui() { QBoxLayout *bottomLayout = new QHBoxLayout(); mDaysCheckBox = new QCheckBox( this ); mDaysCheckBox->setText( i18n( "Sync only events newer than" ) ); mDaysSpinBox = new QSpinBox( this ); mDaysSpinBox->setDisabled( true ); mDaysSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); connect( mDaysCheckBox, SIGNAL( toggled( bool ) ), this, SLOT( toggleDays( bool ) ) ); bottomLayout->addWidget( mDaysCheckBox ); bottomLayout->addWidget( mDaysSpinBox ); bottomLayout->addWidget( new QLabel( i18n( "day(s)" ), this ) ); QGridLayout *localLayout = new QGridLayout( this ); mPathRequester = new KURLRequester( this ); KPushButton *removeButton = new KPushButton( this ); removeButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); removeButton->setText( i18n( "Remove" ) ); connect( removeButton, SIGNAL( clicked() ), this, SLOT( deleteWidget() ) ); mDefaultCheckBox = new QCheckBox( this ); mDefaultCheckBox->setText( i18n( "Set as Default" ) ); localLayout->addItem( new QSpacerItem( 40, 20, QSizePolicy::Expanding ), 0, 0 ); localLayout->addWidget( new QLabel( i18n( "Location:" ), this ), 1, 0 ); localLayout->addWidget( mPathRequester, 1, 1 ); localLayout->addItem( new QSpacerItem( 40, 20, QSizePolicy::Fixed ), 1, 2 ); localLayout->addWidget( removeButton, 1, 3 ); localLayout->addMultiCellLayout( bottomLayout, 2, 2, 0, 2 ); localLayout->addWidget( mDefaultCheckBox, 2, 3 ); }
QList<QWidget*> CommentItemsViewDelegate::createItemWidgets() const { QList<QWidget*> list; KSqueezedTextLabel* author = new KSqueezedTextLabel(); author->setOpenExternalLinks( true ); // not so nice - work around constness to install the event filter CommentItemsViewDelegate* delegate = const_cast<CommentItemsViewDelegate*>( this ); author->installEventFilter( delegate ); list << author; KSqueezedTextLabel* title = new KSqueezedTextLabel(); title->setOpenExternalLinks( true ); list << title; KSqueezedTextLabel* dateTime = new KSqueezedTextLabel(); dateTime->setOpenExternalLinks( true ); list << dateTime; KSqueezedTextLabel* rating = new KSqueezedTextLabel(); rating->setOpenExternalLinks( true ); list << rating; KSqueezedTextLabel* body = new KSqueezedTextLabel(); body->setOpenExternalLinks( true ); body->setSizePolicy( QSizePolicy::Maximum, QSizePolicy::MinimumExpanding ); list << body; KPushButton* replyButton = new KPushButton(); replyButton->setSizePolicy( QSizePolicy::Maximum, QSizePolicy::MinimumExpanding ); list << replyButton; setBlockedEventTypes( replyButton, QList<QEvent::Type>() << QEvent::MouseButtonPress << QEvent::MouseButtonRelease << QEvent::MouseButtonDblClick ); connect( replyButton, SIGNAL( clicked() ), SLOT( slotReplyClicked() ) ); return list; }
void CommentItemsViewDelegate::updateItemWidgets( const QList<QWidget*> widgets, const QStyleOptionViewItem& option, const QPersistentModelIndex& index ) const { const GluonPlayer::CommentItemsModel* model = qobject_cast<const GluonPlayer::CommentItemsModel*>( index.model() ); if( !model ) { kDebug() << "Warning - Invalid Model!"; return; } // setup the install button int margin = option.fontMetrics.height() / 2; int right = option.rect.width(); int bottom = option.rect.height(); const_cast<QSize&>( m_buttonSize ) = QSize( 32, 32 ); KPushButton* replyButton = qobject_cast<KPushButton*>( widgets.at( DelegateCommentReplyButton ) ); if( replyButton ) { replyButton->setVisible( const_cast<GluonPlayer::CommentItemsModel*>( model )->isOnline() ); replyButton->setIcon( KIcon( "edit-undo" ) ); replyButton->setSizePolicy( QSizePolicy::Maximum, QSizePolicy::MinimumExpanding ); replyButton->resize( m_buttonSize ); replyButton->move( right - replyButton->width() - margin, bottom - m_buttonSize.height() * 1.5 ); } KSqueezedTextLabel* author = qobject_cast<KSqueezedTextLabel*>( widgets.at( DelegateCommentAuthor ) ); if( author ) { author->setSizePolicy( QSizePolicy::Maximum, QSizePolicy::MinimumExpanding ); author->resize( right / 5, m_buttonSize.height() ); author->move( margin, option.fontMetrics.height() ); author->setText( index.data( GluonPlayer::CommentItemsModel::AuthorRole ).toString() ); } KSqueezedTextLabel* dateTime = qobject_cast<KSqueezedTextLabel*>( widgets.at( DelegateCommentDateTime ) ); if( dateTime ) { dateTime->resize( author->size().width(), author->size().height() ); dateTime->move( author->x() + author->size().width(), author->y() ); dateTime->setText( index.data( GluonPlayer::CommentItemsModel::DateTimeRole ).toString() ); } KSqueezedTextLabel* title = qobject_cast<KSqueezedTextLabel*>( widgets.at( DelegateCommentTitle ) ); if( title ) { title->resize( dateTime->size().width(), dateTime->size().height() ); title->move( dateTime->x() + dateTime->size().width(), dateTime->y() ); title->setText( index.data( GluonPlayer::CommentItemsModel::TitleRole ).toString() ); } KSqueezedTextLabel* rating = qobject_cast<KSqueezedTextLabel*>( widgets.at( DelegateCommentRating ) ); if( rating ) { rating->resize( title->size().width(), title->size().height() ); rating->move( title->x() + title->size().width(), title->y() ); rating->setText( index.data( GluonPlayer::CommentItemsModel::RatingRole ).toString() ); } KSqueezedTextLabel* body = qobject_cast<KSqueezedTextLabel*>( widgets.at( DelegateCommentBody ) ); if( body ) { body->resize( right - 2 * margin, bottom - author->size().height() - 2 * margin ); body->move( margin, option.fontMetrics.height() + author->size().height() ); body->setText( index.data( GluonPlayer::CommentItemsModel::BodyRole ).toString() ); } }
AmarokConfigDialog::AmarokConfigDialog( QWidget *parent, const char* name, KConfigSkeleton *config ) : KConfigDialog( parent, name, config ) , m_engineConfig( 0 ) , m_opt4( 0 ) { setWFlags( WDestructiveClose ); // IMPORTANT Don't simply change the page names, they are used as identifiers in other parts of the app. m_opt1 = new Options1( 0, "General" ); m_opt2 = new Options2( 0, "Appearance" ); m_opt4 = new Options4( 0, "Playback" ); Options5 *opt5 = new Options5( 0, "OSD" ); QVBox *opt6 = new QVBox; m_opt7 = new Options7( 0, "Collection" ); Options8 *opt8 = new Options8( 0, "Scrobbler" ); QVBox *opt9 = new QVBox; // Sound System opt6->setName( "Engine" ); opt6->setSpacing( KDialog::spacingHint() ); QWidget *groupBox, *aboutEngineButton; groupBox = new QGroupBox( 2, Qt::Horizontal, i18n("Sound System"), opt6 ); m_engineConfigFrame = new QGroupBox( 1, Qt::Horizontal, opt6 ); m_soundSystem = new QComboBox( false, groupBox ); aboutEngineButton = new QPushButton( i18n("About"), groupBox ); QToolTip::add( m_soundSystem, i18n("Click to select the sound system to use for playback.") ); QToolTip::add( aboutEngineButton, i18n("Click to get the plugin information.") ); /// Populate the engine selection combo box KTrader::OfferList offers = PluginManager::query( "[X-KDE-amaroK-plugintype] == 'engine'" ); KTrader::OfferList::ConstIterator end( offers.end() ); for( KTrader::OfferList::ConstIterator it = offers.begin(); it != end; ++it ) { // Don't list the <no engine> (void engine) entry if it's not currenty active, // cause there's no point in choosing this engine (it's a dummy, after all). if( (*it)->property( "X-KDE-amaroK-name" ).toString() == "void-engine" && AmarokConfig::soundSystem() != "void-engine" ) continue; m_soundSystem->insertItem( (*it)->name() ); // Save name properties in QMap for lookup m_pluginName[(*it)->name()] = (*it)->property( "X-KDE-amaroK-name" ).toString(); m_pluginAmarokName[(*it)->property( "X-KDE-amaroK-name" ).toString()] = (*it)->name(); } // Collection #if !defined(USE_MYSQL) && !defined(USE_POSTGRESQL) m_opt7->databaseBox->hide(); #endif #ifndef USE_MYSQL //FIXME we do this because this widget breaks the Apply button (always enabled). //It breaks because it is set to type="password" in the .kcfg file. Setting to //type="string" also fixes this bug, but means the password is stored in plain //text. This is a temporary fix so that the majority of users get a fixed Apply //button. delete m_opt7->dbSetupFrame->kcfg_MySqlPassword2; #endif m_opt7->collectionFoldersBox->setColumns( 1 ); new CollectionSetup( m_opt7->collectionFoldersBox ); //TODO this widget doesn't update the apply/ok buttons // Media Devices opt9->setName( "Media Devices" ); opt9->setSpacing( KDialog::spacingHint() ); QVBox *topbox = new QVBox( opt9 ); topbox->setSpacing( KDialog::spacingHint() ); QGroupBox *mediaBox = new QGroupBox( 2, Qt::Horizontal, i18n("Media Devices"), topbox ); mediaBox->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ); QVBox *vbox = new QVBox( mediaBox ); vbox->setSpacing( KDialog::spacingHint() ); m_deviceManager = new MediumPluginManager( vbox ); QHBox *hbox = new QHBox( topbox ); hbox->setSpacing( KDialog::spacingHint() ); hbox->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ); KPushButton *autodetect = new KPushButton( i18n( "Autodetect Devices" ), hbox ); autodetect->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); connect( autodetect, SIGNAL(clicked()), m_deviceManager, SLOT(redetectDevices()) ); KPushButton *add = new KPushButton( i18n( "Add Device..." ), hbox ); add->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); connect( add, SIGNAL(clicked()), m_deviceManager, SLOT(newDevice()) ); QFrame *frame = new QFrame( topbox ); frame->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ); // add pages addPage( m_opt1, i18n( "General" ), "misc", i18n( "Configure General Options" ) ); addPage( m_opt2, i18n( "Appearance" ), "colors", i18n( "Configure amaroK's Appearance" ) ); addPage( m_opt4, i18n( "Playback" ), "kmix", i18n( "Configure Playback" ) ); addPage( opt5, i18n( "OSD" ), "tv", i18n( "Configure On-Screen-Display" ) ); addPage( opt6, i18n( "Engine" ), "amarok", i18n( "Configure Engine" ) ); addPage( m_opt7, i18n( "Collection" ), amaroK::icon( "collection" ), i18n( "Configure Collection" ) ); addPage( opt8, i18n( "last.fm" ), "audioscrobbler", i18n( "Configure last.fm Support" ) ); addPage( opt9, i18n( "Media Devices" ), amaroK::icon( "device" ), i18n( "Configure Portable Player Support" ) ); // Show information labels (must be done after insertions) QObjectList *list = queryList( "QLabel", "infoPixmap" ); for( QObject *label = list->first(); label; label = list->next() ) static_cast<QLabel*>(label)->setPixmap( QMessageBox::standardIcon( QMessageBox::Information ) ); delete list; //stop KFont Requesters getting stupidly large list = queryList( "QLabel", "m_sampleLabel" ); for( QObject *label = list->first(); label; label = list->next() ) static_cast<QLabel*>(label)->setMaximumWidth( 250 ); delete list; connect( m_deviceManager, SIGNAL(changed()), SLOT(updateButtons()) ); connect( m_soundSystem, SIGNAL(activated( int )), SLOT(updateButtons()) ); connect( aboutEngineButton, SIGNAL(clicked()), SLOT(aboutEngine()) ); connect( opt5, SIGNAL(settingsChanged()), SLOT(updateButtons()) ); //see options5.ui.h connect( m_opt2->styleComboBox, SIGNAL( activated( int ) ), SLOT( updateButtons() ) ); connect( m_opt7->dbSetupFrame->databaseEngine, SIGNAL( activated( int ) ), SLOT( updateButtons() ) ); connect( m_opt1->kComboBox_browser, SIGNAL( activated( int ) ), SLOT( updateButtons() ) ); connect( m_opt1->kLineEdit_customBrowser, SIGNAL( textChanged( const QString& ) ), SLOT( updateButtons() ) ); }