File: testkcd.cpp

package info (click to toggle)
libkcompactdisc 4%3A17.08.3-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 864 kB
  • sloc: ansic: 7,571; cpp: 1,731; makefile: 5; sh: 1
file content (71 lines) | stat: -rw-r--r-- 1,769 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#include <QObject>
#include <QDebug>
#include <QMetaObject>
#include <QCoreApplication>
#include <QtGlobal>

#include <kcompactdisc.h>

class TestKCD : public QObject
{
    Q_OBJECT

    public:

    explicit TestKCD(QObject *parent = 0) :
        QObject(parent),
        mKcd(new KCompactDisc(KCompactDisc::Asynchronous))
    {}

    virtual ~TestKCD()
    {
        mKcd->deleteLater();
    }

    public slots:

    void doTest()
    {
        qDebug() << "Starting test";
        mKcd->setDevice(mKcd->defaultCdromDeviceName(), 50, true, "phonon");
        qDebug() << "";

        qDebug() << "We have" << mKcd->audioSystems().size() << "audo systems available:";
        for (auto system: mKcd->audioSystems()) {
            qDebug() << system;
        }
        qDebug() << "";

        qDebug() << "We have" << mKcd->cdromDeviceNames().size() << "cdrom drives available:";
        for (auto cdrom: mKcd->cdromDeviceNames()) {
            qDebug() << cdrom;
        }
        qDebug() << "";

        qDebug() << "The current cdrom drive loaded is:" << mKcd->deviceName();
        qDebug() << "The disc device node url is:" << mKcd->deviceUrl();
        qDebug() << "The disc status is" << mKcd->discStatus();
        qDebug() << "Does the drive have a disc in it:" << !mKcd->isNoDisc();
        qDebug() << "The number of tracks in the disc:" << mKcd->tracks();
        qDebug() << "The current track no:" << mKcd->trackPosition();

        qApp->exit();
    }

    private:

    KCompactDisc *mKcd;
};

int main(int argc, char **argv)
{
    QCoreApplication app(argc, argv);

    qDebug() << "Testing libKF5CompactDisc";
    TestKCD test;
    QMetaObject::invokeMethod(&test, "doTest", Qt::QueuedConnection);

    return app.exec();
}

#include "testkcd.moc"