K3bIsoImageWritingDialog::K3bIsoImageWritingDialog( QWidget* parent, const char* name, bool modal ) : K3bInteractionDialog( parent, name, i18n("Burn Iso9660 Image"), i18n("to DVD"), START_BUTTON|CANCEL_BUTTON, START_BUTTON, "DVD image writing", modal ) { d = new Private(); setAcceptDrops(true); setupGui(); m_writerSelectionWidget->setWantedMediumType( K3bDevice::MEDIA_WRITABLE_DVD ); m_writerSelectionWidget->setWantedMediumState( K3bDevice::STATE_EMPTY ); m_writerSelectionWidget->setSupportedWritingApps( K3b::GROWISOFS ); m_writingModeWidget->setSupportedModes( K3b::DAO|K3b::WRITING_MODE_INCR_SEQ|K3b::WRITING_MODE_RES_OVWR ); m_md5Job = new K3bMd5Job( 0, this ); connect( m_md5Job, SIGNAL(finished(bool)), this, SLOT(slotMd5JobFinished(bool)) ); connect( m_md5Job, SIGNAL(percent(int)), this, SLOT(slotMd5JobPercent(int)) ); updateImageSize( imagePath() ); connect( m_writerSelectionWidget, SIGNAL(writerChanged()), this, SLOT(slotWriterChanged()) ); connect( m_writerSelectionWidget, SIGNAL(writingAppChanged(int)), this, SLOT(slotWriterChanged()) ); connect( m_writingModeWidget, SIGNAL(writingModeChanged(int)), this, SLOT(slotWriterChanged()) ); connect( m_editImagePath, SIGNAL(textChanged(const QString&)), this, SLOT(updateImageSize(const QString&)) ); connect( m_checkDummy, SIGNAL(toggled(bool)), this, SLOT(slotWriterChanged()) ); }
void K3bIsoImageWritingDialog::updateImageSize( const QString& path ) { m_md5Job->cancel(); m_infoView->clear(); d->md5SumItem = 0; d->haveMd5Sum = false; d->isIsoImage = false; QFileInfo info( path ); if( info.isFile() ) { KIO::filesize_t imageSize = K3b::filesize( KURL::fromPathOrURL(path) ); // ------------------------------------------------ // Test for iso9660 image // ------------------------------------------------ K3bIso9660 isoF( path ); if( isoF.open() ) { d->isIsoImage = true; K3bListViewItem* isoRootItem = new K3bListViewItem( m_infoView, m_infoView->lastItem(), i18n("Iso9660 image") ); isoRootItem->setForegroundColor( 0, palette().disabled().foreground() ); isoRootItem->setPixmap( 0, SmallIcon( "cdimage") ); K3bListViewItem* item = new K3bListViewItem( isoRootItem, m_infoView->lastItem(), i18n("Filesize:"), KIO::convertSize( imageSize ) ); item->setForegroundColor( 0, palette().disabled().foreground() ); item = new K3bListViewItem( isoRootItem, m_infoView->lastItem(), i18n("System Id:"), isoF.primaryDescriptor().systemId.isEmpty() ? QString("-") : isoF.primaryDescriptor().systemId ); item->setForegroundColor( 0, palette().disabled().foreground() ); item = new K3bListViewItem( isoRootItem, m_infoView->lastItem(), i18n("Volume Id:"), isoF.primaryDescriptor().volumeId.isEmpty() ? QString("-") : isoF.primaryDescriptor().volumeId ); item->setForegroundColor( 0, palette().disabled().foreground() ); item = new K3bListViewItem( isoRootItem, m_infoView->lastItem(), i18n("Volume Set Id:"), isoF.primaryDescriptor().volumeSetId.isEmpty() ? QString("-") : isoF.primaryDescriptor().volumeSetId ); item->setForegroundColor( 0, palette().disabled().foreground() ); item = new K3bListViewItem( isoRootItem, m_infoView->lastItem(), i18n("Publisher Id:"), isoF.primaryDescriptor().publisherId.isEmpty() ? QString("-") : isoF.primaryDescriptor().publisherId ); item->setForegroundColor( 0, palette().disabled().foreground() ); item = new K3bListViewItem( isoRootItem, m_infoView->lastItem(), i18n("Preparer Id:"), isoF.primaryDescriptor().preparerId.isEmpty() ? QString("-") : isoF.primaryDescriptor().preparerId ); item->setForegroundColor( 0, palette().disabled().foreground() ); item = new K3bListViewItem( isoRootItem, m_infoView->lastItem(), i18n("Application Id:"), isoF.primaryDescriptor().applicationId.isEmpty() ? QString("-") : isoF.primaryDescriptor().applicationId ); item->setForegroundColor( 0, palette().disabled().foreground() ); isoRootItem->setOpen( true ); isoF.close(); } else { K3bListViewItem* item = new K3bListViewItem( m_infoView, m_infoView->lastItem(), i18n("Not an Iso9660 image") ); item->setForegroundColor( 0, Qt::red ); item->setPixmap( 0, SmallIcon( "stop") ); } calculateMd5Sum( path ); } slotWriterChanged(); }
K3b::WriterSelectionWidget::WriterSelectionWidget( QWidget *parent ) : QWidget( parent ) { d = new Private; d->forceAutoSpeed = false; d->supportedWritingApps = K3b::WritingAppCdrecord|K3b::WritingAppCdrdao|K3b::WritingAppGrowisofs; d->lastSetSpeed = -1; QGroupBox* groupWriter = new QGroupBox( this ); groupWriter->setTitle( i18n( "Burn Medium" ) ); QGridLayout* groupWriterLayout = new QGridLayout( groupWriter ); groupWriterLayout->setAlignment( Qt::AlignTop ); QLabel* labelSpeed = new QLabel( groupWriter ); labelSpeed->setText( i18n( "Speed:" ) ); m_comboSpeed = new K3b::IntMapComboBox( groupWriter ); m_comboMedium = new MediaSelectionComboBox( groupWriter ); m_writingAppLabel = new QLabel( i18n("Writing app:"), groupWriter ); m_comboWritingApp = new K3b::IntMapComboBox( groupWriter ); groupWriterLayout->addWidget( m_comboMedium, 0, 0 ); groupWriterLayout->addWidget( labelSpeed, 0, 1 ); groupWriterLayout->addWidget( m_comboSpeed, 0, 2 ); groupWriterLayout->addWidget( m_writingAppLabel, 0, 3 ); groupWriterLayout->addWidget( m_comboWritingApp, 0, 4 ); groupWriterLayout->setColumnStretch( 0, 1 ); QGridLayout* mainLayout = new QGridLayout( this ); mainLayout->setAlignment( Qt::AlignTop ); mainLayout->setContentsMargins( 0, 0, 0, 0 ); mainLayout->addWidget( groupWriter, 0, 0 ); // tab order setTabOrder( m_comboMedium, m_comboSpeed ); setTabOrder( m_comboSpeed, m_comboWritingApp ); connect( m_comboMedium, SIGNAL(selectionChanged(K3b::Device::Device*)), this, SIGNAL(writerChanged()) ); connect( m_comboMedium, SIGNAL(selectionChanged(K3b::Device::Device*)), this, SIGNAL(writerChanged(K3b::Device::Device*)) ); connect( m_comboMedium, SIGNAL(newMedia()), this, SIGNAL(newMedia()) ); connect( m_comboMedium, SIGNAL(newMedium(K3b::Device::Device*)), this, SIGNAL(newMedium(K3b::Device::Device*)) ); connect( m_comboMedium, SIGNAL(newMedium(K3b::Device::Device*)), this, SLOT(slotNewBurnMedium(K3b::Device::Device*)) ); connect( m_comboWritingApp, SIGNAL(valueChanged(int)), this, SLOT(slotWritingAppSelected(int)) ); connect( this, SIGNAL(writerChanged()), SLOT(slotWriterChanged()) ); connect( m_comboSpeed, SIGNAL(valueChanged(int)), this, SLOT(slotSpeedChanged(int)) ); m_comboMedium->setToolTip( i18n("The medium that will be used for burning") ); m_comboSpeed->setToolTip( i18n("The speed at which to burn the medium") ); m_comboWritingApp->setToolTip( i18n("The external application to actually burn the medium") ); m_comboMedium->setWhatsThis( i18n("<p>Select the medium that you want to use for burning." "<p>In most cases there will only be one medium available which " "does not leave much choice.") ); m_comboSpeed->setWhatsThis( i18n("<p>Select the speed with which you want to burn." "<p><b>Auto</b><br>" "This will choose the maximum writing speed possible with the used " "medium. " "This is the recommended selection for most media.</p>" "<p><b>Ignore</b> (DVD only)<br>" "This will leave the speed selection to the writer device. " "Use this if K3b is unable to set the writing speed." "<p>1x refers to 175 KB/s for CD, 1385 KB/s for DVD, and 4496 KB/s for Blu-ray.</p>" "<p><b>Caution:</b> Make sure your system is able to send the data " "fast enough to prevent buffer underruns.") ); m_comboWritingApp->setWhatsThis( i18n("<p>K3b uses the command line tools cdrecord, growisofs, and cdrdao " "to actually write a CD or DVD." "<p>Normally K3b chooses the best " "suited application for every task automatically but in some cases it " "may be possible that one of the applications does not work as intended " "with a certain writer. In this case one may select the " "application manually.") ); clearSpeedCombo(); slotConfigChanged( KGlobal::config() ); slotWriterChanged(); }