Здравствуйте, что-то как-то не работает Phonon, выдает ошибку, подскажите пожалуйста, вот код:
C++ (Qt)
/*
* File: main.cpp
* Author: u0807
*
* Created on 10 марта 2015 г., 15:57
*/
#include "myClass.h"
QString ping_Around;
QStringList arguments;
QStringList arguments1;
QStringList arguments2;
QStringList arguments3;
QProcess myProcess;
QProcess myProcess1;
QProcess myProcess2;
QProcess myProcess3;
QStringList strlstPingResults;
QStringList strlstPingResults1;
QStringList strlstPingResults2;
QStringList strlstPingResults3;
QStringList Ss[4];
QGraphicsTextItem* itemText[4];
QString count_Pack[4];
QPushButton* Add_Host;
Phonon::MediaObject *mediaO;
void myClass::timer_overflow() {
myProcess.start(ping_Around, arguments);
myProcess.waitForFinished(1000);
myProcess1.start(ping_Around, arguments1);
myProcess1.waitForFinished(1000);
myProcess2.start(ping_Around, arguments2);
myProcess2.waitForFinished(1000);
myProcess3.start(ping_Around, arguments3);
myProcess3.waitForFinished(1000);
strlstPingResults<<myProcess.readAll();
Ss[0] = strlstPingResults[0].split('\n');
strlstPingResults1<<myProcess1.readAll();
Ss[1] = strlstPingResults1[0].split('\n');
strlstPingResults2<<myProcess2.readAll();
Ss[2] = strlstPingResults2[0].split('\n');
strlstPingResults3<<myProcess3.readAll();
Ss[3] = strlstPingResults3[0].split('\n');
for (int i = 0; i < 4; i++) {
if (Ss[i].count() > 1) {
count_Pack[i] = Ss[i][4].mid(23, 1);
}
}
for (int i = 0; i < 4; i++) {
if (count_Pack[i].count() > 0) {
if (count_Pack[i] == "1") {
item[i]->setBrush(QBrush(Qt::green));
}
}
else {
item[i]->setBrush(QBrush(Qt::red));
}
}
}
void myClass::btnClicked() {
}
void myClass::slotFinished() {
}
myClass::myClass(QObject *parent): QGraphicsScene(parent) {
QFont fontForButton;
fontForButton.setPointSize(7);
mediaO = new Phonon::MediaObject(this);
QObject::connect(mediaO, SIGNAL(finished()), this, SLOT(slotFinished()));
QString str("Active.wav");
mediaO->setCurrentSource(str);
mediaO->play();
Add_Host = new QPushButton("&Add", 0);
Add_Host->setFixedSize(23, 20);
Add_Host->setGeometry(-94, 30, 23, 20);
Add_Host->setFont(fontForButton);
QObject::connect(Add_Host, SIGNAL(clicked()), this, SLOT(btnClicked()));
QGraphicsProxyWidget * item_Widget = addWidget(Add_Host);
Add_Host->show();
ping_Around = "/bin/ping";
arguments << "-c" << "1" << "10.31.3.130";
arguments1 << "-c" << "1" << "10.31.4.130";
arguments2 << "-c" << "1" << "10.31.5.130";
arguments3 << "-c" << "1" << "10.31.6.130";
this->setSceneRect(QRectF(-90, 0, 15, 15));
for (int i = 0; i < 4; i++) {
item[i] = new QGraphicsEllipseItem(0, this);
item[i]->setRect(QRectF(-90, -35 + (i * 16), 15, 15));
item[i]->setBrush(QBrush(Qt::yellow));
}
itemText[1] = new QGraphicsTextItem(0, this);
timer = new QTimer;
QObject::connect(timer, SIGNAL(timeout()), this, SLOT(timer_overflow()));
timer->start(4500);
}
int main(int argc, char *argv[]) {
QApplication app(argc, argv);
myClass m;
QGraphicsView v(&m);
v.setWindowFlags(Qt::WindowStaysOnTopHint);
v.setRenderHints(QPainter::Antialiasing);
v.show();
v.setGeometry(1350, 700, 23, 90);
return app.exec();
}
вот вывод сборщика:
"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE=/usr/bin/qmake SUBPROJECTS= .build-conf
make[1]: Вход в каталог `/home/u0807/NetBeansProjects/QtApplication_2'
/usr/bin/qmake VPATH=. -o qttmp-Debug.mk nbproject/qt-Debug.pro
mv -f qttmp-Debug.mk nbproject/qt-Debug.mk
"/usr/bin/make" -f nbproject/qt-Debug.mk dist/Debug/GNU_1-Linux-x86/QtApplication_2
make[2]: Вход в каталог `/home/u0807/NetBeansProjects/QtApplication_2'
g++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -Inbproject -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -Inbproject -I. -o build/Debug/GNU_1-Linux-x86/main.o main.cpp
main.cpp: In constructor ‘myClass::myClass(QObject*)’:
main.cpp:89:33: warning: ‘Phonon::MediaSource::MediaSource(const QString&)’ is deprecated (declared at /usr/include/qt4/phonon/mediasource.h:144) [-Wdeprecated-declarations]
mediaO->setCurrentSource(str);
^
main.cpp:98:28: warning: unused variable ‘item_Widget’ [-Wunused-variable]
QGraphicsProxyWidget * item_Widget = addWidget(Add_Host);
^
g++ -o dist/Debug/GNU_1-Linux-x86/QtApplication_2 build/Debug/GNU_1-Linux-x86/main.o build/Debug/GNU_1-Linux-x86/moc_myClass.o -L/usr/lib/i386-linux-gnu -lQtGui -lQtCore -lpthread
build/Debug/GNU_1-Linux-x86/main.o: In function `myClass::myClass(QObject*)':
/home/u0807/NetBeansProjects/QtApplication_2/main.cpp:85: undefined reference to `Phonon::MediaObject::MediaObject(QObject*)'
/home/u0807/NetBeansProjects/QtApplication_2/main.cpp:89: undefined reference to `Phonon::MediaSource::MediaSource(QString const&)'
/home/u0807/NetBeansProjects/QtApplication_2/main.cpp:89: undefined reference to `Phonon::MediaObject::setCurrentSource(Phonon::MediaSource const&)'
/home/u0807/NetBeansProjects/QtApplication_2/main.cpp:89: undefined reference to `Phonon::MediaSource::~MediaSource()'
/home/u0807/NetBeansProjects/QtApplication_2/main.cpp:90: undefined reference to `Phonon::MediaObject::play()'
/home/u0807/NetBeansProjects/QtApplication_2/main.cpp:89: undefined reference to `Phonon::MediaSource::~MediaSource()'
collect2: error: ld returned 1 exit status
make[2]: *** [dist/Debug/GNU_1-Linux-x86/QtApplication_2] Ошибка 1
make[2]: Выход из каталога `/home/u0807/NetBeansProjects/QtApplication_2'
make[1]: *** [.build-conf] Ошибка 2
make[1]: Выход из каталога `/home/u0807/NetBeansProjects/QtApplication_2'
make: *** [.build-impl] Ошибка 2
СОБРАТЬ FAILED (значение выхода 2,, общее время: 3s)