summaryrefslogtreecommitdiffstats
path: root/kdbg/pgmsettings.cpp
blob: 6b328cdb7dd30fa4d94bd507cacabc2e7492a365 (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
106
107
108
109
110
111
112
113
114
115
/*
 * Copyright Johannes Sixt
 * This file is licensed under the GNU General Public License Version 2.
 * See the file COPYING in the toplevel directory of the source directory.
 */

#include "pgmsettings.h"
#include <tdelocale.h>			/* i18n */
#include <tdeapplication.h>
#include <ntqfileinfo.h>
#include <ntqlayout.h>
#include <ntqlineedit.h>
#include <ntqlabel.h>
#include <ntqradiobutton.h>
#include <ntqbuttongroup.h>
#include "config.h"
#include "mydebug.h"


ChooseDriver::ChooseDriver(TQWidget* parent) :
	TQWidget(parent, "driver")
{
    TQVBoxLayout* layout = new TQVBoxLayout(this, 10);

    TQLabel* label = new TQLabel(this);
    label->setText(i18n("How to invoke &GDB - leave empty to use\n"
			"the default from the global options:"));
    label->setMinimumSize(label->sizeHint());
    layout->addWidget(label);

    m_debuggerCmd = new TQLineEdit(this);
    m_debuggerCmd->setMinimumSize(m_debuggerCmd->sizeHint());
    layout->addWidget(m_debuggerCmd);
    label->setBuddy(m_debuggerCmd);

    layout->addStretch(10);
}

void ChooseDriver::setDebuggerCmd(const TQString& cmd)
{
    m_debuggerCmd->setText(cmd);
}

TQString ChooseDriver::debuggerCmd() const
{
    return m_debuggerCmd->text();
}


OutputSettings::OutputSettings(TQWidget* parent) :
	TQWidget(parent, "output")
{
    // the group is invisible
    m_group = new TQButtonGroup(this);
    m_group->hide();

    TQVBoxLayout* layout = new TQVBoxLayout(this, 10);

    TQRadioButton* btn;

    btn = new TQRadioButton(i18n("&No input and output"), this);
    m_group->insert(btn, 0);
    btn->setMinimumSize(btn->sizeHint());
    layout->addWidget(btn);

    btn = new TQRadioButton(i18n("&Only output, simple terminal emulation"), this);
    m_group->insert(btn, 1);
    btn->setMinimumSize(btn->sizeHint());
    layout->addWidget(btn);

    btn = new TQRadioButton(i18n("&Full terminal emulation"), this);
    m_group->insert(btn, 7);
    btn->setMinimumSize(btn->sizeHint());
    layout->addWidget(btn);

    layout->addStretch(10);

    // there is no simpler way to get to the active button than
    // to connect to a signal
    connect(m_group, SIGNAL(clicked(int)), SLOT(slotLevelChanged(int)));
}

void OutputSettings::setTTYLevel(int l)
{
    m_group->setButton(l);
    m_ttyLevel = l;
}

void OutputSettings::slotLevelChanged(int id)
{
    m_ttyLevel = id;
    TRACE("new ttyLevel: " + TQString().setNum(id));
}



ProgramSettings::ProgramSettings(TQWidget* parent, TQString exeName, bool modal) :
	TQTabDialog(parent, "program_settings", modal),
	m_chooseDriver(this),
	m_output(this)
{
    // construct title
    TQFileInfo fi(exeName);
    TQString cap = kapp->caption();
    TQString title = i18n("%1: Settings for %2");
    setCaption(title.arg(cap, fi.fileName()));

    setCancelButton(i18n("Cancel"));
    setOKButton(i18n("OK"));

    addTab(&m_chooseDriver, i18n("&Debugger"));
    addTab(&m_output, i18n("&Output"));
}

#include "pgmsettings.moc"