Changeset View
Changeset View
Standalone View
Standalone View
src/views/tooltips/tooltipmanager.cpp
Show All 33 Lines | |||||
34 | #include <QWindow> | 34 | #include <QWindow> | ||
35 | 35 | | |||
36 | ToolTipManager::ToolTipManager(QWidget* parent) : | 36 | ToolTipManager::ToolTipManager(QWidget* parent) : | ||
37 | QObject(parent), | 37 | QObject(parent), | ||
38 | m_showToolTipTimer(0), | 38 | m_showToolTipTimer(0), | ||
39 | m_contentRetrievalTimer(0), | 39 | m_contentRetrievalTimer(0), | ||
40 | m_transientParent(0), | 40 | m_transientParent(0), | ||
41 | m_fileMetaDataWidget(0), | 41 | m_fileMetaDataWidget(0), | ||
42 | m_tooltipWidget(new KToolTipWidget()), | | |||
43 | m_toolTipRequested(false), | 42 | m_toolTipRequested(false), | ||
44 | m_metaDataRequested(false), | 43 | m_metaDataRequested(false), | ||
45 | m_appliedWaitCursor(false), | 44 | m_appliedWaitCursor(false), | ||
46 | m_margin(4), | 45 | m_margin(4), | ||
47 | m_item(), | 46 | m_item(), | ||
48 | m_itemRect() | 47 | m_itemRect() | ||
49 | { | 48 | { | ||
50 | if (parent) { | 49 | if (parent) { | ||
▲ Show 20 Lines • Show All 50 Lines • ▼ Show 20 Line(s) | 99 | if (m_appliedWaitCursor) { | |||
101 | QApplication::restoreOverrideCursor(); | 100 | QApplication::restoreOverrideCursor(); | ||
102 | m_appliedWaitCursor = false; | 101 | m_appliedWaitCursor = false; | ||
103 | } | 102 | } | ||
104 | 103 | | |||
105 | m_toolTipRequested = false; | 104 | m_toolTipRequested = false; | ||
106 | m_metaDataRequested = false; | 105 | m_metaDataRequested = false; | ||
107 | m_showToolTipTimer->stop(); | 106 | m_showToolTipTimer->stop(); | ||
108 | m_contentRetrievalTimer->stop(); | 107 | m_contentRetrievalTimer->stop(); | ||
108 | if (m_tooltipWidget) { | ||||
109 | m_tooltipWidget->hideLater(); | 109 | m_tooltipWidget->hideLater(); | ||
110 | } | 110 | } | ||
111 | } | ||||
111 | 112 | | |||
112 | void ToolTipManager::startContentRetrieval() | 113 | void ToolTipManager::startContentRetrieval() | ||
113 | { | 114 | { | ||
114 | if (!m_toolTipRequested) { | 115 | if (!m_toolTipRequested) { | ||
115 | return; | 116 | return; | ||
116 | } | 117 | } | ||
117 | 118 | | |||
118 | m_fileMetaDataWidget->setName(m_item.text()); | 119 | m_fileMetaDataWidget->setName(m_item.text()); | ||
▲ Show 20 Lines • Show All 77 Lines • ▼ Show 20 Line(s) | 196 | if (m_fileMetaDataWidget->preview().isNull() || m_metaDataRequested) { | |||
196 | Q_ASSERT(!m_appliedWaitCursor); | 197 | Q_ASSERT(!m_appliedWaitCursor); | ||
197 | QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); | 198 | QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); | ||
198 | m_appliedWaitCursor = true; | 199 | m_appliedWaitCursor = true; | ||
199 | return; | 200 | return; | ||
200 | } | 201 | } | ||
201 | 202 | | |||
202 | // Adjust the size to get a proper sizeHint() | 203 | // Adjust the size to get a proper sizeHint() | ||
203 | m_fileMetaDataWidget->adjustSize(); | 204 | m_fileMetaDataWidget->adjustSize(); | ||
205 | if (!m_tooltipWidget) { | ||||
206 | m_tooltipWidget.reset(new KToolTipWidget()); | ||||
207 | } | ||||
204 | m_tooltipWidget->showBelow(m_itemRect, m_fileMetaDataWidget, m_transientParent); | 208 | m_tooltipWidget->showBelow(m_itemRect, m_fileMetaDataWidget, m_transientParent); | ||
205 | m_toolTipRequested = false; | 209 | m_toolTipRequested = false; | ||
206 | } | 210 | } | ||
207 | 211 | |