Changeset 76
- Timestamp:
- 01/12/06 19:20:30 (3 years ago)
- Location:
- trunk/src/control
- Files:
-
- 2 modified
-
torcontrol.cpp (modified) (5 diffs)
-
torcontrol.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/control/torcontrol.cpp
r75 r76 30 30 TorControl::TorControl() 31 31 { 32 /* Plumb the process signals */ 33 QObject::connect(&_torProcess, SIGNAL(started()), 34 this, SLOT(onStarted())); 35 QObject::connect(&_torProcess, SIGNAL(finished(int, QProcess::ExitStatus)), 36 this, SLOT(onStopped(int, QProcess::ExitStatus))); 37 38 /* Plumb the appropriate socket signals */ 39 QObject::connect(&_controlConn, SIGNAL(connected()), 40 this, SLOT(onConnected())); 41 QObject::connect(&_controlConn, SIGNAL(disconnected()), 42 this, SLOT(onDisconnected())); 32 43 } 33 44 … … 47 58 } 48 59 60 /** Emits a signal that the Tor process started */ 61 void 62 TorControl::onStarted() 63 { 64 emit started(); 65 } 49 66 50 67 /** Stop the Tor process. */ … … 53 70 { 54 71 _torProcess.stop(); 72 } 73 74 /** Emits a signal that the Tor process stopped */ 75 void 76 TorControl::onStopped(int exitCode, QProcess::ExitStatus exitStatus) 77 { 78 emit stopped(exitCode, exitStatus); 55 79 } 56 80 … … 72 96 } 73 97 98 /** Emits a signal that the control socket successfully established a 99 * connection to Tor. */ 100 void 101 TorControl::onConnected() 102 { 103 emit connected(); 104 } 105 74 106 /** Disconnect from Tor's control port */ 75 107 void … … 77 109 { 78 110 _controlConn.disconnect(); 111 } 112 113 /** Emits a signal that the control socket disconnected from Tor */ 114 void 115 TorControl::onDisconnected() 116 { 117 emit disconnected(); 79 118 } 80 119 -
trunk/src/control/torcontrol.h
r75 r76 35 35 Q_OBJECT 36 36 37 private:38 ControlConnection _controlConn;39 TorProcess _torProcess;40 41 37 public: 42 38 /** Default constructor */ … … 75 71 /** Ask Tor for its version */ 76 72 QString getTorVersion(QString *errmsg = 0); 73 74 75 signals: 76 /** Emitted when the Tor process has started */ 77 void started(); 77 78 79 /** Emitted when the Tor process has stopped */ 80 void stopped(int exitCode, QProcess::ExitStatus exitStatus); 81 82 /** Emitted when the controller has connected to Tor */ 83 void connected(); 84 85 /** Emitted when the controller has disconnected from Tor */ 86 void disconnected(); 87 88 89 private: 90 /** Instantiates a socket used to connect to Tor's control port */ 91 ControlConnection _controlConn; 92 /** Manages and monitors the Tor process */ 93 TorProcess _torProcess; 94 95 /* The slots below simply relay signals from the appropriate member objects */ 96 private slots: 97 void onStarted(); 98 void onStopped(int exitCode, QProcess::ExitStatus exitStatus); 99 void onConnected(); 100 void onDisconnected(); 78 101 }; 79 102
