void GlobalPresence::onAccountManagerReady(Tp::PendingOperation* op)
{
    if (op->isError()) {
        qCDebug(KTP_COMMONINTERNALS) << op->errorName();
        qCDebug(KTP_COMMONINTERNALS) << op->errorMessage();

        //TODO: Create signal to send to client
        qCDebug(KTP_COMMONINTERNALS) << "Something unexpected happened to the core part of your Instant Messaging system "
                 << "and it couldn't be initialized. Try restarting the client.";

        return;
    }

    setAccountManager(m_accountManager);
    Q_EMIT(accountManagerReady());
}
コード例 #2
0
/*!
 * This function provides our class's main functionality - namely, taking an
 * input name and path and creating the appropriate type of collection object
 * to handle it. Note that this function should probably not be run in the
 * event dispatch thread; we load the collection from the path given, which can
 * take a nontrivial amount of time.
 *
 * Also note that we don't do any validity checking on the collection name; it
 * is assumed that the caller did that before calling this function.
 *
 * The returned collection will have this object as a parent, so deleting this
 * object will also delete any collections it created. The new collection will
 * also have the same thread affinity as this object.
 *
 * The new collection, instead of being returned directly, will be given to our
 * caller (and potentially others) via a signal emission once the collection is
 * loaded. This means that this operation can be done in a different thread
 * from our caller.
 *
 * \param n The name for the new collection.
 * \param p The path to the collection.
 * \param s Whether or not to remember the collection for next time.
 */
