Пример #1
0
autobots_toutiao::autobots_toutiao(QWidget *parent)
	: control_status(true), QMainWindow(parent),
	m_account_order(0),m_device_order(0),
	m_client_id("394e2173327e4ead8302dc27f4ae8879")
{
	ui.setupUi(this);

	initialize();

	connect(ui.pushButton_start, SIGNAL(clicked()), this, SLOT(onStart()));

	connect(ui.pushButton_pause, SIGNAL(clicked()), this, SLOT(onPause()));

	connect(ui.pushButton_add_comment_id, SIGNAL(clicked()), this, SLOT(onAddCommentID()));

	connect(ui.action_from_txt, SIGNAL(triggered()), this, SLOT(onActFromTxt()));

	connect(ui.action_import_commentid, SIGNAL(triggered()), this, SLOT(onActImportComment()));

	connect(ui.action_clear_comments, SIGNAL(triggered()), this, SLOT(onActClearComments()));

	connect(ui.action_clear_accounts, SIGNAL(triggered()), this, SLOT(onActClearAccounts()));

	//connect(&network, SIGNAL(postIdReady(QString)), this, SLOT(onPostIdReday(QString)));

	//connect(&network, SIGNAL(clientID(QString)), this, SLOT(onClientIdReday(QString)));

	//connect(&network, SIGNAL(csrftokenReady(QString)), this, SLOT(onCsrfTokenReday(QString)));

	//connect(&network, SIGNAL(loginsucceed(QString)), this, SLOT(onLoginsucceed(QString)));

	// connect(&network, SIGNAL(fatiesucceed(QString, double)), this, SLOT(onFatieSucceed(QString, double)));

	//connect(&network, SIGNAL(newCommentID(double)), this, SLOT(onNewCommentID(QString)));
}
void ControllerEffect::start()
{
	// We're now running
	m_bRunning = true;

	onStart();
}
TEST_F(GameObjectTest, StartTest)
{
	GameObjectComponentMock *component = new GameObjectComponentMock();
	EXPECT_CALL(*component, onStart()).Times(1);
	gameObject.addComponent(component);
	gameObject.start();
}
Пример #4
0
void TaskBase::start(bool recording)
{
    // if started again but this time with recording, fall through to call onStart again. Otherwise check if running and act accordingly.
    if (!_recording && recording)
    {
        _recording = true;
    }
    else if (GetThread() && GetThread()->IsRunning())
    {
        return;
    }
    if (!GetThread())
    {
        if (CreateThread(wxTHREAD_DETACHED) != wxTHREAD_NO_ERROR)
        {
            wxMessageBox(_("Could not create the task thread!"), _("Error"), wxICON_ERROR);
            return;
        }
    }
    // call onStart before running the thread (or when an already running thread is set to recording)
    onStart();

    if (!_running)
    {
        _running = true;
        if (GetThread()->Run() != wxTHREAD_NO_ERROR)
        {
            wxMessageBox(_("Could not run the task thread!"), _("Error"), wxICON_ERROR);
            _running = false;
            _recording = false;
            return;
        }
    }
}
Пример #5
0
Exporter::Exporter(const MocapSettings& params) :
    exporterProcess(NULL),
	time(NULL),
	inSocket(NULL),
	outSocket(NULL),
	settings(params),
        updatePeriod(50),
        exporterTimeout(8000),
	autopilotConnectionStatus(false),
    exporterConnectionStatus(false),
	txTimer(NULL),
    exporterTimer(NULL),
	name("")
{
	// move to thread
	moveToThread(Core::ICore::instance()->threadManager()->getRealTimeThread());
        connect(this, SIGNAL(myStart()), this, SLOT(onStart()),Qt::QueuedConnection);
	emit myStart();

    QTime currentTime=QTime::currentTime();
    gpsPosTime = currentTime;
    groundTruthTime = currentTime;
    gcsRcvrTime = currentTime;
    attRawTime = currentTime;
    baroAltTime = currentTime;
    airspeedActualTime=currentTime;

}
Пример #6
0
void ScProcess::onProcessStateChanged(QProcess::ProcessState state)
{
    switch (state) {
    case QProcess::Starting:
        mActions[Start]->setEnabled(false);
        mActions[Stop]->setEnabled(true);
        mActions[Restart]->setEnabled(true);
        updateToggleRunningAction();

        break;

    case QProcess::Running:
        mActions[StopMain]->setEnabled(true);
        mActions[RecompileClassLibrary]->setEnabled(true);

        onStart();

        break;

    case QProcess::NotRunning:
        mActions[Start]->setEnabled(true);
        mActions[Stop]->setEnabled(false);
        mActions[Restart]->setEnabled(false);
        mActions[StopMain]->setEnabled(false);
        mActions[RecompileClassLibrary]->setEnabled(false);
        updateToggleRunningAction();
        postQuitNotification();
        mCompiled = false;
        break;
    }
}
Пример #7
0
autobots_toutiao::autobots_toutiao(QWidget *parent)
    : control_status(true),QMainWindow(parent),network(NULL),
    m_client_id("394e2173327e4ead8302dc27f4ae8879")
{
    ui.setupUi(this);

    initialize();

    connect(ui.pushButton_start, SIGNAL(clicked()), this, SLOT(onStart()));

    connect(ui.pushButton_pause, SIGNAL(clicked()), this, SLOT(onPause()));

    connect(ui.pushButton_add_comment_id, SIGNAL(clicked()), this, SLOT(onAddCommentID()));

    connect(ui.action_from_txt, SIGNAL(triggered()), this, SLOT(onActFromTxt()));

    connect(ui.action_import_commentid, SIGNAL(triggered()), this, SLOT(onActImportComment()));

    connect(ui.action_clear_comments, SIGNAL(triggered()), this, SLOT(onActClearComments()));

    connect(ui.action_clear_accounts, SIGNAL(triggered()), this, SLOT(onActClearAccounts()));

    connect(ui.pushButton_compute_num, SIGNAL(clicked()), this, SLOT(onComputeNumber()));

    connect(ui.pushButton_count, SIGNAL(clicked()), this, SLOT(onCountAll()));
}
Пример #8
0
void Stoppable::startRecursive ()
{
    onStart ();
    for (Children::const_iterator iter (m_children.cbegin ());
        iter != m_children.cend(); ++iter)
        iter->stoppable->startRecursive ();
}
Пример #9
0
autobots_toutiao::autobots_toutiao(QWidget *parent)
    : QMainWindow(parent),
    m_account_order(0),m_comment_order(0),m_code_online(true)
    ,m_auto_change_ip(true)
{
    ui.setupUi(this);

    initialize();

    connect(ui.pushButton_start, SIGNAL(clicked()), this, SLOT(onStart()));

    connect(ui.pushButton_pause, SIGNAL(clicked()), this, SLOT(onPause()));

    connect(ui.pushButton_develiver, SIGNAL(clicked()), this, SLOT(onDeveliver()));

    connect(ui.pushButton_add_comment_id, SIGNAL(clicked()), this, SLOT(onAddCommentID()));

    connect(ui.action_from_txt, SIGNAL(triggered()), this, SLOT(onActFromTxt()));

    connect(ui.action_import_commentid, SIGNAL(triggered()), this, SLOT(onActImportComment()));

    connect(ui.action_clear_comments, SIGNAL(triggered()), this, SLOT(onActClearComments()));

    connect(ui.action_clear_accounts, SIGNAL(triggered()), this, SLOT(onActClearAccounts()));

	connect(ui.comboBox_adsl, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(onChanged(const QString&)));

	intialVPN();
}
Пример #10
0
void win_system::messageRouter(csystem *src, int msg, param lparam, param rparam)
{
  if (src == this) { return; }
  csystem::messageRouter(src, msg, lparam, rparam);
  
  switch (msg)
  {
    // crashutils global messages
		case MSG_START: onStart(); break;
    case MSG_INIT_NSD: onInitNSD((NSF*)lparam, (NSD*)rparam); break;
    
    // window system local messages
    case WSM_CREATE: onCreate(); break;
  }
  
  if (mainWindow)
  {    
    param params[2];
    params[0] = lparam;
    params[1] = rparam;
    
    main_window_com *mwc = (main_window_com*)mainWindow;
    mwc->BroadcastMessage((UINT)msg, (WPARAM)1, (LPARAM)params);
  }
}
Пример #11
0
void DaemonUi::init()
{
  QStringList args = QApplication::arguments();
  args.takeFirst();
  arguments(args);

  onStart();
}
Пример #12
0
void Serializer::onMessageReceived(const sp<AMessage> &msg) {
    switch (msg->what()) {
        case kWhatAddSource:
        {
            ssize_t index = onAddSource(msg);

            sp<AMessage> response = new AMessage;

            if (index < 0) {
                response->setInt32("err", index);
            } else {
                response->setSize("index", index);
            }

            uint32_t replyID;
            CHECK(msg->senderAwaitsResponse(&replyID));

            response->postReply(replyID);
            break;
        }

        case kWhatStart:
        case kWhatStop:
        {
            status_t err = (msg->what() == kWhatStart) ? onStart() : onStop();

            sp<AMessage> response = new AMessage;
            response->setInt32("err", err);

            uint32_t replyID;
            CHECK(msg->senderAwaitsResponse(&replyID));

            response->postReply(replyID);
            break;
        }

        case kWhatPoll:
        {
            int32_t generation;
            CHECK(msg->findInt32("generation", &generation));

            if (generation != mPollGeneration) {
                break;
            }

            int64_t delayUs = onPoll();
            if (delayUs >= 0ll) {
                schedulePoll(delayUs);
            }
            break;
        }

        default:
            TRESPASS();
    }
}
Пример #13
0
 void Thread::start()
 {
     if(started)
         throw std::logic_error("Thread is already started. Cannot start again before joining");
     
     onStart();
     if(pthread_create(&thread, NULL, runThread, this) != 0)
         throw std::logic_error("Failed to create thread. Cannot start Thread");
     started = true;
 }
