Mana
Loading...
Searching...
No Matches
recorder.h
Go to the documentation of this file.
1/*
2 * A chat recorder
3 * Copyright (C) 2008 Lloyd Bryant <lloyd_bryant@netzero.net>
4 * Copyright (C) 2009-2012 The Mana Developers
5 *
6 * This file is part of The Mana Client.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22#pragma once
23
24#include "gui/widgets/window.h"
25
26#include "utils/gettext.h"
27
28#include <guichan/actionlistener.hpp>
29
30#include <fstream>
31#include <string>
32
33class ChatWindow;
34
35class Recorder : public Window, public gcn::ActionListener
36{
37 public:
38 Recorder(ChatWindow *chat, const std::string &title = _("Recording..."),
39 const std::string &buttonTxt = _("Stop recording"));
40
41 ~Recorder() override;
42
48 void record(const std::string &msg);
49
55 void setRecordingFile(const std::string &msg);
56
60 bool isRecording() { return (bool) mStream.is_open(); }
61
67 void action(const gcn::ActionEvent &event) override;
68
69 private:
71
72 std::ofstream mStream;
73};
The chat window.
Definition chatwindow.h:73
void setRecordingFile(const std::string &msg)
Sets the file being recorded to.
Definition recorder.cpp:68
bool isRecording()
Whether or not the recorder is in use.
Definition recorder.h:60
std::ofstream mStream
Definition recorder.h:72
void action(const gcn::ActionEvent &event) override
called when the button is pressed
Definition recorder.cpp:113
~Recorder() override
void record(const std::string &msg)
Outputs the message to the recorder file.
Definition recorder.cpp:62
ChatWindow * mChat
Definition recorder.h:70
A window.
Definition window.h:59
#define _(s)
Definition gettext.h:38