Exemple #1
0
void ImageLoader::onReplyFinished()
{
    QNetworkReply* reply = qobject_cast<QNetworkReply*>(sender());

    QString response;
    if (reply) {
        if (reply->error() == QNetworkReply::NoError) {
            const int available = reply->bytesAvailable();
            if (available > 0) {
                const QByteArray data(reply->readAll());

                // Setup the image processing thread
                ImageProcessor *imageProcessor = new ImageProcessor(data);
                m_thread = new QThread(this);

                // Move the image processor to the worker thread
                imageProcessor->moveToThread(m_thread);

                // Invoke ImageProcessor's start() slot as soon as the worker thread has started
                connect(m_thread, SIGNAL(started()), imageProcessor, SLOT(start()));

                // Delete the worker thread automatically after it has finished
                connect(m_thread, SIGNAL(finished()), m_thread, SLOT(deleteLater()));

                /*
                 * Invoke our onProcessingFinished slot after the processing has finished.
                 * Since imageProcessor and 'this' are located in different threads we use 'QueuedConnection' to
                 * allow a cross-thread boundary invocation. In this case the QImage parameter is copied in a thread-safe way
                 * from the worker thread to the main thread.
                 */
                connect(imageProcessor, SIGNAL(finished(QImage)), this, SLOT(onImageProcessingFinished(QImage)), Qt::QueuedConnection);

                // Terminate the thread after the processing has finished
                connect(imageProcessor, SIGNAL(finished(QImage)), m_thread, SLOT(quit()));

                m_thread->start();
            }
        } else {
            m_label = tr("Error: %1 status: %2").arg(reply->errorString(), reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toString());
            emit labelChanged();

            m_loading = false;
            emit loadingChanged();
        }

        reply->deleteLater();
    } else {
        m_label = tr("Download failed. Check internet connection");
        emit labelChanged();

        m_loading = false;
        emit loadingChanged();
    }
}
HydrometerTool::HydrometerTool(QWidget* parent) : QDialog(parent)
{
   doLayout();
   
   connect( pushButton_convert, SIGNAL(clicked()), this, SLOT(convert()) );
   connect(label_inputTemp, SIGNAL(labelChanged(Unit::unitDisplay,Unit::unitScale)), lineEdit_inputTemp, SLOT(lineChanged(Unit::unitDisplay,Unit::unitScale)));
   connect(label_inputSg, SIGNAL(labelChanged(Unit::unitDisplay,Unit::unitScale)), lineEdit_inputSg, SLOT(lineChanged(Unit::unitDisplay,Unit::unitScale)));
   connect(label_outputSg, SIGNAL(labelChanged(Unit::unitDisplay,Unit::unitScale)), lineEdit_outputSg, SLOT(lineChanged(Unit::unitDisplay,Unit::unitScale)));

   QMetaObject::connectSlotsByName(this);

}
Exemple #3
0
void QPieModelMapperPrivate::initializePieFromModel()
{
    if (m_model == 0 || m_series == 0)
        return;

    blockSeriesSignals();
    // clear current content
    m_series->clear();
    m_slices.clear();

    // create the initial slices set
    int slicePos = 0;
    QModelIndex valueIndex = valueModelIndex(slicePos);
    QModelIndex labelIndex = labelModelIndex(slicePos);
    while (valueIndex.isValid() && labelIndex.isValid()) {
        QPieSlice *slice = new QPieSlice;
        slice->setLabel(m_model->data(labelIndex, Qt::DisplayRole).toString());
        slice->setValue(m_model->data(valueIndex, Qt::DisplayRole).toDouble());
        connect(slice, SIGNAL(labelChanged()), this, SLOT(sliceLabelChanged()));
        connect(slice, SIGNAL(valueChanged()), this, SLOT(sliceValueChanged()));
        m_series->append(slice);
        m_slices.append(slice);
        slicePos++;
        valueIndex = valueModelIndex(slicePos);
        labelIndex = labelModelIndex(slicePos);
    }
    blockSeriesSignals(false);
}
Exemple #4
0
void QPieModelMapperPrivate::insertData(int start, int end)
{
    if (m_model == 0 || m_series == 0)
        return;

    if (m_count != -1 && start >= m_first + m_count) {
        return;
    } else {
        int addedCount = end - start + 1;
        if (m_count != -1 && addedCount > m_count)
            addedCount = m_count;
        int first = qMax(start, m_first);
        int last = qMin(first + addedCount - 1, m_orientation == Qt::Vertical ? m_model->rowCount() - 1 : m_model->columnCount() - 1);
        for (int i = first; i <= last; i++) {
            QModelIndex valueIndex = valueModelIndex(i - m_first);
            QModelIndex labelIndex = labelModelIndex(i - m_first);
            if (valueIndex.isValid() && labelIndex.isValid()) {
                QPieSlice *slice = new QPieSlice;
                slice->setValue(m_model->data(valueIndex, Qt::DisplayRole).toDouble());
                slice->setLabel(m_model->data(labelIndex, Qt::DisplayRole).toString());
                connect(slice, SIGNAL(labelChanged()), this, SLOT(sliceLabelChanged()));
                connect(slice, SIGNAL(valueChanged()), this, SLOT(sliceValueChanged()));
                m_series->insert(i - m_first, slice);
                m_slices.insert(i - m_first, slice);
            }
        }

        // remove excess of slices (abouve m_count)
        if (m_count != -1 && m_series->slices().size() > m_count)
            for (int i = m_series->slices().size() - 1; i >= m_count; i--) {
                m_series->remove(m_series->slices().at(i));
                m_slices.removeAt(i);
            }
    }
}
Exemple #5
0
void QPieModelMapperPrivate::slicesAdded(QList<QPieSlice *> slices)
{
    if (m_seriesSignalsBlock)
        return;

    if (slices.count() == 0)
        return;

    int firstIndex = m_series->slices().indexOf(slices.at(0));
    if (firstIndex == -1)
        return;

    if (m_count != -1)
        m_count += slices.count();

    for (int i = firstIndex; i < firstIndex + slices.count(); i++) {
        m_slices.insert(i, slices.at(i - firstIndex));
        connect(slices.at(i - firstIndex), SIGNAL(labelChanged()), this, SLOT(sliceLabelChanged()));
        connect(slices.at(i - firstIndex), SIGNAL(valueChanged()), this, SLOT(sliceValueChanged()));
    }

    blockModelSignals();
    if (m_orientation == Qt::Vertical)
        m_model->insertRows(firstIndex + m_first, slices.count());
    else
        m_model->insertColumns(firstIndex + m_first, slices.count());

    for (int i = firstIndex; i < firstIndex + slices.count(); i++) {
        m_model->setData(valueModelIndex(i), slices.at(i - firstIndex)->value());
        m_model->setData(labelModelIndex(i), slices.at(i - firstIndex)->label());
    }
    blockModelSignals(false);
}
void PinLabelDialog::makeOnePinEntry(int index, const QString & text, Qt::Alignment alignment, int row, QGridLayout * gridLayout) 
{
	QLineEdit * label = new QLineEdit();
	label->setText(QString::number(index + 1));
	label->setMaximumWidth(20);
	label->setMinimumWidth(20);
	label->setFrame(false);
	label->setEnabled(false);

	QLineEdit * lEdit = new QLineEdit();
	lEdit->setMaximumWidth(65);
	lEdit->setAlignment(alignment);
	lEdit->setText(text);
	lEdit->setProperty("index", index);
	lEdit->setProperty("prev", text);
	connect(lEdit, SIGNAL(editingFinished()), this, SLOT(labelChanged()));
	connect(lEdit, SIGNAL(textEdited(const QString &)), this, SLOT(labelEdited(const QString &)));

	if (alignment == Qt::AlignLeft) {
		label->setAlignment(Qt::AlignRight);
		gridLayout->addWidget(label, row, 0);
		gridLayout->addWidget(lEdit, row, 1);
	}
	else {
		label->setAlignment(Qt::AlignLeft);
		gridLayout->addWidget(lEdit, row, 0);
		gridLayout->addWidget(label, row, 1);
	}
}
GraphAction::GraphAction(Graph* graph, bool dots, QObject *parent): QAction(parent), graph(graph), dots(dots)
{
	updateText(graph->label());

	connect(graph, SIGNAL(labelChanged(QString)), SLOT(updateText(QString)));
	connect(this, SIGNAL(triggered()), SLOT(processTrigger()));
}
Exemple #8
0
bool TorrentModelItem::setData(int column, const QVariant &value, int role)
{
  qDebug() << Q_FUNC_INFO << column << value;
  if (role != Qt::DisplayRole) return false;
  // Label and Name columns can be edited
  switch(column) {
  case TR_NAME:
    m_name = value.toString();
    TorrentPersistentData::saveName(m_torrent.hash(), m_name);
    return true;
  case TR_LABEL: {
    QString new_label = value.toString();
    if (m_label != new_label) {
      QString old_label = m_label;
      m_label = new_label;
      TorrentPersistentData::saveLabel(m_torrent.hash(), new_label);
      emit labelChanged(old_label, new_label);
    }
    return true;
  }
  default:
    break;
  }
  return false;
}
/*!
    \qmlproperty string PlaceAttribute::label

    This property holds the attribute label which is a user visible string
    describing the attribute.
*/
void QDeclarativePlaceAttribute::setLabel(const QString &label)
{
    if (m_attribute.label() != label) {
        m_attribute.setLabel(label);
        emit labelChanged();
    }
}
Exemple #10
0
void Board::setLabelAboutSquares()
{
    setNumOfAliveSquares();
    // qDebug("setLabelAboutSquares");
    // qDebug() << nAliveCells;
    emit labelChanged(nAliveCells);
}
Exemple #11
0
LabelBuilder::LabelBuilder(QWidget *parent, ObjectStore *store)
  : QWidget(parent), _store(store), _helpBox(0) {

  setupUi(this);

   _label->setWhatsThis(tr("<qt>The syntax for labels is a derivative of a subset of LaTeX.  "
                             "Supported syntax is: <b>\\[greeklettername]</b> and <b>\\[Greeklettername]</b>, "
                             "<b>\\approx</b>, <b>\\cdot</b>, <b>\\ge</b>, <b>\\geq</b>, <b>\\inf</b> ,"
                             "<b>\\int</b>, <b>\\le</b>, <b>\\leq</b>, <b>\\ne</b>, <b>\\n</b>, "
                             "<b>\\partial</b>, <b>\\prod</b>, <b>\\pm</b>, "
                             "<b>\\textcolor{color name}{colored text}</b>, <b>\\textbf{bold text}</b>, "
                             "<b>\\textit{italicized text}</b>, <b>\\t</b>, <b>\\sum</b>, <b>\\sqrt</b>, "
                             "<b>\\underline{underlined text}</b>, <b>\\overline{overlined text}</b>, "
                             "<b>x^y</b>, <b>x_y</b>.  "
                             "Scalars, equations, and vector elements can be embedded.  "
                             "Scalar: <i>[V1/Mean]</i>.  Vector Element: <i>[V1[4]]</i>.  "
                             "Equation: <i>[=[V1/Mean]^2]</i>.  A [ character can be inserted as <i>\\[</i>."));

  _label->setToolTip(tr("Label text.  A subset of LaTeX is supported.  Click 'Help' for help."));

  connect(_label, SIGNAL(textChanged()), this, SIGNAL(labelChanged()));
  connect(_help, SIGNAL(clicked()), this, SLOT(showHelp()));

  _label->setFocus();
}
void QDeclarativeContactDetail::setLabel(const QString &label)
{
    if (m_contactDetail.label() != label) {
        m_contactDetail.setLabel(label);
        emit labelChanged();
    }
}
void FieldBackendBase::setLabel(const QString& value)
{
    if (m_label != value)
    {
        m_label = value;
        emit labelChanged();
    }
}
Exemple #14
0
void SpecialKey::setLabel(const QString& label)
{
    if(label != m_label)
    {
        m_label = label;
        emit labelChanged();
    }
}
/*!
    \qmlproperty QPlaceContactDetail QtLocation5::ContactDetail::contactDetail

    For details on how to use this property to interface between C++ and QML see
    "\l {location-cpp-qml.html#contact_detail} {Interfaces between C++ and QML Code}".
*/
void QDeclarativeContactDetail::setContactDetail(const QPlaceContactDetail &src)
{
    QPlaceContactDetail prevContactDetail = m_contactDetail;
    m_contactDetail = src;

    if (m_contactDetail.label() != prevContactDetail.label())
        emit labelChanged();
    if (m_contactDetail.value() != prevContactDetail.value())
        emit valueChanged();
}
void VideoJobManager::run()
{
    m_stop = false;
    int i = 1;
    int size = m_jobList.size();
    while (m_jobList.size() > 0)
    {
        if (m_stop)
        {
            qDebug() << "run killed";
            emit finished();
            break;
        }
        
        VideoJob v = m_jobList.first();
        m_currentJob = &v;
        
        connect(&v, SIGNAL(labelChanged(QString)), this, SLOT(slotLabel(QString)));
        connect(&v, SIGNAL(minimumChanged(int)), this, SLOT(slotMinimum(int)));
        connect(&v, SIGNAL(maximumChanged(int)), this, SLOT(slotMaximum(int)));
        connect(&v, SIGNAL(valueChanged(int)), this, SLOT(slotValue(int)));
        
        qDebug() << QString("Encoding item %1 of %2: ").arg(i).arg(size);
        emit labelChanged(tr("Encoding item %1 of %2: ").arg(i).arg(size));
        m_currentLabel = tr("Encoding item %1 of %2: ").arg(i).arg(size);
        if (v.run(m_ffmpeg))
        {
            m_jobList.takeFirst();
            i++;
        }
        else
        {
            qDebug() << QString("Error encoding item %1").arg(i);
            FileManager::deleteFile(v.getOutputFile());
            m_success = false;
            emit finished();
            break;
        }
        
    }
    qDebug() << "run ended";
    emit finished();
}
/*!
    \qmlproperty QPlaceAttribute PlaceAttribute::attribute

    For details on how to use this property to interface between C++ and QML see
    "\l {location-cpp-qml.html#placeattribute} {Interfaces between C++ and QML Code}".
*/
void QDeclarativePlaceAttribute::setAttribute(const QPlaceAttribute &src)
{
    QPlaceAttribute prevAttribute = m_attribute;
    m_attribute = src;

    if (m_attribute.label() != prevAttribute.label())
        emit labelChanged();
    if (m_attribute.text() != prevAttribute.text())
        emit textChanged();
}
Exemple #18
0
QPieLegendMarkerPrivate::QPieLegendMarkerPrivate(QPieLegendMarker *q, QPieSeries *series, QPieSlice *slice, QLegend *legend) :
    QLegendMarkerPrivate(q,legend),
    q_ptr(q),
    m_series(series),
    m_slice(slice)
{
    QObject::connect(m_slice, SIGNAL(labelChanged()), this, SLOT(updated()));
    QObject::connect(m_slice, SIGNAL(brushChanged()), this, SLOT(updated()));
    QObject::connect(m_slice, SIGNAL(penChanged()), this, SLOT(updated()));
}
void TorrentModel::addTorrent(BitTorrent::TorrentHandle *const torrent)
{
    if (torrentRow(torrent->hash()) < 0) {
        beginInsertTorrent(m_items.size());
        TorrentModelItem *item = new TorrentModelItem(torrent);
        connect(item, SIGNAL(labelChanged(QString, QString)), SLOT(handleTorrentLabelChange(QString, QString)));
        m_items << item;
        emit torrentAdded(item);
        endInsertTorrent();
    }
}
Exemple #20
0
void
Backdrop::knobChanged(KnobI* k,
                      ValueChangedReasonEnum /*reason*/,
                      ViewSpec /*view*/,
                      double /*time*/,
                      bool /*originatedFromMainThread*/)
{
    if ( k == _imp->knobLabel.lock().get() ) {
        QString text = QString::fromUtf8(_imp->knobLabel.lock()->getValue().c_str());
        Q_EMIT labelChanged(text);
    } 
}
InsertGraphics::InsertGraphics(QWidget *parent, InsertGraphicsConfig *conf)
		: QDialog(parent) {
	setWindowTitle(tr("Insert Graphic"));
	setModal(true);
	ui.setupUi(this);
	ui.fileSelectButton->setIcon(getRealIcon("fileopen"));
	ui.pbSaveDefault->setIcon(getRealIcon("filesave"));

	connect(ui.leFile, SIGNAL(textChanged(const QString &)), this, SIGNAL(fileNameChanged(const QString &)));
	connect(ui.fileSelectButton, SIGNAL(clicked()), this, SLOT(chooseFile()));
	connect(ui.rbWidthHeight, SIGNAL(toggled(bool)), this, SLOT(includeOptionChanged()));
	connect(ui.rbUser, SIGNAL(toggled(bool)), this, SLOT(includeOptionChanged()));
	connect(ui.cbWidth, SIGNAL(toggled(bool)), this, SLOT(includeOptionChanged()));
	connect(ui.cbHeight, SIGNAL(toggled(bool)), this, SLOT(includeOptionChanged()));
	connect(ui.leWidth, SIGNAL(textChanged(QString)), this, SLOT(includeOptionChanged()));
	connect(ui.leHeight, SIGNAL(textChanged(QString)), this, SLOT(includeOptionChanged()));
	connect(ui.cbWidthUnit, SIGNAL(currentIndexChanged(QString)), this, SLOT(includeOptionChanged()));
	connect(ui.cbHeightUnit, SIGNAL(currentIndexChanged(QString)), this, SLOT(includeOptionChanged()));
        connect(ui.upButton, SIGNAL(clicked()), this, SLOT(posMoveItemUp()));
        connect(ui.downButton, SIGNAL(clicked()), this, SLOT(posMoveItemDown()));
        connect(ui.leLabel, SIGNAL(textChanged(QString)), this, SLOT(labelChanged(QString)));
	connect(ui.pbSaveDefault, SIGNAL(clicked()), this, SLOT(saveDefault()));
	connect(this, SIGNAL(fileNameChanged(const QString &)), this, SLOT(updateLabel(const QString &)));
        setWindowTitle(tr("Insert Graphics","Wizard"));

        // adjust listPlacement size
	ui.listPlacement->addItem(new QListWidgetItem(tr("Here"), ui.listPlacement, InsertGraphics::PlaceHere));
	ui.listPlacement->addItem(new QListWidgetItem(tr("Top"), ui.listPlacement, InsertGraphics::PlaceTop));
	ui.listPlacement->addItem(new QListWidgetItem(tr("Bottom"), ui.listPlacement, InsertGraphics::PlaceBottom));
	ui.listPlacement->addItem(new QListWidgetItem(tr("Page"), ui.listPlacement, InsertGraphics::PlacePage));

	int rows = ui.listPlacement->count();
        int rowSize = ui.listPlacement->sizeHintForRow(0);
        int height = rows * rowSize;
        int frameWidth = ui.listPlacement->frameWidth();
        ui.listPlacement->setFixedHeight(height + frameWidth * 2);

	includeOptionChanged();
        filter = "Images (*.eps *.jpg *.png *.pdf)";

	ui.cbWidthUnit->insertItems(0, widthUnits);
	ui.cbHeightUnit->insertItems(0, heightUnits);
        autoLabel = true;

	defaultConfig = conf;
	setConfig(*conf);
}
NotifierWindowTab::NotifierWindowTab(KviWindow * pWnd, QTabWidget * pParent)
    : QScrollArea(pParent)
{
	m_pWnd = pWnd;
	if(m_pWnd)
	{
		m_szLabel = m_pWnd->windowName();
		connect(pWnd, SIGNAL(windowNameChanged()), this, SLOT(labelChanged()));
		connect(pWnd, SIGNAL(destroyed()), this, SLOT(closeMe()));
	}
	else
	{
		m_szLabel = "----";
	}

	if(pParent)
	{
		m_pParent = pParent;
		m_pParent->addTab(this, m_szLabel);
	}

	setFocusPolicy(Qt::NoFocus);
	setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);

	if(verticalScrollBar())
		connect(verticalScrollBar(), SIGNAL(rangeChanged(int, int)), this, SLOT(scrollRangeChanged(int, int)));

	QPalette pal = palette();
	pal.setColor(backgroundRole(), Qt::transparent);
	setPalette(pal);

	m_pVWidget = new QWidget(viewport());
	m_pVBox = new QVBoxLayout(m_pVWidget);
	m_pVBox->setSizeConstraint(QLayout::SetFixedSize);
	m_pVBox->setSpacing(SPACING);
	m_pVBox->setMargin(SPACING);

	setWidget(m_pVWidget);
}
Exemple #23
0
void TorrentModel::addTorrent(const Transfer& h)
{
  if (h.type() == Transfer::ED2K && h.is_seed()) {
    // do not show finished ed2k transfers
    return;
  }
  if (h.type() == Transfer::ED2K && h.state() == qt_checking_resume_data) {
    // we don't know yet whether this transfer finished or not
    m_pendingTransfers << h;
    return;
  }

  if (torrentRow(h.hash()) < 0) {
    beginInsertTorrent(m_torrents.size());
    TorrentModelItem *item = new TorrentModelItem(h);
    connect(item, SIGNAL(labelChanged(QString,QString)),
            SLOT(handleTorrentLabelChange(QString,QString)));
    m_torrents << item;
    emit torrentAdded(item);
    endInsertTorrent();
  }
}
Exemple #24
0
/**
 * ImageLoader::onImageProcessingFinished(const QImage&)
 *
 * Handler for the signal indicating the result of the image processing.
 */
