| 528 | }; |
| 529 | |
| 530 | NetHackQtMainWindow::NetHackQtMainWindow(NetHackQtKeyBuffer& ks) : |
| 531 | message(0), map(0), status(0), invusage(0), |
| 532 | hsplitter(0), vsplitter(0), |
| 533 | keysink(ks), dirkey(0) |
| 534 | { |
| 535 | QToolBar* toolbar = new QToolBar(this); |
| 536 | toolbar->setMovable(false); |
| 537 | toolbar->setFocusPolicy(Qt::NoFocus); |
| 538 | addToolBar(toolbar); |
| 539 | menubar = menuBar(); |
| 540 | |
| 541 | setWindowTitle("NetHack-Qt"); |
| 542 | setWindowIcon(QIcon(QPixmap(qt_compact_mode ? nh_icon_small : nh_icon))); |
| 543 | |
| 544 | #ifdef MACOS |
| 545 | /* |
| 546 | * MacOS Note: |
| 547 | * The toolbar on MacOS starts with a system menu labeled with the |
| 548 | * Apple logo and an application menu labeled with the application's |
| 549 | * name (taken from Info.plist if present, otherwise the base name |
| 550 | * of the running program). After that, application-specific menus |
| 551 | * (in our case "game",...,"help") follow. Several menu entry |
| 552 | * names ("About", "Quit"/"Exit", "Preferences"/"Options"/ |
| 553 | * "Settings"/"Setup"/"Config") get hijacked and placed in the |
| 554 | * application menu (and renamed in the process) even if the code |
| 555 | * here tries to put them in another menu. |
| 556 | * See QtWidgets/doc/qmenubar.html for slightly more information. |
| 557 | * setMenuRole() can be used to override this behavior. |
| 558 | */ |
| 559 | #endif |
| 560 | |
| 561 | #ifdef CTRL_V_HACK |
| 562 | // NetHackQtBind::notify() sees all control characters except for ^V |
| 563 | QShortcut *c_V = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_V), this); |
| 564 | connect(c_V, &QShortcut::activated, this, &NetHackQtMainWindow::CtrlV); |
| 565 | #endif |
| 566 | |
| 567 | QMenu* game=new QMenu; |
| 568 | QMenu* apparel=new QMenu; |
| 569 | QMenu* act1=new QMenu; |
| 570 | QMenu* act2 = qt_compact_mode ? new QMenu : act1; |
| 571 | QMenu* magic=new QMenu; |
| 572 | QMenu* info=new QMenu; |
| 573 | |
| 574 | QMenu *help; |
| 575 | #ifdef KDE |
| 576 | help = kapp->getHelpMenu( true, "" ); |
| 577 | help->addSeparator(); |
| 578 | #else |
| 579 | help = qt_compact_mode ? info : new QMenu; |
| 580 | #endif |
| 581 | |
| 582 | enum { OnDesktop=1, OnHandhelds=2 }; |
| 583 | struct Macro { |
| 584 | QMenu *menu; |
| 585 | const char *name; |
| 586 | int flags; // 1 desktop, 2 handheld, 3 either/both |
| 587 | int (*funct)(void); |
nothing calls this directly
no test coverage detected