OptionsDetailed::OptionsDetailed( Config* _config, QWidget* parent ) : QWidget( parent ), config( _config ) { const int fontHeight = QFontMetrics(QApplication::font()).boundingRect("M").size().height(); int gridRow = 0; grid = new QGridLayout( this ); QHBoxLayout *topBox = new QHBoxLayout(); grid->addLayout( topBox, 0, 0 ); QLabel *lFormat = new QLabel( i18n("Format:"), this ); topBox->addWidget( lFormat ); cFormat = new KComboBox( this ); topBox->addWidget( cFormat ); cFormat->addItems( config->pluginLoader()->formatList(PluginLoader::Encode,PluginLoader::CompressionType(PluginLoader::InferiorQuality|PluginLoader::Lossy|PluginLoader::Lossless|PluginLoader::Hybrid)) ); connect( cFormat, SIGNAL(activated(const QString&)), this, SLOT(formatChanged(const QString&)) ); // connect( cFormat, SIGNAL(activated(const QString&)), this, SLOT(somethingChanged()) ); topBox->addStretch(); lPlugin = new QLabel( i18n("Use Plugin:"), this ); topBox->addWidget( lPlugin ); cPlugin = new KComboBox( this ); topBox->addWidget( cPlugin ); cPlugin->setSizeAdjustPolicy( QComboBox::AdjustToContents ); connect( cPlugin, SIGNAL(activated(const QString&)), this, SLOT(encoderChanged(const QString&)) ); connect( cPlugin, SIGNAL(activated(const QString&)), this, SLOT(somethingChanged()) ); pConfigurePlugin = new KPushButton( KIcon("configure"), "", this ); pConfigurePlugin->setFixedSize( cPlugin->sizeHint().height(), cPlugin->sizeHint().height() ); pConfigurePlugin->setFlat( true ); topBox->addWidget( pConfigurePlugin ); topBox->setStretchFactor( pConfigurePlugin, 1 ); connect( pConfigurePlugin, SIGNAL(clicked()), this, SLOT(configurePlugin()) ); // draw a horizontal line QFrame *lineFrame = new QFrame( this ); lineFrame->setFrameShape( QFrame::HLine ); lineFrame->setFrameShadow( QFrame::Sunken ); lineFrame->setFixedHeight( fontHeight ); grid->addWidget( lineFrame, 1, 0 ); // prepare the plugin widget wPlugin = 0; grid->setRowStretch( 2, 1 ); grid->setRowMinimumHeight( 2, 20 ); gridRow = 3; // draw a horizontal line lineFrame = new QFrame( this ); lineFrame->setFrameShape( QFrame::HLine ); lineFrame->setFrameShadow( QFrame::Sunken ); lineFrame->setFixedHeight( fontHeight ); grid->addWidget( lineFrame, gridRow++, 0 ); int filterCount = 0; foreach( const QString& pluginName, config->data.backends.enabledFilters ) { FilterPlugin *plugin = qobject_cast<FilterPlugin*>(config->pluginLoader()->backendPluginByName(pluginName)); if( !plugin ) continue; FilterWidget *widget = plugin->newFilterWidget(); if( !widget ) continue; wFilter.insert( widget, plugin ); connect( widget, SIGNAL(optionsChanged()), this, SLOT(somethingChanged()) ); grid->addWidget( widget, gridRow++, 0 ); widget->show(); filterCount++; } if( filterCount > 0 ) { // draw a horizontal line lineFrame = new QFrame( this ); lineFrame->setFrameShape( QFrame::HLine ); lineFrame->setFrameShadow( QFrame::Sunken ); lineFrame->setFixedHeight( fontHeight ); grid->addWidget( lineFrame, gridRow++, 0 ); } // the output directory QHBoxLayout *middleBox = new QHBoxLayout( ); grid->addLayout( middleBox, gridRow++, 0 ); QLabel *lOutput = new QLabel( i18n("Destination:"), this ); middleBox->addWidget( lOutput ); outputDirectory = new OutputDirectory( config, this ); middleBox->addWidget( outputDirectory ); QHBoxLayout *bottomBox = new QHBoxLayout(); grid->addLayout( bottomBox, gridRow++, 0 ); cReplayGain = new QCheckBox( i18n("Calculate Replay Gain tags"), this ); bottomBox->addWidget( cReplayGain ); //connect( cReplayGain, SIGNAL(toggled(bool)), this, SLOT(somethingChanged()) ); bottomBox->addStretch(); lEstimSize = new QLabel( QString(QChar(8776))+"? B / min." ); lEstimSize->hide(); // hide for now because most plugins report inaccurate data bottomBox->addWidget( lEstimSize ); pProfileSave = new KPushButton( KIcon("document-save"), "", this ); bottomBox->addWidget( pProfileSave ); pProfileSave->setFixedWidth( pProfileSave->height() ); pProfileSave->setToolTip( i18n("Save current options as a profile") ); connect( pProfileSave, SIGNAL(clicked()), this, SLOT(saveCustomProfile()) ); pProfileLoad = new QToolButton( this ); bottomBox->addWidget( pProfileLoad ); pProfileLoad->setIcon( KIcon("document-open") ); pProfileLoad->setPopupMode( QToolButton::InstantPopup ); pProfileLoad->setFixedWidth( pProfileLoad->height() ); pProfileLoad->setToolTip( i18n("Load saved profiles") ); }