add mp3 and ogg torrent url info to JamendoAlbum
[amarok.git] / src / socketserver.h
blobad876011d7e9b6963059c74f70e237ae070e68ab
1 /***************************************************************************
2 * Copyright (C) 2004,5 Max Howell <max.howell@methylblue.com> *
3 * *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
8 * *
9 ***************************************************************************/
11 #ifndef VIS_SOCKETSERVER_H
12 #define VIS_SOCKETSERVER_H
14 #include <q3listview.h> //baseclass
15 #include <q3serversocket.h> //baseclass
16 #include <QByteArray> //stack allocated
17 #include <QSocketNotifier> //baseclass
18 #include <QString> //stack allocated
21 class K3Process;
23 class QPaintEvent;
24 class QPoint;
27 namespace Amarok
29 class SocketServer : public Q3ServerSocket
31 public:
32 SocketServer( const QString &socketName, QObject *parent );
33 ~SocketServer();
35 protected:
36 int m_sockfd;
37 QByteArray m_path;
42 namespace Vis
44 class SocketServer : public Amarok::SocketServer
46 public:
47 SocketServer( QObject* );
49 void newConnection( int );
51 QByteArray path() const { return m_path; }
54 class SocketNotifier : public QSocketNotifier
56 Q_OBJECT
58 public:
59 SocketNotifier( int sockfd );
61 private slots:
62 void request( int );
65 class Selector : public Q3ListView
67 Q_OBJECT
68 Selector( QWidget *parent=0 );
69 SocketServer *m_server;
71 virtual void viewportPaintEvent( QPaintEvent* );
73 public:
74 static Selector* instance();
75 class Item;
76 friend class Item;
78 ///assigns pid/sockfd combo
79 void mapPID( int, int );
81 class Item : public Q3CheckListItem
83 public:
84 Item( Q3ListView *parent, const char *command, const QString &text, const QString &s2 )
85 : Q3CheckListItem( parent, text, Q3CheckListItem::CheckBox )
86 , m_proc( 0 )
87 , m_sockfd( -1 )
88 , m_command( command ) { setText( 1, s2 ); }
89 ~Item();
91 virtual void stateChange( bool state );
93 K3Process *m_proc;
94 int m_sockfd;
95 const char *m_command;
98 private slots:
99 void rightButton( Q3ListViewItem*, const QPoint&, int );
101 public slots:
102 void processExited( K3Process* );
103 void receivedStdout( K3Process*, char*, int );
105 } //namespace VIS
107 #endif