void LoginPage::nextPage() { setFocus(); clearErrors(); if (login_staked_widget_->currentIndex() == SUBPAGE_PHONE_LOGIN_INDEX) { entered_phone_->setText(country_code_->text() + phone_->text()); entered_phone_->adjustSize(); country_code_->setEnabled(false); phone_->setEnabled(false); sendCode(); } else if (login_staked_widget_->currentIndex() == SUBPAGE_UIN_LOGIN_INDEX) { uin_login_edit_->setEnabled(false); uin_password_edit_->setEnabled(false); gui_coll_helper collection(GetDispatcher()->create_collection(), true); collection.set_value_as_qstring("login", uin_login_edit_->text()); collection.set_value_as_qstring("password", uin_password_edit_->text()); collection.set_value_as_bool("save_auth_data", keep_logged_->isChecked()); collection.set_value_as_bool("not_log", true); if (is_login_) { send_seq_ = GetDispatcher()->post_message_to_core("login_by_password", collection.get()); } else { send_seq_ = GetDispatcher()->post_message_to_core("login_by_password_for_attach_uin", collection.get()); } } }
// zx_status_t zx_task_resume_from_exception zx_status_t sys_task_resume_from_exception(zx_handle_t handle, zx_handle_t port, uint32_t options) { LTRACE_ENTRY; auto up = ProcessDispatcher::GetCurrent(); fbl::RefPtr<ThreadDispatcher> thread; zx_status_t status = up->GetDispatcher(handle, &thread); if (status != ZX_OK) return status; fbl::RefPtr<PortDispatcher> eport; status = up->GetDispatcher(port, &eport); if (status != ZX_OK) return status; // Currently the only option is the ZX_RESUME_TRY_NEXT bit. if (options != 0 && options != ZX_RESUME_TRY_NEXT) return ZX_ERR_INVALID_ARGS; if (options & ZX_RESUME_TRY_NEXT) { return thread->MarkExceptionNotHandled(eport.get()); } else { return thread->MarkExceptionHandled(eport.get()); } }
void qt_theme_settings::postDefaultThemeIdToCore(const int _theme_id) const { Ui::gui_coll_helper cl_coll(GetDispatcher()->create_collection(), true); cl_coll.set_value_as_int("id", _theme_id); GetDispatcher()->post_message_to_core("themes/default/id", cl_coll.get()); }
void LoginPage::setErrorText(int result) { setFocus(); switch (result) { case core::le_wrong_login: error_label_->setText(login_staked_widget_->currentIndex() == SUBPAGE_UIN_LOGIN_INDEX ? QT_TRANSLATE_NOOP("login_page","Wrong UIN/Email or password. Please try again.") : QT_TRANSLATE_NOOP("login_page","You have entered an invalid code. Please try again.")); GetDispatcher()->post_stats_to_core(login_staked_widget_->currentIndex() == SUBPAGE_UIN_LOGIN_INDEX ? core::stats::stats_event_names::reg_error_uin : core::stats::stats_event_names::reg_error_code); break; case core::le_error_validate_phone: error_label_->setText(QT_TRANSLATE_NOOP("login_page","Invalid phone number. Please try again.")); GetDispatcher()->post_stats_to_core(core::stats::stats_event_names::reg_error_phone); break; case core::le_success: error_label_->setText(""); break; case core::le_attach_error_busy_phone: error_label_->setText(QT_TRANSLATE_NOOP("sidebar","This phone number is already attached to another account.\nPlease edit phone number and try again.")); break; default: error_label_->setText(QT_TRANSLATE_NOOP("login_page","Error occured, try again later")); GetDispatcher()->post_stats_to_core(core::stats::stats_event_names::reg_error_other); break; } }
void CListener::HandleRead(const boost::system::error_code& e, std::size_t bytes_transferred) { Logger.Debug << __PRETTY_FUNCTION__ << std::endl; if (!e) { boost::tribool result_; boost::tie(result_, boost::tuples::ignore) = Parse( m_message, m_buffer.data(), m_buffer.data() + bytes_transferred); if (result_) { ptree x = static_cast<ptree>(m_message); std::string uuid = m_message.GetSourceUUID(); remotehost hostname = m_message.GetSourceHostname(); ///Make sure the hostname is registered: GetConnectionManager().PutHostname(uuid,hostname); ///Get the pointer to the connection: CConnection::ConnectionPtr conn; conn = GetConnectionManager().GetConnectionByUUID(uuid, GetSocket().get_io_service(), GetDispatcher()); #ifdef CUSTOMNETWORK if((rand()%100) >= GetReliability()) { Logger.Debug<<"Dropped datagram "<<m_message.GetHash()<<":" <<m_message.GetSequenceNumber()<<std::endl; goto listen; } #endif if(m_message.GetStatus() == freedm::broker::CMessage::Accepted) { ptree pp = m_message.GetProtocolProperties(); size_t hash = pp.get<size_t>("src.hash"); Logger.Debug<<"Recieved ACK"<<hash<<":" <<m_message.GetSequenceNumber()<<std::endl; conn->RecieveACK(m_message); } else if(conn->Recieve(m_message)) { Logger.Debug<<"Accepted message "<<m_message.GetHash()<<":" <<m_message.GetSequenceNumber()<<std::endl; GetDispatcher().HandleRequest(m_message); } else if(m_message.GetStatus() != freedm::broker::CMessage::Created) { Logger.Notice<<"Rejected message "<<m_message.GetHash()<<":" <<m_message.GetSequenceNumber()<<std::endl; } } listen: GetSocket().async_receive_from(boost::asio::buffer(m_buffer, 8192), m_endpoint, boost::bind(&CListener::HandleRead, this, boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred)); } else { GetConnectionManager().Stop(CListener::ConnectionPtr(this)); } }
void MainPage::showPlaceholder(Utils::PlaceholdersType _PlaceholdersType) { switch(_PlaceholdersType) { case Utils::PlaceholdersType::PlaceholdersType_HideFindFriend: if (noContactsYetSuggestions_) { noContactsYetSuggestions_->setHidden(true); pages_->removeWidget(noContactsYetSuggestions_); } pages_->poproot(); break; case Utils::PlaceholdersType::PlaceholdersType_FindFriend: pages_->insertWidget(1, showNoContactsYetSuggestions(pages_, [this]() { onAddContactClicked(); GetDispatcher()->post_stats_to_core(core::stats::stats_event_names::cl_empty_find_friends); })); pages_->push(contact_list_widget_); pages_->poproot(); break; case Utils::PlaceholdersType::PlaceholdersType_SetExistanseOnIntroduceYourself: needShowIntroduceYourself_ = true; break; case Utils::PlaceholdersType::PlaceholdersType_SetExistanseOffIntroduceYourself: if (needShowIntroduceYourself_) { if (introduceYourselfSuggestions_) { introduceYourselfSuggestions_->setHidden(true); pages_->removeWidget(introduceYourselfSuggestions_); } pages_->poproot(); needShowIntroduceYourself_ = false; } break; case Utils::PlaceholdersType::PlaceholdersType_IntroduceYourself: if (!needShowIntroduceYourself_) break; pages_->insertWidget(0, showIntroduceYourselfSuggestions(pages_, [this]() { onAddContactClicked(); GetDispatcher()->post_stats_to_core(core::stats::stats_event_names::cl_empty_find_friends); })); pages_->push(contact_list_widget_); pages_->poproot(); break; default: break; } }
void CloseDispatcherConnection() { IT_IT("CloseDispatcherConnection"); GetDispatcher()->close(); Dispatcher* d = GetDispatcher(); delete d; TheDispatcher = NULL; };
void LoginPage::sendCode() { timer_->stop(); gui_coll_helper collection(GetDispatcher()->create_collection(), true); collection.set_value_as_qstring("country", country_code_->text()); collection.set_value_as_qstring("phone", phone_->text()); collection.set_value_as_qstring("locale", Utils::GetTranslator()->getCurrentLang()); GetDispatcher()->post_message_to_core("login_get_sms_code", collection.get()); remaining_seconds_ = 60; updateTimer(); }
void LoginPage::codeEditChanged(QString code) { if (code.length() == 4) { setFocus(); code_edit_->setEnabled(false); get_gui_settings()->set_value(settings_keep_logged_in, true); gui_coll_helper collection(GetDispatcher()->create_collection(), true); collection.set_value_as_qstring("phone", phone_->text()); collection.set_value_as_qstring("sms_code", code); collection.set_value_as_bool("save_auth_data", true); GetDispatcher()->post_message_to_core("login_by_phone", collection.get()); } }
void qt_gui_settings::post_value_to_core(const QString& _name, const settings_value& _val) const { Ui::gui_coll_helper cl_coll(GetDispatcher()->create_collection(), true); core::ifptr<core::istream> data_stream(cl_coll->create_stream()); if (_val.data_.size()) data_stream->write((const uint8_t*) &_val.data_[0], (uint32_t)_val.data_.size()); cl_coll.set_value_as_qstring("name", _name); cl_coll.set_value_as_stream("value", data_stream.get()); GetDispatcher()->post_message_to_core("settings/value/set", cl_coll.get()); }
void Iec101driverCommand::QueryResponse (QObject *p, const QString &c, int id, QObject*caller) // handles database responses { if(p != this) return; switch(id) { case tUnit: { if(GetConfigureDb()->GetNumberResults() > 0) { unsigned char parametri[sizeof(dispatcher_extra_params)]; dispatcher_extra_params* params = (dispatcher_extra_params *) parametri; memset(parametri, 0, sizeof(dispatcher_extra_params)); (params->res[0]).value = atof((const char*)Value->text()); QString unit_name = GetConfigureDb()->GetString("UNIT"); strcpy(params->string1, (const char *)unit_name); //driver instance strcpy(params->string2, (const char *)samplePointName); strcpy(params->string3, (const char *)Value->text()); //For writing the string //Generate IEC command GetDispatcher()->DoExec(NotificationEvent::CMD_SEND_COMMAND_TO_UNIT, (char *)parametri, sizeof(dispatcher_extra_params)); //broadcast to all tcp clients accept(); } } break; default: break; }; };
static zx_status_t object_unbind_exception_port(zx_handle_t obj_handle, bool debugger) { // TODO(ZX-968): check rights once appropriate right is determined auto up = ProcessDispatcher::GetCurrent(); fbl::RefPtr<Dispatcher> dispatcher; auto status = up->GetDispatcher(obj_handle, &dispatcher); if (status != ZX_OK) return status; auto job = DownCastDispatcher<JobDispatcher>(&dispatcher); if (job) { return job->ResetExceptionPort(debugger) ? ZX_OK : ZX_ERR_BAD_STATE; // No port was bound. } auto process = DownCastDispatcher<ProcessDispatcher>(&dispatcher); if (process) { return process->ResetExceptionPort(debugger) ? ZX_OK : ZX_ERR_BAD_STATE; // No port was bound. } auto thread = DownCastDispatcher<ThreadDispatcher>(&dispatcher); if (thread) { if (debugger) return ZX_ERR_INVALID_ARGS; return thread->ResetExceptionPort() ? ZX_OK : ZX_ERR_BAD_STATE; // No port was bound. } return ZX_ERR_WRONG_TYPE; }
void MainWindow::maximize() { if (isMaximized()) { showNormal(); auto main_rect = Ui::get_gui_settings()->get_value<QRect>( settings_main_window_rect, QRect(0, 0, Utils::scale_value(1000), Utils::scale_value(600))); resize(main_rect.width(), main_rect.height()); move(main_rect.x(), main_rect.y()); #ifdef _WIN32 SetWindowPos((HWND)Shadow_->winId(), (HWND)winId(), 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW); #endif //_WIN32 } else { #ifdef _WIN32 SetWindowPos((HWND)Shadow_->winId(), (HWND)winId(), 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_HIDEWINDOW); #endif //_WIN32 showMaximized(); } GetDispatcher()->post_stats_to_core(core::stats::stats_event_names::main_window_fullscreen); }
/////////////////////////////////////////////////////////////////////////////// /// @fn CConnection::Send /// @description Given a message and wether or not it should be sequenced, /// write that message to the channel. /// @pre The CConnection object is initialized. /// @post If the window is in not full, the message will have been written to /// to the channel. Before being sent the message has been signed with the /// UUID, source hostname and sequence number (if it is being sequenced). /// If the message is being sequenced and the window is not already full, /// the timeout timer is cancelled and reset. /// @param p_mesg A CMessage to write to the channel. /////////////////////////////////////////////////////////////////////////////// void CConnection::Send(CMessage & p_mesg) { Logger.Debug << __PRETTY_FUNCTION__ << std::endl; // If the UUID of the reciepient (The value stored by GetUUID of this // object) is the same as the this node's uuid (As stored by the // Connection manager) place the message directly into the recieved // Queue. if(GetUUID() == GetConnectionManager().GetUUID()) { p_mesg.SetSourceUUID(GetConnectionManager().GetUUID()); p_mesg.SetSourceHostname(GetConnectionManager().GetHostname()); p_mesg.SetSendTimestampNow(); GetDispatcher().HandleRequest(GetBroker(),p_mesg); return; } ProtocolMap::iterator sit = m_protocols.find(p_mesg.GetProtocol()); if(sit == m_protocols.end()) { sit = m_protocols.find(m_defaultprotocol); } (*sit).second->Send(p_mesg); }
ECode AudioPlaybackQueueItem::Run() { AutoPtr<ITextToSpeechServiceUtteranceProgressDispatcher> dispatcher = GetDispatcher(); dispatcher->DispatchOnStart(); // mPlayer = CMediaPlayer::Create(mContext, mUri); if (/*mPlayer == NULL*/FALSE) { dispatcher->DispatchOnError(); return NOERROR; } //try { AutoPtr<MediaPlayerOnErrorListener> mpoer = new MediaPlayerOnErrorListener(this); // mPlayer->SetOnErrorListener(mpoer); AutoPtr<MediaPlayerOnCompletionListener> mpocl = new MediaPlayerOnCompletionListener(this); // mPlayer->SetOnCompletionListener(mpocl); // mPlayer->SetAudioStreamType(mStreamType); // mPlayer->Start(); // mDone->Block(); Finish(); //} catch (IllegalArgumentException ex) { //Java: Log.w(TAG, "MediaPlayer failed", ex); /* Logger::W(TAG, String("MediaPlayer failed\n")); mDone->Open(); */ //} if (mFinished) { dispatcher->DispatchOnDone(); } else { dispatcher->DispatchOnError(); } return NOERROR; }
void ContactAvatarWidget::postSetAvatarToCore(const QPixmap& _avatar) { auto byteArray = processImage(_avatar); core::coll_helper helper(GetDispatcher()->create_collection(), true); core::ifptr<core::istream> data_stream(helper->create_stream()); if (byteArray.size()) data_stream->write((const uint8_t*)byteArray.data(), (uint32_t)byteArray.size()); helper.set_value_as_stream("avatar", data_stream.get()); if (aimid_.isEmpty()) helper.set_value_as_bool("chat", true); else if (aimid_ != MyInfo()->aimId()) helper.set_value_as_string("aimid", aimid_.toStdString()); seq_ = GetDispatcher()->post_message_to_core(qsl("set_avatar"), helper.get()); }
void LoginPage::switchLoginType() { setFocus(); clearErrors(); initLoginSubPage(login_staked_widget_->currentIndex() == SUBPAGE_UIN_LOGIN_INDEX ? SUBPAGE_PHONE_LOGIN_INDEX : SUBPAGE_UIN_LOGIN_INDEX); GetDispatcher()->post_stats_to_core(login_staked_widget_->currentIndex() == SUBPAGE_UIN_LOGIN_INDEX ? core::stats::stats_event_names::reg_page_uin : core::stats::stats_event_names::reg_page_phone); }
void MainPage::createGroupChat() { QStringList empty_list; auto oldModel = Logic::GetChatMembersModel(); Logic::SetChatMembersModel(NULL); Ui::createGroupChat(empty_list); Logic::SetChatMembersModel(oldModel); GetDispatcher()->post_stats_to_core(core::stats::stats_event_names::groupchat_from_create_button); }
void MainPage::onAddContactClicked() { if (!search_contacts_) { search_contacts_ = new SearchContactsWidget(this); pages_->addWidget(search_contacts_); } pages_->push(search_contacts_); search_contacts_->on_focus(); GetDispatcher()->post_stats_to_core(core::stats::stats_event_names::search_open_page); }
void Socket::Close() { if (StopEventProcessing()) { HandleReadEventInternal(); HandleWriteEventInternal(); Ptr this_ = shared_from_this(); GetDispatcher().Postpone([this_](){}); } }
void qt_theme_settings::postContactsThemesToCore() const { Ui::gui_coll_helper cl_coll(GetDispatcher()->create_collection(), true); core::ifptr<core::istream> data_stream(cl_coll->create_stream()); QString result = serializedContactsThemes(); uint size = result.toLatin1().size(); if (size) { data_stream->write((const uint8_t*) result.toLatin1().data(), size); } cl_coll.set_value_as_qstring("name", "contacts_themes"); cl_coll.set_value_as_stream("value", data_stream.get()); __INFO("themes", ", result string: " << result); GetDispatcher()->post_message_to_core("themes/settings/set", cl_coll.get()); }
// // return true on success else false // bool OpenDispatcherConnection() // open the connections with the dispatcher server { IT_IT("OpenDispatcherConnection"); bool res = true; QString DispatcherUserName; QString DispatcherPassword; Dispatcher* d = new Dispatcher(); SetDispatcher(d); QString dsp_ini_file = GetScadaHomeDirectory() + "\\bin\\dispatcher.ini"; Inifile dsp_iniFile((const char*)dsp_ini_file); if( dsp_iniFile.find("user","dispatcherserver") && dsp_iniFile.find("password","dispatcherserver") ) { DispatcherUserName = dsp_iniFile.find("user","dispatcherserver"); DispatcherPassword = dsp_iniFile.find("password","dispatcherserver"); } else { res = false; } //open connection with dispatcher if( dsp_iniFile.find("address","dispatcherserver") && dsp_iniFile.find("port","dispatcherserver") ) { QString host = QString(dsp_iniFile.find("address","dispatcherserver")) + ":" + QString(dsp_iniFile.find("port","dispatcherserver")); res &= GetDispatcher()->Connect(host, DispatcherUserName, DispatcherPassword); } else { res = false; } if(res == false) { if(d) { d->Disconnect(); delete d; } SetDispatcher(NULL); } return res; };
void LoginPage::countrySelected(QString code) { if (prev_country_code_ == code) return; if (!prev_country_code_.isEmpty()) { core::stats::event_props_type props; props.push_back(std::make_pair("prev_code", prev_country_code_.toStdString())); props.push_back(std::make_pair("next_code", code.toStdString())); GetDispatcher()->post_stats_to_core(core::stats::stats_event_names::reg_edit_country, props); } prev_country_code_ = code; country_code_->setText(code); redrawCountryCode(); phone_->setFocus(); }
void LoginPage::loginResult(int64_t _seq, int result) { if (_seq != send_seq_) return; updateErrors(result); if (result == 0) { if (login_staked_widget_->currentIndex() == SUBPAGE_PHONE_CONF_INDEX) { code_edit_->setText(""); initLoginSubPage(SUBPAGE_PHONE_LOGIN_INDEX); } GetDispatcher()->post_stats_to_core(login_staked_widget_->currentIndex() == SUBPAGE_UIN_LOGIN_INDEX ? core::stats::stats_event_names::reg_login_uin : core::stats::stats_event_names::reg_login_phone); clearErrors(); emit loggedIn(); } }
void LoginPage::loginResult(int result) { code_edit_->setEnabled(true); uin_login_edit_->setEnabled(true); uin_password_edit_->setEnabled(true); setErrorText(result); error_label_->setVisible(result); if (login_staked_widget_->currentIndex() == SUBPAGE_UIN_LOGIN_INDEX) { uin_login_edit_->setProperty("UinError", true); uin_login_edit_->setProperty("Uin", false); uin_login_edit_->setStyle(QApplication::style()); uin_password_edit_->clear(); } else { code_edit_->setProperty("EnteredCodeError", true); code_edit_->setProperty("EnteredCode", false); code_edit_->setStyle(QApplication::style()); } if (result == 0) { if (login_staked_widget_->currentIndex() == SUBPAGE_PHONE_CONF_INDEX) { code_edit_->setText(""); initLoginSubPage(SUBPAGE_PHONE_LOGIN_INDEX); } GetDispatcher()->post_stats_to_core(login_staked_widget_->currentIndex() == SUBPAGE_UIN_LOGIN_INDEX ? core::stats::stats_event_names::reg_login_uin : core::stats::stats_event_names::reg_login_phone); clearErrors(); emit loggedIn(); } }
void MainWindow::showLoginPage() { #ifdef __APPLE__ mac_support_->createMenuBar(true); mac_support_->forceEnglishInputSource(); if (!get_gui_settings()->get_value<bool>(settings_mac_accounts_migrated, false)) { QString accountId = MacMigrationManager::canMigrateAccount(); if (accountId.length() > 0) { // Move it out of ifdef-block if it's needed for other platforms main_page_ = nullptr; MainPage::reset(); showMigrateAccountPage(accountId); return; } } #endif if (!login_page_) { login_page_ = new LoginPage(this, true /* is_login */); stacked_widget_->addWidget(login_page_); connect(login_page_, SIGNAL(loggedIn()), this, SLOT(showMainPage()), Qt::QueuedConnection); } stacked_widget_->setCurrentWidget(login_page_); GetDispatcher()->post_stats_to_core(core::stats::stats_event_names::reg_page_phone); login_page_->enableKeepLogedIn(); clear_global_objects(); }
void CollisionWorld::PerformDiscreteCollisionDetection() { DispatcherInfo dispatchInfo; dispatchInfo.m_timeStep = 0.f; dispatchInfo.m_stepCount = 0; //update aabb (of all moved objects) SimdVector3 aabbMin,aabbMax; for (size_t i=0;i<m_collisionObjects.size();i++) { m_collisionObjects[i]->m_cachedInvertedWorldTransform = m_collisionObjects[i]->m_worldTransform.inverse(); m_collisionObjects[i]->m_collisionShape->GetAabb(m_collisionObjects[i]->m_worldTransform,aabbMin,aabbMax); m_pairCache->SetAabb(m_collisionObjects[i]->m_broadphaseHandle,aabbMin,aabbMax); } m_pairCache->RefreshOverlappingPairs(); Dispatcher* dispatcher = GetDispatcher(); if (dispatcher) dispatcher->DispatchAllCollisionPairs(m_pairCache,dispatchInfo); }
// // return true on success else false // bool ConnectToDispatcher() { IT_IT("ConnectToDispatcher"); bool res = true; QString DispatcherUserName; QString DispatcherPassword; QString dsp_ini_file = GetScadaHomeDirectory() + "\\bin\\dispatcher.ini"; Inifile dsp_iniFile((const char*)dsp_ini_file); if( dsp_iniFile.find("user","dispatcherserver") && dsp_iniFile.find("password","dispatcherserver") ) { DispatcherUserName = dsp_iniFile.find("user","dispatcherserver"); DispatcherPassword = dsp_iniFile.find("password","dispatcherserver"); } else { res = false; } //open connection with dispatcher if( dsp_iniFile.find("address","dispatcherserver") && dsp_iniFile.find("port","dispatcherserver") ) { QString host = QString(dsp_iniFile.find("address","dispatcherserver")) + ":" + QString(dsp_iniFile.find("port","dispatcherserver")); res &= GetDispatcher()->Connect(host, DispatcherUserName, DispatcherPassword); } else { res = false; } return res; };
void LoginPage::openProxySettings() { auto connection_settings_widget_ = new ConnectionSettingsWidget(this); connection_settings_widget_->show(); GetDispatcher()->post_stats_to_core(core::stats::stats_event_names::proxy_open); }
void HorizontalLayout::OnEnter() { auto dispatcher = GetDispatcher(); connection = dispatcher->Connect(shared_from_this()); }