示例#1
0
  void Mistress::opLoad()
  {
    beginOperation( Operation_Load );

    void* buffer;
    uint16_t length;

    DEBUG( "Loading graphs from flash" );
    mMemory.readSector( Memory::Sector_Graphs, buffer, length );
    if ( length > 0 )
    {
      JsonValue value;
      JsonAllocator allocator;
      JsonParseStatus status = jsonParse( (char*)buffer, &value, allocator );
      SPARK_ASSERT( status == JSON_PARSE_OK );
      mGraphs.fromJSON( value );
      free( buffer );
    }

    DEBUG( "Loading vibrators from flash" );
    mMemory.readSector( Memory::Sector_Vibrators, buffer, length );
    if ( length > 0 )
    {
      JsonValue value;
      JsonAllocator allocator;
      JsonParseStatus status = jsonParse( (char*)buffer, &value, allocator );
      SPARK_ASSERT( status == JSON_PARSE_OK );
      mVibrators.fromJSON( value );
      free( buffer );
    }

    endOperation( Operation_Load );
  }
示例#2
0
  void Mistress::opExportFunctions()
  {
    beginOperation( Operation_Export );

    mSelf = this;
    DEBUG( "Exporting cloud functions" );
    Spark.function( cSparkVibratorCommand, vibratorCommandFwd );

    endOperation( Operation_Export );
  }
示例#3
0
KoView::KoView( KoDocument *document, QWidget *parent, const char *name )
 : QWidget( parent, name )
{
  Q_ASSERT( document );

  //kdDebug(30003) << "KoView::KoView " << this << endl;
  d = new KoViewPrivate;
  d->m_doc = document;
  KParts::PartBase::setPartObject( this );

  setFocusPolicy( StrongFocus );

  setMouseTracking( true );

  connect( d->m_doc, SIGNAL( childChanged( KoDocumentChild * ) ),
           this, SLOT( slotChildChanged( KoDocumentChild * ) ) );

  connect( d->m_doc, SIGNAL( sigBeginOperation() ),
           this, SLOT( beginOperation() ) );

  connect( d->m_doc, SIGNAL( sigEndOperation() ),
           this, SLOT( endOperation() ) );


  actionCollection()->setWidget( this );
  setupGlobalActions();
  KActionCollection *coll = actionCollection();
  /**** not needed anymore, according to David (Werner)
  QValueList<KAction*> docActions = document->actionCollection()->actions();
  QValueList<KAction*>::ConstIterator it = docActions.begin();
  QValueList<KAction*>::ConstIterator end = docActions.end();
  for (; it != end; ++it )
      coll->insert( *it );
  */

  KStatusBar * sb = statusBar();
  if ( sb ) // No statusbar in e.g. konqueror
  {
      coll->setHighlightingEnabled( true );
      connect( coll, SIGNAL( actionStatusText( const QString & ) ),
               this, SLOT( slotActionStatusText( const QString & ) ) );
      connect( coll, SIGNAL( clearStatusText() ),
               this, SLOT( slotClearStatusText() ) );

      connect( d->m_doc, SIGNAL( sigStatusBarMessage( const QString& ) ),
               this, SLOT( slotActionStatusText( const QString& ) ) );
      connect( d->m_doc, SIGNAL( sigClearStatusBarMessage() ),
               this, SLOT( slotClearStatusText() ) );
  }
  d->m_doc->setCurrent();

  d->m_scrollTimer = new QTimer( this );
  connect (d->m_scrollTimer, SIGNAL( timeout() ), this, SLOT( slotAutoScroll() ) );
}
示例#4
0
  void Mistress::opUpdateVariables()
  {
    beginOperation( Operation_Update );

    DEBUG( "Updating cloud variables" );
    Spark.variable( cSparkGraphsVariable,
      (void*)mGraphs.toJSON().c_str(), STRING );
    Spark.variable( cSparkVibratorsVariable,
      (void*)mVibrators.toJSON().c_str(), STRING );

    endOperation( Operation_Update );
  }
示例#5
0
  void Mistress::opSave()
  {
    beginOperation( Operation_Save );

    DEBUG( "Writing graphs to flash" );
    mMemory.writeSector( Memory::Sector_Graphs, mGraphs.toJSON() );

    DEBUG( "Writing vibrators to flash" );
    mMemory.writeSector( Memory::Sector_Vibrators, mVibrators.toJSON() );

    endOperation( Operation_Save );
  }