| 227 | } |
| 228 | |
| 229 | GitWidget::GitWidget(KTextEditor::MainWindow *mainWindow, KateProjectPluginView *pluginView, QWidget *parent) |
| 230 | : QWidget(parent) |
| 231 | , m_gitStatusWatcher(new QFutureWatcher<GitUtils::GitParsedStatus>(this)) |
| 232 | , m_mainWin(mainWindow) |
| 233 | , m_pluginView(pluginView) |
| 234 | , m_mainView(new QWidget(this)) |
| 235 | , m_stackWidget(new QStackedWidget(this)) |
| 236 | { |
| 237 | // Init delayed because this is called from plugin view ctor and nothing is ready yet |
| 238 | QMetaObject::invokeMethod( |
| 239 | this, |
| 240 | [this] { |
| 241 | m_activeGitDirPath = m_pluginView->projectBaseDir(); |
| 242 | if (!m_activeGitDirPath.endsWith(u"/")) { |
| 243 | m_activeGitDirPath.append(u"/"); |
| 244 | } |
| 245 | |
| 246 | connect(m_gitStatusWatcher, &QFutureWatcher<GitUtils::GitParsedStatus>::finished, this, &GitWidget::parseStatusReady); |
| 247 | // Setup update protection |
| 248 | m_updateTrigger.setSingleShot(true); |
| 249 | m_updateTrigger.setInterval(500); |
| 250 | connect(&m_updateTrigger, &QTimer::timeout, this, &GitWidget::slotUpdateStatus); |
| 251 | slotUpdateStatus(); |
| 252 | }, |
| 253 | Qt::QueuedConnection); |
| 254 | |
| 255 | // We init delayed when the widget will be shown |
| 256 | } |
| 257 | |
| 258 | void GitWidget::showEvent(QShowEvent *e) |
| 259 | { |
nothing calls this directly
no test coverage detected