Hello.
I'm writing a litte music-player based on Qt and Phonon.
Im using a double-linked list (writed by myself) to storage a data and information. First class, File, storage information about opened files:
Qt Code:
  1. #include "file.h"
  2.  
  3. //Phonon::MediaObject *mediaObject;
  4. //Phonon::AudioOutput *audioOutput;
  5.  
  6. File::File()
  7. {
  8. this->next = 0;
  9. this->prev = 0;
  10. this->path_to_file = "";
  11. this->fileName = "";
  12. this->title = "";
  13. }
  14.  
  15. void File::setPath(QString path)
  16. {
  17. this->path_to_file = path;
  18. }
  19.  
  20. QString File::returnPath()
  21. {
  22. return this->path_to_file;
  23. }
  24.  
  25. void File::playFile()
  26. {
  27. this->mediaObject = new Phonon::MediaObject(this);
  28. this->mediaObject->setCurrentSource(this->returnPath());
  29. this->audioOutput = new Phonon::AudioOutput(Phonon::MusicCategory,this);
  30. Phonon::Path path = Phonon::createPath(this->mediaObject,this->audioOutput);
  31. this->mediaObject->play();
  32. }
  33.  
  34. void File::stopFile()
  35. {
  36. this->mediaObject->stop();
  37. }
  38.  
  39.  
  40. void File::setFileName(QString path)
  41. {
  42. int n = 0; QString temp = "";
  43. for(int i=0;i<path.length();i++)
  44. {
  45. if (path[i] == '/')
  46. n = i+1;
  47. }
  48. for(int i=n;i<path.length();i++)
  49. temp.append(path[i]);
  50. this->fileName = temp;
  51. }
  52.  
  53. QString File::returnFileName()
  54. {
  55. return this->fileName;
  56. }
  57.  
  58. File *File::Copy(File &f)
  59. {
  60. File * temp = new File();
  61. temp->setFileName(f.returnFileName());
  62. temp->setPath(f.returnPath());
  63. temp->next = f.next;
  64. temp->prev = f.prev;
  65. return temp;
  66. }
To copy to clipboard, switch view to plain text mode 

And second class it's double-linked list.

I want to make a seekslider, but I have a little problem. I'm using mediaObject not in MainWindow, but in another class.
Something like this doesnt work (in MainWindow):
Qt Code:
  1. ss->setMediaObject(playlist->ReturnX(i)->mediaObject);
To copy to clipboard, switch view to plain text mode 
I also can't make a function i File class that return a mediaObject.

Someone can help me how to resolve this problem??