Cleanup config.h usage.
[kdbg.git] / kdbg / pgmsettings.cpp
blobf027c40729f49c904848e63ad0fbd591fff3b490
1 /*
2 * Copyright Johannes Sixt
3 * This file is licensed under the GNU General Public License Version 2.
4 * See the file COPYING in the toplevel directory of the source directory.
5 */
7 #include "pgmsettings.h"
8 #include <klocale.h> /* i18n */
9 #include <kapplication.h>
10 #include <qfileinfo.h>
11 #include <qlayout.h>
12 #include <qlineedit.h>
13 #include <qlabel.h>
14 #include <qradiobutton.h>
15 #include <qbuttongroup.h>
16 #include "mydebug.h"
19 ChooseDriver::ChooseDriver(QWidget* parent) :
20 QWidget(parent, "driver")
22 QVBoxLayout* layout = new QVBoxLayout(this, 10);
24 QLabel* label = new QLabel(this);
25 label->setText(i18n("How to invoke &GDB - leave empty to use\n"
26 "the default from the global options:"));
27 label->setMinimumSize(label->sizeHint());
28 layout->addWidget(label);
30 m_debuggerCmd = new QLineEdit(this);
31 m_debuggerCmd->setMinimumSize(m_debuggerCmd->sizeHint());
32 layout->addWidget(m_debuggerCmd);
33 label->setBuddy(m_debuggerCmd);
35 layout->addStretch(10);
38 void ChooseDriver::setDebuggerCmd(const QString& cmd)
40 m_debuggerCmd->setText(cmd);
43 QString ChooseDriver::debuggerCmd() const
45 return m_debuggerCmd->text();
49 OutputSettings::OutputSettings(QWidget* parent) :
50 QWidget(parent, "output")
52 // the group is invisible
53 m_group = new QButtonGroup(this);
54 m_group->hide();
56 QVBoxLayout* layout = new QVBoxLayout(this, 10);
58 QRadioButton* btn;
60 btn = new QRadioButton(i18n("&No input and output"), this);
61 m_group->insert(btn, 0);
62 btn->setMinimumSize(btn->sizeHint());
63 layout->addWidget(btn);
65 btn = new QRadioButton(i18n("&Only output, simple terminal emulation"), this);
66 m_group->insert(btn, 1);
67 btn->setMinimumSize(btn->sizeHint());
68 layout->addWidget(btn);
70 btn = new QRadioButton(i18n("&Full terminal emulation"), this);
71 m_group->insert(btn, 7);
72 btn->setMinimumSize(btn->sizeHint());
73 layout->addWidget(btn);
75 layout->addStretch(10);
77 // there is no simpler way to get to the active button than
78 // to connect to a signal
79 connect(m_group, SIGNAL(clicked(int)), SLOT(slotLevelChanged(int)));
82 void OutputSettings::setTTYLevel(int l)
84 m_group->setButton(l);
85 m_ttyLevel = l;
88 void OutputSettings::slotLevelChanged(int id)
90 m_ttyLevel = id;
91 TRACE("new ttyLevel: " + QString().setNum(id));
96 ProgramSettings::ProgramSettings(QWidget* parent, QString exeName, bool modal) :
97 QTabDialog(parent, "program_settings", modal),
98 m_chooseDriver(this),
99 m_output(this)
101 // construct title
102 QFileInfo fi(exeName);
103 QString cap = kapp->caption();
104 QString title = i18n("%1: Settings for %2");
105 setCaption(title.arg(cap, fi.fileName()));
107 setCancelButton(i18n("Cancel"));
108 setOKButton(i18n("OK"));
110 addTab(&m_chooseDriver, i18n("&Debugger"));
111 addTab(&m_output, i18n("&Output"));
114 #include "pgmsettings.moc"