Be prepared that the animated button is destroyed behind our back.
[kdbg.git] / kdbg / procattach.h
blob36eb0bce0b1d9e6d1255281969ddf8d5729b5cb5
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 #ifndef ProcAttach_included
8 #define ProcAttach_included
10 #include "ui_procattachbase.h"
11 #include <QByteArray>
12 #include <QDialog>
13 #include <QLabel>
14 #include <QLineEdit>
15 #include <QPushButton>
16 #include <QVBoxLayout>
17 #include <QHBoxLayout>
18 #include <kdialog.h>
19 #include <vector>
22 class QProcess;
25 * This is the full-featured version of the dialog. It is used when the
26 * system features a suitable ps command.
29 class ProcAttachPS : public QDialog, private Ui::ProcAttachBase
31 Q_OBJECT
32 public:
33 ProcAttachPS(QWidget* parent);
34 ~ProcAttachPS();
36 void setFilterText(const QString& text) { filterEdit->setText(text); }
37 QString text() const;
39 protected:
40 void runPS();
42 protected slots:
43 void on_buttonRefresh_clicked();
44 void on_filterEdit_textChanged(const QString& text);
45 void on_processList_currentItemChanged();
46 void slotTextReceived();
47 void slotPSDone();
49 protected:
50 void pushLine();
51 bool setVisibility(QTreeWidgetItem* i, const QString& text);
53 QProcess* m_ps;
54 // parse state
55 int m_pidCol; //!< The PID column in the ps output
56 int m_ppidCol; //!< The parent-PID column in the ps output
57 QByteArray m_token;
58 std::vector<QString> m_line;
63 * This is an extremely stripped down version of the dialog. It is used
64 * when there is no suitable ps command.
67 class ProcAttach : public QDialog
69 public:
70 ProcAttach(QWidget* parent);
71 virtual ~ProcAttach();
73 void setText(const QString& text) { m_processId.setText(text); }
74 QString text() const { return m_processId.text(); }
76 protected:
77 QLabel m_label;
78 QLineEdit m_processId;
79 QPushButton m_buttonOK;
80 QPushButton m_buttonCancel;
81 QVBoxLayout m_layout;
82 QHBoxLayout m_buttons;
85 #endif // ProcAttach_included