summaryrefslogtreecommitdiffstats
path: root/src/libgui/log_view.h
blob: 75e2481a9c327e0a588fb938f3397937423310e5 (plain)
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
/***************************************************************************
 *   Copyright (C) 2005 Nicolas Hadacek <hadacek@kde.org>                  *
 *                                                                         *
 *   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 LOG_VIEW_H
#define LOG_VIEW_H

#include <tqtextedit.h>
#include "common/global/log.h"

namespace Log
{
enum OutputType { GuiOnly = 0, GuiConsole, Nb_OutputTypes };

class Widget : public TQTextEdit, public View
{
  Q_OBJECT
  TQ_OBJECT
public:
  Widget(TQWidget *tqparent = 0, const char *name = 0);
  virtual void appendToLastLine(const TQString &text);
  virtual void clear();
  virtual void sorry(const TQString &message, const TQString &details);
  virtual bool askContinue(const TQString &message);

protected:
  TQPopupMenu *createPopupMenu(const TQPoint &pos);

private slots:
  void toggleVisible(int i);
  void toggleConsoleOutput();
  void saveAs();

private:
  int         _id[DebugLevel::Nb_Types];
  TQPopupMenu *_popup;
  TQString     _text;

  virtual void updateDebugLevel();
  virtual void doLog(LineType type, const TQString &text, Action action = Immediate);
  virtual void doLog(DebugLevel level, const TQString &text, Action action = Immediate);
  void doLog(const TQString &text, const TQString &color, bool bold, Action action = Immediate);
  void logExtra(const TQString &text);
};

} // namespace

#endif