| 379 | DisableWidget(); |
| 380 | if (isSold()) |
| 381 | { |
| 382 | ui.edit_button->setEnabled(true); |
| 383 | ui.export_button->setEnabled(true); |
| 384 | ui.delete_button->setEnabled(true); |
| 385 | } |
| 386 | else if (isMult()) |
| 387 | { |
| 388 | ui.delete_button->setEnabled(true); |
| 389 | } |
| 390 | if (!currentGroup->base) ui.delete_group_button->setEnabled(true); |
| 391 | } |
| 392 | bool MacroUi::SelectGroup() |
| 393 | { |
| 394 | if (!currentGroup && groups->not_empty()) currentGroup = &groups->front(); |
| 395 | return currentGroup; |
| 396 | } |
| 397 | |
| 398 | bool MacroUi::isSold() { return (currentGroup && currentMacros.size() == 1); } |
| 399 | bool MacroUi::isMult() { return (currentGroup && currentMacros.size()); } |
| 400 | |
| 401 | void MacroUi::showEvent(QShowEvent*) |
| 402 | { |
| 403 | ResetWidget(); |
| 404 | DisableWidget(); |
| 405 | TableUpdate(); |
| 406 | } |
| 407 | void MacroUi::customEvent(QEvent* e) |
| 408 | { |
| 409 | static Macro* edit; |
| 410 | if (e->type() == static_cast<int>(QiEvent::mac_edit_enter)) |
| 411 | { |
| 412 | if (!isSold()) return; |
| 413 | edit = currentMacros.front(); |
| 414 | Qi::widget.editMacro = *edit; |
| 415 | Qi::widget.edit = new EditUi(&Qi::widget.editMacro); |
| 416 | Qi::widget.dialogActive = true; |
| 417 | Qi::widget.main->hide(); |
| 418 | Qi::widget.main->setDisabled(true); |
| 419 | Qi::widget.edit->show(); |
| 420 | Qi::popText->Hide(); |
| 421 | } |
| 422 | else if (e->type() == static_cast<int>(QiEvent::mac_load)) |
| 423 | { |
| 424 | Macro::loadAll(); |
| 425 | TableUpdate(); |
| 426 | ResetWidget(); |
| 427 | DisableWidget(); |
| 428 | Qi::popText->Hide(); |
| 429 | if (!Qi::widget.onload) |
| 430 | { |
| 431 | Qi::widget.onload = true; |
| 432 | if (Qi::set.minMode && Qi::set.defOn) QApplication::sendEvent(Qi::widget.main, new QEvent(QEvent::WindowDeactivate)); |
| 433 | } |
| 434 | } |
| 435 | else if (e->type() == static_cast<int>(QiEvent::mac_edit_exit)) |
| 436 | { |