HeightMapFunction::HeightMapFunction(QObject *parent) : QObject(parent), m_inputLink(nullptr), m_outputLink(nullptr) { connect(this, SIGNAL(inputLinkChanged()), this, SIGNAL(functionChanged())); connect(this, SIGNAL(outputLinkChanged()), this, SIGNAL(functionChanged())); }
void UI::FunctionWidget::disconnects() { disconnect ( m_pRecentToolButton, SIGNAL ( pressed()), this, SLOT(recentFunctions()) ); disconnect ( m_pFunctionEditLine, SIGNAL( functionChanged(QString)), this, SLOT( functionChanged(QString)) ) ; disconnect ( m_pPlotPicker, SIGNAL(selected(QwtDoublePoint)),this,SLOT(pickerSelected(QwtDoublePoint))); disconnect ( m_pPlotPicker, SIGNAL(moved(QwtDoublePoint)),this,SLOT(pickerMoved(QwtDoublePoint))); disconnect ( m_pMinXSpinBox, SIGNAL( valueChanged(double) ), this, SLOT(minXSpinBoxValueChanged(double)) ); disconnect ( m_pMaxXSpinBox, SIGNAL( valueChanged(double) ), this, SLOT(maxXSpinBoxValueChanged(double)) ); disconnect ( m_pMinYSpinBox, SIGNAL( valueChanged(double) ), this, SLOT(minYSpinBoxValueChanged(double)) ); disconnect ( m_pMaxYSpinBox, SIGNAL( valueChanged(double) ), this, SLOT(maxYSpinBoxValueChanged(double)) ); }
void Qtfe::canalChanged() { for (int i = 0; i < outputs.size(); ++i) { outputs[i]->repaint(); } emit functionChanged(); }
void Dialog::showPolinomDialog() { if(!pD) { pD = new polinomDialog(); connect(pD,SIGNAL(accepted()),SLOT(functionChanged())); } pD->show(); }
/****************************************************************************** * Slot called when a channel has been modified. ******************************************************************************/ void Qtfe::onChannelChanged() { // Iterate through number of outputs for ( int i = 0; i < _outputs.size(); ++i ) { _outputs[ i ]->repaint(); } // Emit signal emit functionChanged(); }
void HeightMapFunction::setOutputLink(OutputLinkQ *newLink) { if(newLink==m_outputLink){ return; } //disconnect all signals, since we are about to forget about this input if(m_outputLink!=nullptr)disconnect(m_outputLink->owner(), 0, this, 0); m_outputLink = newLink; //forward signal to listeners of this object connect(m_outputLink->owner(), SIGNAL(dependenciesChanged()), this, SIGNAL(functionChanged())); emit outputLinkChanged(); }
void Qtfe::pointAdded() { QPointF *point = alphacanal->getPoints().back(); for (int i = 0; i < canals.size(); ++i) { if (canals[i] != alphacanal) canals[i]->insertPoint(*point); } for (int i = 0; i < outputs.size(); ++i) { outputs[i]->repaint(); } emit functionChanged(); }
void Qtfe::pointRemoved(int position) { QPointF *point = alphacanal->getPoints().back(); for (int i = 0; i < canals.size(); ++i) { if (canals[i] != alphacanal) canals[i]->removePointAtPosition(position); } for (int i = 0; i < outputs.size(); ++i) { outputs[i]->repaint(); } emit functionChanged(); }
CVC::ColorTable::ColorTable( QWidget *parent, const char *name ) : QFrame( parent, name ) { setFrameStyle( QFrame::Panel | QFrame::Raised ); QBoxLayout *layout = new QBoxLayout( this, QBoxLayout::Down ); layout->setMargin( 3 ); layout->setSpacing( 3 ); m_XoomedIn = new XoomedIn( &m_ColorTableInformation, this, "Xoomed In" ); m_XoomedOut = new XoomedOut( &m_ColorTableInformation, m_XoomedIn, this, "Xoomed Out" ); layout->addWidget( m_XoomedOut ); layout->addWidget( m_XoomedIn ); m_XoomedOut->setFixedHeight( 20 ); // connect the signals and slots connect(m_XoomedIn, SIGNAL(isocontourNodeChanged(int, double)), this, SLOT(relayIsocontourNodeChanged(int, double))); connect(m_XoomedIn, SIGNAL(isocontourNodeColorChanged(int, double,double,double)), this, SLOT(relayIsocontourNodeColorChanged(int, double,double,double))); connect(m_XoomedIn, SIGNAL(isocontourNodeExploring(int, double)), this, SLOT(relayIsocontourNodeExploring(int, double))); connect(m_XoomedIn, SIGNAL(isocontourNodeAdded(int, double,double,double,double)), this, SLOT(relayIsocontourNodeAdded(int, double,double,double,double))); connect(m_XoomedIn, SIGNAL(isocontourNodeDeleted(int)), this, SLOT(relayIsocontourNodeDeleted(int))); connect(m_XoomedIn, SIGNAL(isocontourNodeEditRequest(int)), this, SLOT(relayIsocontourNodeEditRequest(int))); connect(m_XoomedIn, SIGNAL(contourTreeNodeChanged(int, double)), this, SLOT(relayContourTreeNodeChanged(int, double))); //connect(m_XoomedIn, SIGNAL(contourTreeNodeColorChanged(int, double,double,double)), this, SLOT(relayContourTreeNodeColorChanged(int, double,double,double))); connect(m_XoomedIn, SIGNAL(contourTreeNodeExploring(int, double)), this, SLOT(relayContourTreeNodeExploring(int, double))); connect(m_XoomedIn, SIGNAL(contourTreeNodeAdded(int,int,double)), this, SLOT(relayContourTreeNodeAdded(int,int,double))); connect(m_XoomedIn, SIGNAL(contourTreeNodeDeleted(int)), this, SLOT(relayContourTreeNodeDeleted(int))); connect(m_XoomedIn, SIGNAL(functionChanged()), this, SLOT(relayFunctionChanged())); connect(m_XoomedIn, SIGNAL(functionExploring()), this, SLOT(relayFunctionExploring())); connect(m_XoomedIn, SIGNAL(everythingChanged()), this, SLOT(relayEverythingChanged())); connect(m_XoomedIn, SIGNAL(everythingChanged(ColorTableInformation*)), this, SLOT(relayEverythingChanged(ColorTableInformation*))); connect(m_XoomedIn, SIGNAL(acquireContourSpectrum()), this, SLOT(relayAcquireContourSpectrum())); connect(m_XoomedIn, SIGNAL(acquireContourTree()), this, SLOT(relayAcquireContourTree())); connect(this, SIGNAL(spectrumFunctionsChanged(float*,float*,float*,float*,float*)), m_XoomedIn, SLOT(setSpectrumFunctions(float*,float*,float*,float*,float*))); connect(this, SIGNAL(contourTreeChanged(int,int,CTVTX*,CTEDGE*)), m_XoomedIn, SLOT(setCTGraph(int,int,CTVTX*,CTEDGE*))); connect(this, SIGNAL(dataMinMaxChanged(double,double)), m_XoomedIn,SLOT(setDataMinMax(double,double))); }
VolumeGridRoverMainWindow::VolumeGridRoverMainWindow(QWidget* parent, const char *name, Qt::WFlags fl) : QWidget(parent,fl) { m_VolumeGridRoverLayout = new QGridLayout( this ); m_VolumeGridRover = new VolumeGridRover( this,"m_VolumeGridRover"); m_VolumeGridRoverLayout->addWidget(m_VolumeGridRover); m_ColorToolbar = new QToolBar("Transfer Function",this); m_ColorToolbar->setEnabled(true); //Q3Err:not support in Qt4 // m_ColorToolbar->setResizeEnabled(true); // m_ColorToolbar->setMovingEnabled(true); // m_ColorToolbar->setHorizontallyStretchable(true); // m_ColorToolbar->setOpaqueMoving(false); m_ColorTable = new CVC::ColorTable(m_ColorToolbar,"m_ColorTable"); m_ColorTable->setSizePolicy(QSizePolicy(QSizePolicy::Preferred,QSizePolicy::Preferred,0,0,m_ColorTable->sizePolicy().hasHeightForWidth())); m_ColorTable->setSpectrumFunctions(NULL,NULL,NULL,NULL,NULL); connect(m_ColorTable,SIGNAL(functionExploring()),SLOT(functionChangedSlot())); connect(m_ColorTable,SIGNAL(functionExploring()),SLOT(functionChangedSlot())); connect(m_ColorTable,SIGNAL(functionChanged()),SLOT(functionChangedSlot())); connect(m_ColorTable,SIGNAL(everythingChanged()),SLOT(functionChangedSlot())); }
/****************************************************************************** * Slot called when the Load button has been clicked. * * Open a user interface dialog to load a transfer function. * Currently, format is XML document. ******************************************************************************/ void Qtfe::onLoadButtonClicked() { // TO DO // Add a mecanism to check the format of the file while parsing // ... // Open a user interface dialog to load file QString name = QFileDialog::getOpenFileName( 0, QString(), QString(), "*.xml" ); if ( name.isEmpty() ) { return; } // Update member variables _filename = name; _filenameLineEdit->setText( _filename ); // Try to open/create file QFile file( _filename ); if ( ! file.open( QIODevice::ReadOnly ) ) { // TO DO // Handle error //... return; } // Load file data in memory QDomDocument doc; if ( ! doc.setContent( &file ) ) { // TO DO // Handle error //... file.close(); return; } file.close(); // Block functionChanged() signal while loading blockSignals( true ); // Iterate through channels and destroy them for ( int i = 0; i < _channels.size(); ++i ) { delete _channels[ i ]; } _channels.clear(); // Iterate through outputs and destroy them for ( int i = 0; i < _outputs.size(); ++i ) { delete _outputs[ i ]; } _outputs.clear(); // Traverse the XML document QDomElement root = doc.documentElement(); QDomNode node = root.firstChild(); while( ! node.isNull() ) { QDomElement element = node.toElement(); // Search for channels if ( element.tagName() == "Function" ) { // Create a new channel addChannels( 1 ); // Retrieve list of points of current channel QDomNodeList points = element.childNodes(); // Set first and last points of newly created channel QtfeChannel* channel = _channels.back(); channel->setFirstPoint( points.item( 0 ).toElement().attributeNode( "y" ).value().toDouble() ); channel->setLastPoint( points.item( points.length() - 1 ).toElement().attributeNode( "y" ).value().toDouble() ); // Iterate through points and add intermediate points to newly created channel for ( uint i = 1; i < points.length() - 1; i++ ) { // Retrieve current point QDomNode point = points.item( i ); // Retrieve x and y values qreal x = point.toElement().attributeNode( "x" ).value().toDouble(); qreal y = point.toElement().attributeNode( "y" ).value().toDouble(); // Add point in channel channel->insertPoint( QPointF( x, y ) ); } } // Search for outputs if ( element.tagName() == "Output" ) { // Create a new output QtfeOutput* output = new QtfeOutput( this ); // Do bindings output->bindChannelToR( element.attributeNode( "R" ).value().toInt() ); output->bindChannelToG( element.attributeNode( "G" ).value().toInt() ); output->bindChannelToB( element.attributeNode( "B" ).value().toInt() ); output->bindChannelToA( element.attributeNode( "A" ).value().toInt() ); // Store the output _outputs.push_back( output ); // Add it to main widget //this->layout()->addWidget( output ); _transferFunctionGroupBox->layout()->addWidget( output ); // Do connection(s) QObject::connect( output, SIGNAL( outputBindingChanged() ), this, SLOT( onOutputBindingChanged() ) ); } // Go to next sibling in order to traverse the XML document node = node.nextSibling(); } // Unblock functionChanged() signal blockSignals( false ); // Emit signal emit functionChanged(); }
void ConvFit::setupFitTab() { setDefaultPeakType("Lorentzian"); setConvolveMembers(true); setSampleWSSuffices({"_red", "_sqw"}); setSampleFBSuffices({"_red.nxs", "_sqw.nxs", "_sqw.dave"}); setResolutionWSSuffices({"_res", "_red", "_sqw"}); setResolutionFBSuffices({"_res.nxs", "_red.nxs", "_sqw.nxs", "_sqw.dave"}); // Initialise fitTypeStrings m_fitStrings["None"] = ""; m_fitStrings["One Lorentzian"] = "1L"; m_fitStrings["Two Lorentzians"] = "2L"; m_fitStrings["InelasticDiffSphere"] = "IDS"; m_fitStrings["InelasticDiffRotDiscreteCircle"] = "IDC"; m_fitStrings["ElasticDiffSphere"] = "EDS"; m_fitStrings["ElasticDiffRotDiscreteCircle"] = "EDC"; m_fitStrings["StretchedExpFT"] = "SFT"; m_fitStrings["Teixeira Water"] = "TxWater"; auto &functionFactory = FunctionFactory::Instance(); auto lorentzian = functionFactory.createFunction("Lorentzian"); auto teixeiraWater = functionFactory.createFunction("TeixeiraWaterSQE"); auto elasticDiffSphere = functionFactory.createFunction("ElasticDiffSphere"); auto inelasticDiffSphere = functionFactory.createFunction("InelasticDiffSphere"); auto elasticDiffRotDiscCircle = functionFactory.createFunction("ElasticDiffRotDiscreteCircle"); auto inelasticDiffRotDiscCircle = functionFactory.createFunction("InelasticDiffRotDiscreteCircle"); auto stretchedExpFT = functionFactory.createFunction("StretchedExpFT"); auto deltaFunction = functionFactory.createFunction("DeltaFunction"); addCheckBoxFunctionGroup("Use Delta Function", {deltaFunction}); addComboBoxFunctionGroup("One Lorentzian", {lorentzian}); addComboBoxFunctionGroup("Two Lorentzians", {lorentzian, lorentzian}); addComboBoxFunctionGroup("Teixeira Water", {teixeiraWater}); addComboBoxFunctionGroup("InelasticDiffSphere", {inelasticDiffSphere}); addComboBoxFunctionGroup("InelasticDiffRotDiscreteCircle", {inelasticDiffRotDiscCircle}); addComboBoxFunctionGroup("ElasticDiffSphere", {elasticDiffSphere}); addComboBoxFunctionGroup("ElasticDiffRotDiscreteCircle", {elasticDiffRotDiscCircle}); addComboBoxFunctionGroup("StretchedExpFT", {stretchedExpFT}); // Set available background options setBackgroundOptions({"None", "FlatBackground", "LinearBackground"}); addBoolCustomSetting("ExtractMembers", "Extract Members"); addOptionalDoubleSetting("TempCorrection", "Temp. Correction", "UseTempCorrection", "Use Temp. Correction"); setCustomSettingChangesFunction("TempCorrection", true); setCustomSettingChangesFunction("UseTempCorrection", true); // Instrument resolution m_properties["InstrumentResolution"] = m_dblManager->addProperty("InstrumentResolution"); // Post Plot and Save connect(m_uiForm->pbRun, SIGNAL(clicked()), this, SLOT(runClicked())); connect(this, SIGNAL(functionChanged()), this, SLOT(fitFunctionChanged())); }
void Doc::slotFunctionChanged(quint32 fid) { setModified(); emit functionChanged(fid); }
VCCueList::VCCueList(QWidget* parent, Doc* doc) : VCWidget(parent, doc) , m_chaserID(Function::invalidId()) //, m_chaser(NULL) , m_timer(NULL) , m_primaryIndex(0) , m_secondaryIndex(0) , m_primaryLeft(true) { /* Set the class name "VCCueList" as the object name as well */ setObjectName(VCCueList::staticMetaObject.className()); /* Create a layout for this widget */ QGridLayout* grid = new QGridLayout(this); grid->setSpacing(2); m_linkCheck = new QCheckBox(tr("Link")); grid->addWidget(m_linkCheck, 0, 0, 1, 2, Qt::AlignVCenter | Qt::AlignCenter); m_sl1TopLabel = new QLabel("100%"); m_sl1TopLabel->setAlignment(Qt::AlignHCenter); grid->addWidget(m_sl1TopLabel, 1, 0, 1, 1); m_slider1 = new ClickAndGoSlider(); m_slider1->setSliderStyleSheet(CNG_DEFAULT_STYLE); m_slider1->setFixedWidth(32); m_slider1->setRange(0, 100); m_slider1->setValue(100); grid->addWidget(m_slider1, 2, 0, 1, 1); m_sl1BottomLabel = new QLabel(""); m_sl1BottomLabel->setStyleSheet(cfLabelNoStyle); m_sl1BottomLabel->setAlignment(Qt::AlignCenter); grid->addWidget(m_sl1BottomLabel, 3, 0, 1, 1); connect(m_slider1, SIGNAL(valueChanged(int)), this, SLOT(slotSlider1ValueChanged(int))); m_sl2TopLabel = new QLabel("0%"); m_sl2TopLabel->setAlignment(Qt::AlignHCenter); grid->addWidget(m_sl2TopLabel, 1, 1, 1, 1); m_slider2 = new ClickAndGoSlider(); m_slider2->setSliderStyleSheet(CNG_DEFAULT_STYLE); m_slider2->setFixedWidth(32); m_slider2->setRange(0, 100); m_slider2->setValue(0); m_slider2->setInvertedAppearance(true); grid->addWidget(m_slider2, 2, 1, 1, 1); m_sl2BottomLabel = new QLabel(""); m_sl2BottomLabel->setStyleSheet(cfLabelNoStyle); m_sl2BottomLabel->setAlignment(Qt::AlignCenter); grid->addWidget(m_sl2BottomLabel, 3, 1, 1, 1); connect(m_slider2, SIGNAL(valueChanged(int)), this, SLOT(slotSlider2ValueChanged(int))); slotShowCrossfadePanel(false); /* Create a list for scenes (cues) */ m_tree = new QTreeWidget(this); grid->addWidget(m_tree, 0, 2, 3, 1); m_tree->setSelectionMode(QAbstractItemView::SingleSelection); //m_tree->setAlternatingRowColors(true); m_tree->setAllColumnsShowFocus(true); m_tree->setRootIsDecorated(false); m_tree->setItemsExpandable(false); m_tree->header()->setSortIndicatorShown(false); #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) m_tree->header()->setClickable(false); m_tree->header()->setMovable(false); #else m_tree->header()->setSectionsClickable(false); m_tree->header()->setSectionsMovable(false); #endif // Make only the notes column editable m_tree->setItemDelegateForColumn(COL_NUM, new NoEditDelegate(this)); m_tree->setItemDelegateForColumn(COL_NAME, new NoEditDelegate(this)); m_tree->setItemDelegateForColumn(COL_FADEIN, new NoEditDelegate(this)); m_tree->setItemDelegateForColumn(COL_FADEOUT, new NoEditDelegate(this)); m_tree->setItemDelegateForColumn(COL_DURATION, new NoEditDelegate(this)); connect(m_tree, SIGNAL(itemActivated(QTreeWidgetItem*,int)), this, SLOT(slotItemActivated(QTreeWidgetItem*))); connect(m_tree, SIGNAL(itemChanged(QTreeWidgetItem*,int)), this, SLOT(slotItemChanged(QTreeWidgetItem*,int))); m_progress = new QProgressBar(this); m_progress->setOrientation(Qt::Horizontal); m_progress->setStyleSheet(progressDisabledStyle); m_progress->setProperty("status", 0); m_progress->setFixedHeight(20); grid->addWidget(m_progress, 3, 2); m_timer = new QTimer(this); connect(m_timer, SIGNAL(timeout()), this, SLOT(slotProgressTimeout())); m_updateTimer = new QTimer(this); connect(m_updateTimer, SIGNAL(timeout()), this, SLOT(slotUpdateStepList())); m_updateTimer->setSingleShot(true); /* Create control buttons */ QHBoxLayout *hbox = new QHBoxLayout(); hbox->setSpacing(2); m_crossfadeButton = new QToolButton(this); m_crossfadeButton->setIcon(QIcon(":/slider.png")); m_crossfadeButton->setIconSize(QSize(24, 24)); m_crossfadeButton->setCheckable(true); m_crossfadeButton->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); m_crossfadeButton->setFixedHeight(32); m_crossfadeButton->setToolTip(tr("Show/Hide crossfade sliders")); connect(m_crossfadeButton, SIGNAL(toggled(bool)), this, SLOT(slotShowCrossfadePanel(bool))); hbox->addWidget(m_crossfadeButton); m_playbackButton = new QToolButton(this); m_playbackButton->setIcon(QIcon(":/player_play.png")); m_playbackButton->setIconSize(QSize(24, 24)); m_playbackButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); m_playbackButton->setFixedHeight(32); m_playbackButton->setToolTip(tr("Play/Stop Cue list")); connect(m_playbackButton, SIGNAL(clicked()), this, SLOT(slotPlayback())); hbox->addWidget(m_playbackButton); m_previousButton = new QToolButton(this); m_previousButton->setIcon(QIcon(":/back.png")); m_previousButton->setIconSize(QSize(24, 24)); m_previousButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); m_previousButton->setFixedHeight(32); m_previousButton->setToolTip(tr("Go to previous step in the list")); connect(m_previousButton, SIGNAL(clicked()), this, SLOT(slotPreviousCue())); hbox->addWidget(m_previousButton); m_nextButton = new QToolButton(this); m_nextButton->setIcon(QIcon(":/forward.png")); m_nextButton->setIconSize(QSize(24, 24)); m_nextButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); m_nextButton->setFixedHeight(32); m_nextButton->setToolTip(tr("Go to next step in the list")); connect(m_nextButton, SIGNAL(clicked()), this, SLOT(slotNextCue())); hbox->addWidget(m_nextButton); grid->addItem(hbox, 4, 2); setFrameStyle(KVCFrameStyleSunken); setType(VCWidget::CueListWidget); setCaption(tr("Cue list")); QSettings settings; QVariant var = settings.value(SETTINGS_CUELIST_SIZE); if (var.isValid() == true) resize(var.toSize()); else resize(QSize(300, 220)); slotModeChanged(m_doc->mode()); setLiveEdit(m_liveEdit); connect(m_doc, SIGNAL(functionRemoved(quint32)), this, SLOT(slotFunctionRemoved(quint32))); connect(m_doc, SIGNAL(functionChanged(quint32)), this, SLOT(slotFunctionChanged(quint32))); connect(m_doc, SIGNAL(functionNameChanged(quint32)), this, SLOT(slotFunctionNameChanged(quint32))); m_nextLatestValue = 0; m_previousLatestValue = 0; m_playbackLatestValue = 0; }
void Qtfe::load() { QString name = QFileDialog::getOpenFileName(0, QString(), QString(), "*.xml"); if(name.isEmpty()) return; filename = name; fileLabel->setText(filename); QFile file(filename); if (!file.open(QIODevice::ReadOnly)) return; QDomDocument doc; if (!doc.setContent(&file)) { file.close(); return; } file.close(); // block functionChanged() signal while loading blockSignals(true); for(int i=0 ; i < canals.size() ; ++i) delete canals[i]; for(int i=0 ; i < outputs.size() ; ++i) delete outputs[i]; canals.clear(); outputs.clear(); QDomElement root = doc.documentElement(); QDomNode node = root.firstChild(); while(!node.isNull()) { QDomElement element = node.toElement(); if (element.tagName() == "Function") { addCanal(1, "Red"); QtfeCanal * canal = canals.back(); QDomNodeList points = element.childNodes(); canal->setFirstPoint(points.item(0).toElement().attributeNode("y").value().toDouble()); canal->setLastPoint(points.item(points.length()-1).toElement().attributeNode("y").value().toDouble()); for(int i=1;i<points.length()-1;i++) { QDomNode point = points.item(i); qreal x = point.toElement().attributeNode("x").value().toDouble(); qreal y = point.toElement().attributeNode("y").value().toDouble(); canal->insertPoint(QPointF(x,y)); } } if (element.tagName() == "Output") { QtfeOutput * output = new QtfeOutput(this); output->bindCanaltoR(element.attributeNode("R").value().toInt()); output->bindCanaltoG(element.attributeNode("G").value().toInt()); output->bindCanaltoB(element.attributeNode("B").value().toInt()); output->bindCanaltoA(element.attributeNode("A").value().toInt()); outputs.push_back(output); this->layout()->addWidget(output); } node = node.nextSibling(); } // unblock functionChanged() signal and emit blockSignals(false); emit functionChanged(); }
/****************************************************************************** * Slot called when an output binding has been modified. ******************************************************************************/ void Qtfe::onOutputBindingChanged() { // Emit signal emit functionChanged(); }
void FixtureConsole::setFixture(t_fixture_id id) { unsigned int i = 0; Fixture* fxi = NULL; ConsoleChannel* unit = NULL; m_fixture = id; fxi = _app->doc()->fixture(m_fixture); assert(fxi); // Set an icon setIcon(QPixmap(PIXMAPS + QString("/console.png"))); // Set the main horizontal layout m_layout = new QHBoxLayout(this); m_layout->setAutoAdd(true); // Create scene editor widget if (m_sceneEditor) delete m_sceneEditor; m_sceneEditor = new SceneEditor(this); m_sceneEditor->setFixture(m_fixture); m_sceneEditor->show(); // Catch function add signals connect(_app->doc(), SIGNAL(functionAdded(t_function_id)), m_sceneEditor, SLOT(slotFunctionAdded(t_function_id))); // Catch function remove signals connect(_app->doc(), SIGNAL(functionRemoved(t_function_id)), m_sceneEditor, SLOT(slotFunctionRemoved(t_function_id))); // Catch function change signals connect(_app->doc(), SIGNAL(functionChanged(t_function_id)), m_sceneEditor, SLOT(slotFunctionChanged(t_function_id))); // Create channel units for (i = 0; i < fxi->channels(); i++) { unit = new ConsoleChannel(this, m_fixture, i); unit->init(); unit->update(); // Channel updates to scene editor connect(unit, SIGNAL(changed(t_channel, t_value, Scene::ValueType)), m_sceneEditor, SLOT(slotChannelChanged(t_channel, t_value, Scene::ValueType))); // Scene editor updates to channels connect(m_sceneEditor, SIGNAL(sceneActivated(SceneValue*, t_channel)), unit, SLOT(slotSceneActivated(SceneValue*, t_channel))); m_unitList.append(unit); } /* Resize the console to some sensible proportions if at least one channel unit was inserted */ if (unit != NULL) resize(m_sceneEditor->width() + (fxi->channels() * unit->width()), 250); // Update scene editor (also causes an update to channelunits) m_sceneEditor->update(); }
/****************************************************************************** * Initialize the viewer ******************************************************************************/ void SampleViewer::init() { // GLEW initialization GLenum error = glewInit(); if ( error != GLEW_OK ) { // Problem : glewInit failed fprintf( stderr, "Error: %s\n", glewGetErrorString( error ) ); // Exit program exit( 1 ); } // Initialize the GigaVoxels pipeline _sampleCore = new SampleCore(); _sampleCore->init(); // Initialize the transfer function editor _transferFunctionEditor = new Qtfe( NULL ); // Modify transfer function window flags to always stay on top Qt::WindowFlags windowFlags = _transferFunctionEditor->windowFlags(); windowFlags |= Qt::WindowStaysOnTopHint; #ifndef WIN32 windowFlags |= Qt::X11BypassWindowManagerHint; #endif _transferFunctionEditor->setWindowFlags( windowFlags ); // Do connection(s) connect( _transferFunctionEditor, SIGNAL( functionChanged() ), SLOT( onFunctionChanged() ) ); // Try to load a transfer function from file QString dataRepository = QCoreApplication::applicationDirPath() + QDir::separator() + QString( "Data" ); QString filename = dataRepository + QDir::separator() + QString( "TransferFunctions" ) + QDir::separator() + QString( "TransferFunction_Qtfe_01.xml" ); QFileInfo fileInfo( filename ); if ( ( ! fileInfo.isFile() ) || ( ! fileInfo.isReadable() ) ) { // Idea // Maybe use Qt function : bool QFileInfo::permission ( QFile::Permissions permissions ) const // TO DO // Handle error : free memory and exit // ... std::cout << "ERROR. Check filename : " << filename.toLatin1().constData() << std::endl; } bool hasTransferFunctionBeenLoaded = _transferFunctionEditor->load( filename ); if ( ! hasTransferFunctionBeenLoaded ) { // LOG QString logMessage = tr( "Transfer function has not been loaded..." ); std::cout << logMessage.toLatin1().constData() << std::endl; // Initialize a default transfer function // 4 channels [R,G,B,A] bound to 1 output _transferFunctionEditor->addChannels( 4 ); _transferFunctionEditor->addOutputs( 1 ); _transferFunctionEditor->bindChannelToOutputR( 0, 0 ); _transferFunctionEditor->bindChannelToOutputG( 1, 0 ); _transferFunctionEditor->bindChannelToOutputB( 2, 0 ); _transferFunctionEditor->bindChannelToOutputA( 3, 0 ); // Tell GigaVoxels that transfer function has been modified onFunctionChanged(); // LOG logMessage = tr( "A default one has been created." ); std::cout << logMessage.toLatin1().constData() << std::endl; } // Show the transfer function editor _transferFunctionEditor->resize( 367, 546 ); _transferFunctionEditor->show(); // QGLViewer restoration mechanism restoreStateFromFile(); // Initialize light setLight( 1.08f, 1.99f ); setMouseTracking( true ); setAnimationPeriod( 0 ); startAnimation(); // Viewer settings : // - sets the backgroundColor() of the viewer and calls qglClearColor() setBackgroundColor( QColor( 150, 150, 150 ) ); // Update GigaVoxels clear color _sampleCore->setClearColor( 150, 150, 150, 255 ); }
void CVC::ColorTable::relayFunctionChanged( ) { m_XoomedOut->repaint(); emit functionChanged(); }