~ubuntu-branches/ubuntu/natty/kdemultimedia/natty-proposed

« back to all changes in this revision

Viewing changes to libkcompactdisc/kcompactdisc.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Debian Qt/KDE Maintainers
  • Date: 2011-05-26 02:41:36 UTC
  • mfrom: (0.2.3 upstream)
  • mto: This revision was merged to the branch mainline in revision 108.
  • Revision ID: james.westby@ubuntu.com-20110526024136-jjwsigfy402jhupm
Tags: upstream-4.6.3
ImportĀ upstreamĀ versionĀ 4.6.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
    foreach(const Solid::Device &device, Solid::Device::listFromType(Solid::DeviceInterface::OpticalDrive)) {
48
48
        kDebug() << device.udi().toLatin1().constData();
49
49
        const Solid::Block *b = device.as<Solid::Block>();
 
50
        
 
51
        if(!b) {
 
52
            continue;
 
53
        }
 
54
 
50
55
        const Solid::OpticalDrive *o = device.as<Solid::OpticalDrive>();
51
56
        Solid::OpticalDrive::MediumTypes mediumType = o->supportedMedia();
52
57
 
53
 
        url = KUrl::fromPath(b->device().toLatin1());
54
 
 
 
58
        url = KUrl::fromPath(QLatin1String( b->device().toLatin1() ));
 
59
        //TODO translate them ?
55
60
        if(mediumType < Solid::OpticalDrive::Cdrw) {
56
 
            type = "CD-ROM";
 
61
            type = QLatin1String( "CD-ROM" );
57
62
        } else if(mediumType < Solid::OpticalDrive::Dvd) {
58
 
            type = "CDRW";
 
63
            type = QLatin1String( "CDRW" );
59
64
        } else if(mediumType < Solid::OpticalDrive::Dvdr) {
60
 
            type = "DVD-ROM";
 
65
            type = QLatin1String( "DVD-ROM" );
61
66
        } else if(mediumType < Solid::OpticalDrive::Bd) {
62
 
            type = "DVDRW";
 
67
            type = QLatin1String( "DVDRW" );
63
68
        } else if(mediumType < Solid::OpticalDrive::HdDvd) {
64
 
            type = "Blu-ray";
 
69
            type = QLatin1String( "Blu-ray" );
65
70
        } else {
66
 
            type = "High Density DVD";
 
71
            type = QLatin1String( "High Density DVD" );
67
72
        }
68
73
 
69
74
        if(!device.vendor().isEmpty())
70
 
            name = (QString('[') + type + " - " + device.vendor() + " - " + device.product() + ']');
 
75
            name = (QLatin1Char('[') + type + QLatin1String( " - " ) + device.vendor() + QLatin1String( " - " ) + device.product() + QLatin1Char( ']' ));
71
76
        else
72
 
            name = (QString('[') + type + " - unknown vendor - " + device.product() + ']');
 
77
            name = (QLatin1Char('[') + type + QLatin1String( " - unknown vendor - " ) + device.product() + QLatin1Char( ']' ));
73
78
 
74
79
        cdromsNameToDeviceUrl.insert(name, url);
75
80
        cdromsNameToUdi.insert(name, device.udi());
99
104
 
100
105
QString KCompactDisc::urlToDevice(const KUrl& deviceUrl)
101
106
{
102
 
    if(deviceUrl.protocol() == "media" || deviceUrl.protocol() == "system") {
 
107
    if(deviceUrl.protocol() == QLatin1String( "media" ) || deviceUrl.protocol() == QLatin1String( "system" )) {
103
108
        kDebug() << "Asking mediamanager for " << deviceUrl.fileName();
104
109
 
105
 
        QDBusInterface mediamanager( "org.kde.kded", "/modules/mediamanager", "org.kde.MediaManager" );
106
 
        QDBusReply<QStringList> reply = mediamanager.call("properties", deviceUrl.fileName());
 
110
        QDBusInterface mediamanager( QLatin1String( "org.kde.kded" ), QLatin1String( "/modules/mediamanager" ), QLatin1String( "org.kde.MediaManager" ) );
 
111
        QDBusReply<QStringList> reply = mediamanager.call(QLatin1String( "properties" ), deviceUrl.fileName());
107
112
 
108
113
        QStringList properties = reply;
109
114
        if(!reply.isValid() || properties.count() < 6) {
113
118
            kDebug() << "Reply from mediamanager " << properties[5];
114
119
            return properties[5];
115
120
        }
116
 
    } else if(deviceUrl.protocol() == "file") {
 
121
    } else if(deviceUrl.protocol() == QLatin1String( "file" )) {
117
122
        return deviceUrl.path();
118
123
    } else {
119
124
        return QString();
124
129
{
125
130
    QStringList list;
126
131
 
127
 
    list << "phonon"
128
 
#ifdef USE_ARTS
129
 
        << "arts"
130
 
#endif
 
132
    list << QLatin1String( "phonon" )
131
133
#if defined(HAVE_LIBASOUND2)
132
 
        << "alsa"
 
134
        << QLatin1String( "alsa" )
133
135
#endif
134
136
#if defined(sun) || defined(__sun__)
135
 
        << "sun"
 
137
        << QLatin1String( "sun" )
136
138
#endif
137
139
    ;
138
140
    return list;
192
194
    d_ptr(new KCompactDiscPrivate(this, KCompactDisc::defaultCdromDeviceName()))
193
195
{
194
196
    Q_D(KCompactDisc);
195
 
    dummy_ptr = d;
196
197
    d->m_infoMode = infoMode;
197
198
}
198
199
 
199
200
KCompactDisc::~KCompactDisc()
200
201
{
201
202
    stop();
202
 
    delete dummy_ptr;
203
203
    delete d_ptr;
204
204
}
205
205
 
528
528
bool KCompactDisc::setDevice(const QString &deviceName, unsigned volume,
529
529
    bool digitalPlayback, const QString &audioSystem, const QString &audioDevice)
530
530
{
531
 
        QString as = digitalPlayback ? audioSystem : QString("cdin");
532
 
        QString ad = digitalPlayback ? audioDevice : QString();
 
531
        const QString as = digitalPlayback ? audioSystem : QLatin1String("cdin");
 
532
        const QString ad = digitalPlayback ? audioDevice : QString();
533
533
    kDebug() << "Device init: " << deviceName << ", " << as << ", " << ad;
534
534
 
535
 
        if(dummy_ptr->moveInterface(deviceName, as, ad)) {
 
535
        if(d_ptr->moveInterface(deviceName, as, ad)) {
536
536
                setVolume(volume);
537
537
                return 1;
538
538
        } else {