void App::slotSetOperateMode() { if (m_mode == Design) { slotSetMode(); } }
void App::slotSetDesignMode() { if (m_mode == Operate) { slotSetMode(); } }
// // 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); }
ClsQGroupStateManip::ClsQGroupStateManip ( const char * _name = 0,string _strGroupID = ""): QFrame( 0, _name, Qt::WDestructiveClose), strGroupID(_strGroupID) { bApplied = false; clsQStateArrayView = NULL; iInterval = 1; iLoops = 1; iStepSize = 1; string strGroupName = ClsFESystemManager::Instance()->getGroupName(strGroupID).c_str(); string strTitle = "State Manipulation Panel for \"" + strGroupName + "\""; this->setCaption(strTitle.c_str()); QBitmap qbmEraser( eraser_cursor_width, eraser_cursor_height, eraser_cursor_bits, TRUE ); QBitmap qbmEraserMask( eraser_cursor_mask_width, eraser_cursor_mask_height, eraser_cursor_mask_bits, TRUE ); qcursorEraser = new QCursor( qbmEraser, qbmEraserMask,0 ,0 ); QBitmap qbmPencil( pencil_cursor_width, pencil_cursor_height, pencil_cursor_bits, TRUE ); QBitmap qbmPencilMask( pencil_cursor_mask_width, pencil_cursor_mask_height, pencil_cursor_mask_bits, TRUE ); qcursorPencil = new QCursor( qbmPencil, qbmPencilMask, 0, 0 ); QSplitter *qsplitter = new QSplitter(this); QFrame *qfmLeftPane = new QFrame(qsplitter); QBoxLayout * layoutMain = new QHBoxLayout( this); layoutMain->setResizeMode (QLayout::Fixed); layoutMain->addWidget(qsplitter); QBoxLayout * layoutLeftPane = new QVBoxLayout( qfmLeftPane, 5, -1, "mainL"); qlblCaption = new QLabel(qfmLeftPane); qlblCaption->setText(strGroupName.c_str()); layoutLeftPane->addWidget(qlblCaption); qfmStateArray = new QFrame(qfmLeftPane);; QHBoxLayout *qlayoutQfm = new QHBoxLayout( qfmStateArray); qlayoutQfm->setAutoAdd ( true); createStateArray(strGroupID); layoutLeftPane->addWidget(qfmStateArray, 0, Qt::AlignHCenter); qfmStateArray->show(); clsQStateArrayView->show(); clsQStateArrayView->setValue(DEFAULTVALUE); QHBoxLayout *qlayoutGradient = new QHBoxLayout( layoutLeftPane); QString qstr; QLabel* qlblMin = new QLabel(qfmLeftPane); qstr.setNum(fMinVal()); qlblMin->setText(qstr); qlayoutGradient->addWidget(qlblMin, 0, Qt::AlignRight); qlblGradientPixmap = new QLabel(qfmLeftPane);; qlayoutGradient->addWidget(qlblGradientPixmap, 1, Qt::AlignHCenter); qstr.setNum(fMaxVal()); QLabel* qlblMax = new QLabel(qfmLeftPane); qlblMax->setText(qstr); qlayoutGradient->addWidget(qlblMax); int iImgWidth = clsQStateArrayView->width() - qlblMin->minimumWidth() - qlblMax->minimumWidth() - 30; int iImgHeight = 13; qlblGradientPixmap->setFixedSize(iImgWidth,iImgHeight); qlblGradientPixmap->setPixmap(clsQStateArrayView->getGradientPixmap(iImgWidth, iImgHeight)); /* -------------------------------- */ qgrpbxTools = new QGroupBox( ); QLabel *lblValue = new QLabel(); lblValue->setText("Value:"); qdblspnbx = new QDoubleSpinBox( qgrpbxTools ); qdblspnbx->setMinimum(fMinVal()); qdblspnbx->setMaximum(fMaxVal()); qdblspnbx->setDecimals(3); qdblspnbx->setSingleStep ( 0.01); qdblspnbx->setValue(DEFAULTVALUE); connect(qdblspnbx, SIGNAL(valueChanged(double)), this, SLOT(slotChangeValue(double))); QPushButton* qpbtnPen = new QPushButton (QIcon(QPixmap(pencil)), ""); qpbtnPen->setToggleButton ( true); qpbtnPen->setFlat(true); qpbtnPen->setChecked(true); slotSelectTool(TOOL_PENCIL); QPushButton* qpbtnEraser = new QPushButton (QIcon(QPixmap(eraser)), ""); qpbtnEraser->setToggleButton ( true); qpbtnEraser->setFlat(true); QHBoxLayout *qlayoutTools = new QHBoxLayout; qlayoutTools->addWidget(lblValue); qlayoutTools->addWidget(qdblspnbx); qlayoutTools->addWidget(qpbtnPen); qlayoutTools->addWidget(qpbtnEraser); qgrpbxTools->setLayout(qlayoutTools); qbtngrpTools = new QButtonGroup(); connect(qbtngrpTools, SIGNAL(buttonClicked(int)), this, SLOT(slotSelectTool(int))); qbtngrpTools->addButton(qpbtnPen, TOOL_PENCIL); qbtngrpTools->addButton(qpbtnEraser, TOOL_ERASER); layoutLeftPane->addWidget(qgrpbxTools); /* ------------------------------------ */ QHBoxLayout *layout2 = new QHBoxLayout( layoutLeftPane); QPushButton *qpbtnClear = new QPushButton ("Clear", qfmLeftPane); connect(qpbtnClear, SIGNAL(clicked()), this, SLOT(slotClear())); layout2->addWidget(qpbtnClear, Qt::AlignTop); QPushButton *qpbtnAdd = new QPushButton ("Add", qfmLeftPane); connect(qpbtnAdd, SIGNAL(clicked()), this, SLOT(slotAdd())); layout2->addWidget(qpbtnAdd, Qt::AlignTop); QPushButton *qpbtnReplace = new QPushButton ("Replace", qfmLeftPane); connect(qpbtnReplace, SIGNAL(clicked()), this, SLOT(slotReplace())); layout2->addWidget(qpbtnReplace, Qt::AlignTop); /* ------------------------------------ */ QGroupBox *qgrpbxMode = new QGroupBox("Mode", qfmLeftPane); QRadioButton *qrbClamp = new QRadioButton ("Clamp", qgrpbxMode ); qrbClamp->setChecked( TRUE ); slotSetMode(ClsGroupManipPattern::MODE_CLAMP); QRadioButton *qrbAddPattern = new QRadioButton ("Add", qgrpbxMode ); QRadioButton *qrbMultiplyPattern = new QRadioButton ("Multiply", qgrpbxMode ); QHBoxLayout *qlayoutMode = new QHBoxLayout; qlayoutMode->addWidget(qrbClamp, ClsGroupManipPattern::MODE_CLAMP); qlayoutMode->addWidget(qrbAddPattern, ClsGroupManipPattern::MODE_ADD); qlayoutMode->addWidget(qrbMultiplyPattern, ClsGroupManipPattern::MODE_MULTIPLY); qgrpbxMode->setLayout(qlayoutMode); QButtonGroup *qbtngrpMode = new QButtonGroup(); connect(qbtngrpMode, SIGNAL(buttonClicked(int)), SLOT(slotSetMode(int)) ); qbtngrpMode->addButton(qrbClamp, ClsGroupManipPattern::MODE_CLAMP); qbtngrpMode->addButton(qrbAddPattern, ClsGroupManipPattern::MODE_ADD); qbtngrpMode->addButton(qrbMultiplyPattern, ClsGroupManipPattern::MODE_MULTIPLY); layoutLeftPane->addWidget(qgrpbxMode); /* ------------------------------------ */ /* ------------------------------------ */ QGroupBox *qgrpbxPlayBack = new QGroupBox("Play Back", qfmLeftPane); QRadioButton *qrbPersist = new QRadioButton( "For ever" ); qrbPersist->setChecked( TRUE ); slotSetPlayback(ClsGroupManipPattern::PLAYBACK_LOOP); QRadioButton *qrbIterations = new QRadioButton( "Times"); QButtonGroup *qbtngrpPlayBack = new QButtonGroup(); connect(qbtngrpPlayBack, SIGNAL(buttonClicked(int)), SLOT(slotSetPlayback(int)) ); qbtngrpPlayBack->addButton(qrbPersist, ClsGroupManipPattern::PLAYBACK_LOOP); qbtngrpPlayBack->addButton(qrbIterations, ClsGroupManipPattern::PLAYBACK_ITERATIONS); qspnbxIterations = new QSpinBox( ); qspnbxIterations->setMinimum(1); qspnbxIterations->setMaximum(INT_MAX); qspnbxIterations->setMaximumWidth(50); connect(qspnbxIterations, SIGNAL(valueChanged(int)), this, SLOT(slotSetLoops(int))); QLabel *qlblInterval = new QLabel(); qlblInterval->setText("Interval"); qspnbxInterval = new QSpinBox( ); qspnbxInterval->setMinimum(1); qspnbxInterval->setMaximum(INT_MAX); qspnbxInterval->setMaximumWidth(50); connect(qspnbxInterval, SIGNAL(valueChanged(int)), this, SLOT(slotSetInterval(int))); QLabel *qlblStepSize = new QLabel(); qlblStepSize->setText("StepSize"); qspnbxStepSize = new QSpinBox(); qspnbxStepSize->setMinimum(1); qspnbxStepSize->setMaximum(INT_MAX); qspnbxStepSize->setMaximumWidth(50); connect(qspnbxStepSize, SIGNAL(valueChanged(int)), this, SLOT(slotSetInterval(int))); QGridLayout* qglayoutPlayBack = new QGridLayout (); qglayoutPlayBack->addWidget(qrbPersist, 1,1); qglayoutPlayBack->addWidget(qrbIterations, 1, 2); qglayoutPlayBack->addWidget(qspnbxIterations, 1, 3); qglayoutPlayBack->addWidget(qlblInterval, 2, 2); qglayoutPlayBack->addWidget(qspnbxInterval, 2, 3); qglayoutPlayBack->addWidget(qlblStepSize, 3,2); qglayoutPlayBack->addWidget(qspnbxStepSize, 3, 3); qgrpbxPlayBack->setLayout(qglayoutPlayBack); layoutLeftPane->addWidget(qgrpbxPlayBack); /* ------------------------------------ */ QHBoxLayout *qlayoutCmdButtons = new QHBoxLayout( layoutLeftPane, 5); QPushButton *qpbtnApply = new QPushButton ("Send", qfmLeftPane); connect(qpbtnApply, SIGNAL(clicked()), this, SLOT(slotApply())); qpbtnRevoke = new QPushButton ("Revoke", qfmLeftPane); qpbtnRevoke->setEnabled(false); connect(qpbtnRevoke, SIGNAL(clicked()), this, SLOT(slotRevoke())); QPushButton *qpbtnClose = new QPushButton ("Close", qfmLeftPane); connect(qpbtnClose, SIGNAL(clicked()), this, SLOT(close())); qlayoutCmdButtons->addWidget(qpbtnApply); qlayoutCmdButtons->addWidget(qpbtnRevoke); qlayoutCmdButtons->addWidget(qpbtnClose); QToolTip::add(qpbtnPen, "Pencil"); QToolTip::add(qpbtnEraser, "Eraser"); QToolTip::add(qpbtnClear, "Clear"); QToolTip::add(qpbtnAdd, "Add"); QToolTip::add(qrbClamp, "Repace Value"); QToolTip::add(qrbAddPattern, "Add Values"); QToolTip::add(qrbMultiplyPattern, "Mutliply with Values"); QToolTip::add(qrbPersist, "Apply for ever"); QToolTip::add(qspnbxIterations, "Apply for selected timesteps"); QToolTip::add(qspnbxInterval, "Apply every X timestep"); QToolTip::add(qspnbxStepSize, "Apply step by X"); clsQSAList = new ClsQSAList(qsplitter, this); connect(clsQSAList, SIGNAL(sigChangeMatrix(vector <vector<double> >)), this, SLOT(slotMatrixChanged(vector <vector<double> >))); clsQSAList->show(); qsplitter->setResizeMode(clsQSAList, QSplitter::FollowSizeHint); };