| 83 | } |
| 84 | |
| 85 | void CFavoriteView::setupToolBar(QLayout *layout) |
| 86 | { |
| 87 | if(!layout) return; |
| 88 | bool check = false; |
| 89 | QToolBar* pToolBar = new QToolBar(this); |
| 90 | if(!pToolBar) return; |
| 91 | layout->addWidget(pToolBar); |
| 92 | |
| 93 | m_pShowToolbar = new QAction(tr("Show tool bar"), this); |
| 94 | m_pShowToolbar->setCheckable(true); |
| 95 | m_pShowToolbar->setChecked(m_pParaApp->GetDockListFavoriteShowToolBar()); |
| 96 | pToolBar->setVisible(m_pShowToolbar->isChecked()); |
| 97 | check = connect(m_pShowToolbar, &QAction::triggered, this, [&, pToolBar]() { |
| 98 | if(m_pShowToolbar && m_pParaApp) { |
| 99 | pToolBar->setVisible(m_pShowToolbar->isChecked()); |
| 100 | m_pParaApp->SetDockListFovoriteShowToolBar(m_pShowToolbar->isChecked()); |
| 101 | m_pParaApp->Save(); |
| 102 | } |
| 103 | }); |
| 104 | Q_ASSERT(check); |
| 105 | |
| 106 | m_pStartAction = pToolBar->addAction( |
| 107 | QIcon::fromTheme("media-playback-start"), tr("Start")); |
| 108 | if(m_pStartAction) { |
| 109 | m_pStartAction->setToolTip(m_pStartAction->text()); |
| 110 | m_pStartAction->setStatusTip(m_pStartAction->text()); |
| 111 | check = connect(m_pStartAction, &QAction::triggered, |
| 112 | this, &CFavoriteView::slotStart); |
| 113 | Q_ASSERT(check); |
| 114 | } |
| 115 | |
| 116 | m_pEidtStartAction = pToolBar->addAction( |
| 117 | QIcon::fromTheme("system-settings"), tr("Open settings and Start")); |
| 118 | if(m_pEidtStartAction) { |
| 119 | m_pEidtStartAction->setToolTip(m_pEidtStartAction->text()); |
| 120 | m_pEidtStartAction->setStatusTip(m_pEidtStartAction->text()); |
| 121 | check = connect(m_pEidtStartAction, &QAction::triggered, |
| 122 | this, &CFavoriteView::slotOpenStart); |
| 123 | Q_ASSERT(check); |
| 124 | } |
| 125 | |
| 126 | pToolBar->addSeparator(); |
| 127 | |
| 128 | m_pAddFolderAction = pToolBar->addAction( |
| 129 | QIcon::fromTheme("folder-new"), tr("New group")); |
| 130 | if(m_pAddFolderAction) { |
| 131 | m_pAddFolderAction->setToolTip(m_pAddFolderAction->text()); |
| 132 | m_pAddFolderAction->setStatusTip(m_pAddFolderAction->text()); |
| 133 | check = connect(m_pAddFolderAction, &QAction::triggered, |
| 134 | this, &CFavoriteView::slotNewGroup); |
| 135 | Q_ASSERT(check); |
| 136 | } |
| 137 | |
| 138 | m_pEditAction = pToolBar->addAction(QIcon::fromTheme("edit"), tr("Edit")); |
| 139 | if(m_pEditAction) { |
| 140 | m_pEditAction->setToolTip(m_pEditAction->text()); |
| 141 | m_pEditAction->setStatusTip(m_pEditAction->text()); |
| 142 | check = connect(m_pEditAction, &QAction::triggered, |
nothing calls this directly
no test coverage detected