| 265 | } |
| 266 | |
| 267 | void ColorPickerWidget::onColorButtonContextMenu(const QPoint &pos) |
| 268 | { |
| 269 | // Only show context menu for button texts that have a known default color |
| 270 | if ("TabFontColor" != m_buttonText |
| 271 | && "TabBGColor" != m_buttonText |
| 272 | && "FW_BGColor" != m_buttonText |
| 273 | && "FontColor" != m_buttonText |
| 274 | && "BGColor" != m_buttonText |
| 275 | && "CenterColor" != m_buttonText |
| 276 | && "CrosshairColor" != m_buttonText |
| 277 | && "VBtn_BGColor" != m_buttonText |
| 278 | && "VBtn_BtnColor" != m_buttonText |
| 279 | && "VBtn_PressedColor" != m_buttonText |
| 280 | && "VBtn_LockedColor" != m_buttonText |
| 281 | && "VBtn_TextColor" != m_buttonText |
| 282 | && "FloatBtn_BtnColor" != m_buttonText |
| 283 | && "FloatBtn_PressedColor" != m_buttonText |
| 284 | && "FloatBtn_LockedColor" != m_buttonText |
| 285 | && "FloatBtn_TextColor" != m_buttonText |
| 286 | && "FloatBtn_BorderColor" != m_buttonText) { |
| 287 | return; |
| 288 | } |
| 289 | |
| 290 | QMenu menu(this); |
| 291 | QAction *restoreAction = menu.addAction(tr("Restore Default Color")); |
| 292 | QAction *selected = menu.exec(colorButton->mapToGlobal(pos)); |
| 293 | if (selected != restoreAction) { |
| 294 | return; |
| 295 | } |
| 296 | |
| 297 | // Determine the default color for this button type |
| 298 | QColor color; |
| 299 | if ("TabFontColor" == m_buttonText) { |
| 300 | int setting_select_index = QTableSetupDialog::getInstance()->getSettingSelectIndex(); |
| 301 | if (setting_select_index < 0) { |
| 302 | return; |
| 303 | } |
| 304 | else if (GLOBALSETTING_INDEX == setting_select_index) { |
| 305 | color = NOTIFICATION_COLOR_GLOBAL_DEFAULT; |
| 306 | } |
| 307 | else { |
| 308 | color = NOTIFICATION_COLOR_NORMAL_DEFAULT; |
| 309 | } |
| 310 | } |
| 311 | else if ("TabBGColor" == m_buttonText) { |
| 312 | color = NOTIFICATION_BACKGROUND_COLOR_DEFAULT; |
| 313 | } |
| 314 | else if ("FW_BGColor" == m_buttonText) { |
| 315 | color = FLOATINGWINDOW_BACKGROUND_COLOR_DEFAULT; |
| 316 | } |
| 317 | else if ("FontColor" == m_buttonText) { |
| 318 | color = NOTIFICATION_COLOR_NORMAL_DEFAULT; |
| 319 | } |
| 320 | else if ("BGColor" == m_buttonText) { |
| 321 | color = NOTIFICATION_BACKGROUND_COLOR_DEFAULT; |
| 322 | } |
| 323 | else if ("CenterColor" == m_buttonText) { |
| 324 | color = CROSSHAIR_CENTERCOLOR_DEFAULT_QCOLOR; |
nothing calls this directly
no test coverage detected