summaryrefslogtreecommitdiffstats
path: root/parts/outputviews/makeviewpart.cpp
blob: 9324bcb09eb004ac278d938a18c8c522e1eb5f6a (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/***************************************************************************
 *   Copyright (C) 1999-2001 by Bernd Gehrmann                             *
 *   [email protected]                                                    *
 *                                                                         *
 *   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.                                   *
 *                                                                         *
 ***************************************************************************/

#include "makeviewpart.h"

#include <tqwhatsthis.h>
#include <tqdir.h>
#include <kdebug.h>
#include <tdelocale.h>
#include <tdeaction.h>
#include <kiconloader.h>
#include <kdevgenericfactory.h>
#include <kdevplugininfo.h>

#include "kdevproject.h"
#include "kdevcore.h"
#include "kdevmainwindow.h"

#include "makewidget.h"

static const KDevPluginInfo data("kdevmakeview");
typedef KDevGenericFactory< MakeViewPart > MakeViewFactory;
K_EXPORT_COMPONENT_FACTORY( libkdevmakeview, MakeViewFactory( data ) )

MakeViewPart::MakeViewPart(TQObject *parent, const char *name, const TQStringList &)
    : KDevMakeFrontend(&data, parent, name)
{
    setInstance(MakeViewFactory::instance());

    setXMLFile("kdevmakeview.rc");

    m_dcop = new KDevMakeFrontendIface(this);

    m_widget = new MakeWidget(this);
    m_widget->setIcon( SmallIcon("exec") );
    m_widget->setCaption(i18n("Messages Output"));
    TQWhatsThis::add(m_widget, i18n("<b>Messages output</b><p>"
                                   "The messages window shows the output of the compiler and "
                                   "used build tools like make, ant, uic, dcopidl etc. "
                                   "For compiler error messages, click on the error message. "
                                   "This will automatically open the source file and set the "
                                   "cursor to the line that caused the compiler error/warning."));

    mainWindow()->embedOutputView(m_widget, i18n("Messages"), i18n("Compiler output messages"));

    TDEAction *action;
    action = new TDEAction( i18n("&Next Error"), Key_F4, TQT_TQOBJECT(m_widget), TQT_SLOT(nextError()),
                          actionCollection(), "view_next_error");
    action->setToolTip( i18n("Go to the next error") );
    action->setWhatsThis(i18n("<b>Next error</b><p>Switches to the file and line where the next error was reported from."));
    action = new TDEAction( i18n("&Previous Error"), SHIFT+Key_F4, TQT_TQOBJECT(m_widget), TQT_SLOT(prevError()),
                          actionCollection(), "view_previous_error");
    action->setToolTip( i18n("Go to the previous error") );
    action->setWhatsThis(i18n("<b>Previous error</b><p>Switches to the file and line where the previous error was reported from."));

    connect( core(), TQT_SIGNAL(stopButtonClicked(KDevPlugin*)),
             this, TQT_SLOT(slotStopButtonClicked(KDevPlugin*)) );
}


MakeViewPart::~MakeViewPart()
{
	if ( m_widget )
	    mainWindow()->removeView( m_widget );
    delete m_widget;
    delete m_dcop;
}

void MakeViewPart::slotStopButtonClicked(KDevPlugin* which)
{
    if ( which != 0 && which != this )
        return;
    m_widget->killJob();
}

void MakeViewPart::queueCommand(const TQString &dir, const TQString &command)
{
    m_widget->queueJob(dir, command);
}


bool MakeViewPart::isRunning()
{
    return m_widget->isRunning();
}

TQWidget* MakeViewPart::widget()
{
    return m_widget.operator->();
}

void MakeViewPart::updateSettingsFromConfig()
{
    m_widget->updateSettingsFromConfig();
}

#include "makeviewpart.moc"