@@ -783,6 +783,8 @@ void MainWindow::slotCurrentViewChanged(const QWidget* pView)
783783 if (a->data ().value <COperate*>() == o)
784784 a->setChecked (true );
785785 }
786+ ui->actionStop_other ->setText (
787+ tr (" Stop other except the current \" %1\" " ).arg (o->Name ()));
786788 }
787789 }
788790}
@@ -793,6 +795,16 @@ void MainWindow::EnableMenu(bool bEnable)
793795 ui->actionClone ->setEnabled (bEnable);
794796 ui->actionAdd_to_favorite ->setEnabled (bEnable);
795797 ui->actionStop ->setEnabled (bEnable);
798+ ui->actionStop_All ->setEnabled (bEnable);
799+ ui->actionStop_other ->setEnabled (bEnable);
800+ if (bEnable) {
801+ if (m_Operates.size () > 1 )
802+ ui->actionStop_other ->setEnabled (true );
803+ else
804+ ui->actionStop_other ->setEnabled (false );
805+ } else {
806+ ui->actionStop_other ->setText (tr (" Stop other" ));
807+ }
796808 ui->actionTabBar_B ->setEnabled (bEnable);
797809 ui->menuActivity ->setEnabled (bEnable);
798810 m_ptbMenuActivity->setEnabled (bEnable);
@@ -1119,16 +1131,17 @@ void MainWindow::slotRunning()
11191131 }
11201132 //*/
11211133
1122- SetSecureLevel (p );
1134+ slotCurrentViewChanged (p-> GetViewer () );
11231135
11241136 auto m = p->GetMenu ();
11251137 if (m) {
11261138 m->addSeparator ();
11271139 m->addAction (ui->actionClone );
1140+ m->addAction (ui->actionStop_All );
1141+ m->addAction (ui->actionStop_other );
11281142 }
1129- slotLoadOperateMenu ();
11301143
1131- slotInformation (tr (" Connected to " ) + p->Name ());
1144+ slotInformation (tr (" Connected to " ) + " \" " + p->Name () + " \" " );
11321145 qDebug (log) << Q_FUNC_INFO << p->Name ();
11331146}
11341147// ! [MainWindow slotRunning]
@@ -1148,11 +1161,35 @@ void MainWindow::slotCloseView(const QWidget* pView)
11481161 }
11491162}
11501163
1164+ void MainWindow::on_actionStop_other_triggered ()
1165+ {
1166+ if (!m_pView) return ;
1167+ foreach (auto p, m_Operates)
1168+ {
1169+ if (p->GetViewer () != m_pView->GetCurrentView ())
1170+ {
1171+ // TODO: Whether to save the setting
1172+ emit p->sigUpdateParameters (p);
1173+ p->Stop ();
1174+ }
1175+ }
1176+ }
1177+
1178+ void MainWindow::on_actionStop_All_triggered ()
1179+ {
1180+ foreach (auto p, m_Operates)
1181+ {
1182+ // TODO: Whether to save the setting
1183+ emit p->sigUpdateParameters (p);
1184+ p->Stop ();
1185+ }
1186+ }
1187+
11511188void MainWindow::on_actionStop_triggered ()
11521189{
11531190 qDebug (log) << Q_FUNC_INFO;
11541191 if (!m_pView) return ;
1155-
1192+
11561193 QWidget* pView = m_pView->GetCurrentView ();
11571194 slotCloseView (pView);
11581195}
0 commit comments