Action_state_widget::Action_state_widget(Action* action) : ui(new Ui::Action_state_widget) { ui->setupUi(this); connect(action, SIGNAL(started()), this, SIGNAL(show_requested())); connect(action, SIGNAL(state_changed(Action_state)), this, SLOT(state_changed(Action_state))); connect(action, SIGNAL(destroyed()), this, SLOT(deleteLater())); }
void Player::setFaceUp(bool face_up){ if(this->face_up != face_up){ this->face_up = face_up; emit state_changed(); } }
int __connman_technology_disabled(enum connman_service_type type) { struct connman_technology *technology; technology = technology_find(type); if (technology == NULL) return -ENXIO; if (technology->pending_reply != NULL) { g_dbus_send_reply(connection, technology->pending_reply, DBUS_TYPE_INVALID); dbus_message_unref(technology->pending_reply); g_source_remove(technology->pending_timeout); technology->pending_reply = NULL; technology->pending_timeout = 0; } if (__sync_fetch_and_sub(&technology->enabled, 1) != 1) return 0; __connman_notifier_disable(type); technology->state = CONNMAN_TECHNOLOGY_STATE_OFFLINE; state_changed(technology); return 0; }
void Tasks_model::task_added(Action *task) { emit layoutAboutToBeChanged(); connect(task, SIGNAL(state_changed(Action_state)), this, SLOT(task_state_changed(Action_state))); connect(task, SIGNAL(destroyed(QObject*)), this, SLOT(task_destroyed(QObject*))); items << qMakePair(task, Action_state()); emit layoutChanged(); }
static void service_state_changed(struct connman_service *service, enum connman_service_state state) { DBG("service %p state %d", service, state); if (!current_service || current_service != service) return; switch (state) { case CONNMAN_SERVICE_STATE_UNKNOWN: nm_state = NM_STATE_UNKNOWN; break; case CONNMAN_SERVICE_STATE_FAILURE: case CONNMAN_SERVICE_STATE_IDLE: nm_state = NM_STATE_DISCONNECTED; break; case CONNMAN_SERVICE_STATE_ASSOCIATION: case CONNMAN_SERVICE_STATE_CONFIGURATION: nm_state = NM_STATE_CONNECTING; break; case CONNMAN_SERVICE_STATE_READY: nm_state = NM_STATE_CONNECTED_LOCAL; break; case CONNMAN_SERVICE_STATE_ONLINE: nm_state = NM_STATE_CONNECTED_GLOBAL; break; case CONNMAN_SERVICE_STATE_DISCONNECT: nm_state = NM_STATE_DISCONNECTING; break; } state_changed(nm_state); properties_changed(nm_state); }
void __connman_notifier_leave_online(enum connman_service_type type) { DBG("type %d", type); if (__sync_fetch_and_sub(&online[type], 1) == 1) state_changed(); }
void __connman_notifier_disconnect(enum connman_service_type type) { DBG("type %d", type); __sync_synchronize(); if (connected[type] == 0) { connman_error("notifier disconnect underflow"); return; } switch (type) { case CONNMAN_SERVICE_TYPE_UNKNOWN: case CONNMAN_SERVICE_TYPE_SYSTEM: case CONNMAN_SERVICE_TYPE_GPS: case CONNMAN_SERVICE_TYPE_VPN: return; case CONNMAN_SERVICE_TYPE_ETHERNET: case CONNMAN_SERVICE_TYPE_GADGET: case CONNMAN_SERVICE_TYPE_WIFI: case CONNMAN_SERVICE_TYPE_BLUETOOTH: case CONNMAN_SERVICE_TYPE_CELLULAR: case CONNMAN_SERVICE_TYPE_P2P: break; } if (__sync_fetch_and_sub(&connected[type], 1) != 1) return; __connman_technology_set_connected(type, false); state_changed(); }
void LocalZipTask::update_state(const QString& msg) { set_msg(msg); const int progress = (0 == _total_files ? 100 : _compressed_files * 100 / _total_files); set_progress(progress > 100 ? 100 : progress); state_changed(); }
void __connman_notifier_enter_online(enum connman_service_type type) { DBG("type %d", type); if (__sync_fetch_and_add(&online[type], 1) == 0) state_changed(); }
void Dashboard::setPlayer(const Player *player){ this->player = player; connect(player, SIGNAL(state_changed()), this, SLOT(refresh())); connect(player, SIGNAL(kingdom_changed()), this, SLOT(updateAvatar())); updateAvatar(); }
void gimp_tool_set_modifier_state (GimpTool *tool, GdkModifierType state, GimpDisplay *display) { gboolean press; g_return_if_fail (GIMP_IS_TOOL (tool)); g_return_if_fail (GIMP_IS_DISPLAY (display)); g_return_if_fail (gimp_tool_control_is_active (tool->control) == FALSE); GIMP_LOG (TOOL_FOCUS, "tool: %p display: %p tool->focus_display: %p", tool, display, tool->focus_display); g_return_if_fail (display == tool->focus_display); if (state_changed (tool->modifier_state, state, GDK_SHIFT_MASK, &press)) { gimp_tool_modifier_key (tool, GDK_SHIFT_MASK, press, state, display); } if (state_changed (tool->modifier_state, state, GDK_CONTROL_MASK, &press)) { gimp_tool_modifier_key (tool, GDK_CONTROL_MASK, press, state, display); } if (state_changed (tool->modifier_state, state, GDK_MOD1_MASK, &press)) { gimp_tool_modifier_key (tool, GDK_MOD1_MASK, press, state, display); } if (state_changed (tool->modifier_state, state, GDK_MOD2_MASK, &press)) { gimp_tool_modifier_key (tool, GDK_MOD2_MASK, press, state, display); } tool->modifier_state = state; }
void Player::setMaxHP(int max_hp){ if(this->max_hp == max_hp) return; this->max_hp = max_hp; if(hp > max_hp) hp = max_hp; emit state_changed(); }
void Dashboard::setPlayer(const ClientPlayer *player){ connect(player, SIGNAL(state_changed()), this, SLOT(refresh())); connect(player, SIGNAL(kingdom_changed()), this, SLOT(updateAvatar())); connect(player, SIGNAL(general_changed()), this, SLOT(updateAvatar())); connect(player, SIGNAL(action_taken()), this, SLOT(setActionState())); mark_item->setDocument(player->getMarkDoc()); updateAvatar(); }
static void technology_connected(enum connman_service_type type, connman_bool_t connected) { DBG("type %d connected %d", type, connected); connman_dbus_property_changed_array(CONNMAN_MANAGER_PATH, CONNMAN_MANAGER_INTERFACE, "ConnectedTechnologies", DBUS_TYPE_STRING, __connman_notifier_list_connected, NULL); state_changed(connected); }
void server_options_dialog::update_name() { server_id id(ui_->addressEdit->text().trimmed()); ids_.clear(); ids_.push_back(id); if (!list_) list_.reset( new server_list ); job_p job(new job_update_selected(ids_, list_, *gi_)); que_->add_job(job); connect(job.get(), SIGNAL(state_changed(job_t::state_t)), SLOT(job_state_changed(job_t::state_t))); ui_->update_name_button->setEnabled(false); }
int connman_peer_set_state(struct connman_peer *peer, enum connman_peer_state new_state) { enum connman_peer_state old_state = peer->state; int err; DBG("peer (%s) old state %d new state %d", peer->name, old_state, new_state); if (old_state == new_state) return -EALREADY; switch (new_state) { case CONNMAN_PEER_STATE_UNKNOWN: return -EINVAL; case CONNMAN_PEER_STATE_IDLE: if (is_connecting(peer) || is_connected(peer)) return peer_disconnect(peer); peer->sub_device = NULL; break; case CONNMAN_PEER_STATE_ASSOCIATION: break; case CONNMAN_PEER_STATE_CONFIGURATION: if (peer->connection_master) err = start_dhcp_server(peer); else err = start_dhcp_client(peer); if (err < 0) return connman_peer_set_state(peer, CONNMAN_PEER_STATE_FAILURE); break; case CONNMAN_PEER_STATE_READY: reply_pending(peer, 0); break; case CONNMAN_PEER_STATE_DISCONNECT: if (peer->connection_master) stop_dhcp_server(peer); peer->connection_master = false; peer->sub_device = NULL; break; case CONNMAN_PEER_STATE_FAILURE: if (manage_peer_error(peer) == 0) return 0; break; }; peer->state = new_state; state_changed(peer); return 0; }
static void default_changed(struct connman_service *service) { if (service != NULL) state = NM_STATE_CONNECTED; else state = NM_STATE_DISCONNECTED; DBG("%p %d", service, state); state_changed(state); properties_changed(state); }
static void default_changed(struct connman_service *service) { DBG("service %p", service); if (!service) nm_state = NM_STATE_DISCONNECTED; else nm_state = NM_STATE_CONNECTED_LOCAL; state_changed(nm_state); properties_changed(nm_state); current_service = service; }
static void offline_mode(bool enabled) { DBG("enabled %d", enabled); if (enabled) nm_state = NM_STATE_ASLEEP; else nm_state = NM_STATE_DISCONNECTED; state_changed(nm_state); properties_changed(nm_state); current_service = NULL; }
void tags_box_widget::toggle_tag_state(QTreeWidgetItem* item, int column) { DBG_PRINTF(5, "toggle_tag_state"); if (column!=0) return; tag_lvitem* tag_item = dynamic_cast<tag_lvitem*>(item); if (!tag_item) return; if (tag_item->checkState(0) != tag_item->last_state()) { tag_item->update_last_state(); tag_item->colorize(); emit state_changed(tag_item->tag_id(), (tag_item->checkState(0)==Qt::Checked)); } }
/****************************** Local Functions ******************************/ static void change_state(nmt_state state, co_node *node) { if (state != node->state) { switch (state) { case nmt_state_operational: node->state = nmt_state_operational; state_changed(node); break; case nmt_state_pre_operational: node->state = nmt_state_pre_operational; state_changed(node); break; case nmt_state_stopped: node->state = nmt_state_stopped; state_changed(node); break; default: log_write_ln("nmt_slave: ERROR: unknown state: %d", (int)state); break; } } }
void __connman_notifier_offlinemode(bool enabled) { GSList *list; DBG("enabled %d", enabled); offlinemode_changed(enabled); state_changed(); for (list = notifier_list; list; list = list->next) { struct connman_notifier *notifier = list->data; if (notifier->offline_mode) notifier->offline_mode(enabled); } }
void Peer::handle_property_change (const char *name, GVariant *property) { if (g_strcmp0(name, "State") == 0) { state_changed (g_variant_get_string (property, NULL)); } else if (g_strcmp0(name, "Name") == 0) { name_changed (g_variant_get_string (property, NULL)); } else if (g_strcmp0(name, "Services") == 0) { GVariantIter *service_array, *services; GVariant *spec_val; g_variant_get (property, "a(a{sv})", &service_array); while (g_variant_iter_loop (service_array, "(a{sv})", &services)) { const char *service_name; while (g_variant_iter_loop (services, "{sv}", &service_name, &spec_val)) { if (g_strcmp0 (service_name, "WiFiDisplayIEs") == 0) { uint8_t *bytes; gsize length; bytes = (uint8_t*)g_variant_get_fixed_array (spec_val, &length, 1); std::unique_ptr<P2P::InformationElementArray> array (new P2P::InformationElementArray(length, bytes)); ie_.reset(new P2P::InformationElement (array)); } } } g_variant_iter_free (service_array); } else if (g_strcmp0(name, "IPv4") == 0) { GVariantIter *ips; GVariant *spec_val; char *name; const char *remote = ""; const char *local = ""; g_variant_get (property, "a{sv}", &ips); while (g_variant_iter_loop (ips, "{sv}", &name, &spec_val)) { if (g_strcmp0 (name, "Remote") == 0) { remote = g_variant_get_string (spec_val, NULL); } else if (g_strcmp0 (name, "Local") == 0) { local = g_variant_get_string (spec_val, NULL); } } ips_changed (remote, local); g_variant_iter_free (ips); } }
void state_default() { char buf[MAXLEN]; int ret; if(previous_state != STATE_DEFAULT) { previous_state = STATE_DEFAULT; } FD_ZERO(&readfds); FD_SET(client_socket, &readfds); ret = select(client_socket+1, &readfds, NULL, NULL, NULL); if(ret < 0) { PRINT_ERROR("Error in select()\n") state = STATE_SHUTDOWN; return; } if(FD_ISSET(client_socket, &readfds)) { ret = receive_command(client_socket, (char *) &buf); if(ret == 0) { if (state_changed(buf, state)) { strcpy(buf, "< ok >"); send(client_socket, buf, strlen(buf), 0); return; } else { PRINT_ERROR("unknown command '%s'\n", buf); strcpy(buf, "< error unknown command >"); send(client_socket, buf, strlen(buf), 0); } } else { state = STATE_SHUTDOWN; return; } } else { ret = read(client_socket, &buf, 0); if(ret==-1) { state = STATE_SHUTDOWN; return; } } }
void LocalZipTask::run() { set_has_error(false); // 检查路径存在性 const QString source = get_source(), destination = get_destination(); if (!QFileInfo(source).exists()) { set_msg("Source path not exists: " + source); set_has_error(true); return; } if (!QFileInfo(QFileInfo(destination).path()).exists()) // XXX QFileInfo.path() 返回父目录 { set_msg("Parent directory of ZIP destination not exists: " + QFileInfo(destination).path()); set_has_error(true); return; } // 首先检查是否需要更新 set_msg("Checking..."); bool needUpdate = true; if (QFileInfo(destination).exists() && !QFileInfo(destination).isDir()) { const QDateTime mtime = QFileInfo(destination).lastModified(); needUpdate = newer_than(source, mtime); } if (!needUpdate) { set_msg("No need to update at " + QString::fromStdString(DateTime().get_clock_str()) + "."); return; } // 计算工作量 set_msg("Counting..."); _total_files = count_files(source); _compressed_files = 0; // 压缩文件/文件夹到zip bool rs = zip(); if (rs) set_msg("Last done at " + QString::fromStdString(DateTime().get_clock_str()) + "."); state_changed(); }
static int headset_server_probe(struct btd_adapter *adapter) { struct audio_adapter *adp; const gchar *path = adapter_get_path(adapter); int err; DBG("path %s", path); adp = audio_adapter_get(adapter); if (!adp) return -EINVAL; err = headset_server_init(adp); if (err < 0) { audio_adapter_unref(adp); return err; } btd_adapter_register_powered_callback(adapter, state_changed); state_changed(adapter, TRUE); return 0; }
int __connman_technology_remove_device(struct connman_device *device) { struct connman_technology *technology; enum connman_service_type type; DBG("device %p", device); type = __connman_device_get_service_type(device); __connman_notifier_unregister(type); technology = technology_find(type); if (technology == NULL) return -ENXIO; technology->device_list = g_slist_remove(technology->device_list, device); if (technology->device_list == NULL) { technology->state = CONNMAN_TECHNOLOGY_STATE_OFFLINE; state_changed(technology); } return 0; }
void __connman_notifier_connect(enum connman_service_type type) { DBG("type %d", type); switch (type) { case CONNMAN_SERVICE_TYPE_UNKNOWN: case CONNMAN_SERVICE_TYPE_SYSTEM: case CONNMAN_SERVICE_TYPE_GPS: case CONNMAN_SERVICE_TYPE_VPN: case CONNMAN_SERVICE_TYPE_GADGET: return; case CONNMAN_SERVICE_TYPE_ETHERNET: case CONNMAN_SERVICE_TYPE_WIFI: case CONNMAN_SERVICE_TYPE_BLUETOOTH: case CONNMAN_SERVICE_TYPE_CELLULAR: break; } if (__sync_fetch_and_add(&connected[type], 1) == 0) { __connman_technology_set_connected(type, true); state_changed(); } }
void tags_box_widget::toggle_tag_state(QTreeWidgetItem* item, int column) { DBG_PRINTF(5, "toggle_tag_state"); if (column!=0) return; tag_lvitem* tag_item = dynamic_cast<tag_lvitem*>(item); if (!tag_item) return; if (!user::has_permission("update")) { if (tag_item->checkState(0) != tag_item->last_state()) { // revert to the previous state tag_item->set_on(!tag_item->is_on()); } emit state_changed_denied(tag_item->tag_id(), (tag_item->checkState(0)==Qt::Checked)); return; } if (tag_item->checkState(0) != tag_item->last_state()) { tag_item->update_last_state(); tag_item->colorize(); emit state_changed(tag_item->tag_id(), (tag_item->checkState(0)==Qt::Checked)); } }
void Player::setState(const QString &state) { if (this->state != state) { this->state = state; emit state_changed(); } }