~ubuntu-branches/ubuntu/lucid/mythplugins/lucid

« back to all changes in this revision

Viewing changes to mythmusic/mythmusic/globalsettings.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Mario Limonciello
  • Date: 2009-08-16 00:44:19 UTC
  • mfrom: (1.1.24 upstream)
  • Revision ID: james.westby@ubuntu.com-20090816004419-ftlyfcl4dh08uwrn
Tags: 0.21.0+fixes212161-0ubuntu1
* New upstream -fixes snapshot (212161)
* debian/rules:
  - Parse svn rev # from debian/changelog

Show diffs side-by-side

added added

removed removed

Lines of Context:
58
58
    return gc;
59
59
};
60
60
 
61
 
static HostComboBox *CDDevice()
 
61
static HostLineEdit *CDDevice()
62
62
{
63
 
    HostComboBox *gc = new HostComboBox("CDDevice", true);
 
63
    HostLineEdit *gc = new HostLineEdit("CDDevice", true);
64
64
    gc->setLabel(QObject::tr("CD device"));
65
 
    QDir dev("/dev", "cdrom*", QDir::Name, QDir::System);
66
 
    gc->fillSelectionsFromDir(dev);
67
 
    dev.setNameFilter("scd*");
68
 
    gc->fillSelectionsFromDir(dev);
69
 
    dev.setNameFilter("hd*");
70
 
    gc->fillSelectionsFromDir(dev);
71
 
 
72
 
    dev.setNameFilter("cdrom*");
73
 
    dev.setPath("/dev/cdroms");
74
 
    gc->fillSelectionsFromDir(dev);
 
65
    gc->setValue("default");
75
66
    gc->setHelpText(QObject::tr("CDRom device used for ripping/playback."));
76
67
    return gc;
77
68
};
472
463
    return gc;
473
464
};
474
465
 
475
 
static HostComboBox *CDWriterDevice()
 
466
static HostLineEdit *CDWriterDevice()
476
467
{
477
 
    HostComboBox *gc = new HostComboBox("CDWriterDevice");
478
 
 
479
 
    QString argadd[3]  = { "", "-dev=ATA", "-dev=ATAPI" };
480
 
    QString prepend[3] = { "", "ATA:", "ATAPI:" };
481
 
 
482
 
    for (int i = 0; i < 3; i++)
483
 
    {
484
 
        QStringList args;
485
 
        QStringList result;
486
 
 
487
 
        args = "cdrecord";
488
 
        args += "--scanbus";
489
 
 
490
 
        if (argadd[i].length() > 1)
491
 
            args += argadd[i];
492
 
 
493
 
        QString  cmd = args.join(" ");
494
 
        QProcess proc(args);
495
 
 
496
 
        MythTimer totaltimer;
497
 
    
498
 
        if (proc.start())
499
 
        {
500
 
            totaltimer.start();
501
 
 
502
 
            while (1)
503
 
            {
504
 
                while (proc.canReadLineStdout())
505
 
                    result += proc.readLineStdout();
506
 
                if (proc.isRunning())
507
 
                {
508
 
                    qApp->processEvents();
509
 
                    usleep(10000);
510
 
                }
511
 
                else
512
 
                {
513
 
                    if (!proc.normalExit())
514
 
                        VERBOSE(VB_GENERAL,
515
 
                                QString("Failed to run '%1'").arg(cmd));
516
 
                    break;
517
 
                }
518
 
 
519
 
                if (totaltimer.elapsed() > 1500)
520
 
                {
521
 
                    //VERBOSE(VB_GENERAL, QString("Killed '%1' after %2ms")
522
 
                    //                    .arg(cmd).arg(totaltimer.elapsed()));
523
 
                    proc.kill();
524
 
                }
525
 
            }
526
 
        }
527
 
        else
528
 
            VERBOSE(VB_GENERAL, QString("Failed to run '%1'").arg(cmd));
529
 
 
530
 
        while (proc.canReadLineStdout())
531
 
            result += proc.readLineStdout();
532
 
 
533
 
        for (QStringList::Iterator it = result.begin(); it != result.end();
534
 
             ++it)
535
 
        {
536
 
            QString line = *it;
537
 
            if (line.length() > 12)
538
 
            {
539
 
                if (line[10] == ')' && line[12] != '*')
540
 
                {
541
 
                    QString dev  = prepend[i] + line.mid(1, 5);
542
 
                    QString name = line.mid(24, 16);
543
 
 
544
 
                    gc->addSelection(name, dev);
545
 
                    VERBOSE(VB_GENERAL, "MythMusic adding CD-Writer: "
546
 
                                        + dev + " -- " + name);
547
 
                }
548
 
            }
549
 
        }
550
 
    }
551
 
    
 
468
    HostLineEdit *gc = new HostLineEdit("CDWriterDevice");
 
469
    gc->setValue("default");
552
470
    gc->setLabel(QObject::tr("CD-Writer Device"));
553
 
    gc->setHelpText(QObject::tr("Select the SCSI or IDE Device for CD Writing."));
 
471
    gc->setHelpText(QObject::tr("Select the SCSI or IDE Device for CD Writing.")
 
472
                    + QObject::tr(" 'default' will let the "
 
473
                                  "MediaMonitor choose a device."));
554
474
    return gc;
555
475
};
556
476