Beispiel #1
0
void K3bWriterSelectionWidget::slotManualSpeed()
{
  //
  // We need to know if it will be a CD or DVD medium. Since the override device
  // is only used for CD/DVD copy anyway we simply reply on the inserted medium's type.
  //
  int speedFactor = ( k3bappcore->mediaCache()->diskInfo( writerDevice() ).isDvdMedia() ? 1385 : 175 );

  bool ok = true;
  int newSpeed = KInputDialog::getInteger( i18n("Set writing speed manually"),
					   i18n("<p>K3b is not able to perfectly determine the maximum "
						"writing speed of an optical writer. Writing speed is always "
						"reported subject to the inserted medium."
						"<p>Please enter the writing speed here and K3b will remember it "
						"for future sessions (Example: 16x)."),
					   writerDevice()->maxWriteSpeed()/speedFactor,
					   1,
					   10000,
					   1,
					   10,
					   &ok,
					   this ) * speedFactor;
  if( ok ) {
    writerDevice()->setMaxWriteSpeed( QMAX( newSpeed, writerDevice()->maxWriteSpeed() ) );
    slotRefreshWriterSpeeds();
    setSpeed( newSpeed );
  }
  else {
    if( d->lastSetSpeed == -1 )
      m_comboSpeed->setCurrentItem( 0 ); // Auto
    else
      setSpeed( d->lastSetSpeed );
  }
}
void K3b::WriterSelectionWidget::slotManualSpeed()
{
    //
    // In case we think we have all the available speeds (i.e. if the device reported a non-empty list)
    // we just treat it as a manual selection. Otherwise we admit that we cannot do better
    //
    bool haveSpeeds = ( writerDevice() && !k3bappcore->mediaCache()->writingSpeeds( writerDevice() ).isEmpty() );
    QString s;
    if ( haveSpeeds ) {
        s = i18n( "Please enter the speed that K3b should use for burning (Example: 16x)." );
    }
    else {
        s = i18n("<p>K3b is not able to perfectly determine the maximum "
                 "writing speed of an optical writer. Writing speed is always "
                 "reported subject to the inserted medium."
                 "<p>Please enter the writing speed here and K3b will remember it "
                 "for future sessions (Example: 16x).");
    }

    //
    // We need to know the type of medium. Since the override device
    // is only used for copy anyway we simply reply on the inserted medium's type.
    //
    int speedFactor = K3b::Device::SPEED_FACTOR_CD;
    if( Device::isDvdMedia( k3bappcore->mediaCache()->diskInfo( writerDevice() ).mediaType() ) ) {
        speedFactor = K3b::Device::SPEED_FACTOR_DVD;
    }
    else if( Device::isBdMedia( k3bappcore->mediaCache()->diskInfo( writerDevice() ).mediaType() ) ) {
        speedFactor = K3b::Device::SPEED_FACTOR_BD;
    }

    bool ok = true;
    int newSpeed = KInputDialog::getInteger( i18n("Set writing speed manually"),
                                             s,
                                             writerDevice()->maxWriteSpeed()/speedFactor,
                                             1,
                                             10000,
                                             1,
                                             10,
                                             &ok,
                                             this ) * speedFactor;
    if( ok ) {
        writerDevice()->setMaxWriteSpeed( qMax( newSpeed, writerDevice()->maxWriteSpeed() ) );
        if ( haveSpeeds ) {
            insertSpeedItem( newSpeed );
        }
        else {
            slotRefreshWriterSpeeds();
        }
        setSpeed( newSpeed );
    }
    else {
        if( d->lastSetSpeed == -1 )
            m_comboSpeed->setSelectedValue( s_autoSpeedValue ); // Auto
        else
            setSpeed( d->lastSetSpeed );
    }
}
void K3b::WriterSelectionWidget::slotWriterChanged()
{
    slotRefreshWriterSpeeds();
    slotRefreshWritingApps();

    // save last selected writer
    if( K3b::Device::Device* dev = writerDevice() ) {
        KConfigGroup g( KGlobal::config(), "General Options" );
        g.writeEntry( "current_writer", dev->blockDeviceName() );
    }
}
void K3b::WriterSelectionWidget::setForceAutoSpeed( bool b )
{
    d->forceAutoSpeed = b;
    slotRefreshWriterSpeeds();
}