Attach to Process: Start the dialog with the filter set to the program name.
[kdbg.git] / kdbg / prefmisc.cpp
blob052f354f988008bbb50d93064dd9b1856c2d750c
1 // $Id$
3 // Copyright by Johannes Sixt
4 // This file is under GPL, the GNU General Public Licence
6 #include "prefmisc.h"
7 #include <klocale.h> /* i18n */
9 PrefMisc::PrefMisc(QWidget* parent) :
10 QWidget(parent, "debugger"),
11 m_grid(this, 6, 2, 10),
12 m_popForeground(this, "pop_fore"),
13 m_backTimeoutLabel(this, "back_to_lab"),
14 m_backTimeout(this, "back_to"),
15 m_tabWidthLabel(this, "tabwidth_lab"),
16 m_tabWidth(this, "tabwidth"),
17 m_sourceFilterLabel(this, "sourcefilter_lab"),
18 m_sourceFilter(this, "sourcefilter"),
19 m_headerFilterLabel(this, "headerfilter_lab"),
20 m_headerFilter(this, "headerfilter")
22 m_popForeground.setText(i18n("&Pop into foreground when program stops"));
23 m_popForeground.setMinimumSize(m_popForeground.sizeHint());
24 m_grid.addMultiCellWidget(&m_popForeground, 0, 0, 0, 1);
25 m_grid.addRowSpacing(0, m_popForeground.sizeHint().height());
27 m_backTimeoutLabel.setText(i18n("Time until window goes &back (in milliseconds):"));
28 m_backTimeoutLabel.setMinimumSize(m_backTimeoutLabel.sizeHint());
29 m_backTimeoutLabel.setBuddy(&m_backTimeout);
30 m_backTimeout.setMinimumSize(m_backTimeout.sizeHint());
31 m_grid.addWidget(&m_backTimeoutLabel, 1, 0);
32 m_grid.addWidget(&m_backTimeout, 1, 1);
34 setupEditGroup(i18n("&Tabstop every (characters):"),
35 m_tabWidthLabel, m_tabWidth, 2);
36 setupEditGroup(i18n("File filter for &source files:"),
37 m_sourceFilterLabel, m_sourceFilter, 3);
38 setupEditGroup(i18n("File filter for &header files:"),
39 m_headerFilterLabel, m_headerFilter, 4);
41 m_grid.setColStretch(1, 10);
42 // last (empty) row gets all the vertical stretch
43 m_grid.setRowStretch(5, 10);
46 void PrefMisc::setupEditGroup(const QString& label, QLabel& labWidget, QLineEdit& edit, int row)
48 labWidget.setText(label);
49 labWidget.setMinimumSize(labWidget.sizeHint());
50 labWidget.setBuddy(&edit);
51 edit.setMinimumSize(edit.sizeHint());
52 m_grid.addWidget(&labWidget, row, 0);
53 m_grid.addWidget(&edit, row, 1);
56 static int readNumeric(const QLineEdit& edit)
58 QString str = edit.text();
59 return str.toInt();
62 int PrefMisc::backTimeout() const
64 return readNumeric(m_backTimeout);
67 void PrefMisc::setBackTimeout(int to)
69 QString str;
70 str.setNum(to);
71 m_backTimeout.setText(str);
74 int PrefMisc::tabWidth() const
76 return readNumeric(m_tabWidth);
79 void PrefMisc::setTabWidth(int tw)
81 QString str;
82 str.setNum(tw);
83 m_tabWidth.setText(str);