MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { QMenuBar *menuBar; QToolBar *mainToolBar; QWidget *centralWidget; QStatusBar *statusBar; if (this->objectName().isEmpty()) this->setObjectName(QString::fromUtf8("MainWindow")); this->resize(400, 300); menuBar = new QMenuBar(this); menuBar->setObjectName(QString::fromUtf8("menuBar")); this->setMenuBar(menuBar); mainToolBar = new QToolBar(this); mainToolBar->setObjectName(QString::fromUtf8("mainToolBar")); this->addToolBar(mainToolBar); centralWidget = new QWidget(this); centralWidget->setObjectName(QString::fromUtf8("centralWidget")); this->setCentralWidget(centralWidget); statusBar = new QStatusBar(this); statusBar->setObjectName(QString::fromUtf8("statusBar")); this->setStatusBar(statusBar); #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) this->setWindowTitle(QApplication::translate("MainWindow", "MainWindow", 0)); #else this->setWindowTitle(QApplication::translate("MainWindow", "MainWindow", 0, QApplication::UnicodeUTF8)); #endif QMetaObject::connectSlotsByName(this); }
MainWindow::MainWindow() { // // Source code view // m_textViewers = new QTabWidget(this); m_textViewers->setObjectName("Editors"); m_textViewers->setElideMode(Qt::ElideLeft); setCentralWidget(m_textViewers); setGeometry(QRect(0, 0, 800, 600)); m_fileOpenAction = new QAction("Open", this); m_quitAction = new QAction("Quit", this); // // Menubar // QMenu *fileMenu = new QMenu(menuBar()); fileMenu->setTitle(tr("File")); fileMenu->addAction(m_fileOpenAction); fileMenu->addSeparator(); fileMenu->addAction(m_quitAction); menuBar()->addMenu(fileMenu); // // Toolbar // QToolBar *toolbar = new QToolBar(this); toolbar->setObjectName("ToolBar"); toolbar->addAction(m_fileOpenAction); toolbar->addAction(m_quitAction); addToolBar(Qt::TopToolBarArea, toolbar); // // Statusbar // QStatusBar *statusbar = new QStatusBar(this); statusbar->setObjectName("StatusBar"); setStatusBar(statusbar); show(); restoreState(settings().value("MainWindow/State").toByteArray()); setGeometry(settings().value("MainWindow/Geometry").toRect()); // // Connections // connect(m_fileOpenAction, SIGNAL(triggered()), this, SLOT(fileOpen())); connect(m_quitAction, SIGNAL(triggered()), this, SLOT(close())); }
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
QAPEWindow::QAPEWindow() { resize(QSize(800, 500).expandedTo(minimumSizeHint())); actFileNew=new QAction(QIcon(":/images/filenew.png"), tr("&New"), this); actFileNew->setStatusTip(tr("Create new file")); actFileOpen=new QAction(QIcon(":/images/fileopen.png"), tr("&Open..."), this); actFileOpen->setShortcut(tr("Ctrl+O")); actFileOpen->setStatusTip(tr("Open an existing file")); actFileSave=new QAction(QIcon(":/images/filesave.png"), tr("&Save"), this); actFileSave->setShortcut(tr("Ctrl+S")); actFileSave->setStatusTip(tr("Save file")); actFileSaveAs=new QAction(QIcon(":/images/filesaveas.png"), tr("Save &as..."), this); actFileSaveAs->setStatusTip(tr("Save file with another name")); actFileGenerate=new QAction(QIcon(":/images/filegenerate.png"), tr("&Generate ~/.asoundrc directly"), this); actFileGenerate->setStatusTip(tr("Generate config file for ALSA from current file to ~/.asoundrc directly")); actFileGeneratePart=new QAction(QIcon(":/images/filegeneratepart.png"), tr("&Generate config..."), this); actFileGeneratePart->setStatusTip(tr("Generate config file for ALSA from current file")); actFileExit=new QAction(QIcon(":/images/fileexit.png"), tr("E&xit"), this); actFileExit->setStatusTip(tr("Close program")); actEditHW=new QAction(QIcon(":/images/hw.png"), tr("&HW output"), this); actEditHW->setStatusTip(tr("Add HW output block")); actEditInp=new QAction(QIcon(":/images/inp.png"), tr("DSP &input"), this); actEditInp->setStatusTip(tr("Add DSP input block")); actEditNull=new QAction(QIcon(":/images/null.png"), tr("Dummy &null output"), this); actEditNull->setStatusTip(tr("Add dummy null output block")); actEditFile=new QAction(QIcon(":/images/file.png"), tr("Write to &file"), this); actEditFile->setStatusTip(tr("Add block, that writes stream to file")); actEditRoute=new QAction(QIcon(":/images/route.png"), tr("&Route plugin"), this); actEditRoute->setStatusTip(tr("Add route block for routing and duplicating channels")); actEditRate=new QAction(QIcon(":/images/rate.png"), tr("R&ate plugin"), this); actEditRate->setStatusTip(tr("Add samplerate conversion block")); actEditDmix=new QAction(QIcon(":/images/dmix.png"), tr("D&mix pugin"), this); actEditDmix->setStatusTip(tr("Add dmix mixing and samplerate conversion block")); actEditLADSPA=new QAction(QIcon(":/images/ladspa.png"), tr("&LADSPA plugin thunk"), this); actEditLADSPA->setStatusTip(tr("Add some LADSPA effect block")); actEditMeter=new QAction(QIcon(":/images/meter.png"), tr("Me&ter plugin"), this); actEditMeter->setStatusTip(tr("Add volume meter plugin")); actEditLinear=new QAction(QIcon(":/images/linear.png"), tr("Li&near<->linear"), this); actEditLinear->setStatusTip(tr("Add linear<->linear format conversion block")); actEditFloat=new QAction(QIcon(":/images/float.png"), tr("Fl&oat<->linear"), this); actEditFloat->setStatusTip(tr("Add float<->linear format conversion block")); actEditIEC958=new QAction(QIcon(":/images/iec.png"), tr("IE&C-958<->linear"), this); actEditIEC958->setStatusTip(tr("Add IEC-958<->linear frames format conversion block")); actEditMuLaw=new QAction(QIcon(":/images/mulaw.png"), tr("M&u-Law<->linear"), this); actEditMuLaw->setStatusTip(tr("Add mu-Law<->linear format conversion block")); actEditALaw=new QAction(QIcon(":/images/alaw.png"), tr("A-La&w<->linear"), this); actEditALaw->setStatusTip(tr("Add A-Law<->linear format conversion block")); actEditImaADPCM=new QAction(QIcon(":/images/ima.png"), tr("IMA ADP&CM<->linear"), this); actEditImaADPCM->setStatusTip(tr("Add IMA ADPCM<->linear format conversion block")); actToolAllocate=new QAction(tr("&Scroll-in lost components"), this); actToolAllocate->setStatusTip(tr("Move lost components (accidentally moved beyond workspace) in your sight")); actHelpAbout=new QAction(tr("&About..."), this); actHelpAbout->setStatusTip(tr("About ALSA Plugin editor")); QToolBar *tbMain = new QToolBar(this); addToolBar(Qt::TopToolBarArea, tbMain); QToolBar *tbTools = new QToolBar(this); addToolBar(Qt::LeftToolBarArea, tbTools); QMenu *mFile,*mEdit,*mTools,*mHelp; mFile=menuBar()->addMenu(tr("&File")); mFile->addAction(actFileNew); mFile->addAction(actFileOpen); mFile->addAction(actFileSave); mFile->addAction(actFileSaveAs); mFile->addSeparator(); mFile->addAction(actFileExit); mEdit=menuBar()->addMenu(tr("&Edit")); mEdit->addAction(actEditHW); mEdit->addAction(actEditInp); mEdit->addAction(actEditNull); mEdit->addAction(actEditFile); mEdit->addSeparator()->setText(tr("Routing, mixing, effects")); mEdit->addAction(actEditRoute); mEdit->addAction(actEditRate); mEdit->addAction(actEditDmix); mEdit->addAction(actEditLADSPA); mEdit->addAction(actEditMeter); mEdit->addSeparator()->setText(tr("Format conversion")); mEdit->addAction(actEditLinear); mEdit->addAction(actEditFloat); mEdit->addAction(actEditIEC958); mEdit->addAction(actEditMuLaw); mEdit->addAction(actEditALaw); mEdit->addAction(actEditImaADPCM); mTools=menuBar()->addMenu(tr("&Tools")); mTools->addAction(actFileGenerate); mTools->addAction(actFileGeneratePart); mTools->addSeparator(); mTools->addAction(actToolAllocate); mHelp=menuBar()->addMenu(tr("&Help")); mHelp->addAction(actHelpAbout); tbMain->addAction(actFileNew); tbMain->addAction(actFileOpen); tbMain->addAction(actFileSave); tbMain->addSeparator(); tbMain->addAction(actFileGenerate); tbMain->addAction(actFileGeneratePart); tbMain->addSeparator(); tbMain->addAction(actFileExit); tbTools->addAction(actEditHW); tbTools->addAction(actEditInp); tbTools->addAction(actEditNull); tbTools->addAction(actEditFile); tbTools->addSeparator(); tbTools->addAction(actEditRoute); tbTools->addAction(actEditRate); tbTools->addAction(actEditDmix); tbTools->addAction(actEditLADSPA); tbTools->addAction(actEditMeter); tbTools->addSeparator(); tbTools->addAction(actEditLinear); tbTools->addAction(actEditFloat); tbTools->addAction(actEditIEC958); tbTools->addAction(actEditMuLaw); tbTools->addAction(actEditALaw); tbTools->addAction(actEditImaADPCM); QStatusBar* statusbar = new QStatusBar(this); statusbar->setObjectName("statusbar"); setStatusBar(statusbar); statusLabel=new QLabel(statusbar); statusbar->addWidget(statusLabel,100); scrollArea = new QScrollArea(this); scrollArea->setWidgetResizable(true); setCentralWidget(scrollArea); renderArea = new QRenderArea(scrollArea,scrollArea); scrollArea->setWidget(renderArea); programTitle=tr("ALSA Plugin Editor"); workFile=""; repaintTimer=0; deletedTimer=0; connect(actFileNew,SIGNAL(triggered()),this,SLOT(fileNew())); connect(actFileOpen,SIGNAL(triggered()),this,SLOT(fileOpen())); connect(actFileSave,SIGNAL(triggered()),this,SLOT(fileSave())); connect(actFileSaveAs,SIGNAL(triggered()),this,SLOT(fileSaveAs())); connect(actFileGenerate,SIGNAL(triggered()),this,SLOT(fileGenerate())); connect(actFileGeneratePart,SIGNAL(triggered()),this,SLOT(fileGeneratePart())); connect(actFileExit,SIGNAL(triggered()),this,SLOT(fileExit())); connect(actEditHW,SIGNAL(triggered()),this,SLOT(editHW())); connect(actEditInp,SIGNAL(triggered()),this,SLOT(editInp())); connect(actEditNull,SIGNAL(triggered()),this,SLOT(editNull())); connect(actEditFile,SIGNAL(triggered()),this,SLOT(editFile())); connect(actEditDmix,SIGNAL(triggered()),this,SLOT(editDmix())); connect(actEditRoute,SIGNAL(triggered()),this,SLOT(editRoute())); connect(actEditRate,SIGNAL(triggered()),this,SLOT(editRate())); connect(actEditLADSPA,SIGNAL(triggered()),this,SLOT(editLADSPA())); connect(actEditMeter,SIGNAL(triggered()),this,SLOT(editMeter())); connect(actEditLinear,SIGNAL(triggered()),this,SLOT(editLinear())); connect(actEditFloat,SIGNAL(triggered()),this,SLOT(editFloat())); connect(actEditIEC958,SIGNAL(triggered()),this,SLOT(editIEC958())); connect(actEditALaw,SIGNAL(triggered()),this,SLOT(editALaw())); connect(actEditMuLaw,SIGNAL(triggered()),this,SLOT(editMuLaw())); connect(actEditImaADPCM,SIGNAL(triggered()),this,SLOT(editImaADPCM())); connect(actToolAllocate,SIGNAL(triggered()),this,SLOT(toolAllocate())); connect(actHelpAbout,SIGNAL(triggered()),this,SLOT(helpAbout())); modified=false; updateStatus(); srand(clock()); }
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 *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