MCPcopy Create free account
hub / github.com/KDE/kdevelop / SessionChooserDialog

Method SessionChooserDialog

kdevplatform/shell/sessionchooserdialog.cpp:24–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22using namespace KDevelop;
23
24SessionChooserDialog::SessionChooserDialog(QListView* view, QAbstractItemModel* model, QLineEdit* filter)
25 : m_view(view), m_model(model), m_filter(filter), m_deleteCandidateRow(-1)
26{
27 m_updateStateTimer.setInterval(5000);
28 m_updateStateTimer.setSingleShot(false);
29 m_updateStateTimer.start();
30 connect(&m_updateStateTimer, &QTimer::timeout, this, &SessionChooserDialog::updateState);
31 connect(view, &QListView::doubleClicked, this, &SessionChooserDialog::doubleClicked);
32 connect(view, &QListView::entered, this, &SessionChooserDialog::itemEntered);
33
34 m_deleteButton = new QPushButton(view->viewport());
35 m_deleteButton->setIcon(QIcon::fromTheme(QStringLiteral("edit-delete")));
36 m_deleteButton->setToolTip(i18nc("@info:tooltip", "Delete session"));
37 m_deleteButton->hide();
38 connect(m_deleteButton, &QPushButton::clicked, this, &SessionChooserDialog::deleteButtonPressed);
39
40 m_deleteButtonTimer.setInterval(500);
41 m_deleteButtonTimer.setSingleShot(true);
42 connect(&m_deleteButtonTimer, &QTimer::timeout, this, &SessionChooserDialog::showDeleteButton);
43
44 view->setMouseTracking(true);
45 view->installEventFilter(this);
46 filter->installEventFilter(this);
47 connect(filter, &QLineEdit::textChanged, this, &SessionChooserDialog::filterTextChanged);
48
49 setWindowTitle(i18nc("@title:window", "Pick a Session"));
50
51 m_buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Close);
52 auto mainLayout = new QVBoxLayout(this);
53 m_mainWidget = new QWidget(this);
54 mainLayout->addWidget(m_mainWidget);
55
56 QPushButton *okButton = m_buttonBox->button(QDialogButtonBox::Ok);
57 okButton->setDefault(true);
58 okButton->setShortcut(Qt::Key_Return);
59 connect(m_buttonBox, &QDialogButtonBox::accepted, this, &SessionChooserDialog::accept);
60 connect(m_buttonBox, &QDialogButtonBox::rejected, this, &SessionChooserDialog::reject);
61 mainLayout->addWidget(m_buttonBox);
62 okButton->setText(i18nc("@action:button", "Run"));
63 okButton->setIcon(QIcon::fromTheme(QStringLiteral("media-playback-start")));
64}
65
66void SessionChooserDialog::filterTextChanged()
67{

Callers

nothing calls this directly

Calls 6

setIconMethod · 0.80
setToolTipMethod · 0.80
buttonMethod · 0.80
startMethod · 0.45
addWidgetMethod · 0.45
setTextMethod · 0.45

Tested by

no test coverage detected