// // Create & fill toolbar // void App::initToolBar() { m_toolbar = new QToolBar(this, "Workspace"); QString dir; settings()->get(KEY_SYSTEM_DIR, dir); dir += QString("/") + PIXMAPPATH; m_newTB = new QToolButton(QPixmap(dir + QString("/filenew.xpm")), "New workspace", 0, this, SLOT(slotFileNew()), m_toolbar); m_openTB = new QToolButton(QPixmap(dir + QString("/fileopen.xpm")), "Open existing workspace", 0, this, SLOT(slotFileOpen()), m_toolbar); m_saveTB = new QToolButton(QPixmap(dir + QString("/filesave.xpm")), "Save current workspace", 0, this, SLOT(slotFileSave()), m_toolbar); m_toolbar->addSeparator(); m_dmTB = new QToolButton(QPixmap(dir + QString("/device.xpm")), "Device manager", 0, this, SLOT(slotViewDeviceManager()), m_toolbar); m_vcTB = new QToolButton(QPixmap(dir + QString("/virtualconsole.xpm")), "Virtual console", 0, this, SLOT(slotViewVirtualConsole()), m_toolbar); m_ftTB = new QToolButton(QPixmap(dir + QString("/chaser.png")), "Function manager", 0, this, SLOT(slotViewFunctionTree()), m_toolbar); m_toolbar->addSeparator(); m_panicTB = new QToolButton(QPixmap(dir + QString("/panic.xpm")), "Panic!", 0, this, SLOT(slotPanic()), m_toolbar); m_blackOutTB = new QToolButton(QPixmap(dir + QString("/blackout.xpm")), "Blackout", 0, this, SLOT(slotToggleBlackOut()), m_toolbar); m_modeTB = new QToolButton(QPixmap(dir + QString("/unlocked.xpm")), "Design Mode; All editing features enabled", 0, this, SLOT(slotSetMode()), m_toolbar); }
void VPiano::initToolBars() { m_dialStyle = new ClassicStyle(); // Notes tool bar ui.toolBarNotes->addWidget(new QLabel(tr(" Channel: "), this)); m_sboxChannel = new QSpinBox(this); m_sboxChannel->setMinimum(1); m_sboxChannel->setMaximum(16); m_sboxChannel->setValue(dlgPreferences.getOutChannel() + 1); ui.toolBarNotes->addWidget(m_sboxChannel); ui.toolBarNotes->addWidget(new QLabel(tr(" Base Octave: "), this)); m_sboxOctave = new QSpinBox(this); m_sboxOctave->setMinimum(0); m_sboxOctave->setMaximum(9); m_sboxOctave->setValue(dlgPreferences.getBaseOctave()); ui.toolBarNotes->addWidget(m_sboxOctave); ui.toolBarNotes->addWidget(new QLabel(tr(" Velocity: "), this)); m_Velocity = new Knob(this); m_Velocity->setFixedSize(32, 32); m_Velocity->setStyle(m_dialStyle); m_Velocity->setMinimum(0); m_Velocity->setMaximum(127); m_Velocity->setDefaultValue(100); m_Velocity->setDialMode(Knob::LinearMode); m_Velocity->setValue(dlgPreferences.getVelocity()); ui.toolBarNotes->addWidget(m_Velocity); connect( m_sboxChannel, SIGNAL(valueChanged(int)), this, SLOT(slotOutChannel(int)) ); connect( m_sboxOctave, SIGNAL(valueChanged(int)), this, SLOT(slotBaseOctave(int)) ); connect( m_Velocity, SIGNAL(valueChanged(int)), &dlgPreferences, SLOT(setVelocity(int)) ); // Controllers tool bar ui.toolBarControllers->addWidget(new QLabel(tr(" Control: "), this)); m_comboControl = new QComboBox(this); m_comboControl->setSizeAdjustPolicy(QComboBox::AdjustToContents); ui.toolBarControllers->addWidget(m_comboControl); ui.toolBarControllers->addWidget(new QLabel(tr(" Value: "), this)); m_Control= new Knob(this); m_Control->setFixedSize(32, 32); m_Control->setStyle(m_dialStyle); m_Control->setMinimum(0); m_Control->setMaximum(127); m_Control->setValue(0); m_Control->setDefaultValue(0); m_Control->setDialMode(Knob::LinearMode); ui.toolBarControllers->addWidget(m_Control); connect( m_comboControl, SIGNAL(currentIndexChanged(int)), SLOT(slotCtlChanged(int)) ); connect( m_Control, SIGNAL(valueChanged(int)), SLOT(slotController()) ); // Pitch bender tool bar ui.toolBarBender->addWidget(new QLabel(tr(" Bender: "), this)); m_bender = new QSlider(this); m_bender->setOrientation(Qt::Horizontal); m_bender->setMinimum(BENDER_MIN); m_bender->setMaximum(BENDER_MAX); m_bender->setValue(0); ui.toolBarBender->addWidget(m_bender); connect( m_bender, SIGNAL(valueChanged(int)), SLOT(slotBender()) ); // Programs tool bar ui.toolBarPrograms->addWidget(new QLabel(tr(" Bank: "), this)); m_comboBank = new QComboBox(this); m_comboBank->setSizeAdjustPolicy(QComboBox::AdjustToContents); ui.toolBarPrograms->addWidget(m_comboBank); ui.toolBarPrograms->addWidget(new QLabel(tr(" Program: "), this)); m_comboProg = new QComboBox(this); m_comboProg->setSizeAdjustPolicy(QComboBox::AdjustToContents); ui.toolBarPrograms->addWidget(m_comboProg); connect( m_comboBank, SIGNAL(currentIndexChanged(int)), SLOT(slotBankChanged(int)) ); connect( m_comboProg, SIGNAL(currentIndexChanged(int)), SLOT(slotProgChanged(int)) ); // Toolbars actions: toggle view connect(ui.toolBarNotes->toggleViewAction(), SIGNAL(toggled(bool)), ui.actionNotes, SLOT(setChecked(bool))); connect(ui.toolBarControllers->toggleViewAction(), SIGNAL(toggled(bool)), ui.actionControllers, SLOT(setChecked(bool))); connect(ui.toolBarBender->toggleViewAction(), SIGNAL(toggled(bool)), ui.actionBender, SLOT(setChecked(bool))); connect(ui.toolBarPrograms->toggleViewAction(), SIGNAL(toggled(bool)), ui.actionPrograms, SLOT(setChecked(bool))); // Toolbars actions: buttons connect(ui.actionPanic, SIGNAL(triggered()), SLOT(slotPanic())); connect(ui.actionResetAll, SIGNAL(triggered()), SLOT(slotResetAllControllers())); connect(ui.actionReset, SIGNAL(triggered()), SLOT(slotResetBender())); }
// // Menu bar // void App::initMenuBar() { QString dir; settings()->get(KEY_SYSTEM_DIR, dir); dir += QString("/") + PIXMAPPATH; /////////////////////////////////////////////////////////////////// // File Menu m_fileMenu = new QPopupMenu(); m_fileMenu->insertItem(QPixmap(dir + QString("/filenew.xpm")), "&New", this, SLOT(slotFileNew()), CTRL+Key_N, ID_FILE_NEW); m_fileMenu->insertItem(QPixmap(dir + QString("/fileopen.xpm")), "&Open...", this, SLOT(slotFileOpen()), CTRL+Key_O, ID_FILE_OPEN); m_fileMenu->insertSeparator(); m_fileMenu->insertItem(QPixmap(dir + QString("/filesave.xpm")), "&Save", this, SLOT(slotFileSave()), CTRL+Key_S, ID_FILE_SAVE); m_fileMenu->insertItem("Save &As...", this, SLOT(slotFileSaveAs()), 0, ID_FILE_SAVE_AS); m_fileMenu->insertSeparator(); m_fileMenu->insertItem(QPixmap(dir + QString("/settings.xpm")), "Se&ttings...", this, SLOT(slotFileSettings()), 0, ID_FILE_SETTINGS); m_fileMenu->insertSeparator(); m_fileMenu->insertItem(QPixmap(dir + QString("/exit.xpm")), "E&xit", this, SLOT(slotFileQuit()), CTRL+Key_Q, ID_FILE_QUIT); connect(m_fileMenu, SIGNAL(aboutToShow()), this, SLOT(slotRefreshMenus())); /////////////////////////////////////////////////////////////////// // Tools Menu m_toolsMenu = new QPopupMenu(); m_toolsMenu->setCheckable(true); m_toolsMenu->insertItem(QPixmap(dir + QString("/device.xpm")), "Device Manager", this, SLOT(slotViewDeviceManager()), CTRL + Key_M, ID_VIEW_DEVICE_MANAGER); m_toolsMenu->insertItem(QPixmap(dir + QString("/virtualconsole.xpm")), "Virtual Console", this, SLOT(slotViewVirtualConsole()), CTRL + Key_V, ID_VIEW_VIRTUAL_CONSOLE); m_toolsMenu->insertSeparator(); m_toolsMenu->insertItem(QPixmap(dir + QString("/chaser.png")), "Function Manager", this, SLOT(slotViewFunctionTree()), CTRL + Key_F, ID_VIEW_FUNCTION_TREE); m_toolsMenu->insertItem(QPixmap(dir + QString("/bus.xpm")), "Bus Properties", this, SLOT(slotViewBusProperties()), CTRL + Key_B, ID_VIEW_BUS_PROPERTIES); m_toolsMenu->insertSeparator(); m_toolsMenu->insertItem(QPixmap(dir + QString("/panic.xpm")), "Panic!", this, SLOT(slotPanic()), CTRL + Key_P, ID_FUNCTIONS_PANIC); connect(m_toolsMenu, SIGNAL(aboutToShow()), this, SLOT(slotRefreshMenus())); //////////////////////////////////////////////////////////////////// // Mode menu m_modeMenu = new QPopupMenu(); m_modeMenu->setCheckable(true); m_modeMenu->insertItem(QPixmap(dir + QString("/unlocked.xpm")), "Design", this, SLOT(slotSetDesignMode()), CTRL + Key_D, ID_FUNCTIONS_MODE_DESIGN); m_modeMenu->insertItem(QPixmap(dir + QString("/locked.xpm")), "Operate", this, SLOT(slotSetOperateMode()), CTRL + Key_R, ID_FUNCTIONS_MODE_OPERATE); connect(m_modeMenu, SIGNAL(aboutToShow()), this, SLOT(slotRefreshMenus())); /////////////////////////////////////////////////////////////////// // Window Menu m_windowMenu = new QPopupMenu(); connect(m_windowMenu, SIGNAL(aboutToShow()), this, SLOT(slotRefreshMenus())); connect(m_windowMenu, SIGNAL(activated(int)), this, SLOT(slotWindowMenuCallback(int))); /////////////////////////////////////////////////////////////////// // Help menu m_helpMenu = new QPopupMenu(); m_helpMenu->setCheckable(true); m_helpMenu->insertItem(QPixmap(dir + QString("/help.xpm")), "Index...", this, SLOT(slotHelpIndex()), SHIFT + Key_F1, ID_HELP_INDEX); m_helpMenu->insertSeparator(); m_helpMenu->insertItem(QPixmap(dir + QString("/Q.xpm")), "About...", this, SLOT(slotHelpAbout()), 0, ID_HELP_ABOUT); m_helpMenu->insertItem(QPixmap(dir + QString("/qt.xpm")), "About Qt...", this, SLOT(slotHelpAboutQt()), 0, ID_HELP_ABOUT_QT); m_helpMenu->insertSeparator(); m_helpMenu->insertItem(QPixmap(dir + QString("")), "Show Tooltips", this, SLOT(slotHelpTooltips()), 0, ID_HELP_TOOLTIPS); /////////////////////////////////////////////////////////////////// // Menubar configuration menuBar()->insertItem("&File", m_fileMenu); menuBar()->insertItem("&Tools", m_toolsMenu); m_toolsMenu->insertItem("&Mode", m_modeMenu); menuBar()->insertItem("&Window", m_windowMenu); menuBar()->insertSeparator(); menuBar()->insertItem("&Help", m_helpMenu); menuBar()->setSeparator(QMenuBar::InWindowsStyle); }
void VPiano::initToolBars() { QLabel *lbl; m_dialStyle = new ClassicStyle(); m_dialStyle->setParent(this); // Notes tool bar ui.toolBarNotes->addWidget(lbl = new QLabel(tr("Channel:"), this)); lbl->setMargin(TOOLBARLABELMARGIN); m_sboxChannel = new QSpinBox(this); m_sboxChannel->setMinimum(1); m_sboxChannel->setMaximum(MIDICHANNELS); m_sboxChannel->setValue(m_channel + 1); m_sboxChannel->setFocusPolicy(Qt::NoFocus); ui.toolBarNotes->addWidget(m_sboxChannel); ui.toolBarNotes->addWidget(lbl = new QLabel(tr("Base Octave:"), this)); lbl->setMargin(TOOLBARLABELMARGIN); m_sboxOctave = new QSpinBox(this); m_sboxOctave->setMinimum(0); m_sboxOctave->setMaximum(9); m_sboxOctave->setValue(m_baseOctave); m_sboxOctave->setFocusPolicy(Qt::NoFocus); ui.toolBarNotes->addWidget(m_sboxOctave); ui.toolBarNotes->addWidget(lbl = new QLabel(tr("Transpose:"), this)); lbl->setMargin(TOOLBARLABELMARGIN); m_sboxTranspose = new QSpinBox(this); m_sboxTranspose->setMinimum(-11); m_sboxTranspose->setMaximum(11); m_sboxTranspose->setValue(m_transpose); m_sboxTranspose->setFocusPolicy(Qt::NoFocus); ui.toolBarNotes->addWidget(m_sboxTranspose); ui.toolBarNotes->addWidget(lbl = new QLabel(tr("Velocity:"), this)); lbl->setMargin(TOOLBARLABELMARGIN); m_Velocity = new Knob(this); m_Velocity->setFixedSize(32, 32); m_Velocity->setStyle(dlgPreferences()->getStyledWidgets()? m_dialStyle : NULL); m_Velocity->setMinimum(0); m_Velocity->setMaximum(127); m_Velocity->setDefaultValue(100); m_Velocity->setDialMode(Knob::LinearMode); m_Velocity->setValue(m_velocity); m_Velocity->setToolTip(QString::number(m_velocity)); m_Velocity->setFocusPolicy(Qt::NoFocus); ui.toolBarNotes->addWidget(m_Velocity); connect( m_sboxChannel, SIGNAL(valueChanged(int)), this, SLOT(slotChannelChanged(int)) ); connect( m_sboxOctave, SIGNAL(valueChanged(int)), this, SLOT(slotBaseOctave(int)) ); connect( m_sboxTranspose, SIGNAL(valueChanged(int)), this, SLOT(slotTranspose(int)) ); connect( m_Velocity, SIGNAL(valueChanged(int)), this, SLOT(setVelocity(int)) ); // Controllers tool bar ui.toolBarControllers->addWidget(lbl = new QLabel(tr("Control:"), this)); lbl->setMargin(TOOLBARLABELMARGIN); m_comboControl = new QComboBox(this); m_comboControl->setSizeAdjustPolicy(QComboBox::AdjustToContents); m_comboControl->setFocusPolicy(Qt::NoFocus); ui.toolBarControllers->addWidget(m_comboControl); ui.toolBarControllers->addWidget(lbl = new QLabel(tr("Value:"), this)); lbl->setMargin(TOOLBARLABELMARGIN); m_Control= new Knob(this); m_Control->setFixedSize(32, 32); m_Control->setStyle(dlgPreferences()->getStyledWidgets()? m_dialStyle : NULL); m_Control->setMinimum(0); m_Control->setMaximum(127); m_Control->setValue(0); m_Control->setToolTip("0"); m_Control->setDefaultValue(0); m_Control->setDialMode(Knob::LinearMode); m_Control->setFocusPolicy(Qt::NoFocus); ui.toolBarControllers->addWidget(m_Control); connect( m_comboControl, SIGNAL(currentIndexChanged(int)), SLOT(slotCtlChanged(int)) ); connect( m_Control, SIGNAL(sliderMoved(int)), SLOT(slotController(int)) ); // Pitch bender tool bar ui.toolBarBender->addWidget(lbl = new QLabel(tr("Bender:"), this)); lbl->setMargin(TOOLBARLABELMARGIN); m_bender = new QSlider(this); m_bender->setOrientation(Qt::Horizontal); m_bender->setMaximumWidth(200); m_bender->setMinimum(BENDER_MIN); m_bender->setMaximum(BENDER_MAX); m_bender->setValue(0); m_bender->setToolTip("0"); m_bender->setFocusPolicy(Qt::NoFocus); ui.toolBarBender->addWidget(m_bender); connect( m_bender, SIGNAL(sliderMoved(int)), SLOT(slotBender(int)) ); connect( m_bender, SIGNAL(sliderReleased()), SLOT(slotBenderReleased()) ); // Programs tool bar ui.toolBarPrograms->addWidget(lbl = new QLabel(tr("Bank:"), this)); lbl->setMargin(TOOLBARLABELMARGIN); m_comboBank = new QComboBox(this); m_comboBank->setSizeAdjustPolicy(QComboBox::AdjustToContents); m_comboBank->setFocusPolicy(Qt::NoFocus); ui.toolBarPrograms->addWidget(m_comboBank); ui.toolBarPrograms->addWidget(lbl = new QLabel(tr("Program:"), this)); lbl->setMargin(TOOLBARLABELMARGIN); m_comboProg = new QComboBox(this); m_comboProg->setSizeAdjustPolicy(QComboBox::AdjustToContents); m_comboProg->setFocusPolicy(Qt::NoFocus); ui.toolBarPrograms->addWidget(m_comboProg); connect( m_comboBank, SIGNAL(currentIndexChanged(int)), SLOT(slotBankChanged(int)) ); connect( m_comboProg, SIGNAL(currentIndexChanged(int)), SLOT(slotProgChanged(int)) ); // Toolbars actions: toggle view connect(ui.toolBarNotes->toggleViewAction(), SIGNAL(toggled(bool)), ui.actionNotes, SLOT(setChecked(bool))); connect(ui.toolBarControllers->toggleViewAction(), SIGNAL(toggled(bool)), ui.actionControllers, SLOT(setChecked(bool))); connect(ui.toolBarBender->toggleViewAction(), SIGNAL(toggled(bool)), ui.actionBender, SLOT(setChecked(bool))); connect(ui.toolBarPrograms->toggleViewAction(), SIGNAL(toggled(bool)), ui.actionPrograms, SLOT(setChecked(bool))); connect(ui.toolBarExtra->toggleViewAction(), SIGNAL(toggled(bool)), ui.actionExtraControls, SLOT(setChecked(bool))); // Toolbars actions: buttons connect(ui.actionPanic, SIGNAL(triggered()), SLOT(slotPanic())); connect(ui.actionResetAll, SIGNAL(triggered()), SLOT(slotResetAllControllers())); connect(ui.actionReset, SIGNAL(triggered()), SLOT(slotResetBender())); connect(ui.actionEditExtra, SIGNAL(triggered()), SLOT(slotEditExtraControls())); //connect(ui.actionEditPrograms, SIGNAL(triggered()), SLOT(slotEditPrograms())); }
void App::initMenuBar() { QString dir; settings()->get(KEY_SYSTEM_DIR, dir); dir += QString("/") + PIXMAPPATH; /////////////////////////////////////////////////////////////////// // File Menu m_fileMenu = new QPopupMenu(); m_fileMenu->insertItem(QPixmap(dir + QString("/filenew.xpm")), "&New", this, SLOT(slotFileNew()), CTRL+Key_N, ID_FILE_NEW); m_fileMenu->insertItem(QPixmap(dir + QString("/fileopen.xpm")), "&Open...", this, SLOT(slotFileOpen()), CTRL+Key_O, ID_FILE_OPEN); m_fileMenu->insertSeparator(); m_fileMenu->insertItem(QPixmap(dir + QString("/filesave.xpm")), "&Save", this, SLOT(slotFileSave()), CTRL+Key_S, ID_FILE_SAVE); m_fileMenu->insertItem("Save &As...", this, SLOT(slotFileSaveAs()), 0, ID_FILE_SAVE_AS); m_fileMenu->insertSeparator(); m_fileMenu->insertItem(QPixmap(dir + QString("/info.xpm")), "Se&ttings...", this, SLOT(slotFileSettings()), 0, ID_FILE_SETTINGS); m_fileMenu->insertSeparator(); m_fileMenu->insertItem(QPixmap(dir + QString("/exit.xpm")), "E&xit", this, SLOT(slotFileQuit()), CTRL+Key_Q, ID_FILE_QUIT); /////////////////////////////////////////////////////////////////// // View Menu m_toolsMenu = new QPopupMenu(); m_toolsMenu->setCheckable(true); m_toolsMenu->insertItem(QPixmap(dir + QString("/device.xpm")), "Device Manager", this, SLOT(slotViewDeviceManager()), CTRL + Key_D, ID_VIEW_DEVICE_MANAGER); m_toolsMenu->insertItem(QPixmap(dir + QString("/virtualconsole.xpm")), "Virtual Console", this, SLOT(slotViewVirtualConsole()), CTRL + Key_G, ID_VIEW_VIRTUAL_CONSOLE); m_toolsMenu->insertSeparator(); m_toolsMenu->insertItem(QPixmap(dir + QString("/deviceclasseditor.xpm")), "Device Class Editor", this, SLOT(slotViewDeviceClassEditor()), CTRL + Key_E, ID_VIEW_DEVICE_CLASS_EDITOR); m_toolsMenu->insertItem(QPixmap(dir + QString("/function.xpm")), "Function Tree", this, SLOT(slotViewFunctionTree()), CTRL + Key_F, ID_VIEW_FUNCTION_TREE); m_toolsMenu->insertSeparator(); m_toolsMenu->insertItem(QPixmap(dir + QString("/panic.xpm")), "Panic!", this, SLOT(slotPanic()), CTRL + Key_C, ID_FUNCTIONS_PANIC); connect(m_toolsMenu, SIGNAL(aboutToShow()), this, SLOT(slotRefreshToolsMenu())); /////////////////////////////////////////////////////////////////// // Window Menu m_windowMenu = new QPopupMenu(); connect(m_windowMenu, SIGNAL(aboutToShow()), this, SLOT(slotRefreshWindowMenu())); /////////////////////////////////////////////////////////////////// // Help menu m_helpMenu = new QPopupMenu(); m_helpMenu->insertItem(QPixmap(dir + QString("/help.xpm")), "About...", this, SLOT(slotHelpAbout()), 0, ID_HELP_ABOUT); m_helpMenu->insertItem(QPixmap(dir + QString("/qt.xpm")), "About Qt...", this, SLOT(slotHelpAboutQt()), 0, ID_HELP_ABOUT_QT); /////////////////////////////////////////////////////////////////// // Menubar configuration menuBar()->insertItem("&File", m_fileMenu); menuBar()->insertItem("&Tools", m_toolsMenu); menuBar()->insertItem("&Window", m_windowMenu); menuBar()->insertSeparator(); menuBar()->insertItem("&Help", m_helpMenu); menuBar()->setSeparator(QMenuBar::InWindowsStyle); }
void App::initToolBar() { m_toolbar = new QToolBar(this, "Workspace"); QString dir; settings()->get(KEY_SYSTEM_DIR, dir); dir += QString("/") + PIXMAPPATH; new QToolButton(QPixmap(dir + QString("/filenew.xpm")), "New workspace; clear everything", 0, this, SLOT(slotFileNew()), m_toolbar); new QToolButton(QPixmap(dir + QString("/fileopen.xpm")), "Open existing workspace", 0, this, SLOT(slotFileOpen()), m_toolbar); new QToolButton(QPixmap(dir + QString("/filesave.xpm")), "Save current workspace", 0, this, SLOT(slotFileSave()), m_toolbar); m_toolbar->addSeparator(); new QToolButton(QPixmap(dir + QString("/device.xpm")), "View device manager", 0, this, SLOT(slotViewDeviceManager()), m_toolbar); new QToolButton(QPixmap(dir + QString("/virtualconsole.xpm")), "View virtual console", 0, this, SLOT(slotViewVirtualConsole()), m_toolbar); QToolBar* vc = new QToolBar(this, "Virtual Console toolbar"); new QToolButton(QPixmap(dir + QString("/panic.xpm")), "Panic; Shut down all running functions", 0, this, SLOT(slotPanic()), vc); m_modeButton = new QToolButton(QPixmap(dir + QString("/unlocked.xpm")), "Design Mode; All editing features enabled", 0, this, SLOT(slotModeButtonClicked()), vc); }