@@ -375,7 +375,7 @@ void CMainWindow::setSymbolFont(QFont symbolFont)
375375 QString symbolFontSize = QString::number (symbolFont.pointSize ());
376376 QString lineHeight = QString::number (symbolFont.pointSize () / 3 );
377377
378- QString textDocumentSyleStr = QString (" a {color: #0066FF; font-weight: bold; font-family: %1; text-decoration: none} functionsig {color: #33F000; font-weight:bold; font-family: %1;} code { display: table-row; font-family: Consolas; white-space: nowrap} linenum {color: #9999CC; font-family: %1} keyword {color: #00CCCC; font-weight:bold} spacesize {font-size: %3pt} body {background: #FAFAFA; font-size: %2pt}" ).arg (symbolFontFamily, symbolFontSize, lineHeight);
378+ QString textDocumentSyleStr = QString (" a {color: #0066FF; font-weight: bold; font-family: %1; text-decoration: none} functionsig {color: #33F000; font-weight:bold; font-family: %1;} code {display: table-row; font-family: Consolas; white-space: nowrap} linenum {color: #9999CC; font-family: %1} keyword {color: #00CCCC; font-weight:bold} spacesize {font-size: %3pt} body {background: #FAFAFA; font-size: %2pt}" ).arg (symbolFontFamily, symbolFontSize, lineHeight);
379379
380380 textDocument_.setDefaultStyleSheet (textDocumentSyleStr);
381381}
@@ -493,11 +493,12 @@ void CMainWindow::createActions()
493493
494494 connect (search_lineEdit, SIGNAL (returnPressed ()), this , SLOT (on_searchButton_clicked ()));
495495
496- connect (CProjectManager::getInstance (), SIGNAL (projectMapUpdated ()), this , SLOT (loadProjectList ()));
497- connect (CProjectManager::getInstance (), SIGNAL (groupMapUpdated ()), this , SLOT (loadGroupList ()));
496+ connect (CProjectManager::getInstance (), &CProjectManager::projectMapUpdated, this , &CMainWindow::loadProjectList);
497+ connect (CProjectManager::getInstance (), &CProjectManager::groupMapUpdated, this , &CMainWindow::loadGroupList);
498+ connect (CProjectManager::getInstance (), &CProjectManager::newProjectAdded, this , &CMainWindow::projectRebuildTag);
498499
499500 connect (&timeLine_, SIGNAL (frameChanged (int )), &progressBar_, SLOT (setValue (int )));
500- connect (&projectUpdateThread_, SIGNAL ( percentageCompleted ( int )) , this , SLOT ( updateTagBuildProgress ( int )) );
501+ connect (&projectUpdateThread_, &CProjectUpdateThread:: percentageCompleted, this , &CMainWindow:: updateTagBuildProgress);
501502
502503 // update progress bar for cancelled tag build
503504 connect (&projectUpdateThread_, SIGNAL (cancelledTagBuild ()), this , SLOT (updateCancelledTagBuild ()));
@@ -593,7 +594,7 @@ void CMainWindow::createActions()
593594 connect (actionWebZoomOut, SIGNAL (triggered ()), this , SLOT (webZoomOut ()));
594595
595596 // connect for lauching editor from symbol panel
596- connect (symbol_textBrowser, &CSearchTextEdit::linkActivated, this , &CMainWindow::launchEditor );
597+ connect (symbol_textBrowser, &CSearchTextEdit::linkActivated, this , &CMainWindow::launchEditorWithLineNum );
597598}
598599
599600void CMainWindow::on_newProjectButton_clicked ()
@@ -669,7 +670,7 @@ void CMainWindow::on_updateProjectButton_clicked()
669670 projectItem.tagUpdateDateTime_ = currDateTime.toString (" dd/MM/yyyy hh:mm:ss" );
670671
671672 // tag last update date time updated so need update in project manager
672- CProjectManager::getInstance ()->updateProjectItem (projectItemName, projectItem);
673+ CProjectManager::getInstance ()->updateProjectItem (false , projectItemName, projectItem);
673674
674675 statusBar ()->showMessage (" Updating tag for " + projectItem.name_ + " ..." );
675676
@@ -683,41 +684,46 @@ void CMainWindow::on_updateProjectButton_clicked()
683684 }
684685}
685686
687+ void CMainWindow::projectRebuildTag (const QString projectItemName)
688+ {
689+ CProjectItem projectItem;
690+ QDateTime currDateTime;
691+
692+ projectItem = CProjectManager::getInstance ()->getProjectItem (projectItemName);
693+
694+ QDir currentDir (QDir::currentPath ());
695+
696+ // only update project if source directory exists
697+ if (currentDir.exists (projectItem.srcDir_ )) {
698+ currDateTime = QDateTime::currentDateTime ();
699+ projectItem.tagUpdateDateTime_ = currDateTime.toString (" dd/MM/yyyy hh:mm:ss" );
700+
701+ // tag last update date time updated so need update in project manager
702+ CProjectManager::getInstance ()->updateProjectItem (false , projectItemName, projectItem);
703+
704+ statusBar ()->showMessage (" Rebuilding tag for " + projectItem.name_ + " ..." );
705+
706+ projectUpdateThread_.setRebuildTag (true );
707+ projectUpdateThread_.setCurrentProjectItem (projectItem);
708+ projectUpdateThread_.start (QThread::HighestPriority); // priority for update thread
709+ } else {
710+ QMessageBox::warning (this , " Load" , " Cannot rebuilt project. Source directory doesn't exists." , QMessageBox::Ok);
711+ }
712+ }
713+
686714void CMainWindow::on_rebuildTagProjectButton_clicked ()
687715{
688716 QStringList projectItemNameList = getSelectedProjectItemNameList ();
689717 int projectSelected = projectItemNameList.size ();
690718
691719 QString projectItemName;
692- CProjectItem projectItem;
693- QDateTime currDateTime;
694720
695721 if (projectSelected != 0 ) {
696722 if (projectSelected > 1 ) {
697723 QMessageBox::information (this , " Rebuild" , " Only one project can be rebuilt each time" , QMessageBox::Ok);
698724 } else {
699725 projectItemName = projectItemNameList.at (0 );
700-
701- projectItem = CProjectManager::getInstance ()->getProjectItem (projectItemName);
702-
703- QDir currentDir (QDir::currentPath ());
704-
705- // only update project if source directory exists
706- if (currentDir.exists (projectItem.srcDir_ )) {
707- currDateTime = QDateTime::currentDateTime ();
708- projectItem.tagUpdateDateTime_ = currDateTime.toString (" dd/MM/yyyy hh:mm:ss" );
709-
710- // tag last update date time updated so need update in project manager
711- CProjectManager::getInstance ()->updateProjectItem (projectItemName, projectItem);
712-
713- statusBar ()->showMessage (" Rebuilding tag for " + projectItem.name_ + " ..." );
714-
715- projectUpdateThread_.setRebuildTag (true );
716- projectUpdateThread_.setCurrentProjectItem (projectItem);
717- projectUpdateThread_.start (QThread::HighestPriority); // priority for update thread
718- } else {
719- QMessageBox::warning (this , " Load" , " Cannot rebuilt project. Source directory doesn't exists." , QMessageBox::Ok);
720- }
726+ projectRebuildTag (projectItemName);
721727 }
722728 }
723729}
@@ -1197,6 +1203,8 @@ void CMainWindow::on_actionSetting_triggered()
11971203 QFont updatedSymbolFont = static_cast <CConfigDlg*> (dialog)->getSymbolDefaultFont ();
11981204
11991205 setSymbolFont (updatedSymbolFont);
1206+ // update symbol panel
1207+ on_searchButton_clicked ();
12001208 }
12011209}
12021210
@@ -1281,7 +1289,7 @@ void CMainWindow::closeEvent(QCloseEvent *event)
12811289 event->accept ();
12821290}
12831291
1284- void CMainWindow::updateTagBuildProgress (int percentage)
1292+ void CMainWindow::updateTagBuildProgress (int percentage, QString indexingFileName )
12851293{
12861294 // show the progress bar when pecentage completed >= 0
12871295 if (percentage >= 0 ) {
@@ -1291,6 +1299,10 @@ void CMainWindow::updateTagBuildProgress(int percentage)
12911299
12921300 progressBar_.setValue (percentage);
12931301
1302+ if (indexingFileName != " " ) {
1303+ statusBar ()->showMessage (" Indexing " + indexingFileName + " ..." );
1304+ }
1305+
12941306 // hide the progress bar when completed
12951307 if (percentage == 100 ) {
12961308 statusBar ()->showMessage (" Tag update completed." );
@@ -1690,6 +1702,14 @@ void CMainWindow::on_fileEditExternalPressed()
16901702
16911703 QString consoleCommnad = confManager_->getAppSettingValue (" DefaultEditor" ).toString ();
16921704
1705+ if (consoleCommnad == " " ) {
1706+ QMessageBox msgBox;
1707+ msgBox.setIcon (QMessageBox::Information);
1708+ msgBox.setText (" External editor has not be defined. Please set it in Options -> Settings -> Main -> External Editor" );
1709+ msgBox.exec ();
1710+ return ;
1711+ }
1712+
16931713#ifdef Q_OS_WIN
16941714 editFilename = " \" " + selectedItemList.at (0 ) + " \" " ;
16951715#else
@@ -1707,6 +1727,13 @@ void CMainWindow::on_fileEditExternalPressed()
17071727 }
17081728}
17091729
1730+ void CMainWindow::launchEditorWithLineNum (const QString &fileName, int lineNum)
1731+ {
1732+ editor_.loadFileWithLineNum (fileName, lineNum);
1733+ editor_.show ();
1734+ QApplication::setActiveWindow (static_cast <QMainWindow*> (&editor_));
1735+ }
1736+
17101737void CMainWindow::launchEditor (const QString &fileName)
17111738{
17121739 editor_.loadFile (fileName);
0 commit comments