void ImageLoader::onImageProcessingFinished(const QImage &image)
{
	try
	{
		if (!image.isNull()) {
			if (image.size().height() > 0) {
				m_image = bb::cascades::Image(fromQImage(image));
			}
			emit imageChanged();

			m_label.clear();
			emit labelChanged();
		}

		m_loading = false;

		emit loadingChanged();
	}
	catch (...)
	{
		qDebug() << "FMI ##### AAAAAAAAAAAAAAAAAAAAAAAAAAAAAHHHHH!!!!";
	}
}
bool TorrentModelItem::setData(int column, const QVariant &value, int role)
{
    qDebug() << Q_FUNC_INFO << column << value;
    if (role != Qt::DisplayRole) return false;

    // Label, seed date and Name columns can be edited
    switch(column) {
    case TR_NAME:
        m_torrent->setName(value.toString());
        return true;
    case TR_LABEL: {
        QString new_label = value.toString();
        if (m_torrent->label() != new_label) {
            QString old_label = m_torrent->label();
            m_torrent->setLabel(new_label);
            emit labelChanged(old_label, new_label);
        }
        return true;
    }
    default:
        break;
    }
    return false;
}
Exemple #26
0
void
BackdropGui::createGui()
{
    NodeGui::createGui();

    _imp->label = new NodeGraphTextItem(getDagGui(), this, false);
    _imp->label->setDefaultTextColor( QColor(0, 0, 0, 255) );
    _imp->label->setZValue(getBaseDepth() + 1);

    EffectInstancePtr effect = getNode()->getEffectInstance();
    assert(effect);
    Backdrop* isBd = dynamic_cast<Backdrop*>( effect.get() );
    assert(isBd);

    QObject::connect( isBd, SIGNAL(labelChanged(QString)), this, SLOT(onLabelChanged(QString)) );

    refreshTextLabelFromKnob();

    // Make the backdrop large enough to contain the selected nodes and position it correctly
    const NodesGuiList& selectedNodes =  getDagGui()->getSelectedNodes();
    QRectF bbox;
    for (NodesGuiList::const_iterator it = selectedNodes.begin(); it != selectedNodes.end(); ++it) {
        QRectF nodeBbox = (*it)->mapToScene( (*it)->boundingRect() ).boundingRect();
        bbox = bbox.united(nodeBbox);
    }

    double border50 = mapToScene( QPoint(50, 0) ).x();
    double border0 = mapToScene( QPoint(0, 0) ).x();
    double border = border50 - border0;
    double headerHeight = getFrameNameHeight();
    QPointF scenePos(bbox.x() - border, bbox.y() - border);

    setPos( mapToParent( mapFromScene(scenePos) ) );
    resize(bbox.width() + 2 * border, bbox.height() + 2 * border - headerHeight);

}
void FieldBackendBase::endFieldUpdate()
{
    if (m_label.isCurrentValueDifferentFromStoredValue())
    {
        emit labelChanged();
    }

    if (m_enabled.isCurrentValueDifferentFromStoredValue())
    {
        emit enabledChanged();
    }

    if (m_visible.isCurrentValueDifferentFromStoredValue())
    {
        emit visibleChanged();
    }

    if (m_state.isCurrentValueDifferentFromStoredValue())
    {
        emit stateChanged();
    }

    m_statusMessages->endFieldUpdate();
}
Exemple #28
0
void PhoenixLibrary::setLabel(QString label)
{
    m_label = label;
    emit labelChanged();
}
Exemple #29
0
void Arc::setLabel(QString newLabel)
{
	arcLabel = newLabel;

	emit labelChanged(newLabel);
}
Exemple #30
0
void
NodeAnim::initialize(AnimatedItemTypeEnum nodeType)
{
    _imp->nodeType = nodeType;
    NodePtr internalNode = getNodeGui()->getNode();

    AnimationModuleBasePtr model = getModel();
    NodeAnimPtr thisShared = shared_from_this();
    _imp->nameItem = new QTreeWidgetItem;
    _imp->nameItem->setData(0, QT_ROLE_CONTEXT_ITEM_POINTER, qVariantFromValue((void*)thisShared.get()));
    _imp->nameItem->setText( 0, QString::fromUtf8( internalNode->getLabel().c_str() ) );
    _imp->nameItem->setData(0, QT_ROLE_CONTEXT_TYPE, nodeType);
    _imp->nameItem->setData(0, QT_ROLE_CONTEXT_IS_ANIMATED, true);
    _imp->nameItem->setExpanded(true);
    int nCols = getModel()->getTreeColumnsCount();
    if (nCols > ANIMATION_MODULE_TREE_VIEW_COL_VISIBLE) {
        _imp->nameItem->setData(ANIMATION_MODULE_TREE_VIEW_COL_VISIBLE, QT_ROLE_CONTEXT_ITEM_VISIBLE, QVariant(true));
        _imp->nameItem->setIcon(ANIMATION_MODULE_TREE_VIEW_COL_VISIBLE, model->getItemVisibilityIcon(true));
    }
    if (nCols > ANIMATION_MODULE_TREE_VIEW_COL_PLUGIN_ICON) {
        QString iconFilePath = QString::fromUtf8(internalNode->getPluginIconFilePath().c_str());
        AnimationModuleTreeView::setItemIcon(iconFilePath, _imp->nameItem);
    }

    connect( internalNode.get(), SIGNAL(labelChanged(QString, QString)), this, SLOT(onNodeLabelChanged(QString, QString)) );

    initializeKnobsAnim();

    initializeTableItems();

    // Connect signals/slots to knobs to compute the frame range
    AnimationModulePtr animModel = toAnimationModule(model);
    assert(animModel);

    if (nodeType == eAnimatedItemTypeCommon) {
        // Also connect the lifetime knob
        KnobIntPtr lifeTimeKnob = internalNode->getLifeTimeKnob();
        if (lifeTimeKnob) {
            connect( lifeTimeKnob->getSignalSlotHandler().get(), SIGNAL(mustRefreshKnobGui(ViewSetSpec,DimSpec,ValueChangedReasonEnum)), this, SLOT(onFrameRangeKnobChanged()) );
        }

    } else if (nodeType == eAnimatedItemTypeReader) {
        // The dopesheet view must refresh if the user set some values in the settings panel
        // so we connect some signals/slots
        KnobIPtr lastFrameKnob = internalNode->getKnobByName(kReaderParamNameLastFrame);
        if (!lastFrameKnob) {
            return;
        }
        boost::shared_ptr<KnobSignalSlotHandler> lastFrameKnobHandler =  lastFrameKnob->getSignalSlotHandler();
        assert(lastFrameKnob);
        boost::shared_ptr<KnobSignalSlotHandler> startingTimeKnob = internalNode->getKnobByName(kReaderParamNameStartingTime)->getSignalSlotHandler();
        assert(startingTimeKnob);

        connect( lastFrameKnobHandler.get(), SIGNAL(mustRefreshKnobGui(ViewSetSpec,DimSpec,ValueChangedReasonEnum)), this, SLOT(onFrameRangeKnobChanged()) );

        connect( startingTimeKnob.get(), SIGNAL(mustRefreshKnobGui(ViewSetSpec,DimSpec,ValueChangedReasonEnum)), this, SLOT(onFrameRangeKnobChanged()) );

        // We don't make the connection for the first frame knob, because the
        // starting time is updated when it's modified. Thus we avoid two
        // refreshes of the view.
    } else if (nodeType == eAnimatedItemTypeRetime) {
        boost::shared_ptr<KnobSignalSlotHandler> speedKnob =  internalNode->getKnobByName(kRetimeParamNameSpeed)->getSignalSlotHandler();
        assert(speedKnob);

        connect( speedKnob.get(), SIGNAL(mustRefreshKnobGui(ViewSetSpec,DimSpec,ValueChangedReasonEnum)), this, SLOT(onFrameRangeKnobChanged()) );
    } else if (nodeType == eAnimatedItemTypeTimeOffset) {
        boost::shared_ptr<KnobSignalSlotHandler> timeOffsetKnob =  internalNode->getKnobByName(kReaderParamNameTimeOffset)->getSignalSlotHandler();
        assert(timeOffsetKnob);

        connect( timeOffsetKnob.get(), SIGNAL(mustRefreshKnobGui(ViewSetSpec,DimSpec,ValueChangedReasonEnum)), this, SLOT(onFrameRangeKnobChanged()) );
    } else if (nodeType == eAnimatedItemTypeFrameRange) {
        boost::shared_ptr<KnobSignalSlotHandler> frameRangeKnob =  internalNode->getKnobByName(kFrameRangeParamNameFrameRange)->getSignalSlotHandler();
        assert(frameRangeKnob);

        connect( frameRangeKnob.get(), SIGNAL(mustRefreshKnobGui(ViewSetSpec,DimSpec,ValueChangedReasonEnum)),  this, SLOT(onFrameRangeKnobChanged()) );
    }
    
    refreshFrameRange();

} // initialize