Write ID3 tags in MP3 files via libid3
[skype-call-recorder.git] / call.h
blobc35cb31dc9324548190655a4e6b7de7fd229d89d
1 /*
2 Skype Call Recorder
3 Copyright (C) 2008 jlh (jlh at gmx dot ch)
5 This program is free software; you can redistribute it and/or modify it
6 under the terms of the GNU General Public License as published by the
7 Free Software Foundation; either version 2 of the License, version 3 of
8 the License, or (at your option) any later version.
10 This program is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 The GNU General Public License version 2 is included with the source of
20 this program under the file name COPYING. You can also get a copy on
21 http://www.fsf.org/
24 #ifndef CALL_H
25 #define CALL_H
27 #include <QObject>
28 #include <QString>
29 #include <QByteArray>
30 #include <QMap>
31 #include <QSet>
32 #include <QPointer>
33 #include <QDateTime>
35 class QStringList;
36 class Skype;
37 class AudioFileWriter;
38 class QTcpServer;
39 class QTcpSocket;
41 typedef int CallID;
43 class Call : public QObject {
44 Q_OBJECT
45 public:
46 Call(QObject *, Skype *, CallID);
47 ~Call();
48 void startRecording(bool = false);
49 void stopRecording(bool = true);
50 bool okToDelete() const;
51 void setStatus(const QString &);
52 QString getStatus() const { return status; }
53 bool statusDone() const;
54 CallID getID() const { return id; }
55 void removeFile();
56 void hideConfirmation(int);
58 signals:
59 void startedCall(const QString &);
60 void stoppedCall();
61 void startedRecording();
62 void stoppedRecording();
64 private:
65 QString constructFileName() const;
66 QString constructCommentTag() const;
67 void mixToMono(int);
68 void setShouldRecord();
69 void ask();
71 private:
72 Skype *skype;
73 CallID id;
74 QString status;
75 QString skypeName;
76 QString displayName;
77 AudioFileWriter *writer;
78 bool isRecording;
79 int channelMode;
80 int shouldRecord;
81 QString fileName;
82 QPointer<QObject> confirmation;
83 QDateTime timeStartRecording;
85 QTcpServer *serverLocal, *serverRemote;
86 QTcpSocket *socketLocal, *socketRemote;
87 QByteArray bufferLocal, bufferRemote;
88 QByteArray bufferMono;
90 private slots:
91 void acceptLocal();
92 void acceptRemote();
93 void readLocal();
94 void readRemote();
95 void checkConnections();
96 void tryToWrite(bool = false);
97 void confirmRecording();
98 void denyRecording();
100 private:
101 // disabled
102 Call(const Call &);
103 Call &operator=(const Call &);
106 class CallHandler : public QObject {
107 Q_OBJECT
108 public:
109 CallHandler(QObject *, Skype *);
110 ~CallHandler();
111 void callCmd(const QStringList &);
113 signals:
114 void startedCall(const QString &);
115 void stoppedCall();
116 void startedRecording();
117 void stoppedRecording();
119 public slots:
120 void startRecording();
121 void stopRecording();
122 void stopRecordingAndDelete();
124 private:
125 void prune();
127 private:
128 typedef QMap<CallID, Call *> CallMap;
129 typedef QSet<CallID> CallSet;
131 CallMap calls;
132 CallSet ignore;
133 Skype *skype;
134 CallID currentCall;
137 #endif