Пример #14
0
void ApplicationContext::start()
{
  if (_app_state == ApplicationLifeState::INITIALIZED
      || _app_state == ApplicationLifeState::STOPPED)
  {
    _event_listener.activate();
    onStart();
    _app_state = ApplicationLifeState::RUNNABLE;
    _last_update_time = System::getInstance()->getTime();
  }
}
Пример #15
0
TelemetryManager::TelemetryManager()
{
    moveToThread(Core::ICore::instance()->threadManager()->getRealTimeThread());
    // Get UAVObjectManager instance
    ExtensionSystem::PluginManager* pm = ExtensionSystem::PluginManager::instance();
    objMngr = pm->getObject<UAVObjectManager>();

    // connect to start stop signals
    connect(this, SIGNAL(myStart()), this, SLOT(onStart()),Qt::QueuedConnection);
    connect(this, SIGNAL(myStop()), this, SLOT(onStop()),Qt::QueuedConnection);
}
Пример #16
0
void ActorStateMachine::start()
{
    assert(!running);
    assert(!currentState);
    assert(states.find(initialState) != states.end());

    running = true;
    currentState = states[initialState];
    currentState->onEnter();

    onStart();
}
 void IServer::start() {
     boost::mutex lock_;
     lock_.lock();
     if (isRunning_) {
         BOOST_LOG_TRIVIAL(warning) << "Server is already running!!!\n";
         return;
     } else {
         isRunning_ = true;
         onStart();
     }
     lock_.unlock();
 }
