3 // Copyright by Johannes Sixt
4 // This file is under GPL, the GNU General Public Licence
6 #include "pgmsettings.h"
7 #include <klocale.h> /* i18n */
10 #include <qlineedit.h>
12 #include <qradiobutton.h>
13 #include <qbuttongroup.h>
18 ChooseDriver::ChooseDriver(QWidget
* parent
) :
19 QWidget(parent
, "driver")
21 QVBoxLayout
* layout
= new QVBoxLayout(this, 10);
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(10);
37 void ChooseDriver::setDebuggerCmd(const QString
& cmd
)
39 m_debuggerCmd
->setText(cmd
);
42 QString
ChooseDriver::debuggerCmd() const
44 return m_debuggerCmd
->text();
48 OutputSettings::OutputSettings(QWidget
* parent
) :
49 QWidget(parent
, "output")
51 // the group is invisible
52 m_group
= new QButtonGroup(this);
55 QVBoxLayout
* layout
= new QVBoxLayout(this, 10);
59 btn
= new QRadioButton(i18n("&No input and output"), this);
60 m_group
->insert(btn
, 0);
61 btn
->setMinimumSize(btn
->sizeHint());
62 layout
->addWidget(btn
);
64 btn
= new QRadioButton(i18n("&Only output, simple terminal emulation"), this);
65 m_group
->insert(btn
, 1);
66 btn
->setMinimumSize(btn
->sizeHint());
67 layout
->addWidget(btn
);
69 btn
= new QRadioButton(i18n("&Full terminal emulation"), this);
70 m_group
->insert(btn
, 7);
71 btn
->setMinimumSize(btn
->sizeHint());
72 layout
->addWidget(btn
);
74 layout
->addStretch(10);
76 // there is no simpler way to get to the active button than
77 // to connect to a signal
78 connect(m_group
, SIGNAL(clicked(int)), SLOT(slotLevelChanged(int)));
81 void OutputSettings::setTTYLevel(int l
)
83 m_group
->setButton(l
);
87 void OutputSettings::slotLevelChanged(int id
)
90 TRACE("new ttyLevel: " + QString().setNum(id
));
95 ProgramSettings::ProgramSettings(QWidget
* parent
, QString exeName
, bool modal
) :
96 QTabDialog(parent
, "program_settings", modal
),
101 int slash
= exeName
.findRev('/');
103 exeName
.remove(0, slash
+1);
105 QString cap
= kapp
->caption();
106 QString fmt
= i18n("%s: Settings for %s");
107 SIZED_QString(title
, fmt
.length() + cap
.length() + exeName
.length());
108 title
.sprintf(fmt
, cap
.data(), exeName
.data());
111 setCancelButton(i18n("Cancel"));
112 setOKButton(i18n("OK"));
113 setDefaultButton(i18n("&Help"));
115 connect(this, SIGNAL(defaultButtonPressed()), SLOT(slotHelp()));
117 addTab(&m_chooseDriver
, i18n("&Debugger"));
118 addTab(&m_output
, i18n("&Output"));
121 void ProgramSettings::slotHelp()
125 // find active page and jump to its section
126 QWidget
* curWidget
= currentPage();
127 if (curWidget
!= 0) {
128 section
= curWidget
->name();
130 TRACE("invoking help: pgmsettings.html section #" + section
);
131 kapp
->invokeHTMLHelp("kdbg/pgmsettings.html", section
);
134 #include "pgmsettings.moc"