Exemple #1
0
PythonBrowserView::PythonBrowserView(PythonEngine *pythonEngine, PythonScriptingConsole *console, QWidget *parent)
    : QDockWidget(tr("Browser"), parent), pythonEngine(pythonEngine), console(console)
{
    setMinimumWidth(280);
    setObjectName("BrowserView");

    connect(pythonEngine, SIGNAL(executedExpression()), this, SLOT(executed()));
    connect(pythonEngine, SIGNAL(executedScript()), this, SLOT(executed()));

    trvBrowser = new QTreeWidget(this);
    trvBrowser->setContextMenuPolicy(Qt::CustomContextMenu);
    trvBrowser->setColumnCount(3);
    trvBrowser->setIndentation(18);
    trvBrowser->setColumnWidth(0, 200);
    trvBrowser->setColumnWidth(0, 200);

    QStringList headers;
    headers << tr("Name") << tr("Type") << tr("Value");
    trvBrowser->setHeaderLabels(headers);

    trvVariables = NULL;
    trvFunctions = NULL;
    trvClasses = NULL;
    trvOther = NULL;

    variableExpanded = true;
    functionExpanded = true;
    classExpanded = true;
    otherExpanded = false;

    executed();
    trvBrowser->sortItems(0, Qt::AscendingOrder);

    connect(trvBrowser, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), this, SLOT(executeCommand(QTreeWidgetItem *, int)));
    connect(trvBrowser, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(doContextMenu(const QPoint &)));

    actCopyName = new QAction(icon(""), tr("Copy name"), this);
    connect(actCopyName, SIGNAL(triggered()), this, SLOT(copyName()));

    actCopyValue = new QAction(icon(""), tr("Copy value"), this);
    connect(actCopyValue, SIGNAL(triggered()), this, SLOT(copyValue()));

    actDelete = new QAction(icon(""), tr("&Delete"), this);
    connect(actDelete, SIGNAL(triggered()), this, SLOT(deleteVariable()));

    mnuContext = new QMenu(trvBrowser);
    mnuContext->addAction(actCopyName);
    mnuContext->addAction(actCopyValue);
    mnuContext->addSeparator();
    mnuContext->addAction(actDelete);

    setWidget(trvBrowser);
}
void CardView::contentsMouseReleaseEvent( QMouseEvent *e )
{
  Q3ScrollView::contentsMouseReleaseEvent( e );

  if ( d->mResizeAnchor && d->mSpan ) {
    unsetCursor();
    // hide rubber bands
    int newiw = d->mItemWidth - ((d->mResizeAnchor - d->mRubberBandAnchor) / d->mSpan);
    drawRubberBands( 0 );
    // we should move to reflect the new position if we are scrolled.
    if ( contentsX() ) {
      int newX = qMax( 0, ( d->mPressed * ( newiw + d->mColspace + d->mSepWidth ) ) - e->x() );
      setContentsPos( newX, contentsY() );
    }
    // set new item width
    setItemWidth( newiw );
    // reset anchors
    d->mResizeAnchor = 0;
    d->mRubberBandAnchor = 0;
    return;
  }

  // If there are accel keys, we will not emit signals
  if ( (e->modifiers() & Qt::ShiftModifier) || (e->modifiers() & Qt::ControlModifier) )
    return;

  // Get the item at this position
  CardViewItem *item = itemAt( e->pos() );

  if ( item && KGlobalSettings::singleClick() )
    emit executed( item );
}
Exemple #3
0
void QuickButton::launch()
{
   setDown(false);
   repaint();
   KIconEffect::visualActivate(this, rect());
   _qurl->run();
   emit executed(_qurl->menuId());
}
AMActionHistoryModel3::AMActionHistoryModel3(AMDatabase *db, QObject *parent) : QAbstractItemModel(parent)
{
	db_ = db;
	actionLogTableName_ = AMDbObjectSupport::s()->tableNameForClass<AMActionLog3>();
	visibleActionsCount_ = 0;
	maximumActionsLimit_ = 100;

	connect(&refreshFunctionCall_, SIGNAL(executed()), this, SLOT(refreshFromDb()));
	connect(&specificRefreshFunctionCall_, SIGNAL(executed()), this, SLOT(refreshSpecificIds()));

	itemTreeRoot_ = new AMPointerTreeNode(0, 0, this);
	itemTree_ = new AMPointerTree(itemTreeRoot_, this);

	succeededIcon_ = QPixmap(":/22x22/greenCheck.png");
	cancelledIcon_ = QPixmap(":/22x22/orangeX.png");
	failedIcon_ = QPixmap(":/22x22/redCrash.png");
	unknownIcon_ = QPixmap(":/22x22/dialog-question.png");
}
Exemple #5
0
void SettingsDialog::on_pbPosition_clicked()
{
  QScopedPointer< Gui::Dialog > dialog(new Gui::Dialog(Gui::Dialog::CenterOfScreen,this));
  PositionModel *model = new PositionModel(dialog.data());
  QTableView *view = new QTableView(dialog.data());
  QItemSelectionModel *selectionModel = new QItemSelectionModel(model,dialog.data());

  dialog->setWindowTitle(tr("Set position"));

  QVBoxLayout *layout = new QVBoxLayout;
  QDialogButtonBox *dialogButtons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel,
                                                         Qt::Horizontal,dialog.data());
  connect(dialogButtons,SIGNAL(accepted()),dialog.data(),SLOT(accept()));
  connect(dialogButtons,SIGNAL(rejected()),dialog.data(),SLOT(reject()));

  view->setModel(model);
  view->setItemDelegateForColumn(0,new PositionLabelDelegate);
  view->setItemDelegateForColumn(1,new PositionDelegate(QApplication::palette()));
  view->setSelectionBehavior(QAbstractItemView::SelectRows);
  view->setSelectionMode(QAbstractItemView::SingleSelection);
  view->setSelectionModel(selectionModel);
  view->verticalHeader()->setVisible(false);
  view->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
  view->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel);
  view->setEditTriggers(QAbstractItemView::NoEditTriggers);

  layout->addWidget(view);
  layout->addWidget(dialogButtons);
  dialog->setLayout(layout);
  dialog->resize(700,500);
  connect(dialog.data(),SIGNAL(executed()),view,SLOT(resizeColumnsToContents()));
  connect(dialog.data(),SIGNAL(executed()),view,SLOT(resizeRowsToContents()));

  selectionModel->select(model->index(pbPosition->property("wallPosition").toInt(),0),
                         QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows);
  view->scrollTo(model->index(pbPosition->property("wallPosition").toInt(),0));
  if (dialog->exec() == QDialog::Accepted)
  {
    Wally::Application::Position p = static_cast<Wally::Application::Position> (selectionModel->currentIndex().row());
    pbPosition->setProperty("wallPosition",static_cast<int> (p));
    pbPosition->setText(positionToString(p).replace("&","&&"));
    settingsModified();
  }
}
Exemple #6
0
QuickButton* QuickLauncher::createButton(TQString url)
{
    QuickButton* newButton=new QuickButton(url, m_configAction, this);
    connect(newButton, TQT_SIGNAL(executed(TQString)), 
            this, TQT_SLOT(slotOwnServiceExecuted(TQString)));
    connect(newButton, TQT_SIGNAL(stickyToggled(bool)), 
            this, TQT_SLOT(slotStickyToggled()));
    newButton->setPopupDirection(popupDirection());
    return newButton;
}
void QgsProcessingAlgRunnerTask::finished( bool result )
{
  Q_UNUSED( result );
  QVariantMap ppResults;
  if ( result )
  {
    ppResults = mAlgorithm->postProcess( mContext, mFeedback );
  }
  emit executed( result, !ppResults.isEmpty() ? ppResults : mResults );
}
Exemple #8
0
void FUSCOORELoad::performed(DInst *dinst) {
  //printf("DEBUG: calling ScooreLoad::performed\n");
  /* memory operation was globally performed {{{1 */
  if (dinst->isExecuted()) {
    // In-order RETIRE OPERATION
    dinst->markPerformed();
  }else{
    // Out-of-order EXECUTE OPERATION
    executed(dinst);
  }
}
Exemple #9
0
 commandstruct::commandstruct(guidtype gid, indx tgid, indx grp, num64 val_b,
         num64 val_s, guidtype clid, tagtype tp) {
     guid_ = static_cast<unum64> (gid);
     tagid_ = static_cast<num64> (tgid);
     type(tp);
     clientid(clid);
     executed(false);
     group(grp);
     value_before<num64 > (val_b);
     value_set<num64 > (val_s);
     istext(false);
 }