Пример #18
0
void AmSession::run()
{
  try {
    try {

      onStart();

      while (!sess_stopped.get() || 
	     (dlg.getStatus() == AmSipDialog::Disconnecting)//  ||
	     // (dlg.getUACTransPending())
	     ){

	waitForEvent();
	processEvents();

	DBG("%s dlg.getUACTransPending() = %i\n",
	    dlg.callid.c_str(),dlg.getUACTransPending());
      }
	    
      if ( dlg.getStatus() != AmSipDialog::Disconnected ) {
		
	DBG("dlg '%s' not terminated: sending bye\n",dlg.callid.c_str());
	if(dlg.bye() == 0){
	  while ( dlg.getStatus() != AmSipDialog::Disconnected ){
	    waitForEvent();
	    processEvents();
	  }
	}
	else {
	  WARN("failed to terminate call properly\n");
	}
      }
    }
    catch(const AmSession::Exception& e){ throw e; }
    catch(const string& str){
      ERROR("%s\n",str.c_str());
      throw AmSession::Exception(500,"unexpected exception.");
    }
    catch(...){
      throw AmSession::Exception(500,"unexpected exception.");
    }
  }
  catch(const AmSession::Exception& e){
    ERROR("%i %s\n",e.code,e.reason.c_str());
  }
	
  destroy();
    
  // wait at least until session is out of RtpScheduler
  DBG("session is stopped.\n");
  //detached.wait_for();
}
Пример #19
0
WindowMain::WindowMain(QWidget *parent) :
	QMainWindow(parent),
	m_ui(new Ui::WindowMain)
{
	/** Initialize the UI */
	m_ui->setupUi(this);

	/** Set the window title */
	setWindowTitle(PACKAGE_STRING);

	/** Connect the actions */
	connect(m_ui->actionAboutQt, SIGNAL(triggered()),
			qApp, SLOT(aboutQt()));
	connect(m_ui->actionAbout, SIGNAL(triggered()),
			this, SLOT(onAbout()));
	connect(m_ui->actionSettings, SIGNAL(triggered()),
			this, SLOT(onSettings()));
	connect(m_ui->actionQuit, SIGNAL(triggered()),
			this, SLOT(close()));
	connect(this, SIGNAL(next()),
			this, SLOT(onNext()));
	connect(this, SIGNAL(done()),
			this, SLOT(onEnd()));

	/** Initialize the settings */
	m_settings = new Settings(this);

	/** Create and setup the drop area */
	m_dropArea = new DropArea();
	connect(m_dropArea, SIGNAL(dropped(QList<QUrl>)),
			this, SLOT(onStart(QList<QUrl>)));
	setCentralWidget(m_dropArea);

	/** Initialize the status bar */
	m_ui->statusBar->setStyleSheet("QStatusBar::item {border: none;}");
	m_ui->statusBar->showMessage(tr("Ready"));

	/** Create the progress bar */
	m_progress = new QProgressBar();

	/** Create the allocine engine */
	m_allocine = new AllocineEngine();
	connect(m_allocine, SIGNAL(found(QList<AllocineResult*>)),
			this, SLOT(onFound(QList<AllocineResult*>)));
	connect(m_allocine, SIGNAL(fetched(AllocineResult*)),
			this, SLOT(onFetched(AllocineResult*)));
	connect(m_allocine, SIGNAL(error(QString)),
			this, SLOT(onError(QString)));

	/** Initialize the processing flag */
	m_processing = false;
}
Пример #20
0
void AlarmWidget::setConnections()
{
    connect (btnStart, SIGNAL(clicked()), this, SLOT(onStart()));
    connect(btnPause, SIGNAL(clicked()), this, SLOT(onPause()));
    connect(btnQuit,  SIGNAL(clicked()), this, SLOT(close()));
    connect(m_timer_ctd, SIGNAL(timeout()), this, SLOT(onTimerEvent()));

    connect(radioMin, SIGNAL(toggled(bool)), this, SLOT(changeTimeUnit()));
    connect(radioSec, SIGNAL(toggled(bool)), this, SLOT(changeTimeUnit()));

    connect(radioSoundOFF, SIGNAL(toggled(bool)), this, SLOT(changeSoundOutput()));
    connect(radioSoundOn, SIGNAL(toggled(bool)), this, SLOT(changeSoundOutput()));
}
Пример #21
0
// This fuction is used as the main loop in all game states.
const StateEvent& BaseState::start(const StateArgs& args)
{
    stateEvent.reset(); // Must reset the event in case the state still existed in memory after this returned
    processArgs(args);
    onStart();
    handleEvents();
    while (stateEvent.shouldContinue())
    {
        update();
        draw();
        handleEvents(); // This is last so it doesn't have to update and draw an extra frame if the state is supposed to change
    }
    return stateEvent;
}
Пример #22
0
void
Work::run()
{
    if (getState() == WORK_PENDING)
    {
        CLOG(DEBUG, "Work") << "starting " << getUniqueName();
        mApp.getMetrics().NewMeter({"work", "unit", "start"}, "unit").Mark();
        onStart();
    }
    CLOG(DEBUG, "Work") << "running " << getUniqueName();
    mApp.getMetrics().NewMeter({"work", "unit", "run"}, "unit").Mark();
    setState(WORK_RUNNING);
    onRun();
}
Пример #23
0
void RTMFPServer::run() {

    try {
        _pSocket->bind(SocketAddress("0.0.0.0",_port));
        _mainSockets.add(*_pSocket,*this);

        NOTE("RTMFP server starts on %u port",_port);
        onStart();

        RTMFPManager manager(*this);
        bool terminate=false;
        while(!terminate)
            handle(terminate);

    } catch(Exception& ex) {
        FATAL("RTMFPServer, %s",ex.displayText().c_str());
    } catch (exception& ex) {
        FATAL("RTMFPServer, %s",ex.what());
    } catch (...) {
        FATAL("RTMFPServer, unknown error");
    }

    _mainSockets.remove(*_pSocket);

    // terminate handle
    terminate();

    // clean sessions, and send died message if need
    _handshake.clear();
    _sessions.clear();

    // stop receiving and sending engine (it waits the end of sending last session messages)
    poolThreads.clear();

    // close UDP socket
    delete _pSocket;

    sockets.clear();
    _mainSockets.clear();
    _port=0;
    onStop();

    if(_pCirrus) {
        delete _pCirrus;
        _pCirrus = NULL;
    }

    NOTE("RTMFP server stops");
}
//---------------------------------------------------------------------------
DialogRampalTest::DialogRampalTest(QWidget *parent) :
    QDialog(parent,Qt::Window),
    ui(new Ui::DialogRampalTest),
    m_valid_input(false)
{
  ui->setupUi(this);
  QObject::connect(ui->button_start,SIGNAL(clicked()),
    this,SLOT(onStart()));
  QObject::connect(ui->button_benchmark,SIGNAL(clicked()),
    this,SLOT(onBenchmark()));
  QObject::connect(ui->edit_newick,SIGNAL(textChanged(QString)),
    this,SLOT(onAnyChange()));
  QObject::connect(ui->edit_theta,SIGNAL(textChanged(QString)),
    this,SLOT(onAnyChange()));

  //Set table header
  {
    QTableWidgetItem * const i
      = new QTableWidgetItem("Test name");
    ui->table->setHorizontalHeaderItem(0,i);
  }
  {
    QTableWidgetItem * const i
      = new QTableWidgetItem("Probability");
    ui->table->setHorizontalHeaderItem(1,i);
  }
  {
    QTableWidgetItem * const i
      = new QTableWidgetItem("Time (sec)");
    ui->table->setHorizontalHeaderItem(2,i);
  }
  {
    QTableWidgetItem * const i
      = new QTableWidgetItem("Newick");
    ui->table->setHorizontalHeaderItem(3,i);
  }
  {
    QTableWidgetItem * const i
      = new QTableWidgetItem("Complexity");
    ui->table->setHorizontalHeaderItem(4,i);
  }


  //Put the dialog in the screen center
  const QRect screen = QApplication::desktop()->screenGeometry();
  this->move( screen.center() - this->rect().center() );

  onAnyChange();
}
Пример #25
0
bool SoundRecorder::start(unsigned int sampleRate)
{
    // Check if the device can do audio capture
    if (!isAvailable())
    {
        err() << "Failed to start capture: your system cannot capture audio data (call SoundRecorder::isAvailable to check it)" << std::endl;
        return false;
    }

    // Check that another capture is not already running
    if (captureDevice)
    {
        err() << "Trying to start audio capture, but another capture is already running" << std::endl;
        return false;
    }

    // Determine the recording format
    ALCenum format = (m_channelCount == 1) ? AL_FORMAT_MONO16 : AL_FORMAT_STEREO16;

    // Open the capture device for capturing 16 bits samples
    captureDevice = alcCaptureOpenDevice(m_deviceName.c_str(), sampleRate, format, sampleRate);
    if (!captureDevice)
    {
        err() << "Failed to open the audio capture device with the name: " << m_deviceName << std::endl;
        return false;
    }

    // Clear the array of samples
    m_samples.clear();

    // Store the sample rate
    m_sampleRate = sampleRate;

    // Notify derived class
    if (onStart())
    {
        // Start the capture
        alcCaptureStart(captureDevice);

        // Start the capture in a new thread, to avoid blocking the main thread
        m_isCapturing = true;
        m_thread.launch();

        return true;
    }

    return false;
}
Пример #26
0
bool Action::step( float dt )
{
    bool updated = !isDone();
    if (m_firstTick){
        m_elapsed = 0;
        onStart();
        m_firstTick = false;
    }
    m_elapsed += dt;
    if (m_easing){
        update(m_easing->update(min(1, m_elapsed/m_duration)));
    }else{
        update(min(1, m_elapsed/m_duration));
    }
    return updated;
}
Пример #27
0
bool URLRequest::start(CURL* handle)
{
	_handle = handle;

	curl_easy_setopt(handle, CURLOPT_NOPROGRESS, 0);
	curl_easy_setopt(handle, CURLOPT_PROGRESSFUNCTION, progressCallback);
	curl_easy_setopt(handle, CURLOPT_PROGRESSDATA, this);

	curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, receiveDataCallback);
	curl_easy_setopt(handle, CURLOPT_WRITEDATA, this);

	curl_easy_setopt(handle, CURLOPT_HEADERFUNCTION, receiveHeaderCallback);
	curl_easy_setopt(handle, CURLOPT_HEADERDATA, this);

	return onStart(handle);
}
Пример #28
0
int htThreadItf::Execute()
{
	// Notify that thread has started
	onStart();
	
	// Loop until termination requested
	while( !IsTerminating() ) {
		mMutex.Acquire();
		if( run() ) break;
		mMutex.Release();
		Sleep( waitTime() );
	}
	
	// Notify that thread is ending
	onStop();
}
Пример #29
0
	void LocalMediaRecorder::handleMessage(Message* msg){
		switch(msg->what){
		case MSG_SET_OUTPUT_FILE:
			{
				char* path = (char*)msg->obj;
				strncpy(mOutputFile, path, sizeof(mOutputFile));
				free(path);
				mListener->notify(MediaRecorderListener::NATIVE_MSG_SET_OUTPUT_FILE_DONE);
				break;
			}
		case MSG_SET_LISTENER:
			mListener = (MediaRecorderListener*)msg->obj;
			mListener->registerCurThread();
			mListener->notify(MediaRecorderListener::NATIVE_MSG_SET_LISTENER_DONE);
			break;
		case MSG_SET_PARAMETER:
			{
				char* param = (char*)msg->obj;
				onSetParameter(param);
				free(param);
				mListener->notify(MediaRecorderListener::NATIVE_MSG_SET_PARAMETER_DONE);
				break;
			}
		case MSG_SET_PREVIEW:
			mListener->notify(MediaRecorderListener::NATIVE_MSG_SET_PREVIEW_DONE);
			break;
		case MSG_SET_CHANNELS:
			mChannels = msg->arg1;
			break;
		case MSG_SET_SAMPLE_RATE:
			mSampleRate = msg->arg1;
			break;
		case MSG_SET_VIDEO_SIZE:
			mWidth = msg->arg1;
			mHeight = msg->arg2;
			break;
		case MSG_SET_COLOR_FORMAT:
			mColorFormat = (OMX_COLOR_FORMATTYPE)msg->arg1;
			break;
		case MSG_START:
			onStart();
			break;
		default:
			break;
		}
	}
Пример #30
0
auto_smzdm::auto_smzdm(QWidget *parent)
    : control_status(true), QMainWindow(parent)
{
    ui.setupUi(this);

    //networkManager = new QNetworkAccessManager(this);

    connect(ui.pushButton_start, SIGNAL(clicked()), this, SLOT(onStart()));

    connect(ui.pushButton_pause, SIGNAL(clicked()), this, SLOT(onPause()));

    connect(ui.pushButton_clickone, SIGNAL(clicked()), this, SLOT(onOneClick()));

    //connect(&network, SIGNAL(csrfToken(QString)), this, SLOT(onCsrfToken(QString)));

    //connect(&network, SIGNAL(votecount(double)), this, SLOT(onVoteSucceed(double)));
}