void CSCollectionTypeResolver::newCollection(const QString &n,
	const QString &p, bool s)
{ /* SLOT */

	CSAbstractCollection *c = NULL;

	// Create our new collection object.

	c = createCollection(n, p);

	// If we didn't create one, its type must be invalid.

	if(c == NULL)
	{
#pragma message "TODO - Errors need to be handled here by emitting a signal"
		return;
	}

	// Set our collection's save property.

	c->setSaveOnExit(s);

	// Connect the collection to our slots.

	QObject::connect(c, SIGNAL(jobStarted(const QString &, bool)),
		this, SLOT(doJobStarted(const QString &, bool)));
	QObject::connect(c, SIGNAL(progressLimitsUpdated(int, int)),
		this, SLOT(doProgressLimitsUpdated(int, int)));
	QObject::connect(c, SIGNAL(progressUpdated(int)),
		this, SLOT(doProgressUpdated(int)));
	QObject::connect(c, SIGNAL(jobFinished(const QString &)),
		this, SLOT(doJobFinished(const QString &)));

	/*
	 * The collection has been created, but we still need to load its data.
	 * Emit the signal indicating that the collection exists, but set it
	 * disabled (until it has been loaded).
	 */

	c->setEnabled(false);
	Q_EMIT(collectionCreated(c));

	// Try to load the collection from the path provided.

	c->loadCollectionFromPath(p);

}
コード例 #3
0
void
MainWindow::processInput(CGAL::Object o)
{
  bool was_empty = triang.empty();
  Point_2 p;
  if(CGAL::assign(p, o)) {
    double dx = triang.domain().xmax() - triang.domain().xmin();
    double dy = triang.domain().ymax() - triang.domain().ymin();
    p = Point_2(p.x()- std::floor(p.x()/dx),
                p.y()- std::floor(p.y()/dy));
    triang.insert(p);
  }
  Q_EMIT( changed());

  if (was_empty)
    on_actionRecenter_triggered();
}
コード例 #4
0
ファイル: Polygon_2.cpp プロジェクト: ArcEarth/cgal
void
MainWindow::processInput(CGAL::Object o)
{
  this->actionCreateInputPolygon->setChecked(false);
  std::list<Point_2> points;
  if(CGAL::assign(points, o)){
    if((points.size() == 1)&& poly.size()>0){
    
    } else {
      poly.clear();
      if(points.front() == points.back()){
	points.pop_back();
      }
      poly.insert(poly.vertices_begin(), points.begin(), points.end());
    }
    Q_EMIT( changed());
  }
}
コード例 #5
0
ファイル: QcWebView.cpp プロジェクト: DSastre/supercollider
void WebView::keyPressEvent( QKeyEvent *e )
{
    int key = e->key();
    int mods = e->modifiers();

    if( _interpretSelection &&
            ( key == Qt::Key_Enter ||
              ( key == Qt::Key_Return && mods & (Qt::ControlModifier|Qt::ShiftModifier) ) ) )
    {
        QString selection = selectedText();
        if( !selection.isEmpty() ) {
            Q_EMIT( interpret( selection ) );
            return;
        }
    }

    QWebView::keyPressEvent( e );
}
コード例 #6
0
ファイル: Alpha_shapes_2.cpp プロジェクト: CGAL/releases
void MainWindow::alphaChanged(int i)
{
  if (as.number_of_alphas() > 0){
    if(i < 100){
      int n = static_cast<int>((i * as.number_of_alphas())/ 100);
      if(n == 0) n++;
      alpha = as.get_nth_alpha(n);
      as.set_alpha(alpha);
    } else {
      Alpha_iterator alpha_end_it = as.alpha_end();
      alpha = (*(--alpha_end_it))+1;
      as.set_alpha(alpha);
    }
  } else {
    alpha = 0;
    as.set_alpha(0);
  }
  Q_EMIT( changed());
}
コード例 #7
0
void QGeoPositionInfoSourceBbPrivate::receivePeriodicPositionReply()
{
    // don't try to receive a reply if periodic updates have not been started. This is
    // necessary because this slot is connected to PpsObject::readyRead() and could be
    // invoked any time the pps file is updated by the server. Under error conditions
    // this would otherwise lead to a circular calling sequence: receive, timeout due to
    // error, cancel, receive...
    if (!_startUpdatesInvoked)
        return;

    if (!receivePositionReply(*_periodicUpdatePpsObject)) {
        Q_Q(QGeoPositionInfoSourceBb);
        if (fatalError(_replyErrorCode)
            && q->receivers(SIGNAL(error(QGeoPositionInfoSource::Error)))) {
            Q_EMIT ((QGeoPositionInfoSource *)q)->error(_sourceError);
        } else {
            periodicUpdatesTimeout();
        }
    }
}
コード例 #8
0
 void insert_polyline(Iterator b, Iterator e)
 {
   Point_2 p, q;
   SVD::Vertex_handle vh, wh;
   Iterator it = b;
   vh = svd.insert(*it);
   p = *it;
   ++it;
   for(; it != e; ++it){
     q = *it;
     if(p != q){
       wh = svd.insert(*it);
       svd.insert(vh,wh);
       vh = wh;
       p = q;
     } else {
       std::cout << "duplicate point: " << p << std::endl; 
     }
   }
   Q_EMIT( changed());
 }
コード例 #9
0
void
MainWindow::open(QString fileName)
{
  // wait cursor
  QApplication::setOverrideCursor(Qt::WaitCursor);
  m_sites.clear();
  
  std::ifstream ifs(qPrintable(fileName));
  
  Kernel::Point_2 p;
  while(ifs >> p) {
    m_sites.push_back(p);
  }
  calculate_envelope();

  // default cursor
  QApplication::restoreOverrideCursor();
  this->addToRecentFiles(fileName);
  actionRecenter->trigger();
  Q_EMIT( changed());
}
コード例 #10
0
ファイル: Generator_2.cpp プロジェクト: MoniqueTeillaud/cgal
  void
  on_actionGenerate_triggered()
  {
    QRectF rect = CGAL::Qt::viewportsBbox(&scene);
    CGAL::Qt::Converter<K> convert;  
    Iso_rectangle_2 isor = convert(rect);
    Point_2 center = CGAL::midpoint(isor[0], isor[2]);
    Vector_2 offset = center - CGAL::ORIGIN;
    double w = isor.xmax() - isor.xmin();
    double h = isor.ymax() - isor.ymin();
    double radius = (w<h) ? w/2 : h/2;

    G pg(radius);
    bool ok = false;
    const int number_of_points = 
      QInputDialog::getInteger(this, 
                               tr("Number of random points"),
                               tr("Enter number of random points"),
                               100,
                               0,
                               (std::numeric_limits<int>::max)(),
                               1,
                               &ok);

    if(!ok) {
      return;
    }

    // wait cursor
    QApplication::setOverrideCursor(Qt::WaitCursor);

    points.reserve(points.size() + number_of_points);
    for(int i = 0; i < number_of_points; ++i){
      points.push_back(*pg + offset);
      ++pg;
    }
    // default cursor
    QApplication::restoreOverrideCursor();
    Q_EMIT( changed());
  }
