void MWMDIManagerImpl::addMDIWindow(MWMDIWindow* w) { bool contains = getWindowById(w->getId())!=NULL; if (contains) { assert(0); //must never happen return; } w->setParent(mdiArea); QMdiSubWindow* qw = mdiArea->addSubWindow(w); qw->setWindowTitle(w->windowTitle()); QIcon icon = w->windowIcon(); if (icon.isNull()) { icon = QIcon(":/ugene/images/ugene_16.png"); } qw->setWindowIcon(icon); //qw->setAttribute(Qt::WA_NativeWindow); MDIItem* i = new MDIItem(w, qw); items.append(i); qw->installEventFilter(this); uiLog.trace(QString("Adding window: '%1'").arg(w->windowTitle())); updateState(); emit si_windowAdded(w); if (items.count() == 1 && defaultIsMaximized) { qw->showMaximized(); } else { qw->show(); } qw->raise(); }
void MainWindow::CreateTableReport() { if (!SetActiveTable(tReport)) { QMdiSubWindow *sw = CreateTable(tReport, new TblReport(mdiArea)); sw->setWindowIcon(QIcon(":/Resource/Images/Report.ico")); } }
void MainWindow::CreateTableContract() { if (!SetActiveTable(tContract)) { QMdiSubWindow *sw = CreateTable(tContract, new TblContract(mdiArea)); sw->setWindowIcon(QIcon(":/Resource/Images/Contract.ico")); } }
void MainWindow::CreateTableDeveloper() { if (!SetActiveTable(tDeveloper)) { QMdiSubWindow *sw = CreateTable(tDeveloper, new TblDeveloper(mdiArea)); sw->setWindowIcon(QIcon(":/Resource/Images/Developer.ico")); } }
void MainWindow::CreateTableDistrProjDev() { if (!SetActiveTable(tDistrProjDev)) { QMdiSubWindow *sw = CreateTable(tDistrProjDev, new TblDistrProjDev(mdiArea)); sw->setWindowIcon(QIcon(":/Resource/Images/Distribution.ico")); } }
void MainWindow::CreateTableProblemDepend() { if (!SetActiveTable(tProblemDepend)) { QMdiSubWindow *sw = CreateTable(tProblemDepend, new TblProblemDepend(mdiArea)); sw->setWindowIcon(QIcon(":/Resource/Images/Depending.ico")); } }
void PropLov::setTabName(const QModelIndex &index) { QMdiSubWindow *subWindow = qobject_cast<QMdiSubWindow *> (this->parent()); QString lovName = modelData(DBLOVXML::LOV, DBLOVXML::NAME,index).toString(); QString id = this->dataId(index); this->setObjectName("PropLov::" + id); subWindow->setWindowIcon(qvariant_cast<QIcon>(index.data(Qt::DecorationRole))); subWindow->setWindowTitle(lovName); }
QMdiSubWindow *CustomMdiArea::addSubWindow(QWidget *widget, Qt::WindowFlags flags) { QMdiSubWindow *subwindow = QMdiArea::addSubWindow(widget, flags); QPixmap pix(16, 16); pix.fill(Qt::transparent); subwindow->setWindowIcon(QIcon(pix)); subwindow->setOption(QMdiSubWindow::RubberBandResize, true); subwindow->setOption(QMdiSubWindow::RubberBandMove, true); return subwindow; }
void App::slotFileNew() { QLCFixtureEditor* editor; QMdiSubWindow* sub; sub = new QMdiSubWindow(centralWidget()); editor = new QLCFixtureEditor(sub, new QLCFixtureDef()); sub->setWidget(editor); sub->setAttribute(Qt::WA_DeleteOnClose); sub->setWindowIcon(QIcon(":/fixture.png")); qobject_cast<QMdiArea*> (centralWidget())->addSubWindow(sub); editor->show(); sub->show(); }
PlotWithCurves* Group::insertPlot() { QMdiSubWindow* window = new QMdiSubWindow; { window->setMinimumSize(250, 150); window->setWindowIcon(QIcon(":/res/mainWindow/closeAllPlots.png")); window->setAttribute(Qt::WA_DeleteOnClose); } PlotWithCurves* plot = new PlotWithCurves(samplesManager, curvesManagerView, window); { plot->connect(plot, SIGNAL(destroyed()), this, SLOT(retitle())); window->setWidget(plot); addSubWindow(window); window->show(); retitle(); } return plot; }
//----------------------------------------------------------------------------------------- bool GenericTextEditor::displayText(QString docName, QString text, QString extension, QString optionalData) { // If there is no extra extension passed, then try to find the matching one based on the doc name ITextEditorCodecFactory* codecFactory; if(extension == "") codecFactory = GenericTextEditor::findMatchingCodecFactory(docName); else codecFactory = GenericTextEditor::findMatchingCodecFactory(extension); if(codecFactory == 0) return false; GenericTextEditorDocument* document = 0; if(!isDocAlreadyShowing(docName, document) || isAllowDoubleDisplay()) { document = new GenericTextEditorDocument(this); ITextEditorCodec* codec = codecFactory->create(document, docName); document->setCodec(codec); document->displayText(docName, text, optionalData); QMdiSubWindow *window = addSubWindow(document); window->setWindowIcon(QIcon(codec->getDocumentIcon())); document->showMaximized(); QTabBar* tabBar = findChildren<QTabBar*>().at(0); tabBar->setTabToolTip(findChildren<QMdiSubWindow*>().size() - 1, docName); } else { document->getCodec()->setOptionalData(optionalData); document->getCodec()->onDisplayRequest(); setActiveSubWindow(qobject_cast<QMdiSubWindow*>(document->window())); document->setFocus(Qt::ActiveWindowFocusReason); } moveToForeground(); connect(document, SIGNAL(textChanged()), document, SLOT(documentWasModified())); mActSave->setEnabled(false); return true; }
void MainWindow::addEditorWindow() { _editor = new QsciScintilla; _luaLexer = new QsciLexerLua; _editor->setLexer(_luaLexer); _luaLexer->setFont(QFont("Courier New")); // symbols _editor->setMarginType(1, QsciScintilla::SymbolMargin); _editor->setMarginWidth(1, "xx"); _editor->setMarginSensitivity (1, true); _editor->markerDefine(QsciScintilla::RightTriangle, BOOKMARK_MARKER); _editor->setMarkerBackgroundColor(QColor (0,0,232), BOOKMARK_MARKER); _editor->markerDefine(QsciScintilla::Circle, BREAKPOINT_MARKER); _editor->setMarkerBackgroundColor(QColor (192,0,0), BREAKPOINT_MARKER); _editor->markerDefine(QsciScintilla::RightTriangle, DEBUGGER_MARKER); _editor->setMarkerBackgroundColor(QColor (255,255,0), DEBUGGER_MARKER); // line numbers _editor->setMarginsForegroundColor(QColor (96, 96, 96)); _editor->setMarginsBackgroundColor(QColor (232, 232, 220)); _editor->setMarginType(2, QsciScintilla::TextMargin); _editor->setMarginWidth(2, "xxxx"); _editor->setMarginLineNumbers(2, true); // other features _editor->setBraceMatching(QsciScintilla::StrictBraceMatch); _editor->setAutoIndent(true); _editor->setIndentationWidth(2); _editor->setIndentationsUseTabs(false); _editor->setCaretLineVisible(true); _editor->setCaretLineBackgroundColor(QColor (248, 248, 248)); _editor->setUtf8(true); QMdiSubWindow *subWindow = ui->mdiArea->addSubWindow(_editor); subWindow->setWindowIcon(QIcon("://icons/text-x-generic-template.svg")); subWindow->showMaximized(); }
void ChatList::addChatWindow(ChatWindow* chatw) { connect(m_mainWindow, SIGNAL(closing()), chatw, SLOT(save())); int listSize = m_chatWindowList.size(); beginInsertRows(QModelIndex(), listSize, listSize); m_chatMenu.addAction(chatw->toggleViewAction()); connect(chatw, SIGNAL(ChatWindowHasChanged(ChatWindow *)), this, SLOT(changeChatWindow(ChatWindow *))); QMdiSubWindow* subWindowChat = static_cast<QMdiSubWindow*>(m_mainWindow->registerSubWindow(chatw,chatw->toggleViewAction())); connect(chatw->chat(), SIGNAL(changedName(QString)), subWindowChat, SLOT(setWindowTitle(QString))); m_chatWindowList.append(chatw); m_chatSubWindowList.append(subWindowChat); if((subWindowChat->height()<451)||(subWindowChat->width()<264)) { subWindowChat->resize(264,451); } if(NULL!=subWindowChat) { chatw->setSubWindow(subWindowChat); subWindowChat->setWindowTitle(tr("%1 (Chat)").arg(chatw->getTitleFromChat())); subWindowChat->setWindowIcon(QIcon(":/chat.png")); subWindowChat->setAttribute(Qt::WA_DeleteOnClose, false); chatw->setAttribute(Qt::WA_DeleteOnClose, false); subWindowChat->setVisible(chatw->toggleViewAction()->isChecked()); } endInsertRows(); }
//----------------------------------------------------------------------------------------- bool GenericTextEditor::displayTextFromFile(QString filePath, QString optionalData) { ITextEditorCodecFactory* codecFactory = GenericTextEditor::findMatchingCodecFactory(filePath); if(codecFactory == 0) return false; GenericTextEditorDocument* document = 0; if(!isPathAlreadyShowing(filePath, document) || isAllowDoubleDisplay()) { document = new GenericTextEditorDocument(this); ITextEditorCodec* codec = codecFactory->create(document, filePath); document->setCodec(codec); document->displayTextFromFile(QFile(filePath).fileName(), filePath, optionalData); QMdiSubWindow *window = addSubWindow(document); window->setWindowIcon(QIcon(codec->getDocumentIcon())); document->showMaximized(); QTabBar* tabBar = findChildren<QTabBar*>().at(0); tabBar->setTabToolTip(findChildren<QMdiSubWindow*>().size() - 1, QFile(filePath).fileName()); } else { document->getCodec()->setOptionalData(optionalData); document->getCodec()->onDisplayRequest(); setActiveSubWindow(qobject_cast<QMdiSubWindow*>(document->window())); document->setFocus(Qt::ActiveWindowFocusReason); } moveToForeground(); connect(document, SIGNAL(textChanged()), document, SLOT(documentWasModified())); mActSave->setEnabled(false); return true; }
void MainWindow::CreateWorkStatement() { QMdiSubWindow *sw = mdiArea->addSubWindow(new WorkStatement(mdiArea)); sw->show(); sw->setWindowIcon(QIcon(":/Resource/Images/WorkStatement.ico")); }
// #### ITW: InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) : QWidget(), ModelView( NULL, this ), m_track( _itv->model() ), m_itv( _itv ), m_instrumentView( NULL ) { setAcceptDrops( true ); // init own layout + widgets setFocusPolicy( Qt::StrongFocus ); QVBoxLayout * vlayout = new QVBoxLayout( this ); vlayout->setMargin( 0 ); vlayout->setSpacing( 0 ); tabWidget* generalSettingsWidget = new tabWidget( tr( "GENERAL SETTINGS" ), this ); QVBoxLayout* generalSettingsLayout = new QVBoxLayout( generalSettingsWidget ); generalSettingsLayout->setContentsMargins( 8, 18, 8, 8 ); generalSettingsLayout->setSpacing( 6 ); // setup line edit for changing instrument track name m_nameLineEdit = new QLineEdit; m_nameLineEdit->setFont( pointSize<9>( m_nameLineEdit->font() ) ); connect( m_nameLineEdit, SIGNAL( textChanged( const QString & ) ), this, SLOT( textChanged( const QString & ) ) ); generalSettingsLayout->addWidget( m_nameLineEdit ); QHBoxLayout* basicControlsLayout = new QHBoxLayout; basicControlsLayout->setSpacing( 3 ); // set up volume knob m_volumeKnob = new knob( knobBright_26, NULL, tr( "Instrument volume" ) ); m_volumeKnob->setVolumeKnob( true ); m_volumeKnob->setHintText( tr( "Volume:" ) + " ", "%" ); m_volumeKnob->setLabel( tr( "VOL" ) ); m_volumeKnob->setWhatsThis( tr( volume_help ) ); basicControlsLayout->addWidget( m_volumeKnob ); // set up panning knob m_panningKnob = new knob( knobBright_26, NULL, tr( "Panning" ) ); m_panningKnob->setHintText( tr( "Panning:" ) + " ", "" ); m_panningKnob->setLabel( tr( "PAN" ) ); basicControlsLayout->addWidget( m_panningKnob ); basicControlsLayout->addStretch(); // set up pitch knob m_pitchKnob = new knob( knobBright_26, NULL, tr( "Pitch" ) ); m_pitchKnob->setHintText( tr( "Pitch:" ) + " ", " " + tr( "cents" ) ); m_pitchKnob->setLabel( tr( "PITCH" ) ); basicControlsLayout->addWidget( m_pitchKnob ); // set up pitch range knob m_pitchRangeSpinBox= new LcdSpinBox( 2, NULL, tr( "Pitch range (semitones)" ) ); m_pitchRangeSpinBox->setLabel( tr( "RANGE" ) ); basicControlsLayout->addWidget( m_pitchRangeSpinBox ); basicControlsLayout->addStretch(); // setup spinbox for selecting FX-channel m_effectChannelNumber = new fxLineLcdSpinBox( 2, NULL, tr( "FX channel" ) ); m_effectChannelNumber->setLabel( tr( "FX" ) ); basicControlsLayout->addWidget( m_effectChannelNumber ); basicControlsLayout->addStretch(); QPushButton* saveSettingsBtn = new QPushButton( embed::getIconPixmap( "project_save" ), QString() ); saveSettingsBtn->setMinimumSize( 32, 32 ); connect( saveSettingsBtn, SIGNAL( clicked() ), this, SLOT( saveSettingsBtnClicked() ) ); toolTip::add( saveSettingsBtn, tr( "Save current channel settings in a preset-file" ) ); saveSettingsBtn->setWhatsThis( tr( "Click here, if you want to save current channel settings " "in a preset-file. Later you can load this preset by " "double-clicking it in the preset-browser." ) ); basicControlsLayout->addWidget( saveSettingsBtn ); generalSettingsLayout->addLayout( basicControlsLayout ); m_tabWidget = new tabWidget( "", this ); m_tabWidget->setFixedHeight( INSTRUMENT_HEIGHT + 10 ); // create tab-widgets m_ssView = new InstrumentSoundShapingView( m_tabWidget ); // FUNC tab QWidget* instrumentFunctions = new QWidget( m_tabWidget ); QVBoxLayout* instrumentFunctionsLayout = new QVBoxLayout( instrumentFunctions ); instrumentFunctionsLayout->setMargin( 5 ); m_noteStackingView = new InstrumentFunctionNoteStackingView( &m_track->m_noteStacking ); m_arpeggioView = new InstrumentFunctionArpeggioView( &m_track->m_arpeggio ); instrumentFunctionsLayout->addWidget( m_noteStackingView ); instrumentFunctionsLayout->addWidget( m_arpeggioView ); instrumentFunctionsLayout->addStretch(); // MIDI tab m_midiView = new InstrumentMidiIOView( m_tabWidget ); // FX tab m_effectView = new EffectRackView( m_track->m_audioPort.effects(), m_tabWidget ); m_tabWidget->addTab( m_ssView, tr( "ENV/LFO" ), 1 ); m_tabWidget->addTab( instrumentFunctions, tr( "FUNC" ), 2 ); m_tabWidget->addTab( m_effectView, tr( "FX" ), 3 ); m_tabWidget->addTab( m_midiView, tr( "MIDI" ), 4 ); // setup piano-widget m_pianoView = new PianoView( this ); m_pianoView->setFixedSize( INSTRUMENT_WIDTH, PIANO_HEIGHT ); vlayout->addWidget( generalSettingsWidget ); vlayout->addWidget( m_tabWidget ); vlayout->addWidget( m_pianoView ); setModel( _itv->model() ); updateInstrumentView(); setFixedWidth( INSTRUMENT_WIDTH ); resize( sizeHint() ); QMdiSubWindow * subWin = engine::mainWindow()->workspace()->addSubWindow( this ); Qt::WindowFlags flags = subWin->windowFlags(); flags |= Qt::MSWindowsFixedSizeDialogHint; flags &= ~Qt::WindowMaximizeButtonHint; subWin->setWindowFlags( flags ); subWin->setWindowIcon( embed::getIconPixmap( "instrument_track" ) ); subWin->setFixedSize( subWin->size() ); subWin->hide(); }
/*! * \param name Window name * \param type Window type (see constants.h for WT_*) * \param parent Parent ID (typically connection ID) * \param activate Activate window on creation * * Creates a new subwindow.\n * Specify Parent 0 if it's a custom (scriptable window).\n * DCC windows sets their parent to the IConnection that created it. It won't be a child of this IConnection though. * \return -1 if failed, otherwise Window ID */ int IdealIRC::CreateSubWindow(QString name, int type, int parent, bool activate) { if (WindowExists(name, parent) == true) return -1; qDebug() << "Creating new subwindow type " << type << " name " << name; IWin *s; if ((type >= WT_DCCSEND) && (type <= WT_DCCCHAT)) { IConnection *c = conlist.value(parent, NULL); s = new IWin(ui->mdiArea, name, type, &conf, &scriptParent, c); parent = 0; } else s = new IWin(ui->mdiArea, name, type, &conf, &scriptParent); IConnection *connection = conlist.value(parent, NULL); if (type == WT_STATUS) { qDebug() << "Window is status, new connection added with id " << s->getId(); connection = new IConnection(this, &chanlist, s->getId(), &conf, &scriptParent, &wsw); connection->setActiveInfo(&activeWname, &activeConn); connect(connection, SIGNAL(connectionClosed()), this, SLOT(connectionClosed())); connect(connection, SIGNAL(connectedToIRC()), this, SLOT(connectionEstablished())); connect(connection, SIGNAL(RequestTrayMsg(QString,QString)), this, SLOT(trayMessage(QString,QString))); } qDebug() << "Connection added, setting pointers"; s->setConnectionPtr(connection); if (connection != NULL) s->setSortRuleMap(connection->getSortRuleMapPtr()); qDebug() << "Pointers set, setting up mdiSubWindow"; QMdiSubWindow *previous = ui->mdiArea->currentSubWindow(); QMdiSubWindow *sw = ui->mdiArea->addSubWindow(s, Qt::SubWindow); qDebug() << "Pointer to subwindow: " << sw; qDebug() << "Icon..."; // Add icon to window QString ico = ":/window/gfx/custom.png"; // Default to this. if (type == WT_PRIVMSG) ico = ":/window/gfx/query.png"; if (type == WT_CHANNEL) ico = ":/window/gfx/channel.png"; if (type == WT_STATUS) ico = ":/window/gfx/status.png"; sw->setWindowIcon(QIcon(ico)); qDebug() << "Treeitem..."; QTreeWidgetItem *treeitem = GetWidgetItem(parent); if (treeitem == NULL) treeitem = new QTreeWidgetItem(ui->treeWidget); else treeitem = new QTreeWidgetItem(treeitem); treeitem->setIcon(0, QIcon(ico)); treeitem->setText(0, name); treeitem->setToolTip(0, name); qDebug() << "subwindow_t instance..."; subwindow_t wt; wt.connection = connection; wt.parent = parent; wt.subwin = sw; wt.treeitem = treeitem; wt.type = type; wt.wid = s->getId(); wt.widget = s; wt.highlight = HL_NONE; qDebug() << "Adding subwindow_t to winlist..."; winlist.insert(s->getId(), wt); wsw.addWindow(type, name, wt.wid, parent); sw->setGeometry(0, 0, 500, 400); if (type == WT_STATUS) { qDebug() << "Adding connection to the list..."; // The Connection class ID is the exact same ID as the status window ID. conlist.insert(s->getId(), connection); treeitem->setExpanded(true); connection->addWindow("STATUS", wt); connect(connection, SIGNAL(RequestWindow(QString,int,int,bool)), this, SLOT(CreateSubWindow(QString,int,int,bool))); connect(connection, SIGNAL(HighlightWindow(int,int)), this, SLOT(Highlight(int,int))); }
// #### ITW: InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) : QWidget(), ModelView( NULL, this ), m_track( _itv->model() ), m_itv( _itv ), m_instrumentView( NULL ) { setAcceptDrops( true ); // init own layout + widgets setFocusPolicy( Qt::StrongFocus ); QVBoxLayout * vlayout = new QVBoxLayout( this ); vlayout->setMargin( 0 ); vlayout->setSpacing( 0 ); TabWidget* generalSettingsWidget = new TabWidget( tr( "GENERAL SETTINGS" ), this ); QVBoxLayout* generalSettingsLayout = new QVBoxLayout( generalSettingsWidget ); generalSettingsLayout->setContentsMargins( 8, 18, 8, 8 ); generalSettingsLayout->setSpacing( 6 ); QWidget* nameAndChangeTrackWidget = new QWidget( generalSettingsWidget ); QHBoxLayout* nameAndChangeTrackLayout = new QHBoxLayout( nameAndChangeTrackWidget ); nameAndChangeTrackLayout->setContentsMargins( 0, 0, 0, 0 ); nameAndChangeTrackLayout->setSpacing( 2 ); // setup line edit for changing instrument track name m_nameLineEdit = new QLineEdit; m_nameLineEdit->setFont( pointSize<9>( m_nameLineEdit->font() ) ); connect( m_nameLineEdit, SIGNAL( textChanged( const QString & ) ), this, SLOT( textChanged( const QString & ) ) ); m_nameLineEdit->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred)); nameAndChangeTrackLayout->addWidget(m_nameLineEdit); // set up left/right arrows for changing instrument m_leftRightNav = new LeftRightNav(this); connect( m_leftRightNav, SIGNAL( onNavLeft() ), this, SLOT( viewPrevInstrument() ) ); connect( m_leftRightNav, SIGNAL( onNavRight() ), this, SLOT( viewNextInstrument() ) ); m_leftRightNav->setWhatsThis( tr( "Use these controls to view and edit the next/previous track in the song editor." ) ); // m_leftRightNav->setShortcuts(); nameAndChangeTrackLayout->addWidget(m_leftRightNav); generalSettingsLayout->addWidget( nameAndChangeTrackWidget ); QGridLayout* basicControlsLayout = new QGridLayout; basicControlsLayout->setHorizontalSpacing(3); basicControlsLayout->setVerticalSpacing(0); basicControlsLayout->setContentsMargins(0, 0, 0, 0); QString labelStyleSheet = "font-size: 6pt;"; Qt::Alignment labelAlignment = Qt::AlignHCenter | Qt::AlignTop; Qt::Alignment widgetAlignment = Qt::AlignHCenter | Qt::AlignCenter; // set up volume knob m_volumeKnob = new Knob( knobBright_26, NULL, tr( "Instrument volume" ) ); m_volumeKnob->setVolumeKnob( true ); m_volumeKnob->setHintText( tr( "Volume:" ), "%" ); m_volumeKnob->setWhatsThis( tr( volume_help ) ); basicControlsLayout->addWidget( m_volumeKnob, 0, 0 ); basicControlsLayout->setAlignment( m_volumeKnob, widgetAlignment ); QLabel *label = new QLabel( tr( "VOL" ), this ); label->setStyleSheet( labelStyleSheet ); basicControlsLayout->addWidget( label, 1, 0); basicControlsLayout->setAlignment( label, labelAlignment ); // set up panning knob m_panningKnob = new Knob( knobBright_26, NULL, tr( "Panning" ) ); m_panningKnob->setHintText( tr( "Panning:" ), "" ); basicControlsLayout->addWidget( m_panningKnob, 0, 1 ); basicControlsLayout->setAlignment( m_panningKnob, widgetAlignment ); label = new QLabel( tr( "PAN" ), this ); label->setStyleSheet( labelStyleSheet ); basicControlsLayout->addWidget( label, 1, 1); basicControlsLayout->setAlignment( label, labelAlignment ); basicControlsLayout->setColumnStretch(2, 1); // set up pitch knob m_pitchKnob = new Knob( knobBright_26, NULL, tr( "Pitch" ) ); m_pitchKnob->setHintText( tr( "Pitch:" ), " " + tr( "cents" ) ); basicControlsLayout->addWidget( m_pitchKnob, 0, 3 ); basicControlsLayout->setAlignment( m_pitchKnob, widgetAlignment ); m_pitchLabel = new QLabel( tr( "PITCH" ), this ); m_pitchLabel->setStyleSheet( labelStyleSheet ); basicControlsLayout->addWidget( m_pitchLabel, 1, 3); basicControlsLayout->setAlignment( m_pitchLabel, labelAlignment ); // set up pitch range knob m_pitchRangeSpinBox= new LcdSpinBox( 2, NULL, tr( "Pitch range (semitones)" ) ); basicControlsLayout->addWidget( m_pitchRangeSpinBox, 0, 4 ); basicControlsLayout->setAlignment( m_pitchRangeSpinBox, widgetAlignment ); m_pitchRangeLabel = new QLabel( tr( "RANGE" ), this ); m_pitchRangeLabel->setStyleSheet( labelStyleSheet ); basicControlsLayout->addWidget( m_pitchRangeLabel, 1, 4); basicControlsLayout->setAlignment( m_pitchRangeLabel, labelAlignment ); basicControlsLayout->setColumnStretch(5, 1); // setup spinbox for selecting FX-channel m_effectChannelNumber = new fxLineLcdSpinBox( 2, NULL, tr( "FX channel" ) ); basicControlsLayout->addWidget( m_effectChannelNumber, 0, 6 ); basicControlsLayout->setAlignment( m_effectChannelNumber, widgetAlignment ); label = new QLabel( tr( "FX" ), this ); label->setStyleSheet( labelStyleSheet ); basicControlsLayout->addWidget( label, 1, 6); basicControlsLayout->setAlignment( label, labelAlignment ); QPushButton* saveSettingsBtn = new QPushButton( embed::getIconPixmap( "project_save" ), QString() ); saveSettingsBtn->setMinimumSize( 32, 32 ); connect( saveSettingsBtn, SIGNAL( clicked() ), this, SLOT( saveSettingsBtnClicked() ) ); ToolTip::add( saveSettingsBtn, tr( "Save current instrument track settings in a preset file" ) ); saveSettingsBtn->setWhatsThis( tr( "Click here, if you want to save current instrument track settings in a preset file. " "Later you can load this preset by double-clicking it in the preset-browser." ) ); basicControlsLayout->addWidget( saveSettingsBtn, 0, 7 ); label = new QLabel( tr( "SAVE" ), this ); label->setStyleSheet( labelStyleSheet ); basicControlsLayout->addWidget( label, 1, 7); basicControlsLayout->setAlignment( label, labelAlignment ); generalSettingsLayout->addLayout( basicControlsLayout ); m_tabWidget = new TabWidget( "", this ); m_tabWidget->setFixedHeight( INSTRUMENT_HEIGHT + 10 ); // create tab-widgets m_ssView = new InstrumentSoundShapingView( m_tabWidget ); // FUNC tab QWidget* instrumentFunctions = new QWidget( m_tabWidget ); QVBoxLayout* instrumentFunctionsLayout = new QVBoxLayout( instrumentFunctions ); instrumentFunctionsLayout->setMargin( 5 ); m_noteStackingView = new InstrumentFunctionNoteStackingView( &m_track->m_noteStacking ); m_arpeggioView = new InstrumentFunctionArpeggioView( &m_track->m_arpeggio ); instrumentFunctionsLayout->addWidget( m_noteStackingView ); instrumentFunctionsLayout->addWidget( m_arpeggioView ); instrumentFunctionsLayout->addStretch(); // MIDI tab m_midiView = new InstrumentMidiIOView( m_tabWidget ); // FX tab m_effectView = new EffectRackView( m_track->m_audioPort.effects(), m_tabWidget ); // MISC tab m_miscView = new InstrumentMiscView( m_track, m_tabWidget ); m_tabWidget->addTab( m_ssView, tr( "ENV/LFO" ), 1 ); m_tabWidget->addTab( instrumentFunctions, tr( "FUNC" ), 2 ); m_tabWidget->addTab( m_effectView, tr( "FX" ), 3 ); m_tabWidget->addTab( m_midiView, tr( "MIDI" ), 4 ); m_tabWidget->addTab( m_miscView, tr( "MISC" ), 5 ); // setup piano-widget m_pianoView = new PianoView( this ); m_pianoView->setFixedSize( INSTRUMENT_WIDTH, PIANO_HEIGHT ); vlayout->addWidget( generalSettingsWidget ); vlayout->addWidget( m_tabWidget ); vlayout->addWidget( m_pianoView ); setModel( _itv->model() ); updateInstrumentView(); setFixedWidth( INSTRUMENT_WIDTH ); resize( sizeHint() ); QMdiSubWindow * subWin = gui->mainWindow()->addWindowedWidget( this ); Qt::WindowFlags flags = subWin->windowFlags(); flags |= Qt::MSWindowsFixedSizeDialogHint; flags &= ~Qt::WindowMaximizeButtonHint; subWin->setWindowFlags( flags ); // Hide the Size and Maximize options from the system menu // since the dialog size is fixed. QMenu * systemMenu = subWin->systemMenu(); systemMenu->actions().at( 2 )->setVisible( false ); // Size systemMenu->actions().at( 4 )->setVisible( false ); // Maximize subWin->setWindowIcon( embed::getIconPixmap( "instrument_track" ) ); subWin->setFixedSize( subWin->size() ); subWin->hide(); }
PerformanceMeasurement::Panel::Panel(QWidget *parent) : QWidget(parent), Workspace::Instance("Performance Measurement", vars, num_vars), state(INIT1), duration(0), lastRead(0), timestep(0), maxDuration(0), maxTimestep(0), jitter(0) { QWidget::setAttribute(Qt::WA_DeleteOnClose); // Make Mdi QMdiSubWindow *subWindow = new QMdiSubWindow; subWindow->setWindowIcon(QIcon("/usr/local/lib/rtxi/RTXI-widget-icon.png")); subWindow->setAttribute(Qt::WA_DeleteOnClose); subWindow->setFixedSize(310,200); MainWindow::getInstance()->createMdi(subWindow); // Create main layout QVBoxLayout *layout = new QVBoxLayout; QString suffix = QString("s)").prepend(QChar(0x3BC)); // Create child widget and gridLayout QGridLayout *gridLayout = new QGridLayout; durationEdit = new QLineEdit(subWindow); durationEdit->setReadOnly(true); gridLayout->addWidget(new QLabel(tr("Computation Time (").append(suffix)), 1, 0); gridLayout->addWidget(durationEdit, 1, 1); maxDurationEdit = new QLineEdit(subWindow); maxDurationEdit->setReadOnly(true); gridLayout->addWidget(new QLabel(tr("Peak Computation Time (").append(suffix)), 2, 0); gridLayout->addWidget(maxDurationEdit, 2, 1); timestepEdit = new QLineEdit(subWindow); timestepEdit->setReadOnly(true); gridLayout->addWidget(new QLabel(tr("Real-time Period (").append(suffix)), 3, 0); gridLayout->addWidget(timestepEdit, 3, 1); maxTimestepEdit = new QLineEdit(subWindow); maxTimestepEdit->setReadOnly(true); gridLayout->addWidget(new QLabel(tr("Peak Real-time Period (").append(suffix)), 4, 0); gridLayout->addWidget(maxTimestepEdit, 4, 1); timestepJitterEdit = new QLineEdit(subWindow); timestepJitterEdit->setReadOnly(true); gridLayout->addWidget(new QLabel(tr("Real-time Jitter (").append(suffix)), 5, 0); gridLayout->addWidget(timestepJitterEdit, 5, 1); QPushButton *resetButton = new QPushButton("Reset", this); gridLayout->addWidget(resetButton, 6, 1); QObject::connect(resetButton,SIGNAL(released(void)),this,SLOT(reset(void))); // Attach child widget to parent widget layout->addLayout(gridLayout); // Attach gridLayout to Widget setLayout(layout); setWindowTitle(QString::number(getID()) + tr(" RT Benchmarks")); // Set layout to Mdi subWindow->setWidget(this); show(); QTimer *timer = new QTimer(this); timer->start(1000); QObject::connect(timer,SIGNAL(timeout(void)),this,SLOT(update(void))); resetMaxTimer = new QTimer(this); QObject::connect(resetMaxTimer,SIGNAL(timeout(void)),this,SLOT(resetMaxTimeStep(void))); // Connect states to workspace setData(Workspace::STATE, 0, &duration); setData(Workspace::STATE, 1, &maxDuration); setData(Workspace::STATE, 2, ×tep); setData(Workspace::STATE, 3, &maxTimestep); setData(Workspace::STATE, 4, &jitter); setActive(true); saveStats = false; }
/* Build Module GUI */ void IScale_DynClamp::Module::createGUI( void ) { QMdiSubWindow *subWindow = new QMdiSubWindow; subWindow->setAttribute(Qt::WA_DeleteOnClose); subWindow->setWindowIcon(QIcon("/usr/local/lib/rtxi/RTXI-widget-icon.png")); subWindow->setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowCloseButtonHint | Qt::WindowMinimizeButtonHint ); MainWindow::getInstance()->createMdi(subWindow); subWindow->setWidget(this); mainWindow = new IScale_DynClampUI(subWindow); // Construct Main Layout - vertical layout QVBoxLayout *layout = new QVBoxLayout(this); setLayout(layout); layout->addWidget(mainWindow); // Model Combo Box mainWindow->modelComboBox->addItem("LivRudy 2009"); mainWindow->modelComboBox->addItem("FaberRudy 2000"); // Set GUI refresh rate QTimer *timer = new QTimer(this); timer->start(500); // Set validators mainWindow->APDRepolEdit->setValidator( new QIntValidator(mainWindow->APDRepolEdit) ); mainWindow->minAPDEdit->setValidator( new QIntValidator(mainWindow->minAPDEdit) ); mainWindow->stimWindowEdit->setValidator( new QIntValidator(mainWindow->stimWindowEdit) ); mainWindow->numTrialEdit->setValidator( new QIntValidator(mainWindow->numTrialEdit) ); mainWindow->intervalTimeEdit->setValidator( new QIntValidator(mainWindow->intervalTimeEdit) ); mainWindow->BCLEdit->setValidator( new QDoubleValidator(mainWindow->BCLEdit) ); mainWindow->stimMagEdit->setValidator( new QDoubleValidator(mainWindow->stimMagEdit) ); mainWindow->stimLengthEdit->setValidator( new QDoubleValidator(mainWindow->stimLengthEdit) ); mainWindow->CmEdit->setValidator( new QDoubleValidator(mainWindow->CmEdit) ); mainWindow->LJPEdit->setValidator( new QDoubleValidator(mainWindow->CmEdit) ); // Connect MainWindow elements to slot functions QObject::connect( mainWindow->addStepButton, SIGNAL(clicked(void)), this, SLOT( addStep(void)) ); QObject::connect( mainWindow->deleteStepButton, SIGNAL(clicked(void)), this, SLOT( deleteStep(void)) ); QObject::connect( mainWindow->saveProtocolButton, SIGNAL(clicked(void)), this, SLOT( saveProtocol(void)) ); QObject::connect( mainWindow->loadProtocolButton, SIGNAL(clicked(void)), this, SLOT( loadProtocol(void)) ); QObject::connect( mainWindow->clearProtocolButton, SIGNAL(clicked(void)), this, SLOT( clearProtocol(void)) ); QObject::connect( mainWindow->recordDataCheckBox, SIGNAL(clicked(void)), this, SLOT( modify(void)) ); QObject::connect( mainWindow->startProtocolButton, SIGNAL(toggled(bool)), this, SLOT( toggleProtocol(void)) ); QObject::connect( mainWindow->thresholdButton, SIGNAL(clicked(void)), this, SLOT( toggleThreshold(void)) ); QObject::connect( mainWindow->staticPacingButton, SIGNAL(clicked(void)), this, SLOT( togglePace(void)) ); QObject::connect( mainWindow->resetButton, SIGNAL(clicked(void)), this, SLOT( reset(void)) ); QObject::connect( mainWindow->modelComboBox, SIGNAL(activated(int)), this, SLOT( changeModel(int)) ); QObject::connect( mainWindow->APDRepolEdit, SIGNAL(returnPressed(void)), this, SLOT( modify(void)) ); QObject::connect( mainWindow->minAPDEdit, SIGNAL(returnPressed(void)), this, SLOT( modify(void)) ); QObject::connect( mainWindow->stimWindowEdit, SIGNAL(returnPressed(void)), this, SLOT( modify(void)) ); QObject::connect( mainWindow->numTrialEdit, SIGNAL(returnPressed(void)), this, SLOT( modify(void)) ); QObject::connect( mainWindow->intervalTimeEdit, SIGNAL(returnPressed(void)), this, SLOT( modify(void)) ); QObject::connect( mainWindow->BCLEdit, SIGNAL(returnPressed(void)), this, SLOT( modify(void)) ); QObject::connect( mainWindow->stimMagEdit, SIGNAL(returnPressed(void)), this, SLOT( modify(void)) ); QObject::connect( mainWindow->stimLengthEdit, SIGNAL(returnPressed(void)), this, SLOT( modify(void)) ); QObject::connect( mainWindow->CmEdit, SIGNAL(returnPressed(void)), this, SLOT( modify(void)) ); QObject::connect( mainWindow->LJPEdit, SIGNAL(returnPressed(void)), this, SLOT( modify(void)) ); QObject::connect(timer, SIGNAL(timeout(void)), this, SLOT(refreshDisplay(void))); // Connections to allow only one button being toggled at a time QObject::connect( mainWindow->thresholdButton, SIGNAL(toggled(bool)), mainWindow->staticPacingButton, SLOT( setDisabled(bool)) ); QObject::connect( mainWindow->thresholdButton, SIGNAL(toggled(bool)), mainWindow->startProtocolButton, SLOT( setDisabled(bool)) ); QObject::connect( mainWindow->startProtocolButton, SIGNAL(toggled(bool)), mainWindow->staticPacingButton, SLOT( setDisabled(bool)) ); QObject::connect( mainWindow->startProtocolButton, SIGNAL(toggled(bool)), mainWindow->thresholdButton, SLOT( setDisabled(bool)) ); QObject::connect( mainWindow->staticPacingButton, SIGNAL(toggled(bool)), mainWindow->thresholdButton, SLOT( setDisabled(bool)) ); QObject::connect( mainWindow->staticPacingButton, SIGNAL(toggled(bool)), mainWindow->startProtocolButton, SLOT( setDisabled(bool)) ); // Connect states to workspace setData( Workspace::STATE, 0, &time ); setData( Workspace::STATE, 1, &voltage ); setData( Workspace::STATE, 2, &beatNum ); setData( Workspace::STATE, 3, &APD ); setData( Workspace::STATE, 4, &targetCurrent ); setData( Workspace::STATE, 5, &scaledCurrent ); subWindow->show(); subWindow->adjustSize(); } // End createGUI()
void MainWindow::CreateGanttChart() { QMdiSubWindow *sw = mdiArea->addSubWindow(new GanttChart(mdiArea)); sw->show(); sw->setWindowIcon(QIcon(":/Resource/Images/GanttChart.png")); }
// #### ITW: InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) : QWidget(), ModelView( NULL, this ), m_track( _itv->model() ), m_itv( _itv ), m_instrumentView( NULL ) { setAcceptDrops( true ); // init own layout + widgets setFocusPolicy( Qt::StrongFocus ); QVBoxLayout * vlayout = new QVBoxLayout( this ); vlayout->setMargin( 0 ); vlayout->setSpacing( 0 ); m_generalSettingsWidget = new tabWidget( tr( "GENERAL SETTINGS" ), this ); m_generalSettingsWidget->setFixedHeight( 90 ); // setup line-edit for changing channel-name m_nameLineEdit = new QLineEdit( m_generalSettingsWidget ); m_nameLineEdit->setFont( pointSize<8>( m_nameLineEdit->font() ) ); m_nameLineEdit->setGeometry( 10, 16, 196, 20 ); connect( m_nameLineEdit, SIGNAL( textChanged( const QString & ) ), this, SLOT( textChanged( const QString & ) ) ); m_saveSettingsBtn = new QPushButton( embed::getIconPixmap( "project_save" ), "", m_generalSettingsWidget ); m_saveSettingsBtn->setGeometry( 216, 14, 24, 24 ); connect( m_saveSettingsBtn, SIGNAL( clicked() ), this, SLOT( saveSettingsBtnClicked() ) ); toolTip::add( m_saveSettingsBtn, tr( "Save instrument track settings in a preset file" ) ); m_saveSettingsBtn->setWhatsThis( tr( "Click here, if you want to save current channel settings " "in a preset-file. Later you can load this preset by " "double-clicking it in the preset-browser." ) ); // setup volume-knob m_volumeKnob = new knob( knobBright_26, m_generalSettingsWidget, tr( "Instrument volume" ) ); m_volumeKnob->setVolumeKnob( true ); m_volumeKnob->move( 8, 46 ); m_volumeKnob->setHintText( tr( "Volume:" ) + " ", "%" ); m_volumeKnob->setLabel( tr( "VOL" ) ); m_volumeKnob->setWhatsThis( tr( volume_help ) ); // setup panning-knob m_panningKnob = new knob( knobBright_26, m_generalSettingsWidget, tr( "Panning" ) ); m_panningKnob->move( m_volumeKnob->x() + m_volumeKnob->width() + 12, 46 ); m_panningKnob->setHintText( tr( "Panning:" ) + " ", "" ); m_panningKnob->setLabel( tr( "PAN" ) ); m_pitchKnob = new knob( knobBright_26, m_generalSettingsWidget, tr( "Pitch" ) ); m_pitchKnob->move( m_panningKnob->x() + m_panningKnob->width() + 24, 46 ); m_pitchKnob->setHintText( tr( "Pitch:" ) + " ", " " + tr( "cents" ) ); m_pitchKnob->setLabel( tr( "PITCH" ) ); m_pitchRange = new lcdSpinBox( 2, m_generalSettingsWidget, tr( "Pitch range (semitones)" ) ); m_pitchRange->setLabel( tr( "RANGE" ) ); m_pitchRange->move( m_pitchKnob->x() + m_pitchKnob->width() + 8, 46 ); // setup spinbox for selecting FX-channel m_effectChannelNumber = new fxLineLcdSpinBox( 2, m_generalSettingsWidget, tr( "FX channel" ) ); m_effectChannelNumber->setLabel( tr( "FX CHNL" ) ); m_effectChannelNumber->move( m_pitchRange->x() + m_pitchRange->width() + 24, 46 ); m_tabWidget = new tabWidget( "", this ); m_tabWidget->setFixedHeight( INSTRUMENT_HEIGHT + 10 ); // create tab-widgets m_ssView = new InstrumentSoundShapingView( m_tabWidget ); QWidget * instrument_functions = new QWidget( m_tabWidget ); m_chordView = new ChordCreatorView( &m_track->m_chordCreator, instrument_functions ); m_arpView= new ArpeggiatorView( &m_track->m_arpeggiator, instrument_functions ); m_midiView = new InstrumentMidiIOView( m_tabWidget ); m_effectView = new EffectRackView( m_track->m_audioPort.effects(), m_tabWidget ); m_tabWidget->addTab( m_ssView, tr( "ENV/LFO" ), 1 ); m_tabWidget->addTab( instrument_functions, tr( "FUNC" ), 2 ); m_tabWidget->addTab( m_effectView, tr( "FX" ), 3 ); m_tabWidget->addTab( m_midiView, tr( "MIDI" ), 4 ); // setup piano-widget m_pianoView = new PianoView( this ); vlayout->addWidget( m_generalSettingsWidget ); vlayout->addWidget( m_tabWidget ); vlayout->addWidget( m_pianoView ); setModel( _itv->model() ); updateInstrumentView(); setFixedWidth( INSTRUMENT_WIDTH ); resize( sizeHint() ); QMdiSubWindow * subWin = engine::mainWindow()->workspace()->addSubWindow( this ); Qt::WindowFlags flags = subWin->windowFlags(); flags |= Qt::MSWindowsFixedSizeDialogHint; flags &= ~Qt::WindowMaximizeButtonHint; subWin->setWindowFlags( flags ); subWin->setWindowIcon( embed::getIconPixmap( "instrument_track" ) ); subWin->setFixedSize( subWin->size() ); subWin->hide(); }
SampleTrackWindow::SampleTrackWindow(SampleTrackView * tv) : QWidget(), ModelView(NULL, this), m_track(tv->model()), m_stv(tv) { // init own layout + widgets setFocusPolicy(Qt::StrongFocus); QVBoxLayout * vlayout = new QVBoxLayout(this); vlayout->setMargin(0); vlayout->setSpacing(0); TabWidget* generalSettingsWidget = new TabWidget(tr("GENERAL SETTINGS"), this); QVBoxLayout* generalSettingsLayout = new QVBoxLayout(generalSettingsWidget); generalSettingsLayout->setContentsMargins(8, 18, 8, 8); generalSettingsLayout->setSpacing(6); QWidget* nameWidget = new QWidget(generalSettingsWidget); QHBoxLayout* nameLayout = new QHBoxLayout(nameWidget); nameLayout->setContentsMargins(0, 0, 0, 0); nameLayout->setSpacing(2); // setup line edit for changing sample track name m_nameLineEdit = new QLineEdit; m_nameLineEdit->setFont(pointSize<9>(m_nameLineEdit->font())); connect(m_nameLineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(textChanged(const QString &))); m_nameLineEdit->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred)); nameLayout->addWidget(m_nameLineEdit); generalSettingsLayout->addWidget(nameWidget); QGridLayout* basicControlsLayout = new QGridLayout; basicControlsLayout->setHorizontalSpacing(3); basicControlsLayout->setVerticalSpacing(0); basicControlsLayout->setContentsMargins(0, 0, 0, 0); QString labelStyleSheet = "font-size: 6pt;"; Qt::Alignment labelAlignment = Qt::AlignHCenter | Qt::AlignTop; Qt::Alignment widgetAlignment = Qt::AlignHCenter | Qt::AlignCenter; // set up volume knob m_volumeKnob = new Knob(knobBright_26, NULL, tr("Sample volume")); m_volumeKnob->setVolumeKnob(true); m_volumeKnob->setHintText(tr("Volume:"), "%"); basicControlsLayout->addWidget(m_volumeKnob, 0, 0); basicControlsLayout->setAlignment(m_volumeKnob, widgetAlignment); QLabel *label = new QLabel(tr("VOL"), this); label->setStyleSheet(labelStyleSheet); basicControlsLayout->addWidget(label, 1, 0); basicControlsLayout->setAlignment(label, labelAlignment); // set up panning knob m_panningKnob = new Knob(knobBright_26, NULL, tr("Panning")); m_panningKnob->setHintText(tr("Panning:"), ""); basicControlsLayout->addWidget(m_panningKnob, 0, 1); basicControlsLayout->setAlignment(m_panningKnob, widgetAlignment); label = new QLabel(tr("PAN"),this); label->setStyleSheet(labelStyleSheet); basicControlsLayout->addWidget(label, 1, 1); basicControlsLayout->setAlignment(label, labelAlignment); basicControlsLayout->setColumnStretch(2, 1); // setup spinbox for selecting FX-channel m_effectChannelNumber = new FxLineLcdSpinBox(2, NULL, tr("FX channel"), m_stv); basicControlsLayout->addWidget(m_effectChannelNumber, 0, 3); basicControlsLayout->setAlignment(m_effectChannelNumber, widgetAlignment); label = new QLabel(tr("FX"), this); label->setStyleSheet(labelStyleSheet); basicControlsLayout->addWidget(label, 1, 3); basicControlsLayout->setAlignment(label, labelAlignment); generalSettingsLayout->addLayout(basicControlsLayout); m_effectRack = new EffectRackView(tv->model()->audioPort()->effects()); m_effectRack->setFixedSize(240, 242); vlayout->addWidget(generalSettingsWidget); vlayout->addWidget(m_effectRack); setModel(tv->model()); QMdiSubWindow * subWin = gui->mainWindow()->addWindowedWidget(this); Qt::WindowFlags flags = subWin->windowFlags(); flags |= Qt::MSWindowsFixedSizeDialogHint; flags &= ~Qt::WindowMaximizeButtonHint; subWin->setWindowFlags(flags); // Hide the Size and Maximize options from the system menu // since the dialog size is fixed. QMenu * systemMenu = subWin->systemMenu(); systemMenu->actions().at(2)->setVisible(false); // Size systemMenu->actions().at(4)->setVisible(false); // Maximize subWin->setWindowIcon(embed::getIconPixmap("sample_track")); subWin->setFixedSize(subWin->size()); subWin->hide(); }