void EditorMainWindow::SetupUI(QMainWindow *MainWindow) { setWindowIcon(*QtConfig::GetIcon("colorwheel.png")); MainWindow->setWindowTitle("Sound Engine v0.2.3"); MainWindow->resize(1280, 720); MainWindow->setDockOptions(QMainWindow::AnimatedDocks | QMainWindow::AllowNestedDocks | QMainWindow::AllowTabbedDocks); MainWindow->setTabPosition(Qt::AllDockWidgetAreas, QTabWidget::TabPosition::North); // ************************************************************************ // Load styling ReloadStyleSheets(); // ************************************************************************ // File Picker auto *picker = new FilePicker(); picker->setNameFilter("*.xml"); GUI::Set(QT_INSTACE::FILE_PICKER, (void*) picker); // ************************************************************************ // Menu Bar QMenuBar *menuBar = new QMenuBar(MainWindow); menuBar->setObjectName(QStringLiteral("menuBar")); menuBar->setGeometry(QRect(0, 0, 1051, 21)); MainWindow->setMenuBar(menuBar); // Menu Entry { QMenu *menuEngine = new QMenu(menuBar); menuEngine->setObjectName(QStringLiteral("menuEngine")); menuEngine->setTitle("File"); menuBar->addAction(menuEngine->menuAction()); { QAction *action = new QAction(MainWindow); action->setText("Exit"); action->setIcon(*QtConfig::GetIcon("power.png")); menuEngine->addAction(action); QObject::connect(action, &QAction::triggered, this, &EditorMainWindow::close); } { QAction *action = new QAction(MainWindow); action->setText("Save As..."); action->setIcon(*QtConfig::GetIcon("memorycard.png")); menuEngine->addAction(action); QObject::connect(action, &QAction::triggered, this, [picker]() { picker->OpenForSave(); }); QObject::connect(picker, &QFileDialog::fileSelected, this, [picker] (const QString & file) { if (picker->IsSaving()) { CSoundEditor::GetScene()->SaveSceneAs(file.toStdString().c_str()); } }); } } // Menu Entry { QMenu *menu = new QMenu(menuBar); menu->setTitle("Scene"); menuBar->addAction(menu->menuAction()); // Submenu buttons QAction *action = new QAction(MainWindow); action->setText("Clear Scene"); action->setIcon(*QtConfig::GetIcon("denied.png")); menu->addAction(action); QObject::connect(action, &QAction::triggered, this, []() { CSoundEditor::GetScene()->Clear(); GUI::Get<SceneWindow>(QT_INSTACE::SCENE_EDITOR)->Clear(); }); } // Menu Entry { QMenu *menu = new QMenu(menuBar); menu->setTitle("Tools"); menuBar->addAction(menu->menuAction()); // Submenu buttons { QAction *action = new QAction(MainWindow); action->setText("Reload StyleSheets"); action->setIcon(*QtConfig::GetIcon("cmyk.png")); menu->addAction(action); QObject::connect(action, &QAction::triggered, this, &EditorMainWindow::ReloadStyleSheets); } // Submenu buttons { QAction *action = new QAction(MainWindow); action->setText("Reload CSound Config"); action->setIcon(*QtConfig::GetIcon("loading.png")); menu->addAction(action); QObject::connect(action, &QAction::triggered, this, []() { SoundManager::Init(); }); } } // Menu Entry { QMenu *menu = new QMenu(menuBar); menu->setTitle("CSound"); menuBar->addAction(menu->menuAction()); // Submenu buttons QAction *action = new QAction(MainWindow); action->setText("Options"); action->setIcon(*QtConfig::GetIcon("gear.png")); menu->addAction(action); appWindows["CSoundOptions"] = new CSoundOptionsWindow(); QObject::connect(action, &QAction::triggered, this, [&]() { appWindows["CSoundOptions"]->Toggle(); }); } // Menu Entry { QMenu *menu = new QMenu(menuBar); menu->setTitle("Help"); menuBar->addAction(menu->menuAction()); // Submenu buttons QAction *action = new QAction(MainWindow); action->setText("About"); action->setIcon(*QtConfig::GetIcon("chat.png")); menu->addAction(action); appWindows["About"] = new AboutWindow(); QObject::connect(action, &QAction::triggered, this, [&]() { appWindows["About"]->Toggle(); }); } // ************************************************************************ // Toolbar QToolBar *toolbar = new QToolBar(); toolbar->setWindowTitle("Toolbar"); // Play Audio { QToolButton *button = new QToolButton(); button->setText("Play"); button->setMaximumWidth(80); button->setIcon(*QtConfig::GetIcon("play.png")); button->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); QObject::connect(button, &QToolButton::clicked, this, []() { CSoundEditor::GetScene()->Play(); }); toolbar->addWidget(button); } // Stop Audio { QToolButton *button = new QToolButton(); button->setText("Stop"); button->setMaximumWidth(80); button->setIcon(*QtConfig::GetIcon("volume_disabled.png")); button->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); QObject::connect(button, &QToolButton::clicked, this, []() { CSoundEditor::GetScene()->Stop(); }); toolbar->addWidget(button); } // Save Scene { QToolButton *button = new QToolButton(); button->setText("Save Scene"); button->setIcon(*QtConfig::GetIcon("download.png")); button->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); QObject::connect(button, &QToolButton::clicked, this, []() { auto result = CSoundEditor::GetScene()->SaveScene(); if (!result) { auto picker = GUI::Get<FilePicker>(QT_INSTACE::FILE_PICKER); if (picker) { picker->OpenForSave(); } } }); toolbar->addWidget(button); } // Load Scene { QToolButton *button = new QToolButton(); button->setText("Load Scene"); button->setIcon(*QtConfig::GetIcon("upload.png")); button->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); QObject::connect(picker, &QFileDialog::fileSelected, this, [picker] (const QString & file) { if (!picker->IsSaving()) { CSoundEditor::GetScene()->LoadScene(file.toStdString().c_str()); GUI::Get<SceneWindow>(QT_INSTACE::SCENE_EDITOR)->Init(); } }); QObject::connect(button, &QToolButton::clicked, this, [picker]() { picker->OpenForLoad(); }); toolbar->addWidget(button); } // Headphone Test { QToolButton *button = new QToolButton(); button->setText("Headphone Test"); button->setIcon(*QtConfig::GetIcon("speaker.png")); button->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); appWindows["HeadphoneTest"] = new HeadphoneTestWindow(); QObject::connect(button, &QToolButton::clicked, this, [this]() { appWindows["HeadphoneTest"]->Toggle(); }); toolbar->addWidget(button); } // Moving Plane { QToolButton *button = new QToolButton(); button->setText("Moving Plane"); button->setIcon(*QtConfig::GetIcon("frames.png")); button->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); toolbar->addWidget(button); appWindows["MovingPlane"] = new MovingPlaneWindow(); QObject::connect(button, &QToolButton::clicked, this, [this]() { appWindows["MovingPlane"]->Toggle(); }); } // Sweeping Plane { QToolButton *button = new QToolButton(); button->setText("Horizontal Sweep"); button->setIcon(*QtConfig::GetIcon("half-loading.png")); button->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); toolbar->addWidget(button); appWindows["SweepingPlane"] = new SweepingPlaneWindow(); QObject::connect(button, &QToolButton::clicked, this, [this]() { appWindows["SweepingPlane"]->Toggle(); }); } // Expanding Sphere { QToolButton *button = new QToolButton(); button->setText("Expanding Sphere"); button->setIcon(*QtConfig::GetIcon("target.png")); button->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); appWindows["ExpandingPlane"] = new ExpandingSphereWindow(); QObject::connect(button, &QToolButton::clicked, this, [this]() { appWindows["ExpandingPlane"]->Toggle(); }); toolbar->addWidget(button); } // Padding Scene { QWidget *empty = new QWidget(); empty->setObjectName("ToolWiteSpace"); toolbar->addWidget(empty); } // Sound Output Mode { dropdown = new QComboBox(); dropdown->setMinimumWidth(60); QStyledItemDelegate* itemDelegate = new QStyledItemDelegate(); dropdown->setItemDelegate(itemDelegate); dropdown->addItem("None", QVariant(-1)); dropdown->addItem("Mono", QVariant(0)); dropdown->addItem("HRTF2", QVariant(1)); dropdown->addItem("Stereo", QVariant(2)); dropdown->addItem("ind-HRTF", QVariant(4)); dropdown->addItem("PAN2", QVariant(8)); dropdown->addItem("Quad-HRTF", QVariant(16)); dropdown->addItem("Multi-8", QVariant(32)); dropdown->addItem("Quad-Stereo", QVariant(64)); // Default is HRTF dropdown->setCurrentIndex(2); SoundManager::SetGlobalOutputModelIndex(1); // Add widget auto widget = new CustomWidget(QBoxLayout::LeftToRight); widget->setObjectName("GlobalOutputDropdown"); auto label = new QLabel("Global output"); widget->AddWidget(label); widget->AddWidget(dropdown); toolbar->addWidget(widget); void (QComboBox::* indexChangedSignal)(int index) = &QComboBox::currentIndexChanged; QObject::connect(dropdown, indexChangedSignal, this, [&](int index) { if (index == 0) { SoundManager::SetGlobalOutputModelIndex(1024); CSoundEditor::GetScene()->SetOutputModel("none"); return; } else if (SoundManager::GetGlobalOutputModelIndex() == 1024) { CSoundEditor::GetScene()->SetOutputModel("global-output"); } auto data = dropdown->currentData().toUInt(); SoundManager::SetGlobalOutputModelIndex(data); }); } // Attach toobar to the main window MainWindow->addToolBar(toolbar); // ************************************************************************ // Status Bar QStatusBar *statusBar = new QStatusBar(MainWindow); statusBar->setObjectName(QStringLiteral("statusBar")); MainWindow->setStatusBar(statusBar); //QMetaObject::connectSlotsByName(MainWindow); // ************************************************************************ // Central Area QWidget *centeralWidget = new QWidget(); centeralWidget->setFixedWidth(0); MainWindow->setCentralWidget(centeralWidget); // ************************************************************************ // Attach windows dockWindows["TextPreview"] = new TextPreviewWindow(); dockWindows["CodeEditor"] = new CodeEditorWindow(); dockWindows["ComponentList"] = new ComponentList(); dockWindows["InstrumentList"] = new InstrumentList(); dockWindows["ScoreList"] = new ScoreList(); dockWindows["ScoreEditor"] = new ScoreEditor(); dockWindows["InstrumentEditor"] = new InstrumentEditor(); dockWindows["ComponentEditor"] = new ComponentEditor(); dockWindows["SceneWindow"] = new SceneWindow(); dockWindows["GameWindow"] = new GameWindow(); dockWindows["ObjectProperty"] = new SceneObjectProperties(); dockWindows["CameraProperty"] = new CameraPropertyEditor(); dockWindows["CSoundControl"] = new CSoundControlWindow(); //// Left Dock MainWindow->addDockWidget(Qt::DockWidgetArea::LeftDockWidgetArea, dockWindows["SceneWindow"], Qt::Orientation::Vertical); MainWindow->addDockWidget(Qt::DockWidgetArea::LeftDockWidgetArea, dockWindows["ScoreEditor"], Qt::Orientation::Horizontal); MainWindow->addDockWidget(Qt::DockWidgetArea::LeftDockWidgetArea, dockWindows["InstrumentEditor"], Qt::Orientation::Horizontal); MainWindow->addDockWidget(Qt::DockWidgetArea::LeftDockWidgetArea, dockWindows["ComponentEditor"], Qt::Orientation::Vertical); MainWindow->tabifyDockWidget(dockWindows["ComponentEditor"], dockWindows["ObjectProperty"]); MainWindow->tabifyDockWidget(dockWindows["ComponentEditor"], dockWindows["CameraProperty"]); MainWindow->tabifyDockWidget(dockWindows["ComponentEditor"], dockWindows["CSoundControl"]); MainWindow->addDockWidget(Qt::DockWidgetArea::LeftDockWidgetArea, dockWindows["TextPreview"], Qt::Orientation::Horizontal); MainWindow->tabifyDockWidget(dockWindows["TextPreview"], dockWindows["CodeEditor"]); MainWindow->tabifyDockWidget(dockWindows["TextPreview"], dockWindows["GameWindow"]); dockWindows["GameWindow"]->setFloating(true); dockWindows["GameWindow"]->setFloating(false); dockWindows["GameWindow"]->raise(); // Right Dock MainWindow->addDockWidget(Qt::DockWidgetArea::RightDockWidgetArea, dockWindows["ComponentList"], Qt::Orientation::Vertical); MainWindow->addDockWidget(Qt::DockWidgetArea::RightDockWidgetArea, dockWindows["InstrumentList"], Qt::Orientation::Vertical); MainWindow->addDockWidget(Qt::DockWidgetArea::RightDockWidgetArea, dockWindows["ScoreList"], Qt::Orientation::Vertical); // Activate Windows dockWindows["ObjectProperty"]->raise(); }
void setupUi(QMainWindow *Detection) { if (Detection->objectName().isEmpty()) Detection->setObjectName(QString::fromUtf8("Detection")); Detection->resize(729, 480); actionE_xit = new QAction(Detection); actionE_xit->setObjectName(QString::fromUtf8("actionE_xit")); action_Load_Map = new QAction(Detection); action_Load_Map->setObjectName(QString::fromUtf8("action_Load_Map")); action_Connect = new QAction(Detection); action_Connect->setObjectName(QString::fromUtf8("action_Connect")); action_Disconnect = new QAction(Detection); action_Disconnect->setObjectName(QString::fromUtf8("action_Disconnect")); centralWidget = new QWidget(Detection); centralWidget->setObjectName(QString::fromUtf8("centralWidget")); gridLayoutWidget = new QWidget(centralWidget); gridLayoutWidget->setObjectName(QString::fromUtf8("gridLayoutWidget")); gridLayoutWidget->setGeometry(QRect(0, 0, 721, 421)); gridLayout = new QGridLayout(gridLayoutWidget); gridLayout->setSpacing(6); gridLayout->setContentsMargins(11, 11, 11, 11); gridLayout->setObjectName(QString::fromUtf8("gridLayout")); gridLayout->setSizeConstraint(QLayout::SetNoConstraint); gridLayout->setVerticalSpacing(5); gridLayout->setContentsMargins(0, 0, 0, 0); ugvFeedLabel = new QLabel(gridLayoutWidget); ugvFeedLabel->setObjectName(QString::fromUtf8("ugvFeedLabel")); QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); sizePolicy.setHorizontalStretch(0); sizePolicy.setVerticalStretch(0); sizePolicy.setHeightForWidth(ugvFeedLabel->sizePolicy().hasHeightForWidth()); ugvFeedLabel->setSizePolicy(sizePolicy); gridLayout->addWidget(ugvFeedLabel, 1, 2, 1, 1); connectionButton = new QCommandLinkButton(gridLayoutWidget); connectionButton->setObjectName(QString::fromUtf8("connectionButton")); gridLayout->addWidget(connectionButton, 0, 2, 1, 1); uavFeedLabel = new QLabel(gridLayoutWidget); uavFeedLabel->setObjectName(QString::fromUtf8("uavFeedLabel")); sizePolicy.setHeightForWidth(uavFeedLabel->sizePolicy().hasHeightForWidth()); uavFeedLabel->setSizePolicy(sizePolicy); uavFeedLabel->setMaximumSize(QSize(16777215, 16777215)); gridLayout->addWidget(uavFeedLabel, 1, 0, 1, 1); ugvMapLabel = new QLabel(gridLayoutWidget); ugvMapLabel->setObjectName(QString::fromUtf8("ugvMapLabel")); QSizePolicy sizePolicy1(QSizePolicy::MinimumExpanding, QSizePolicy::Expanding); sizePolicy1.setHorizontalStretch(0); sizePolicy1.setVerticalStretch(0); sizePolicy1.setHeightForWidth(ugvMapLabel->sizePolicy().hasHeightForWidth()); ugvMapLabel->setSizePolicy(sizePolicy1); gridLayout->addWidget(ugvMapLabel, 1, 3, 1, 1); horizontalLayout_4 = new QHBoxLayout(); horizontalLayout_4->setSpacing(6); horizontalLayout_4->setObjectName(QString::fromUtf8("horizontalLayout_4")); label_2 = new QLabel(gridLayoutWidget); label_2->setObjectName(QString::fromUtf8("label_2")); horizontalLayout_4->addWidget(label_2); uavTakeoffLandButton = new QPushButton(gridLayoutWidget); uavTakeoffLandButton->setObjectName(QString::fromUtf8("uavTakeoffLandButton")); horizontalLayout_4->addWidget(uavTakeoffLandButton); gridLayout->addLayout(horizontalLayout_4, 2, 0, 1, 1); horizontalLayout_2 = new QHBoxLayout(); horizontalLayout_2->setSpacing(6); horizontalLayout_2->setObjectName(QString::fromUtf8("horizontalLayout_2")); label = new QLabel(gridLayoutWidget); label->setObjectName(QString::fromUtf8("label")); horizontalLayout_2->addWidget(label); ugvSpeedLCD = new QLCDNumber(gridLayoutWidget); ugvSpeedLCD->setObjectName(QString::fromUtf8("ugvSpeedLCD")); ugvSpeedLCD->setFrameShape(QFrame::Box); horizontalLayout_2->addWidget(ugvSpeedLCD); gridLayout->addLayout(horizontalLayout_2, 4, 2, 1, 1); horizontalLayout_6 = new QHBoxLayout(); horizontalLayout_6->setSpacing(6); horizontalLayout_6->setObjectName(QString::fromUtf8("horizontalLayout_6")); label_3 = new QLabel(gridLayoutWidget); label_3->setObjectName(QString::fromUtf8("label_3")); horizontalLayout_6->addWidget(label_3); ugvSpeakerButton = new QPushButton(gridLayoutWidget); ugvSpeakerButton->setObjectName(QString::fromUtf8("ugvSpeakerButton")); horizontalLayout_6->addWidget(ugvSpeakerButton); gridLayout->addLayout(horizontalLayout_6, 2, 2, 1, 1); verticalLayout = new QVBoxLayout(); verticalLayout->setSpacing(6); verticalLayout->setObjectName(QString::fromUtf8("verticalLayout")); label_4 = new QLabel(gridLayoutWidget); label_4->setObjectName(QString::fromUtf8("label_4")); label_4->setAlignment(Qt::AlignCenter); verticalLayout->addWidget(label_4); sauverStatus = new QTextBrowser(gridLayoutWidget); sauverStatus->setObjectName(QString::fromUtf8("sauverStatus")); sauverStatus->setEnabled(true); QSizePolicy sizePolicy2(QSizePolicy::Minimum, QSizePolicy::Minimum); sizePolicy2.setHorizontalStretch(0); sizePolicy2.setVerticalStretch(0); sizePolicy2.setHeightForWidth(sauverStatus->sizePolicy().hasHeightForWidth()); sauverStatus->setSizePolicy(sizePolicy2); sauverStatus->setMaximumSize(QSize(777215, 215)); verticalLayout->addWidget(sauverStatus); gridLayout->addLayout(verticalLayout, 4, 3, 1, 1); label_5 = new QLabel(gridLayoutWidget); label_5->setObjectName(QString::fromUtf8("label_5")); gridLayout->addWidget(label_5, 0, 0, 1, 1); Detection->setCentralWidget(centralWidget); menuBar = new QMenuBar(Detection); menuBar->setObjectName(QString::fromUtf8("menuBar")); menuBar->setGeometry(QRect(0, 0, 729, 23)); menuFile = new QMenu(menuBar); menuFile->setObjectName(QString::fromUtf8("menuFile")); menu_Tools = new QMenu(menuBar); menu_Tools->setObjectName(QString::fromUtf8("menu_Tools")); menu_Help = new QMenu(menuBar); menu_Help->setObjectName(QString::fromUtf8("menu_Help")); Detection->setMenuBar(menuBar); mainToolBar = new QToolBar(Detection); mainToolBar->setObjectName(QString::fromUtf8("mainToolBar")); Detection->addToolBar(Qt::TopToolBarArea, mainToolBar); statusBar = new QStatusBar(Detection); statusBar->setObjectName(QString::fromUtf8("statusBar")); Detection->setStatusBar(statusBar); menuBar->addAction(menuFile->menuAction()); menuBar->addAction(menu_Tools->menuAction()); menuBar->addAction(menu_Help->menuAction()); menuFile->addAction(action_Load_Map); menuFile->addAction(action_Disconnect); menuFile->addAction(actionE_xit); menu_Tools->addAction(action_Connect); retranslateUi(Detection); QObject::connect(actionE_xit, SIGNAL(activated()), Detection, SLOT(close())); QObject::connect(action_Connect, SIGNAL(activated()), connectionButton, SLOT(click())); QMetaObject::connectSlotsByName(Detection); } // setupUi
void setupUi(QMainWindow *MainWindow) { if (MainWindow->objectName().isEmpty()) MainWindow->setObjectName(QString::fromUtf8("MainWindow")); MainWindow->resize(999, 913); actionAbout = new QAction(MainWindow); actionAbout->setObjectName(QString::fromUtf8("actionAbout")); actionAtlas = new QAction(MainWindow); actionAtlas->setObjectName(QString::fromUtf8("actionAtlas")); actionMapping = new QAction(MainWindow); actionMapping->setObjectName(QString::fromUtf8("actionMapping")); actionLibrary = new QAction(MainWindow); actionLibrary->setObjectName(QString::fromUtf8("actionLibrary")); actionToolbox = new QAction(MainWindow); actionToolbox->setObjectName(QString::fromUtf8("actionToolbox")); centralwidget = new QWidget(MainWindow); centralwidget->setObjectName(QString::fromUtf8("centralwidget")); gridLayout = new QGridLayout(centralwidget); gridLayout->setObjectName(QString::fromUtf8("gridLayout")); mainSizer = new QGridLayout(); mainSizer->setObjectName(QString::fromUtf8("mainSizer")); mainSizer->setVerticalSpacing(14); mainSizer->setContentsMargins(0, -1, -1, -1); renderFrame = new QFrame(centralwidget); renderFrame->setObjectName(QString::fromUtf8("renderFrame")); renderFrame->setMinimumSize(QSize(800, 600)); renderFrame->setFrameShape(QFrame::Box); renderFrame->setFrameShadow(QFrame::Raised); mainSizer->addWidget(renderFrame, 0, 0, 1, 1); gridLayout->addLayout(mainSizer, 0, 0, 1, 1); MainWindow->setCentralWidget(centralwidget); menubar = new QMenuBar(MainWindow); menubar->setObjectName(QString::fromUtf8("menubar")); menubar->setGeometry(QRect(0, 0, 999, 21)); menuFile = new QMenu(menubar); menuFile->setObjectName(QString::fromUtf8("menuFile")); menuTools = new QMenu(menubar); menuTools->setObjectName(QString::fromUtf8("menuTools")); menuAbout = new QMenu(menubar); menuAbout->setObjectName(QString::fromUtf8("menuAbout")); menuWindows = new QMenu(menubar); menuWindows->setObjectName(QString::fromUtf8("menuWindows")); MainWindow->setMenuBar(menubar); statusbar = new QStatusBar(MainWindow); statusbar->setObjectName(QString::fromUtf8("statusbar")); MainWindow->setStatusBar(statusbar); menubar->addAction(menuFile->menuAction()); menubar->addAction(menuTools->menuAction()); menubar->addAction(menuWindows->menuAction()); menubar->addAction(menuAbout->menuAction()); menuTools->addAction(actionAtlas); menuTools->addAction(actionMapping); menuAbout->addAction(actionAbout); menuWindows->addAction(actionLibrary); menuWindows->addAction(actionToolbox); retranslateUi(MainWindow); QMetaObject::connectSlotsByName(MainWindow); } // setupUi