~ubuntu-branches/ubuntu/natty/nuapplet/natty

« back to all changes in this revision

Viewing changes to src/logs.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Pierre Chifflier
  • Date: 2010-05-17 15:15:59 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20100517151559-lf4zajscmlwf2yef
Tags: 2.3.0-1
* Imported Upstream version 2.3.0
  Add support for new (>= 2.4) libnuclient API (Closes: #573667)
* Urgency high, RC bug
* Bump standards version to 3.8.4
* Update homepage location
* Update dependencies on libnuclient and libnussl >= 2.4.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 ** Copyright 2004-2009 - INL
 
3
 ** Written by Pierre Chifflier <chifflier@inl.fr>
 
4
 ** INL http://www.inl.fr/
 
5
 **
 
6
 ** This program is free software; you can redistribute it and/or modify
 
7
 ** it under the terms of the GNU General Public License as published by
 
8
 ** the Free Software Foundation, version 2 of the License.
 
9
 **
 
10
 ** This program is distributed in the hope that it will be useful,
 
11
 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 ** GNU General Public License for more details.
 
14
 **
 
15
 ** You should have received a copy of the GNU General Public License
 
16
 ** along with this program; if not, write to the Free Software
 
17
 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
18
 */
 
19
 
 
20
#include <QtGui>
 
21
 
 
22
#include "logs.h"
 
23
#include "logs.moc"
 
24
 
 
25
#include <ui_logs.h>
 
26
 
 
27
extern "C" {
 
28
extern int debug_level;
 
29
}
 
30
 
 
31
NuLogsWindow::NuLogsWindow(QWidget *parent)
 
32
{
 
33
        ui = new Ui::LogsWindow();
 
34
        ui->setupUi(this);
 
35
}
 
36
 
 
37
void NuLogsWindow::addLine(int area, int level, char *format, va_list args)
 
38
{
 
39
        QString msg, text;
 
40
        QDateTime date = QDateTime::currentDateTime();
 
41
        const char *dateformat = "yyyy-MM-dd hh:mm:ss.zzz";
 
42
 
 
43
        msg.vsprintf(format, args);
 
44
        text = QString("[%1] %2").arg(date.toString(dateformat)).arg(msg);
 
45
        ui->edit->append( text );
 
46
        ui->edit->textCursor().movePosition(QTextCursor::End);
 
47
        ui->edit->ensureCursorVisible();
 
48
}
 
49
 
 
50
void NuLogsWindow(int level)
 
51
{
 
52
        debug_level = level;
 
53
}
 
54