コード例 #11
0
ファイル: QcTextEdit.cpp プロジェクト: 2mc/supercollider
void QcTextEdit::keyPressEvent( QKeyEvent *e )
{
  if( _interpretSelection && e->modifiers() & (Qt::ControlModifier|Qt::ShiftModifier)
      && ( e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter ) )
  {
    QTextCursor c(textCursor());

    if ( !c.hasSelection() ) {
      c.movePosition( QTextCursor::StartOfLine );
      c.movePosition( QTextCursor::EndOfLine, QTextCursor::KeepAnchor );
    }

    if ( c.hasSelection() ) {
      QString selection( c.selectedText() );
      Q_EMIT( interpret( prepareText(selection) ) );
    }

    return;
  }

  QTextEdit::keyPressEvent( e );
}
コード例 #12
0
void
MainWindow::open(QString fileName)
{
  // wait cursor
  QApplication::setOverrideCursor(Qt::WaitCursor);
  std::ifstream ifs(qPrintable(fileName));
  
  Point_2 p;
  std::vector<Point_2> points;
  while(ifs >> p) {
    points.push_back(p);
  }
  triang.clear();
  triang.insert(points.begin(), points.end());

  // default cursor
  QApplication::restoreOverrideCursor();
  this->addToRecentFiles(fileName);
  actionRecenter->trigger();
  Q_EMIT( changed());
    
}
コード例 #13
0
void CppHelperPluginConfigPage::validateSanitizeRule(const int row, const int column)
{
    kDebug(DEBUG_AREA) << "Sanitize rule has been changed: row =" << row << ", col =" << column;
    const auto p = isSanitizeRuleValid(row, column);
    if (!p.first)
    {
        KPassivePopup::message(
            i18nc("@title:window", "Error")
          , i18nc(
                "@info:tooltip"
              , "Regular expression at (%1, %2) is not valid: %3"
              , row
              , column
              , p.second
              )
          , qobject_cast<QWidget*>(this)
          );
        /// \todo How to enter in edit mode?
        m_completion_settings->sanitizeRules->cellWidget(row, column)->setFocus();
    }
    Q_EMIT(changed());
}
コード例 #14
0
// request single update
void QGeoPositionInfoSourceBbPrivate::requestUpdate(int msec)
{
    // do nothing if an immediate update has already been requested
    if (_requestUpdateInvoked)
        return;

    if (msec) {
        // If it is not possible to update in msec timeout immediately.
        Q_Q(QGeoPositionInfoSourceBb);
        if (msec < q->minimumUpdateInterval()) {
            // The connection is queued because it is possible for the user to call requestUpdate()
            // from within the slot handling the timeout. The queued connection avoids potential
            // infinite recursion.
            Q_EMIT queuedUpdateTimeout();
            return;
        }
    }

    if (requestPositionInfo(false, msec)) {
        _requestUpdateInvoked = true;
    } else {
        // With Qt5 the error() signal was introduced. If there are any receivers emit error() else
        // maintain QtMobility behavior.
        _sourceError
            = positionErrorCodeToErrorMap.value(_replyErrorCode,
                                                QGeoPositionInfoSource::UnknownSourceError);
        Q_Q(QGeoPositionInfoSourceBb);
        if (q->receivers(SIGNAL(error(QGeoPositionInfoSource::Error)))) {
            Q_EMIT ((QGeoPositionInfoSource *)q)->error(_sourceError);
        } else {
            // user is expecting a signal to be emitted, cannot emit positionUpdated() because of
            // error so emit timeout signal. The connection is queued because it is possible for the
            // user to call startUpdates() from within the slot handling the timeout. The queued
            // connection avoids potential infinite recursion.
            Q_EMIT queuedUpdateTimeout();
        }
    }
}
コード例 #15
0
void
MainWindow::open(QString fileName)
{
  // wait cursor
  QApplication::setOverrideCursor(Qt::WaitCursor);
  std::ifstream ifs(qPrintable(fileName));
  
  K::Point_2 p;
  std::vector<K::Point_2> points;
  while(ifs >> p) {
    // ignore whatever comes after x and y
    ifs.ignore((std::numeric_limits<std::streamsize>::max)(), '\n'); 
    points.push_back(p);
  }
  dt.insert(points.begin(), points.end());

  // default cursor
  QApplication::restoreOverrideCursor();
  this->addToRecentFiles(fileName);
  actionRecenter->trigger();
  Q_EMIT( changed());
    
}
コード例 #16
0
ファイル: Alpha_shapes_2.cpp プロジェクト: CGAL/releases
void
MainWindow::open(QString fileName)
{
  std::cerr << "open " << std::endl;
  std::cerr << qPrintable(fileName) << std::endl;
  // wait cursor
  QApplication::setOverrideCursor(Qt::WaitCursor);
  std::ifstream ifs(qPrintable(fileName));
  
  K::Point_2 p;
  while(ifs >> p) {
    points.push_back(p);
  }
  as.make_alpha_shape(points.begin(), points.end());
  as.set_alpha(alpha);

  // default cursor
  QApplication::restoreOverrideCursor();
  this->addToRecentFiles(fileName);
  actionRecenter->trigger();
  Q_EMIT( changed());
    
}
コード例 #17
0
void
MainWindow::on_actionInsertRandomPoints_triggered()
{
  CGAL::Random_points_in_iso_rectangle_2<Point_2> pg((triang.domain().min)(),
                                                     (triang.domain().max)());
  bool ok = false;

  const int number_of_points = 
    QInputDialog::getInt(this, 
                             tr("Number of random points"),
                             tr("Enter number of random points"),
			     250,
			     0,
			     (std::numeric_limits<int>::max)(),
			     1,
			     &ok);

  if(!ok) {
    return;
  }

  // wait cursor
  QApplication::setOverrideCursor(Qt::WaitCursor);

  std::vector<Point_2> points;
  points.reserve(number_of_points);
  for(int i = 0; i < number_of_points; ++i){
    points.push_back(*pg++);
  }
  triang.insert(points.begin(), points.end(), true);

  // default cursor
  QApplication::restoreOverrideCursor();

  on_actionRecenter_triggered();
  Q_EMIT( changed());
}
コード例 #18
0
ファイル: QcCanvas.cpp プロジェクト: acamari/supercollider
void QcCanvas::paintEvent( QPaintEvent *e )
{
  if( _paint && _repaintNeeded ) {
    if( _resize ) {
      _pixmap = QPixmap( size() );
      _resize = false;
      _clearOnce = true;
    }

    if( _clearOnRefresh || _clearOnce ) {
      _pixmap.fill( QColor(0,0,0,0) );
      _clearOnce = false;
    }

    bool opaque_before = testAttribute(Qt::WA_OpaquePaintEvent);

    QPainter pixPainter( &_pixmap );
    Q_EMIT( painting(&pixPainter) );
    _repaintNeeded = false;

    bool opaque_after = testAttribute(Qt::WA_OpaquePaintEvent);
    if( opaque_before && !opaque_after )
    {
      repaint();
      return;
    }
  }

  QPainter p(this);
  QPalette plt(palette());

  if( _bkg.isValid() )
      p.fillRect( e->rect(), _bkg );

  if( _paint ) p.drawPixmap( e->rect(), _pixmap, e->rect() );
}
コード例 #19
0
void QcListWidget::keyPressEvent( QKeyEvent *e )
{
  QListWidget::keyPressEvent( e );

  switch (e->key())
  {
  case Qt::Key_Return:
  case Qt::Key_Enter:
    Q_EMIT( returnPressed() );
    e->accept();
    break;
  case Qt::Key_Up:
  case Qt::Key_Down:
  case Qt::Key_Left:
  case Qt::Key_Right:
  case Qt::Key_PageUp:
  case Qt::Key_PageDown:
  case Qt::Key_Home:
  case Qt::Key_End:
    // Prevent propagating to parent when scroller reaches minimum or maximum:
    e->accept();
  default: break;
  }
}
コード例 #20
0
ファイル: Alpha_shapes_2.cpp プロジェクト: CGAL/releases
void
MainWindow::on_actionInsertRandomPoints_triggered()
{
  QRectF rect = CGAL::Qt::viewportsBbox(&scene);
  CGAL::Qt::Converter<K> convert;  
  Iso_rectangle_2 isor = convert(rect);
  CGAL::Random_points_in_iso_rectangle_2<Point_2> pg((isor.min)(), (isor.max)());
  bool ok = false;

  const int number_of_points = 
    QInputDialog::getInt(this, 
                             tr("Number of random points"),
                             tr("Enter number of random points"),
			     100,
			     0,
			     (std::numeric_limits<int>::max)(),
			     1,
			     &ok);

  if(!ok) {
    return;
  }

  // wait cursor
  QApplication::setOverrideCursor(Qt::WaitCursor);

  points.reserve(points.size() + number_of_points);
  for(int i = 0; i < number_of_points; ++i){
    points.push_back(*pg++);
  }
  as.make_alpha_shape(points.begin(), points.end());
  as.set_alpha(alpha);
  // default cursor
  QApplication::restoreOverrideCursor();
  Q_EMIT( changed());
}
コード例 #21
0
ファイル: VideoWatcher.cpp プロジェクト: kecsap/iop-server
void VideoWatcher::CaptureFinished()
{
  QFuture<void> CaptureTask;
  static bool AudioStarted = false;

  // In debug mode, keep the audio and video playback in sync
  if (WaitDuration > 0)
    MCSleep(WaitDuration);

  FrameCount++;
  OverallFrameCount++;
  *OriginalImage = *CapturedImage;
  if (AudioStarted == false)
  {
    QTimer::singleShot(100, this, SIGNAL(StartAudio()));
    AudioStarted = true;
  }
  // Start a new capture
  CaptureTask = QtConcurrent::run(boost::bind(&VideoWatcher::CaptureImage, this));
  CaptureWatcher.setFuture(CaptureTask);
  if (FrameCount % 3 == 1)
    return;

  OriginalImage->ConvertBGRToRGB();
  *FinalImage = *OriginalImage;
  CheckFiles();
  // Check if the capture process stopped by some reason
  if (!CaptureDevice->IsCapturing())
  {
    MC_LOG("Capture stopped");
    QCoreApplication::quit();
  }
  // Be sure that the image has the expected size
  if (FinalImage->GetWidth() != FrameWidth && FinalImage->GetHeight() != FrameHeight)
  {
    FinalImage->Resize(FrameWidth, FrameHeight);
  }
  if (Undistort && FinalImage->GetWidth() == FrameWidth && FinalImage->GetHeight() == FrameHeight)
  {
    Calibration->Undistort(*FinalImage);
    // TODO: The rotational correction is too CPU expensive
    if (!MCIsFloatInfinity(RotationAngle))
    {
      FinalImage->Rotate(RotationCenter.X, RotationCenter.Y, RotationAngle);
    }
  }
  // Check if the lights are off
  if (FinalImage->AverageBrightnessLevel() < 10)
  {
    Markers->Reset();
    MotionDetection->Reset();
    Q_EMIT(VideoEvent(IOP::IdleEvent));
    Q_EMIT(VideoEvent(IOP::CaptureEvent));
    return;
  }
  // Calculate fps
  if (FrameCount % 300 == 0)
  {
    MC_LOG("Capture speed: %1.2f fps", (float)1000 / FpsTimer.elapsed()*FrameCount);
    FpsTimer.start();
    FrameCount = 0;
    MC_LOG("Average brightness level: %1.2f", FinalImage->AverageBrightnessLevel());
  }
  // Corner detection
  Markers->AddImage(*FinalImage);
  // TODO: The rotational correction is too CPU expensive
  if (Markers->IsReady() && !Markers->IsAnyMissingCorner() && MCIsFloatInfinity(RotationAngle))
  {
    // Get the rotational angle and reset the marker detection
    Markers->GetRotationalCorrection(*FinalImage, RotationAngle, RotationCenter);
    MC_LOG("Detected rotation: %1.2f degrees", RotationAngle);
    Markers->Reset();
  }
  // Motion detection
  MEImage MotionFrame = *FinalImage;

  MotionFrame.Resize(FrameWidth / 4, FrameHeight / 4);
  MotionDetection->DetectMotions(MotionFrame);
  /*
   * Draw the debug signs and texts on the original image
   */
  DebugMessageImage->Clear();
  // Composite debug signs
  if (DebugMotions)
  {
    MEImage MaskImage;

    MotionDetection->GetMotionsMask(MaskImage);
    // Convert the grayscale image back to RGB
    MaskImage.ConvertToRGB();
    MaskImage.Resize(FrameWidth, FrameHeight);
    FinalImage->Addition(MaskImage, ME::MaskAddition);
  }
  if (DebugCorners)
    Markers->DrawDebugSigns(*FinalImage);
  if (Markers->IsReady() && Markers->IsAnyMissingCorner())
  {
    Markers->DrawMissingCorners(*FinalImage);
    DebugMessageImage->DrawText(160, 320, "Table not detected", 1, MEColor(255, 255, 255));
    Q_EMIT(VideoEvent(IOP::MissingCornersEvent));
  }
  Q_EMIT(VideoEvent(IOP::NormalEvent));
  Q_EMIT(VideoEvent(IOP::CaptureEvent));
}
コード例 #22
0
void CppHelperPluginConfigPage::clearGlobalDirs()
{
    m_system_list->pathsList->clear();
    Q_EMIT(changed());
}
コード例 #23
0
void
MainWindow::on_actionClear_triggered()
{
  dt.clear();
  Q_EMIT( changed());
}
コード例 #24
0
ファイル: dialog.cpp プロジェクト: DrewKrause/supercollider
void Dialog::apply()
{
    Q_EMIT( storeRequest(mManager) );
    Main::instance()->applySettings();
}
コード例 #25
0
ファイル: dialog.cpp プロジェクト: DrewKrause/supercollider
void Dialog::reset()
{
    Q_EMIT( loadRequest(mManager) );
}
コード例 #26
0
void PlaybackActionClient::playbackFeedbackCallback(const pumpkin_messages::PlaybackFeedbackConstPtr &feedback) {
	double perc = feedback->percentage;
	perc*100;
	Q_EMIT(playbackPercentage(int(round(perc))));
}
コード例 #27
0
ファイル: view.cpp プロジェクト: acamari/supercollider
void QcWaveform::mouseDoubleClickEvent ( QMouseEvent * )
{
  setSelection( _curSel, _rangeBeg, _rangeEnd );
  Q_EMIT( action() );
}
コード例 #28
0
void PlaybackActionClient::sceneFeedbackCallback(const pumpkin_messages::PlaybackFeedbackConstPtr &feedback)
{
	double perc = feedback->percentage;
	perc*100;
	Q_EMIT(scenePercentage(feedback->movement_index, _goal.filenames.size(), int(round(perc))));
}
コード例 #29
0
ファイル: CreatePage.cpp プロジェクト: Ryetschye/Tagbuilder
void CreatePage::tagTypeSelected(const QModelIndex &which)
{
	dismiss();
	Q_EMIT(selected(m_model != 0 ? m_model->name(which) : ""));
}
コード例 #30
0
void PlaybackActionClient::playbackActiveCallback() {
	_running = true;
	_scene = false;
	Q_EMIT(blockOnPlayback(true));
	Q_EMIT(sendStatusMessage(QString("Start playback file %0.").arg(QString::fromStdString(_goal.filenames[0])), 1000));
}