Exemple #10
0
 commandstruct::commandstruct(guidtype gid, indx tgid, indx grp, const std::string& vl,
         guidtype clid) {
     guid_ = static_cast<unum64> (gid);
     tagid_ = static_cast<num64> (tgid);
     clientid(clid);
     type(TYPE_TEXT);
     executed(false);
     group(grp);
     value_before<num64 > (0);
     value_set<num64 > (0);
     strvalue(vl);
     istext(true);
 }
Exemple #11
0
bool AMDeferredFunctionCall::event(QEvent *e) {
	if(e->type() == eventType_) {
		e->accept();
		if(scheduled_) {
			scheduled_ = false;
			emit executed();
			execute();
		}
		return true;
	}
	else
		return false;
}
void CardView::contentsMouseDoubleClickEvent( QMouseEvent *e )
{
  Q3ScrollView::contentsMouseDoubleClickEvent( e );

  CardViewItem *item = itemAt( e->pos() );

  if ( item )
    d->mCurrentItem = item;

  if ( item && !KGlobalSettings::singleClick() )
    emit executed(item);

  emit doubleClicked( item );
}
void SynchronousJobDispatcher::execute() {
    AbstractAction *lastAction = dynamic_cast<AbstractAction*>(sender());
    if (lastAction) {
        disconnect(lastAction, SIGNAL(executed()), this, SLOT(execute()));
        if (!lastAction->successful()) {
            debug() << "Action" << lastAction->metaObject()->className() << "did not succeed";
            m_actions.clear();
            emit finished();
            return;
        }
    }

    if (m_actions.isEmpty()) {
        emit finished();
        return;
    }

    AbstractAction *action = m_actions.dequeue();
    connect(action, SIGNAL(executed()), this, SLOT(execute()));

    debug() << "Running action" << action->metaObject()->className();

    action->run();
}
REIXSXESImageInterpolationAB::REIXSXESImageInterpolationAB(const QString &outputName, QObject *parent) :
	AMStandardAnalysisBlock(outputName, parent)
{
	// Live correlation turned off by default. Prevents correlation while loading from db and no shift is really better than a random shift, initially.
	liveCorrelation_ = false;

	curve1Smoother_ = 0;
	curve2Smoother_ = 0;

	sumRangeMinY_ = 10;
	sumRangeMaxY_ = 53;
	sumRangeMinX_ = 75;
	sumRangeMaxX_ = 925;
	rangeRound_ = 0.6;
	curve2Disabled_ = false;
	correlation1CenterPx_ = 250;
	correlation2CenterPx_ = 700;
	correlation1HalfWidth_ = 40;
	correlation2HalfWidth_ = 40;
	setCorrelation1Smoothing(QPair<int,int>(3,5)); //poly,quadratic
	setCorrelation2Smoothing(QPair<int,int>(3,5)); //poly,quadratic

	energyCalibrationOffset_ = 0;
	tiltCalibrationOffset_ = 0;

	interpolationLevel_ = 10;
	binningLevel_ = 2;

	inputSource_ = 0;
	cacheUpdateRequired_ = false;
	cachedDataRange_ = AMRange();
	axisValueCacheInvalid_ = true;
	axisValuesInvalid_ = false;

	// leave sources_ empty for now.

	axes_ << AMAxisInfo("invalid", 0, "No input data");
	connect(&callCorrelation_, SIGNAL(executed()), this, SLOT(correlateNow()));
	setDescription("XES Interpolated Spectrum");

	// shift values can start out empty.
	shiftValues1_ << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0;
	shiftValues2_ << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0;

}
Exemple #15
0
void vmMarkov::start() {

	if ( machineWorking )
		return;

	if ( ! execConnected ) {
		connect(machine, SIGNAL(executed()), this, SLOT(stopExecuting()));
		execConnected = true;
	}

	if ( ! startConnected ) {
		connect(machine, SIGNAL(started()), this, SLOT(startExecuting()));
		startConnected = true;
	}

	machineWorking = true;

}
AMSamplePlatePre2013Selector::AMSamplePlatePre2013Selector(AMSamplePlatePre2013* sourcePlate, QWidget *parent)
	: QWidget(parent) {

	samplePlateTableName_ = AMDbObjectSupport::s()->tableNameForClass<AMSamplePlatePre2013>();
	// Either use an external plate (if specified in sourcePlate), or make an internal one.
	plate_ = sourcePlate ? sourcePlate : new AMSamplePlatePre2013(this);

	setupUi();
	notesEditor->setObjectName("notesEditor");
	notesEditor->setStyleSheet("#notesEditor { background-image: url(:/notepadBackground.png); font: bold 15px \"Marker Felt\";}");

	AMDetailedItemDelegate* del = new AMDetailedItemDelegate(this);
	// Setting a new view fixes a grayed-menu-background drawing bug on mac
	QListView* lview = new QListView(this);
	lview->setItemDelegate(del);
	lview->setAlternatingRowColors(true);
	plateComboBox->setView(lview);

	notesEditor->setMaximumHeight(80);
	this->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);

	connect(&plateRefreshScheduler_, SIGNAL(executed()), this, SLOT(populateSamplePlates()));
	plateRefreshScheduler_.schedule();

	onSamplePlateChanged(/*plate_->valid()*/);

	connect(AMDatabase::database("user"), SIGNAL(updated(QString,int)), this, SLOT(onDatabaseUpdated(QString,int)), Qt::QueuedConnection);
	connect(AMDatabase::database("user"), SIGNAL(created(QString,int)), this, SLOT(onDatabaseCreated(QString,int)), Qt::QueuedConnection);
	connect(AMDatabase::database("user"), SIGNAL(removed(QString,int)), this, SLOT(onDatabaseRemoved(QString,int)), Qt::QueuedConnection);

	// GUI event connections
	connect(plateComboBox, SIGNAL(activated(int)), this, SLOT(onComboBoxActivated(int)));
	connect(nameEdit, SIGNAL(textEdited(QString)), this, SLOT(onNameEdited(QString)));
	connect(nameEdit, SIGNAL(editingFinished()), this, SLOT(onPlateEditingFinished()));
	connect(notesEditor, SIGNAL(textChanged()), this, SLOT(onNotesEdited()));
	connect(notesEditor, SIGNAL(editingFinished(int)), this, SLOT(onPlateEditingFinished()));

	notesHeaderButton->setChecked(false);
	notesEditor->setVisible(false);
	connect(notesHeaderButton, SIGNAL(clicked(bool)), notesEditor, SLOT(setVisible(bool)));

	// when our current sample plate is re-loaded out of the database, respond to update the GUI values
	connect(plate_, SIGNAL(loadedFromDb()), this, SLOT(onSamplePlateChanged()), Qt::QueuedConnection);
}
Exemple #17
0
AM3dDataSourceView::AM3dDataSourceView(const AMScan* scan, int dataSourceIndex, QWidget *parent) :
	QWidget(parent)
{
	QVBoxLayout* vl = new QVBoxLayout();

	surfacePlot_ = new Qwt3D::SurfacePlot();
	surfacePlot_->setPlotStyle(Qwt3D::FILLEDMESH);
	surfacePlot_->setShading(Qwt3D::GOURAUD);

	surfacePlot_->enableLighting();
	surfacePlot_->illuminate(0);
	surfacePlot_->setLightShift(23,23,23);
	surfacePlot_->setLightRotation(90,0,0);

	surfacePlot_->setRotation(30,0,15);
	surfacePlot_->setZoom(0.90);


	QGLColormap colors;
	colors.setEntry(0, qRgb(0, 0, 131));
	colors.setEntry(1, qRgb(0, 0, 255));
	colors.setEntry(2, qRgb(0, 255, 255));
	colors.setEntry(3, qRgb(255, 255, 0));
	colors.setEntry(4, qRgb(255, 0, 0));
	colors.setEntry(5, qRgb(128, 0, 0));

	surfacePlot_->setColormap(colors);
	surfacePlot_->setResolution(4);
	vl->addWidget(surfacePlot_);

	setLayout(vl);

	if(scan && scan->dataSourceCount() > dataSourceIndex && scan->dataSourceAt(dataSourceIndex)->rank() == 2) {
		scan_ = scan;
		dataSourceIndex_ = dataSourceIndex;
		updatePlotScheduler_.schedule();
	}
	else {
		scan_ = 0;
		dataSourceIndex_ = 0;
	}

	connect(&updatePlotScheduler_, SIGNAL(executed()), this, SLOT(updatePlotFromDataSource()));
}
Exemple #18
0
void vmMarkov::terminate() {

	if ( execConnected ) {
		disconnect(machine, SIGNAL(executed()), this, SLOT(stopExecuting()));
		execConnected = false;
	}

	if ( startConnected ) {
		disconnect(machine, SIGNAL(started()), this, SLOT(startExecuting()));
		startConnected = false;
	}

	machineWorking = false;
	memory = QString();
	log->clear();

	if ( win != NULL )
		win->hide();

}
void NormalDeclarationCompletionItem::execute(KTextEditor::Document* document, const KTextEditor::Range& word) {

  if( m_completionContext && m_completionContext->depth() != 0 )
    return; //Do not replace any text when it is an argument-hint

  QString newText;

  {
    KDevelop::DUChainReadLocker lock(KDevelop::DUChain::lock());
    if(m_declaration) {
      newText = declarationName();
    } else {
      kDebug() << "Declaration disappeared";
      return;
    }
  }

  document->replaceText(word, newText);
  
  executed(document, word);
}
void NormalDeclarationCompletionItem::execute(KTextEditor::View* view, const KTextEditor::Range& word) {

    if( m_completionContext && m_completionContext->depth() != 0 )
        return; //Do not replace any text when it is an argument-hint

    KTextEditor::Document* document = view->document();
    QString newText;

    {
        KDevelop::DUChainReadLocker lock(KDevelop::DUChain::lock());
        if(m_declaration) {
            newText = declarationName();
        } else {
            qCDebug(LANGUAGE) << "Declaration disappeared";
            return;
        }
    }

    document->replaceText(word, newText);
    KTextEditor::Range newRange = word;
    newRange.setEnd(KTextEditor::Cursor(newRange.end().line(), newRange.start().column() + newText.length()));

    executed(view, newRange);
}
void DocumentationGeneratorAction::execute()
{
    // yes, it's duplicate from the doc file widget, but it's too painful to share it
    QString path = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/" + "kdevpythonsupport/documentation_files/";
    QDir dir(path);
    dir.mkpath(path);
    auto wizard = new DocfileWizard(path);
    wizard->setModuleName(module);
    wizard->setModal(true);
    wizard->setAttribute(Qt::WA_DeleteOnClose);
    wizard->show();
    QObject::connect(wizard, &QDialog::accepted,
        [wizard, this]() {
            if ( ! wizard->wasSavedAs().isNull() ) {
                ICore::self()->documentController()->openDocument(QUrl::fromLocalFile(wizard->wasSavedAs()));
                // force a recursive update of the context, so that all the imports are reparsed too
                // (since they potentially have changed through this action)
                ICore::self()->languageController()->backgroundParser()->addDocument(document, TopDUContext::ForceUpdateRecursive);
            }
        }
    );

    emit executed(this);
}
Exemple #22
0
/*!
    \fn PDS::ProtocolComponent::emitExecuted()
 */
