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

Method updateState

kdevplatform/shell/sessionchooserdialog.cpp:80–107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78}
79
80void SessionChooserDialog::updateState() {
81 // Sometimes locking may take some time, so we stop the timer, to prevent an 'avalanche' of events
82 m_updateStateTimer.stop();
83 for(int row = 0; row < m_model->rowCount(); ++row)
84 {
85 QString session = m_model->index(row, 0).data().toString();
86
87 if(session.isEmpty()) //create new session
88 continue;
89
90 QString state, tooltip;
91 SessionRunInfo info = SessionController::sessionRunInfo(session);
92 if(info.isRunning)
93 {
94 tooltip = i18nc("@info:tooltip", "Active session.\npid %1, app %2, host %3",
95 info.holderPid, info.holderApp, info.holderHostname);
96 state = i18n("Running");
97 }
98
99 m_model->setData(m_model->index(row, 1),
100 !info.isRunning ? QIcon() : QIcon::fromTheme(QStringLiteral("media-playback-start")),
101 Qt::DecorationRole);
102 m_model->setData(m_model->index(row, 1), tooltip, Qt::ToolTipRole);
103 m_model->setData(m_model->index(row, 2), state, Qt::DisplayRole);
104 }
105
106 m_updateStateTimer.start();
107}
108
109void SessionChooserDialog::itemEntered(const QModelIndex& index)
110{

Callers 1

Calls 9

stopMethod · 0.80
QIconClass · 0.50
rowCountMethod · 0.45
toStringMethod · 0.45
dataMethod · 0.45
indexMethod · 0.45
isEmptyMethod · 0.45
setDataMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected