Extend copyright to 2018.
[kdbg.git] / kdbg / pgmsettings.cpp
blob143a7ade2cd83291278c97707813a1996898adea
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 <klocalizedstring.h> /* i18n */
9 #include <QFileInfo>
10 #include <QLineEdit>
11 #include <QLabel>
12 #include <QRadioButton>
13 #include <QButtonGroup>
14 #include <QVBoxLayout>
15 #include "mydebug.h"
18 ChooseDriver::ChooseDriver(QWidget* parent) :
19 QWidget(parent)
21 QVBoxLayout* layout = new QVBoxLayout(this);
23 QLabel* label = new QLabel(this);
24 label->setText(i18n("How to invoke &GDB - leave empty to use\n"
25 "the default from the global options:"));
26 label->setMinimumSize(label->sizeHint());
27 layout->addWidget(label);
29 m_debuggerCmd = new QLineEdit(this);
30 m_debuggerCmd->setMinimumSize(m_debuggerCmd->sizeHint());
31 layout->addWidget(m_debuggerCmd);
32 label->setBuddy(m_debuggerCmd);
34 layout->addStretch();
35 this->setLayout(layout);
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)
52 m_group = new QButtonGroup(this);
54 QVBoxLayout* layout = new QVBoxLayout(this);
56 QRadioButton* btn;
58 btn = new QRadioButton(i18n("&No input and output"), this);
59 m_group->addButton(btn, 0);
60 layout->addWidget(btn);
62 btn = new QRadioButton(i18n("&Only output, simple terminal emulation"), this);
63 m_group->addButton(btn, 1);
64 layout->addWidget(btn);
66 btn = new QRadioButton(i18n("&Full terminal emulation"), this);
67 m_group->addButton(btn, 7);
68 layout->addWidget(btn);
70 layout->addStretch();
72 this->setLayout(layout);
74 // there is no simpler way to get to the active button than
75 // to connect to a signal
76 connect(m_group, SIGNAL(buttonClicked(int)), SLOT(slotLevelChanged(int)));
79 void OutputSettings::setTTYLevel(int l)
81 QAbstractButton* button = m_group->button(l);
82 Q_ASSERT(button);
83 button->setChecked(true);
84 m_ttyLevel = l;
87 void OutputSettings::slotLevelChanged(int id)
89 m_ttyLevel = id;
90 TRACE("new ttyLevel: " + QString().setNum(id));
95 ProgramSettings::ProgramSettings(QWidget* parent, QString exeName) :
96 KPageDialog(parent),
97 m_chooseDriver(this),
98 m_output(this)
100 // construct title
101 QFileInfo fi(exeName);
102 QString title = i18n("Settings for %1");
103 setWindowTitle(title.arg(fi.fileName()));
105 addPage(&m_chooseDriver, i18n("Debugger"));
106 addPage(&m_output, i18n("Output"));
109 #include "pgmsettings.moc"