void PDS::ProtocolComponent::emitExecuted(){
	executed_ = true;
	executionTime = QDateTime::currentDateTime();
	emit executed();
	emit executed(this);
}
/*!

 */
void
MonitorMoveDialog::sendCommand()
{
    const bool reverse = Options::instance().reverseSide();

    {
        if ( M_free_kick_left_rb->isChecked() )
        {
            M_trainer_data.setPlayMode( reverse
                                        ? rcsc::PM_FreeKick_Right
                                        : rcsc::PM_FreeKick_Left );
        }
        else if ( M_free_kick_right_rb->isChecked() )
        {
            M_trainer_data.setPlayMode( reverse
                                        ? rcsc::PM_FreeKick_Left
                                        : rcsc::PM_FreeKick_Right );
        }
        else
        {
            M_trainer_data.setPlayMode( rcsc::PM_Drop_Ball );
        }
     }

    // ball
    {
        bool ok = false;
        rcsc::Vector2D pos( 0.0, 0.0 );
        rcsc::Vector2D vel( rcsc::Vector2D::INVALIDATED );

        if ( M_ball_cb->isChecked() )
        {
            pos.x = M_ball_x->text().toDouble( &ok );
            if ( ok ) pos.y = M_ball_y->text().toDouble( &ok );

            if ( ok
                 && M_ball_vel_cb->isChecked() )
            {
                vel.x = M_ball_vx->text().toDouble( &ok );
                if ( ok ) vel.y = M_ball_vy->text().toDouble( &ok );
            }
        }

        if ( ok )
        {
            if ( reverse )
            {
                pos *= -1.0;
                if ( vel.isValid() ) vel *= -1.0;
            }
            M_trainer_data.setBall( pos, vel );
        }
        else
        {
            M_trainer_data.setBall( rcsc::Vector2D::INVALIDATED );
        }
    }

    // left
    rcsc::SideID side = ( reverse
                          ? rcsc::RIGHT
                          : rcsc::LEFT );
    for ( int i = 0; i < 11; ++i )
    {
        bool ok = false;
        rcsc::Vector2D pos;
        double body = 0.0;

        if ( M_left_cb[i]->isChecked() )
        {
            pos.x = M_left_x[i]->text().toDouble( &ok );
            if ( ok ) pos.y = M_left_y[i]->text().toDouble( &ok );
            if ( ok ) body = M_left_body[i]->text().toDouble( &ok );
        }

        if ( ok )
        {
            if ( reverse )
            {
                pos *= -1.0;
                body += 180.0;
            }
            M_trainer_data.setPlayer( side, i + 1,
                                      pos, body );
        }
        else
        {
            M_trainer_data.setPlayer( side, i + 1,
                                      rcsc::Vector2D::INVALIDATED, body );
        }
    }

    // right
    side = ( reverse
             ? rcsc::LEFT
             : rcsc::RIGHT );
    for ( int i = 0; i < 11; ++i )
    {
        bool ok = false;
        rcsc::Vector2D pos;
        double body = 0.0;

        if ( M_right_cb[i]->isChecked() )
        {
            pos.x = M_right_x[i]->text().toDouble( &ok );
            if ( ok ) pos.y = M_right_y[i]->text().toDouble( &ok );
            if ( ok ) body = M_right_body[i]->text().toDouble( &ok );
        }

        if ( ok )
        {
            if ( reverse )
            {
                pos *= -1.0;
                body += 180.0;
            }
            M_trainer_data.setPlayer( side, i + 1,
                                      pos, body );
        }
        else
        {
            M_trainer_data.setPlayer( side, i + 1,
                                      rcsc::Vector2D::INVALIDATED, body );
        }
    }

    emit executed();
}
Exemple #24
0
 void commandstruct::reset_commandstruct(num64 val_s, guidtype clid) {
     value_set<num64 > (val_s);
     istext(false);
     if (clid != NULL_CLIENT) clientid(clid);
     executed(false);
 }
