TransactionItem::TransactionItem( QWidget* parent, ProgressItem *item, bool first ) : QVBox( parent, "TransactionItem" ), mCancelButton( 0 ), mItem( item ) { setSpacing( 2 ); setMargin( 2 ); setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Fixed ) ); mFrame = new QFrame( this ); mFrame->setFrameShape( QFrame::HLine ); mFrame->setFrameShadow( QFrame::Raised ); mFrame->show(); setStretchFactor( mFrame, 3 ); QHBox *h = new QHBox( this ); h->setSpacing( 5 ); mItemLabel = new QLabel( item->label(), h ); // always interpret the label text as RichText, but disable word wrapping mItemLabel->setTextFormat( Qt::RichText ); mItemLabel->setAlignment( Qt::AlignAuto | Qt::AlignVCenter | Qt::SingleLine ); h->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Fixed ) ); mProgress = new QProgressBar( 100, h ); mProgress->setProgress( item->progress() ); if ( item->canBeCanceled() ) { mCancelButton = new QPushButton( SmallIcon( "cancel" ), QString::null, h ); QToolTip::add( mCancelButton, i18n("Cancel this operation.") ); connect ( mCancelButton, SIGNAL( clicked() ), this, SLOT( slotItemCanceled() )); } h = new QHBox( this ); h->setSpacing( 5 ); h->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Fixed ) ); mSSLLabel = new SSLLabel( h ); mSSLLabel->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); mItemStatus = new QLabel( item->status(), h ); // always interpret the status text as RichText, but disable word wrapping mItemStatus->setTextFormat( Qt::RichText ); mItemStatus->setAlignment( Qt::AlignAuto | Qt::AlignVCenter | Qt::SingleLine ); // richtext leads to sizeHint acting as if wrapping was enabled though, // so make sure we only ever have the height of one line. mItemStatus->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Ignored ) ); mItemStatus->setFixedHeight( mItemLabel->sizeHint().height() ); setCrypto( item->usesCrypto() ); if( first ) hideHLine(); }
BookmarksSettingsPage::BookmarksSettingsPage(QWidget*parent) : SettingsPageBase(parent), m_addButton(0), m_removeButton(0), m_moveUpButton(0), m_moveDownButton(0) { QVBoxLayout* topLayout = new QVBoxLayout(parent, 2, KDialog::spacingHint()); const int spacing = KDialog::spacingHint(); QHBox* hBox = new QHBox(parent); hBox->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); hBox->setSpacing(spacing); hBox->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Ignored); m_listView = new KListView(hBox); m_listView->addColumn(i18n("Icon")); m_listView->addColumn(i18n("Name")); m_listView->addColumn(i18n("Location")); m_listView->setResizeMode(QListView::LastColumn); m_listView->setColumnAlignment(0, Qt::AlignHCenter); m_listView->setAllColumnsShowFocus(true); m_listView->setSorting(-1); connect(m_listView, SIGNAL(selectionChanged()), this, SLOT(updateButtons())); connect(m_listView, SIGNAL(pressed(QListViewItem*)), this, SLOT(slotBookmarkPressed(QListViewItem*))); connect(m_listView, SIGNAL(doubleClicked(QListViewItem*, const QPoint&, int)), this, SLOT(slotBookmarkDoubleClicked(QListViewItem*, const QPoint&, int))); QVBox* buttonBox = new QVBox(hBox); buttonBox->setSpacing(spacing); const QSizePolicy buttonSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum); m_addButton = new KPushButton(i18n("Add..."), buttonBox); connect(m_addButton, SIGNAL(clicked()), this, SLOT(slotAddButtonClicked())); m_addButton->setSizePolicy(buttonSizePolicy); m_editButton = new KPushButton(i18n("Edit..."), buttonBox); connect(m_editButton, SIGNAL(clicked()), this, SLOT(slotEditButtonClicked())); m_editButton->setSizePolicy(buttonSizePolicy); m_removeButton = new KPushButton(i18n("Remove"), buttonBox); connect(m_removeButton, SIGNAL(clicked()), this, SLOT(slotRemoveButtonClicked())); m_removeButton->setSizePolicy(buttonSizePolicy); m_moveUpButton = new KPushButton(i18n("Move Up"), buttonBox); connect(m_moveUpButton, SIGNAL(clicked()), this, SLOT(slotMoveUpButtonClicked())); m_moveUpButton->setSizePolicy(buttonSizePolicy); m_moveDownButton = new KPushButton(i18n("Move Down"), buttonBox); connect(m_moveDownButton, SIGNAL(clicked()), this, SLOT(slotMoveDownButtonClicked())); m_moveDownButton->setSizePolicy(buttonSizePolicy); // Add a dummy widget with no restriction regarding a vertical resizing. // This assures that the spacing between the buttons is not increased. new QWidget(buttonBox); topLayout->addWidget(hBox); // insert all editable bookmarks. KBookmarkGroup root = DolphinSettings::instance().bookmarkManager()->root(); KBookmark bookmark = root.first(); QListViewItem* prev = 0; while (!bookmark.isNull()) { QListViewItem* item = new QListViewItem(m_listView); item->setPixmap(PixmapIdx, SmallIcon(bookmark.icon())); item->setText(NameIdx, bookmark.text()); item->setText(URLIdx, bookmark.url().prettyURL()); // add hidden column to be able to retrieve the icon name again item->setText(IconIdx, bookmark.icon()); m_listView->insertItem(item); if (prev != 0) { item->moveItem(prev); } prev = item; bookmark = root.next(bookmark); } m_listView->setSelected(m_listView->firstChild(), true); updateButtons(); }
GeneralSettingsPage::GeneralSettingsPage(QWidget* parent) : SettingsPageBase(parent), m_homeURL(0), m_startSplit(0), m_startEditable(0) { QVBoxLayout* topLayout = new QVBoxLayout(parent, 2, KDialog::spacingHint()); const int spacing = KDialog::spacingHint(); const int margin = KDialog::marginHint(); const QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); DolphinSettings& settings = DolphinSettings::instance(); QVBox* vBox = new QVBox(parent); vBox->setSizePolicy(sizePolicy); vBox->setSpacing(spacing); vBox->setMargin(margin); vBox->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Ignored); // create 'Home URL' editor QGroupBox* homeGroup = new QGroupBox(1, Qt::Horizontal, i18n("Home URL"), vBox); homeGroup->setSizePolicy(sizePolicy); homeGroup->setMargin(margin); QHBox* homeURLBox = new QHBox(homeGroup); homeURLBox->setSizePolicy(sizePolicy); homeURLBox->setSpacing(spacing); new QLabel(i18n("Location:"), homeURLBox); m_homeURL = new QLineEdit(settings.homeURL().prettyURL(), homeURLBox); QPushButton* selectHomeURLButton = new QPushButton(SmallIcon("folder"), QString::null, homeURLBox); connect(selectHomeURLButton, SIGNAL(clicked()), this, SLOT(selectHomeURL())); QHBox* buttonBox = new QHBox(homeGroup); buttonBox->setSizePolicy(sizePolicy); buttonBox->setSpacing(spacing); QPushButton* useCurrentButton = new QPushButton(i18n("Use current location"), buttonBox); connect(useCurrentButton, SIGNAL(clicked()), this, SLOT(useCurrentLocation())); QPushButton* useDefaultButton = new QPushButton(i18n("Use default location"), buttonBox); connect(useDefaultButton, SIGNAL(clicked()), this, SLOT(useDefaulLocation())); // create 'Default View Mode' group QButtonGroup* buttonGroup = new QButtonGroup(3, Qt::Vertical, i18n("Default View Mode"), vBox); buttonGroup->setSizePolicy(sizePolicy); buttonGroup->setMargin(margin); m_iconsView = new QRadioButton(i18n("Icons"), buttonGroup); m_detailsView = new QRadioButton(i18n("Details"), buttonGroup); m_previewsView = new QRadioButton(i18n("Previews"), buttonGroup); switch (settings.defaultViewMode()) { case DolphinView::IconsView: m_iconsView->setChecked(true); break; case DolphinView::DetailsView: m_detailsView->setChecked(true); break; case DolphinView::PreviewsView: m_previewsView->setChecked(true); break; } // create 'Start with split view' checkbox m_startSplit = new QCheckBox(i18n("Start with split view"), vBox); m_startSplit->setChecked(settings.isViewSplit()); // create 'Start with editable navigation bar' checkbox m_startEditable = new QCheckBox(i18n("Start with editable navigation bar"), vBox); m_startEditable->setChecked(settings.isURLEditable()); // create 'Save view properties for each folder' checkbox m_saveView = new QCheckBox(i18n("Save view properties for each folder"), vBox); m_saveView->setChecked(settings.isSaveView()); // Add a dummy widget with no restriction regarding // a vertical resizing. This assures that the dialog layout // is not stretched vertically. new QWidget(vBox); topLayout->addWidget(vBox); }
QWidget* MyFracWindow::createDisplayDock(QWidget* parent) { QVBox* wrapper = new QVBox(parent); wrapper->setSpacing(0); QGrid* propDisplay = new QGrid(2, wrapper); propDisplay->setMargin(7); propDisplay->setSpacing(5); new QLabel(i18n("Color gradient:"), propDisplay); GradientButton* gradButton = new GradientButton(propDisplay); connect(this, SIGNAL(gradientChanged(const QRgb*, double, double)), gradButton, SLOT(setGradient(const QRgb*, double, double))); connect(gradButton, SIGNAL(clicked()), this, SLOT(onGradientEdit())); QToolTip::add(gradButton, i18n("Gradient used to display the fractal")); new QLabel(i18n("Color scale:"), propDisplay); _sliderScale = new QSlider(QSlider::Horizontal, propDisplay); _sliderScale->setRange(0, 100); connect(_sliderScale, SIGNAL(valueChanged(int)), SLOT(setGradientScale(int))); QToolTip::add(_sliderScale, i18n("Scale of the color gradient")); new QLabel(i18n("Color offset:"), propDisplay); _sliderOffset = new QSlider(QSlider::Horizontal, propDisplay); _sliderOffset->setRange(0, 100); connect(_sliderOffset, SIGNAL(valueChanged(int)), SLOT(setGradientOffset(int))); QToolTip::add(_sliderOffset, i18n("Offset of the color gradient")); new QLabel(i18n("Scroll colors:"), propDisplay); QHBox* box = new QHBox(propDisplay); box->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); box->setSpacing(5); QComboBox* combo = new QComboBox(box); combo->insertItem(i18n("scroll direction", "Off")); combo->insertItem(i18n("scroll direction", "Left")); combo->insertItem(i18n("scroll direction", "Right")); connect(combo, SIGNAL(activated(int)), SLOT(setScrollMode(int))); _sliderScroll = new QSlider(QSlider::Horizontal, box); _sliderScroll->setRange(0, 100); _sliderScroll->setEnabled(false); connect(_sliderScroll, SIGNAL(valueChanged(int)), SLOT(setScrollSpeed(int))); QToolTip::add(combo, i18n("Scrolling direction")); QToolTip::add(_sliderScroll, i18n("Scrolling speed")); new QLabel(i18n("Background:"), propDisplay); _colorButton = new KColorButton(_backgroundColor, propDisplay); connect(_colorButton, SIGNAL(changed(const QColor&)), SLOT(selectBackground(const QColor&))); QToolTip::add(_colorButton, i18n("Color of the background area")); new QLabel(i18n("3D grid size:"), propDisplay); _comboGrid = new QComboBox(propDisplay); for (int i = 64; i <= 1024; i *= 2) _comboGrid->insertItem(i18n("%1 x %2").arg(i).arg(i)); _comboGrid->setEnabled(false); connect(_comboGrid, SIGNAL(activated(int)), SLOT(setGridSize(int))); QToolTip::add(_comboGrid, i18n("Resolution of the 3D mesh")); new QLabel(i18n("Height scale:"), propDisplay); _sliderHeight = new QSlider(QSlider::Horizontal, propDisplay); _sliderHeight->setRange(0, 100); _sliderHeight->setEnabled(false); connect(_sliderHeight, SIGNAL(valueChanged(int)), SLOT(setHeightScale(int))); QToolTip::add(_sliderHeight, i18n("Height scale of the 3D mesh")); wrapper->setStretchFactor(new QWidget(wrapper), 1); return wrapper; }
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() ) ); }