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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
/***************************************************************************
* Copyright (C) 2004,5 Max Howell <max.howell@methylblue.com> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef VIS_SOCKETSERVER_H
#define VIS_SOCKETSERVER_H
#include <tqstring.h> //stack allocated
#include <tqlistview.h> //baseclass
#include <tqserversocket.h> //baseclass
#include <tqsocketnotifier.h> //baseclass
class TQPoint;
class KProcess;
namespace Amarok
{
class SocketServer : public TQServerSocket
{
public:
SocketServer( const TQString &socketName, TQObject *tqparent );
~SocketServer();
protected:
int m_sockfd;
TQCString m_path;
};
}
namespace Vis
{
class SocketServer : public Amarok::SocketServer
{
public:
SocketServer( TQObject* );
void newConnection( int );
TQCString path() const { return m_path; }
};
class SocketNotifier : public TQSocketNotifier
{
Q_OBJECT
TQ_OBJECT
public:
SocketNotifier( int sockfd );
private slots:
void request( int );
};
class Selector : public TQListView
{
Q_OBJECT
TQ_OBJECT
Selector( TQWidget *tqparent=0 );
SocketServer *m_server;
virtual void viewportPaintEvent( TQPaintEvent* );
public:
static Selector* instance();
class Item;
friend class Item;
///assigns pid/sockfd combo
void mapPID( int, int );
class Item : public TQCheckListItem
{
public:
Item( TQListView *tqparent, const char *command, const TQString &text, const TQString &s2 )
: TQCheckListItem( tqparent, text, TQCheckListItem::CheckBox )
, m_proc( 0 )
, m_sockfd( -1 )
, m_command( command ) { setText( 1, s2 ); }
~Item();
virtual void stateChange( bool state );
KProcess *m_proc;
int m_sockfd;
const char *m_command;
};
private slots:
void rightButton( TQListViewItem*, const TQPoint&, int );
public slots:
void processExited( KProcess* );
void receivedStdout( KProcess*, char*, int );
};
} //namespace VIS
#endif
|