/* ---------------------------- */
static void
dissect_nasdaq_itch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
    proto_item *ti;
    proto_tree *nasdaq_itch_tree = NULL;
    guint8 nasdaq_itch_type;
    int  offset = 0;
    gint col_info;
    int version = 3;
    int big = 0;

    col_info = PINFO_COL(pinfo);

    col_set_str(pinfo->cinfo, COL_PROTOCOL, "Nasdaq-ITCH");

    nasdaq_itch_type = tvb_get_guint8(tvb, offset);
    if (nasdaq_itch_type >= '0' && nasdaq_itch_type <= '9') {
        version = 2;
        nasdaq_itch_type = tvb_get_guint8(tvb, offset +8);
    }

    if ((!nasdaq_itch_chi_x || version == 3) && strchr(chix_msg, nasdaq_itch_type)) {
        nasdaq_itch_type = 0; /* unknown */
    }
    if (col_info || tree) {
        const gchar *rep = val_to_str(nasdaq_itch_type, message_types_val, "Unknown packet type (0x%02x) ");
        if (col_info ) {
            col_clear(pinfo->cinfo, COL_INFO);
            col_add_str(pinfo->cinfo, COL_INFO, rep);
        }
        if (tree) {
            proto_item *item;

            ti = proto_tree_add_protocol_format(tree, proto_nasdaq_itch, tvb, offset, -1, "Nasdaq TotalView-ITCH %s, %s",
                    version == 2?"2.0":"3.0", rep);

            nasdaq_itch_tree = proto_item_add_subtree(ti, ett_nasdaq_itch);

            item=proto_tree_add_uint(nasdaq_itch_tree, hf_nasdaq_itch_version, tvb, 0, 0, version);
            PROTO_ITEM_SET_GENERATED(item);
        }
    }

    if (version == 2) {
        offset = time_stamp (tvb, nasdaq_itch_tree, hf_nasdaq_itch_millisecond, offset, 8);
    }

    proto_tree_add_item(nasdaq_itch_tree, hf_nasdaq_itch_message_type, tvb, offset, 1, ENC_BIG_ENDIAN);
    offset++;

    if (version == 3) {
      switch (nasdaq_itch_type) {
      case 'T': /* seconds */
          offset = time_stamp (tvb, nasdaq_itch_tree, hf_nasdaq_itch_second, offset, 5);
          return;

      case 'M': /* milliseconds */
          offset = time_stamp (tvb, nasdaq_itch_tree, hf_nasdaq_itch_millisecond, offset, 3);
          return;
      }
    }

    switch (nasdaq_itch_type) {
    case 'S': /* system event */
        proto_tree_add_item(nasdaq_itch_tree, hf_nasdaq_itch_system_event, tvb, offset, 1, ENC_BIG_ENDIAN);
        offset++;
        break;

    case 'R': /* Stock Directory */
        offset = stock(tvb, pinfo, nasdaq_itch_tree, offset);

        proto_tree_add_item(nasdaq_itch_tree, hf_nasdaq_itch_market_category, tvb, offset, 1, ENC_BIG_ENDIAN);
        offset += 1;
        proto_tree_add_item(nasdaq_itch_tree, hf_nasdaq_itch_financial_status, tvb, offset, 1, ENC_BIG_ENDIAN);
        offset += 1;
        proto_tree_add_item(nasdaq_itch_tree, hf_nasdaq_itch_round_lot_size, tvb, offset, 6, ENC_ASCII|ENC_NA);
        offset += 6;
        proto_tree_add_item(nasdaq_itch_tree, hf_nasdaq_itch_round_lots_only, tvb, offset, 1, ENC_BIG_ENDIAN);
        offset += 1;
        break;

    case 'H': /* Stock trading action */
        offset = stock(tvb, pinfo, nasdaq_itch_tree, offset);

        proto_tree_add_item(nasdaq_itch_tree, hf_nasdaq_itch_trading_state, tvb, offset, 1, ENC_ASCII|ENC_NA);
        offset += 1;
        proto_tree_add_item(nasdaq_itch_tree, hf_nasdaq_itch_reserved, tvb, offset, 1, ENC_ASCII|ENC_NA);
        offset += 1;
        proto_tree_add_item(nasdaq_itch_tree, hf_nasdaq_itch_reason, tvb, offset, 4, ENC_ASCII|ENC_NA);
        offset += 4;
        break;

    case 'a' :
        big = 1;
    case 'A': /* Add order, no MPID */
        offset = order(tvb, pinfo, nasdaq_itch_tree, offset, big);
        if (version == 2) {
            proto_tree_add_item(nasdaq_itch_tree, hf_nasdaq_itch_printable, tvb, offset, 1, ENC_ASCII|ENC_NA);
            offset += 1;
        }
        break;

    case 'F': /* Add order, MPID */
        offset = order(tvb, pinfo, nasdaq_itch_tree, offset, big);
        proto_tree_add_item(nasdaq_itch_tree, hf_nasdaq_itch_attribution, tvb, offset, 4, ENC_ASCII|ENC_NA);
        offset += 4;
        break;

    case 'e' :
        big = 1;
    case 'E' : /* Order executed */
        offset = executed(tvb, pinfo, nasdaq_itch_tree, offset, big);
        break;

    case 'C' : /* Order executed with price */
        offset = executed(tvb, pinfo, nasdaq_itch_tree, offset, big);
        proto_tree_add_item(nasdaq_itch_tree, hf_nasdaq_itch_printable, tvb, offset, 1, ENC_ASCII|ENC_NA);
        offset += 1;

        offset = price(tvb, pinfo, nasdaq_itch_tree, hf_nasdaq_itch_execution_price, offset, big);
        break;

    case 'x' :
        big = 1;
    case 'X' : /* Order cancel */
        offset = order_ref_number(tvb, pinfo, nasdaq_itch_tree, offset);
        offset = number_of_shares(tvb, pinfo, nasdaq_itch_tree, hf_nasdaq_itch_canceled, offset, big);
        break;

    case 'D' : /* Order delete */
        offset = order_ref_number(tvb, pinfo, nasdaq_itch_tree, offset);
        offset += 9;
        break;

    case 'p' :
        big = 1;
    case 'P' : /* Trade identifier */
        offset = order(tvb, pinfo, nasdaq_itch_tree, offset, big);
        proto_tree_add_item(nasdaq_itch_tree, hf_nasdaq_itch_match, tvb, offset, 9, ENC_ASCII|ENC_NA);
        offset += 9;
        break;

    case 'Q' : /* Cross Trade */
        offset = number_of_shares(tvb, pinfo, nasdaq_itch_tree, hf_nasdaq_itch_shares, offset, big);

        offset = stock(tvb, pinfo, nasdaq_itch_tree, offset);

        offset = price(tvb, pinfo, nasdaq_itch_tree, hf_nasdaq_itch_price, offset, big);

        proto_tree_add_item(nasdaq_itch_tree, hf_nasdaq_itch_match, tvb, offset, 9, ENC_ASCII|ENC_NA);
        offset += 9;
        proto_tree_add_item(nasdaq_itch_tree, hf_nasdaq_itch_cross, tvb, offset, 1, ENC_ASCII|ENC_NA);
        offset += 1;
        break;

    case 'B' : /* Broken Trade */
        proto_tree_add_item(nasdaq_itch_tree, hf_nasdaq_itch_match, tvb, offset, 9, ENC_ASCII|ENC_NA);
        offset += 9;
        break;

    case 'I': /* NOII, FIXME */
        offset = stock(tvb, pinfo, nasdaq_itch_tree, offset);

        proto_tree_add_item(nasdaq_itch_tree, hf_nasdaq_itch_cross, tvb, offset, 1, ENC_ASCII|ENC_NA);
        offset += 1;
        break;

    default:
        /* unknown */
        proto_tree_add_item(nasdaq_itch_tree, hf_nasdaq_itch_message, tvb, offset, -1, ENC_ASCII|ENC_NA);
        offset += 5-1;
        break;
    }
}
Exemple #26
0
void AbstractAction::callSuccessfulSlot(QNetworkReply *reply) {
    m_successful = true;
    callSuccessful(reply);
    emit executed();
}
Exemple #27
0
void AbstractAction::callFailedSlot(QNetworkReply *reply) {
    m_successful = false;
    callFailed(reply);
    emit executed();
}
Exemple #28
0
 void commandstruct::reset_commandstruct(const std::string& vl, guidtype clid) {
     istext(true);
     strvalue(vl);
     if (clid != NULL_CLIENT) clientid(clid);
     executed(false);
 }
