MCPcopy Create free account
hub / github.com/SpartanJ/eepp / updateStatusBarSync

Method updateStatusBarSync

src/tools/ecode/plugins/git/gitplugin.cpp:314–417  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

312}
313
314void GitPlugin::updateStatusBarSync() {
315 buildSidePanelTab();
316
317 mGitContentView->setVisible( !mGit->getGitFolder().empty() )
318 ->setEnabled( !mGit->getGitFolder().empty() );
319 mGitNoContentView->setVisible( !mGitContentView->isVisible() )
320 ->setEnabled( !mGitContentView->isEnabled() );
321
322 if ( !mGit->getGitFolder().empty() ) {
323 {
324 Lock l( mGitStatusMutex );
325 mStatusTree->setModel( GitStatusModel::asModel( mGitStatus.files, this ) );
326 }
327 mStatusTree->expandAll();
328 } else {
329 return;
330 }
331
332 if ( !mStatusBarDisplayBranch )
333 return;
334
335 if ( !mStatusBar )
336 getUISceneNode()->bind( "status_bar", mStatusBar );
337 if ( !mStatusBar )
338 return;
339
340 if ( !mStatusButton ) {
341 mStatusButton = UIPushButton::New();
342 mStatusButton->setLayoutSizePolicy( SizePolicy::WrapContent, SizePolicy::MatchParent );
343 mStatusButton->setParent( mStatusBar );
344 mStatusButton->setId( "git_status" );
345 mStatusButton->setClass( "status_but" );
346 mStatusButton->setIcon( iconDrawable( "source-control", 10 ) );
347 mStatusButton->reloadStyle( true, true );
348 mStatusButton->getTextView()->setUsingCustomStyling( true );
349
350 mStatusButton->on( Event::MouseClick, [this]( const Event* event ) {
351 if ( nullptr == mTab )
352 return;
353 mTab->setTabSelected();
354 if ( event->asMouseEvent()->getFlags() & EE_BUTTON_RMASK )
355 mPanelSwicher->getListBox()->setSelected( 0 );
356 else if ( mGitStatus.totalInserts || mGitStatus.totalDeletions )
357 mPanelSwicher->getListBox()->setSelected( 1 );
358 } );
359
360 const auto reposition = [this] {
361 if ( mStatusBar == nullptr )
362 return;
363 if ( mStatusButton->getNextNode() == nullptr ||
364 mStatusButton->getNextNode()->getId() != "doc_info" ) {
365 auto docInfo = mStatusBar->find( "doc_info" );
366 if ( docInfo != nullptr && docInfo->getParent() == mStatusButton->getParent() ) {
367 mStatusButton->toPosition( docInfo->getNodeIndex() );
368 }
369 }
370 };
371

Callers

nothing calls this directly

Calls 15

formatFunction · 0.85
SyntaxPatternClass · 0.85
expandAllMethod · 0.80
setLayoutSizePolicyMethod · 0.80
setParentMethod · 0.80
setClassMethod · 0.80
getTextViewMethod · 0.80
getFlagsMethod · 0.80
asMouseEventMethod · 0.80
getNextNodeMethod · 0.80
toPositionMethod · 0.80
getNodeIndexMethod · 0.80

Tested by

no test coverage detected