void QgsLayerPropertiesWidget::updateSymbolLayerWidget( QgsSymbolLayerV2* layer )
{
  if ( stackedWidget->currentWidget() != pageDummy )
  {
    // stop updating from the original widget
    disconnect( stackedWidget->currentWidget(), SIGNAL( changed() ), this, SLOT( emitSignalChanged() ) );
    stackedWidget->removeWidget( stackedWidget->currentWidget() );
  }

  QgsSymbolLayerV2Registry* pReg = QgsSymbolLayerV2Registry::instance();

  QString layerType = layer->layerType();
  QgsSymbolLayerV2AbstractMetadata* am = pReg->symbolLayerMetadata( layerType );
  if ( am )
  {
    QgsSymbolLayerV2Widget* w = am->createSymbolLayerWidget( mVectorLayer );
    if ( w )
    {
      w->setExpressionContext( mPresetExpressionContext );
      if ( mMapCanvas )
        w->setMapCanvas( mMapCanvas );
      w->setSymbolLayer( layer );
      stackedWidget->addWidget( w );
      stackedWidget->setCurrentWidget( w );
      // start receiving updates from widget
      connect( w, SIGNAL( changed() ), this, SLOT( emitSignalChanged() ) );
      connect( w, SIGNAL( symbolChanged() ), this, SLOT( reloadLayer() ) );
      return;
    }
  }
  // When anything is not right
  stackedWidget->setCurrentWidget( pageDummy );
}
Esempio n. 2
0
void Asset::update(const graphene::chain::asset_object& asset)
{
   if (asset.id.instance() != id())
      setProperty("id", QVariant::fromValue(asset.id.instance()));
   if (asset.symbol != m_symbol.toStdString()) {
      m_symbol = QString::fromStdString(asset.symbol);
      Q_EMIT symbolChanged();
   }
   if (asset.precision != m_precision) {
      m_precision = asset.precision;
      Q_EMIT precisionChanged();
   }

   if (asset.options.core_exchange_rate != coreExchangeRate)
      coreExchangeRate = asset.options.core_exchange_rate;
}
Esempio n. 3
0
QgsSymbolSelectorWidget::QgsSymbolSelectorWidget( QgsSymbol *symbol, QgsStyle *style, QgsVectorLayer *vl, QWidget *parent )
  : QgsPanelWidget( parent )
  , mVectorLayer( vl )
{
#ifdef Q_OS_MAC
  setWindowModality( Qt::WindowModal );
#endif
  mStyle = style;
  mSymbol = symbol;
  mPresentWidget = nullptr;

  setupUi( this );
  this->layout()->setContentsMargins( 0, 0, 0, 0 );

  // setup icons
  btnAddLayer->setIcon( QIcon( QgsApplication::iconPath( "symbologyAdd.svg" ) ) );
  btnRemoveLayer->setIcon( QIcon( QgsApplication::iconPath( "symbologyRemove.svg" ) ) );
  QIcon iconLock;
  iconLock.addFile( QgsApplication::iconPath( QStringLiteral( "locked.svg" ) ), QSize(), QIcon::Normal, QIcon::On );
  iconLock.addFile( QgsApplication::iconPath( QStringLiteral( "locked.svg" ) ), QSize(), QIcon::Active, QIcon::On );
  iconLock.addFile( QgsApplication::iconPath( QStringLiteral( "unlocked.svg" ) ), QSize(), QIcon::Normal, QIcon::Off );
  iconLock.addFile( QgsApplication::iconPath( QStringLiteral( "unlocked.svg" ) ), QSize(), QIcon::Active, QIcon::Off );
  btnLock->setIcon( iconLock );
  btnDuplicate->setIcon( QIcon( QgsApplication::iconPath( "mActionDuplicateLayer.svg" ) ) );
  btnUp->setIcon( QIcon( QgsApplication::iconPath( "mActionArrowUp.svg" ) ) );
  btnDown->setIcon( QIcon( QgsApplication::iconPath( "mActionArrowDown.svg" ) ) );

  model = new QStandardItemModel( layersTree );
  // Set the symbol
  layersTree->setModel( model );
  layersTree->setHeaderHidden( true );

  //get first feature from layer for previews
  if ( mVectorLayer )
  {
    QgsFeatureIterator it = mVectorLayer->getFeatures( QgsFeatureRequest().setLimit( 1 ) );
    it.nextFeature( mPreviewFeature );
    mPreviewExpressionContext.appendScopes( QgsExpressionContextUtils::globalProjectLayerScopes( mVectorLayer ) );
    mPreviewExpressionContext.setFeature( mPreviewFeature );
  }
  else
  {
    mPreviewExpressionContext.appendScopes( QgsExpressionContextUtils::globalProjectLayerScopes( nullptr ) );
  }

  QItemSelectionModel *selModel = layersTree->selectionModel();
  connect( selModel, &QItemSelectionModel::currentChanged, this, &QgsSymbolSelectorWidget::layerChanged );

  loadSymbol( symbol, static_cast<SymbolLayerItem *>( model->invisibleRootItem() ) );
  updatePreview();

  connect( btnUp, &QAbstractButton::clicked, this, &QgsSymbolSelectorWidget::moveLayerUp );
  connect( btnDown, &QAbstractButton::clicked, this, &QgsSymbolSelectorWidget::moveLayerDown );
  connect( btnAddLayer, &QAbstractButton::clicked, this, &QgsSymbolSelectorWidget::addLayer );
  connect( btnRemoveLayer, &QAbstractButton::clicked, this, &QgsSymbolSelectorWidget::removeLayer );
  connect( btnLock, &QAbstractButton::clicked, this, &QgsSymbolSelectorWidget::lockLayer );
  connect( btnDuplicate, &QAbstractButton::clicked, this, &QgsSymbolSelectorWidget::duplicateLayer );
  connect( this, &QgsSymbolSelectorWidget::symbolModified, this, &QgsPanelWidget::widgetChanged );

  updateUi();

  // set symbol as active item in the tree
  QModelIndex newIndex = layersTree->model()->index( 0, 0 );
  layersTree->setCurrentIndex( newIndex );

  setPanelTitle( tr( "Symbol Selector" ) );

  connect( QgsApplication::svgCache(), &QgsSvgCache::remoteSvgFetched, this, [ = ]
  {
    // when a remote svg has been fetched, update the widget's previews
    // this is required if the symbol utilizes remote svgs, and the current previews
    // have been generated using the temporary "downloading" svg. In this case
    // we require the preview to be regenerated to use the correct fetched
    // svg
    symbolChanged();
    updatePreview();
  } );
}
TesterTestPage::TesterTestPage (QWidget *p) : QWidget (p)
{
  fieldList.append(tr("Open"));
  fieldList.append(tr("Close"));
  fieldList.append(tr("Mid Point"));

  QHBoxLayout *hbox = new QHBoxLayout(this);
  hbox->setMargin(5);
  hbox->setSpacing(10);

  // left side grid

  QGridLayout *grid = new QGridLayout(hbox);
  grid->setColStretch(1, 1);
  grid->setSpacing(5);

  // trades area  

  tradeLong = new QCheckBox(tr("Long"), this);
  grid->addWidget(tradeLong, 0, 0);

  tradeShort = new QCheckBox(tr("Short"), this);
  grid->addWidget(tradeShort, 1, 0);

  QLabel *label = new QLabel(tr("Trade Delay"), this);
  grid->addWidget(label, 2, 0);
    
  tradeDelay = new QSpinBox(1, 999999, 1, this);
  tradeDelay->setValue(1);
  grid->addWidget(tradeDelay, 2, 1);

  grid->setRowSpacing(grid->numRows(), 25);

  // account area

  label = new QLabel(tr("Account Balance"), this);
  grid->addWidget(label, 4, 0);

  account = new QSpinBox(0, 999999, 1, this);
  account->setValue(10000);
  grid->addWidget(account, 4, 1);
  
  label = new QLabel(tr("Futures Margin"), this);
  grid->addWidget(label, 5, 0);

  margin = new QSpinBox(0, 999999, 1, this);
  grid->addWidget(margin, 5, 1);
  
  label = new QLabel(tr("Volume %"), this);
  grid->addWidget(label, 6, 0);

  volumePercent = new QSpinBox(0, 100, 1, this);
  grid->addWidget(volumePercent, 6, 1);

  grid->setRowSpacing(grid->numRows(), 25);

  // commission area

  commissionType = new QCheckBox(tr("Use Commission %"), this);
  grid->addWidget(commissionType, 8, 0);

  label = new QLabel(tr("Entry"), this);
  grid->addWidget(label, 9, 0);

  QDoubleValidator *dv = new QDoubleValidator(0, 99999999.0, 4, this, 0);
  entryCom = new QLineEdit(QString::number(10), this);
  entryCom->setValidator(dv);
  grid->addWidget(entryCom, 9, 1);

  label = new QLabel(tr("Exit"), this);
  grid->addWidget(label, 10, 0);

  QDoubleValidator *dv2 = new QDoubleValidator(0, 99999999.0, 4, this, 0);
  exitCom = new QLineEdit(QString::number(10), this);
  exitCom->setValidator(dv2);
  grid->addWidget(exitCom, 10, 1);

  grid->setRowStretch(grid->numRows() + 1, 1);

  // vline sperarator
  
  QFrame *line = new QFrame(this);
  line->setFrameStyle(QFrame::VLine | QFrame::Plain);
  hbox->addWidget(line);

  // right side grid

  grid = new QGridLayout(hbox);
  grid->setColStretch(1, 1);
  grid->setSpacing(5);

  // test area

  label = new QLabel(tr("Symbol"), this);
  grid->addWidget(label, 0, 0);

  Config config;
  QString s, s2;
  config.getData(Config::DataPath, s);
  symbolButton = new SymbolButton(this, s, s2);
  connect(symbolButton, SIGNAL(symbolChanged()), this, SLOT(symbolButtonPressed()));
  grid->addWidget(symbolButton, 0, 1);
  
  label = new QLabel(tr("Bar Length"), this);
  grid->addWidget(label, 1, 0);
  
  BarData bd(s);
  barLength = new QComboBox(this);
  bd.getBarLengthList(barLengthList);
  barLength->insertStringList(barLengthList, -1);
  barLength->setCurrentItem(6);
  grid->addWidget(barLength, 1, 1);

  label = new QLabel(tr("Bars"), this);
  grid->addWidget(label, 2, 0);
  
  bars = new QSpinBox(1, 99999999, 1, this);
  bars->setValue(275);
  grid->addWidget(bars, 2, 1);

  label = new QLabel(tr("Entry/Exit Price"), this);
  grid->addWidget(label, 3, 0);
  
  priceField = new QComboBox(this);
  priceField->insertStringList(fieldList,-1);
  grid->addWidget(priceField, 3, 1);

  grid->setRowStretch(grid->numRows() + 1, 1);
}
Esempio n. 5
0
MainWindow::MainWindow(QWidget* parent)
		: QMainWindow(parent)
		, config_()
		, model_()
		, synthesis_(new Synthesis)
		, ui_(new Ui::MainWindow)
		, dataEntryWindow_(new DataEntryWindow)
		, intonationWindow_(new IntonationWindow)
		, intonationParametersWindow_(new IntonationParametersWindow)
		, postureEditorWindow_(new PostureEditorWindow)
		, prototypeManagerWindow_(new PrototypeManagerWindow)
		, specialTransitionEditorWindow_(new TransitionEditorWindow)
		, ruleManagerWindow_(new RuleManagerWindow)
		, ruleTesterWindow_(new RuleTesterWindow)
		, synthesisWindow_(new SynthesisWindow)
		, transitionEditorWindow_(new TransitionEditorWindow)
{
	ui_->setupUi(this);

	ui_->logTextEdit->setMaximumBlockCount(MAX_LOG_BLOCK_COUNT);
	specialTransitionEditorWindow_->setSpecial();

	connect(ui_->quitAction, SIGNAL(triggered()), qApp, SLOT(closeAllWindows()));
	connect(ui_->aboutAction, SIGNAL(triggered()), this, SLOT(about()));

	coutStreamBuffer_.reset(new LogStreamBuffer(std::cout, false, ui_->logTextEdit));
	cerrStreamBuffer_.reset(new LogStreamBuffer(std::cerr, true, ui_->logTextEdit));
	LogStreamBuffer::registerQDebugMessageHandler();

	connect(prototypeManagerWindow_.get(), SIGNAL(editTransitionButtonClicked(unsigned int, unsigned int)),
		transitionEditorWindow_.get(), SLOT(handleEditTransitionButtonClicked(unsigned int, unsigned int)));

	connect(prototypeManagerWindow_.get(), SIGNAL(editSpecialTransitionButtonClicked(unsigned int, unsigned int)),
		specialTransitionEditorWindow_.get(), SLOT(handleEditTransitionButtonClicked(unsigned int, unsigned int)));

	connect(dataEntryWindow_.get(), SIGNAL(categoryChanged()) , postureEditorWindow_.get(), SLOT(unselectPosture()));
	connect(dataEntryWindow_.get(), SIGNAL(parameterChanged()), postureEditorWindow_.get(), SLOT(unselectPosture()));
	connect(dataEntryWindow_.get(), SIGNAL(symbolChanged())   , postureEditorWindow_.get(), SLOT(unselectPosture()));

	connect(dataEntryWindow_.get(), SIGNAL(parameterChanged()), ruleManagerWindow_.get(), SLOT(loadRuleData()));
	connect(dataEntryWindow_.get(), SIGNAL(parameterChanged()), synthesisWindow_.get(), SLOT(setupParameterTable()));

	connect(postureEditorWindow_.get(), SIGNAL(postureChanged()), ruleManagerWindow_.get(), SLOT(unselectRule()));
	connect(postureEditorWindow_.get(), SIGNAL(postureCategoryChanged()), dataEntryWindow_.get(), SLOT(updateCategoriesTable()));

	connect(prototypeManagerWindow_.get(), SIGNAL(equationChanged()), transitionEditorWindow_.get(), SLOT(updateEquationsTree()));
	connect(prototypeManagerWindow_.get(), SIGNAL(equationChanged()), transitionEditorWindow_.get(), SLOT(updateTransition()));
	connect(prototypeManagerWindow_.get(), SIGNAL(equationChanged()), specialTransitionEditorWindow_.get(), SLOT(updateEquationsTree()));
	connect(prototypeManagerWindow_.get(), SIGNAL(equationChanged()), specialTransitionEditorWindow_.get(), SLOT(updateTransition()));
	connect(prototypeManagerWindow_.get(), SIGNAL(equationChanged()), ruleManagerWindow_.get(), SLOT(setupRuleSymbolEquationsTable()));
	connect(prototypeManagerWindow_.get(), SIGNAL(equationChanged()), ruleManagerWindow_.get(), SLOT(setupEquationsTree()));

	connect(prototypeManagerWindow_.get(), SIGNAL(transitionChanged()), transitionEditorWindow_.get(), SLOT(clear()));
	connect(prototypeManagerWindow_.get(), SIGNAL(transitionChanged()), ruleManagerWindow_.get(), SLOT(setupRuleTransitionsTable()));
	connect(prototypeManagerWindow_.get(), SIGNAL(transitionChanged()), ruleManagerWindow_.get(), SLOT(setupTransitionsTree()));

	connect(prototypeManagerWindow_.get(), SIGNAL(specialTransitionChanged()), specialTransitionEditorWindow_.get(), SLOT(clear()));
	connect(prototypeManagerWindow_.get(), SIGNAL(specialTransitionChanged()), ruleManagerWindow_.get(), SLOT(setupRuleSpecialTransitionsTable()));
	connect(prototypeManagerWindow_.get(), SIGNAL(specialTransitionChanged()), ruleManagerWindow_.get(), SLOT(setupSpecialTransitionsTree()));

	connect(transitionEditorWindow_.get(), SIGNAL(equationReferenceChanged()), prototypeManagerWindow_.get(), SLOT(setupEquationsTree()));
	connect(transitionEditorWindow_.get(), SIGNAL(transitionChanged()),        prototypeManagerWindow_.get(), SLOT(unselectTransition()));

	connect(specialTransitionEditorWindow_.get(), SIGNAL(equationReferenceChanged()), prototypeManagerWindow_.get(), SLOT(setupEquationsTree()));
	connect(specialTransitionEditorWindow_.get(), SIGNAL(transitionChanged()),        prototypeManagerWindow_.get(), SLOT(unselectSpecialTransition()));

	connect(ruleManagerWindow_.get(), SIGNAL(categoryReferenceChanged()), dataEntryWindow_.get(), SLOT(updateCategoriesTable()));

	connect(ruleManagerWindow_.get(), SIGNAL(transitionReferenceChanged())       , prototypeManagerWindow_.get(), SLOT(setupTransitionsTree()));
	connect(ruleManagerWindow_.get(), SIGNAL(specialTransitionReferenceChanged()), prototypeManagerWindow_.get(), SLOT(setupSpecialTransitionsTree()));
	connect(ruleManagerWindow_.get(), SIGNAL(equationReferenceChanged())         , prototypeManagerWindow_.get(), SLOT(setupEquationsTree()));

	connect(synthesisWindow_.get(), SIGNAL(textSynthesized()), intonationWindow_.get(), SLOT(loadIntonationFromEventList()));
	connect(synthesisWindow_.get(), SIGNAL(audioStarted()), intonationWindow_.get(), SLOT(handleAudioStarted()));
	connect(synthesisWindow_.get(), SIGNAL(audioFinished()), intonationWindow_.get(), SLOT(handleAudioFinished()));
	connect(synthesisWindow_.get(), SIGNAL(synthesisFinished()), intonationWindow_.get(), SLOT(handleSynthesisFinished()));
	connect(intonationWindow_.get(), SIGNAL(synthesisRequested()), synthesisWindow_.get(), SLOT(synthesizeWithManualIntonation()));
	connect(intonationWindow_.get(), SIGNAL(synthesisToFileRequested(QString)), synthesisWindow_.get(), SLOT(synthesizeToFileWithManualIntonation(QString)));
}