/* -*- c++ -*-
 *
 * debugpage.cpp
 *
 * Copyright (C) 2003 Petter Stokke <ummo@hellokitty.com>
 *
 * 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.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Steet, Fifth Floor, Boston, MA 02110-1301, USA.
 *
 */

#include <klocale.h>
#include <ktextbrowser.h>

#include <donkeyprotocol.h>

#include "kmldonkey.h"
#include "debugpage.h"
#include "debugpage.moc"

DebugPage::DebugPage(QWidget* parent)
    : QVBox(parent, "debugPage")
    , KMLDonkeyPage()
{
    debugView = new KTextBrowser(this, "debugView");
    debugView->setFocusPolicy(QTextBrowser::ClickFocus);
    debugView->setTextFormat(QTextBrowser::PlainText);

    connect(KMLDonkey::App->donkey, SIGNAL(unhandledMessage(const DonkeyMessage*)), this, SLOT(write(const DonkeyMessage*)));
}

void DebugPage::clear()
{
}

void DebugPage::applyPreferences(KMLDonkeyPreferences*)
{
    debugView->setFont(KMLDonkey::App->consoleFont);
}

void DebugPage::write(const DonkeyMessage* msg)
{
    debugView->append(msg->dumpArray());
}

void DebugPage::write(const QString& msg)
{
    debugView->append(msg);
}

