Address status bar text boxes by pointer instead of "command IDs".
[kdbg.git] / kdbg / pgmsettings.cpp
blob4e19d9159ebc97d4ac58e8923e7a461b1ab29960
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 <kglobal.h>
10 #include <QFileInfo>
11 #include <QLineEdit>
12 #include <QLabel>
13 #include <QRadioButton>
14 #include <QButtonGroup>
15 #include <QVBoxLayout>
16 #include "mydebug.h"
19 ChooseDriver::ChooseDriver(QWidget* parent) :
20 QWidget(parent)
22 QVBoxLayout* layout = new QVBoxLayout(this);
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();
36 this->setLayout(layout);
39 void ChooseDriver::setDebuggerCmd(const QString& cmd)
41 m_debuggerCmd->setText(cmd);
44 QString ChooseDriver::debuggerCmd() const
46 return m_debuggerCmd->text();
50 OutputSettings::OutputSettings(QWidget* parent) :
51 QWidget(parent)
53 m_group = new QButtonGroup(this);
55 QVBoxLayout* layout = new QVBoxLayout(this);
57 QRadioButton* btn;
59 btn = new QRadioButton(i18n("&No input and output"), this);
60 m_group->addButton(btn, 0);
61 layout->addWidget(btn);
63 btn = new QRadioButton(i18n("&Only output, simple terminal emulation"), this);
64 m_group->addButton(btn, 1);
65 layout->addWidget(btn);
67 btn = new QRadioButton(i18n("&Full terminal emulation"), this);
68 m_group->addButton(btn, 7);
69 layout->addWidget(btn);
71 layout->addStretch();
73 this->setLayout(layout);
75 // there is no simpler way to get to the active button than
76 // to connect to a signal
77 connect(m_group, SIGNAL(buttonClicked(int)), SLOT(slotLevelChanged(int)));
80 void OutputSettings::setTTYLevel(int l)
82 QAbstractButton* button = m_group->button(l);
83 Q_ASSERT(button);
84 button->setChecked(true);
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) :
97 KPageDialog(parent),
98 m_chooseDriver(this),
99 m_output(this)
101 // construct title
102 QFileInfo fi(exeName);
103 QString cap = KGlobal::caption();
104 QString title = i18n("%1: Settings for %2");
105 setWindowTitle(title.arg(cap, fi.fileName()));
107 addPage(&m_chooseDriver, i18n("Debugger"));
108 addPage(&m_output, i18n("Output"));
111 #include "pgmsettings.moc"