void CardView::keyPressEvent( QKeyEvent *e )
{
  if ( !(childCount() && d->mCurrentItem) ) {
    e->ignore();
    return;
  }

  uint pos = d->mItemList.findRef( d->mCurrentItem );
  CardViewItem *aItem = 0;
  CardViewItem *old = d->mCurrentItem;

  switch ( e->key() ) {
    case Qt::Key_Up:
      if ( pos > 0 ) {
        aItem = d->mItemList.at( pos - 1 );
        setCurrentItem( aItem );
      }
      break;
    case Qt::Key_Down:
      if ( pos < d->mItemList.count() - 1 ) {
        aItem = d->mItemList.at( pos + 1 );
        setCurrentItem( aItem );
      }
      break;
    case Qt::Key_Left:
    {
      // look for an item in the previous/next column, starting from
      // the vertical middle of the current item.
      // FIXME use nice calculatd measures!!!
      QPoint aPoint( d->mCurrentItem->d->x, d->mCurrentItem->d->y );
      aPoint -= QPoint( 30, -(d->mCurrentItem->height() / 2) );
      aItem = itemAt( aPoint );
      // maybe we hit some space below an item
      while ( !aItem && aPoint.y() > 27 ) {
        aPoint -= QPoint( 0, 16 );
        aItem = itemAt( aPoint );
      }
      if ( aItem )
        setCurrentItem( aItem );

      break;
    }
    case Qt::Key_Right:
    {
      // FIXME use nice calculated measures!!!
      QPoint aPoint( d->mCurrentItem->d->x + d->mItemWidth, d->mCurrentItem->d->y );
      aPoint += QPoint( 30, (d->mCurrentItem->height() / 2) );
      aItem = itemAt( aPoint );
      while ( !aItem && aPoint.y() > 27 ) {
        aPoint -= QPoint( 0, 16 );
        aItem = itemAt( aPoint );
      }
      if ( aItem )
        setCurrentItem( aItem );

      break;
    }
    case Qt::Key_Home:
      aItem = d->mItemList.first();
      setCurrentItem( aItem );
      break;
    case Qt::Key_End:
      aItem = d->mItemList.last();
      setCurrentItem( aItem );
      break;
    case Qt::Key_PageUp: // PageUp
    {
      // QListView: "Make the item above the top visible and current"
      // TODO if contentsY(), pick the top item of the leftmost visible column
      if ( contentsX() <= 0 )
        return;
      int cw = columnWidth();
      int theCol = ( qMax( 0, ( contentsX() / cw) * cw ) ) + d->mItemSpacing;
      aItem = itemAt( QPoint( theCol + 1, d->mItemSpacing + 1 ) );
      if ( aItem )
        setCurrentItem( aItem );

      break;
    }
    case Qt::Key_PageDown:  // PageDown
    {
      // QListView: "Make the item below the bottom visible and current"
      // find the first not fully visible column.
      // TODO: consider if a partly visible (or even hidden) item at the
      //       bottom of the rightmost column exists
      int cw = columnWidth();
      int theCol = ( (( contentsX() + visibleWidth() ) / cw) * cw ) + d->mItemSpacing + 1;
      // if separators are on, we may need to we may be one column further right if only the spacing/sep is hidden
      if ( d->mDrawSeparators && cw - (( contentsX() + visibleWidth() ) % cw) <= int( d->mItemSpacing + d->mSepWidth ) )
        theCol += cw;

      // make sure this is not too far right
      while ( theCol > contentsWidth() )
        theCol -= columnWidth();

      aItem = itemAt( QPoint( theCol, d->mItemSpacing + 1 ) );

      if ( aItem )
        setCurrentItem( aItem );

      break;
    }
    case Qt::Key_Space:
      setSelected( d->mCurrentItem, !d->mCurrentItem->isSelected() );
      emit selectionChanged();
      break;
    case Qt::Key_Return:
    case Qt::Key_Enter:
      emit returnPressed( d->mCurrentItem );
      emit executed( d->mCurrentItem );
      break;
    case Qt::Key_Menu:
      emit contextMenuRequested( d->mCurrentItem, viewport()->mapToGlobal(
                                 itemRect(d->mCurrentItem).center() ) );
      break;
    default:
      if ( (e->modifiers() & Qt::ControlModifier) && e->key() == Qt::Key_A ) {
        // select all
        selectAll( true );
        break;
      } else if ( !e->text().isEmpty() && e->text()[ 0 ].isPrint() ) {
        // if we have a string, do autosearch
      }
      break;
  }

  // handle selection
  if ( aItem ) {
    if ( d->mSelectionMode == CardView::Extended ) {
      if ( e->modifiers() & Qt::ShiftModifier ) {
        // shift button: toggle range
        // if control button is pressed, leave all items
        // and toggle selection current->old current
        // otherwise, ??????
        bool s = ! aItem->isSelected();
        int from, to, a, b;
        a = d->mItemList.findRef( aItem );
        b = d->mItemList.findRef( old );
        from = a < b ? a : b;
        to = a > b ? a : b;

        if ( to - from > 1 ) {
          bool b = signalsBlocked();
          blockSignals( true );
          selectAll( false );
          blockSignals( b );
        }

        CardViewItem *item;
        for ( ; from <= to; ++from ) {
          item = d->mItemList.at( from );
          item->setSelected( s );
          repaintItem( item );
        }

        emit selectionChanged();
      } else if ( e->modifiers() & Qt::ControlModifier ) {
        // control button: do nothing
      } else {
        // no button: move selection to this item
        bool b = signalsBlocked();
        blockSignals( true );
        selectAll( false );
        blockSignals( b );

        setSelected( aItem, true );
        emit selectionChanged();
      }
    }
  }
}
Exemple #30
0
void AMDeferredFunctionCall::onDelayTimerTimeout()
{
	delayTimer_.stop();
	emit executed();
	execute();
}