Ejemplo n.º 1
0
static void
set_property(GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
{
	RSDcp *dcp = RS_DCP(object);
	RSFilter *filter = RS_FILTER(dcp);
	gpointer temp;
	gboolean changed = FALSE;

	switch (property_id)
	{
		case PROP_SETTINGS:
			if (dcp->settings && dcp->settings_signal_id)
			{
				if (dcp->settings == g_value_get_object(value))
				{
					settings_changed(dcp->settings, MASK_ALL, dcp);
					break;
				}
				g_signal_handler_disconnect(dcp->settings, dcp->settings_signal_id);
				g_object_weak_unref(G_OBJECT(dcp->settings), settings_weak_notify, dcp);
			}
			dcp->settings = g_value_get_object(value);
			dcp->settings_signal_id = g_signal_connect(dcp->settings, "settings-changed", G_CALLBACK(settings_changed), dcp);
			settings_changed(dcp->settings, MASK_ALL, dcp);
			g_object_weak_ref(G_OBJECT(dcp->settings), settings_weak_notify, dcp);
			break;
		case PROP_PROFILE:
			g_static_rec_mutex_lock(&dcp_mutex);
			read_profile(dcp, g_value_get_object(value));
			changed = TRUE;
			g_static_rec_mutex_unlock(&dcp_mutex);
			break;
		case PROP_READ_OUT_CURVE:
			temp = g_value_get_object(value);
			if (temp != dcp->read_out_curve)
				changed = TRUE;
			dcp->read_out_curve = temp;
			break;
		case PROP_USE_PROFILE:
			g_static_rec_mutex_lock(&dcp_mutex);
			dcp->use_profile = g_value_get_boolean(value);
			if (!dcp->use_profile)
				free_dcp_profile(dcp);
			else
				precalc(dcp);
			g_static_rec_mutex_unlock(&dcp_mutex);
			break;
		default:
			G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
	}

	if (changed)
		rs_filter_changed(filter, RS_FILTER_CHANGED_PIXELDATA);
}
Ejemplo n.º 2
0
static void ppp_disconnect(GAtPPPDisconnectReason reason, gpointer user_data)
{
    DBusConnection *conn = ofono_dbus_get_connection();
    struct dundee_device *device = user_data;

    DBG("%p", device);
    DBG("PPP Link down: %d\n", reason);

    g_at_ppp_unref(device->ppp);
    device->ppp = NULL;

    g_at_chat_resume(device->chat);

    g_free(device->settings.interface);
    g_free(device->settings.ip);
    g_strfreev(device->settings.nameservers);
    device->settings.interface = NULL;
    device->settings.ip = NULL;
    device->settings.nameservers = NULL;

    device->active = FALSE;

    settings_changed(device);
    ofono_dbus_signal_property_changed(conn, device->path,
                                       DUNDEE_DEVICE_INTERFACE, "Active",
                                       DBUS_TYPE_BOOLEAN, &device->active);

    device->driver->disconnect(device, disconnect_callback, device);
}
Ejemplo n.º 3
0
UberDelegate::UberDelegate(QObject *parent)
    : QStyledItemDelegate(parent)
    , m_model(0)
    , m_proxy(0)
{
    read_settings();
    connect(DT, SIGNAL(settings_changed()), this, SLOT(read_settings()));

    // Build a star shape for drawing later (http://doc.trolltech.com/4.5/itemviews-stardelegate-starrating-cpp.html)
    double pi = 3.14; // nobody cares, these are tiny
    for (int i = 0; i < 5; ++i) {
        // star points are 5 per circle which are 2pi/5 radians apart
        // we want to cross center by drawing points that are 4pi/5 radians apart
        // in order. The winding-fill will fill it in nicely as we draw each point
        // skip a point on each iteration by moving 4*pi/5 around the circle
        // which is basically .8 * pi
        m_star_shape << QPointF(
                            0.4 * cos(i * pi * 0.8), // x
                            0.4 * sin(i * pi * 0.8)  // y
                            );
    }

    m_diamond_shape << QPointF(0.5, 0.1) //top
                    << QPointF(0.75, 0.5) // right
                    << QPointF(0.5, 0.9) //bottom
                    << QPointF(0.25, 0.5); // left
}
Ejemplo n.º 4
0
static void ppp_connect(const char *iface, const char *local, const char *peer,
                        const char *dns1, const char *dns2,
                        gpointer user_data)
{
    DBusConnection *conn = ofono_dbus_get_connection();
    struct dundee_device *device = user_data;
    const char *dns[3] = { dns1, dns2, 0 };

    DBG("%p", device);
    DBG("Network Device: %s\n", iface);
    DBG("IP Address: %s\n", local);
    DBG("Peer IP Address: %s\n", peer);
    DBG("Primary DNS Server: %s\n", dns1);
    DBG("Secondary DNS Server: %s\n", dns2);

    if (device->connect_timeout > 0) {
        g_source_remove(device->connect_timeout);
        device->connect_timeout = 0;
    }

    g_free(device->settings.interface);
    device->settings.interface = g_strdup(iface);
    if (device->settings.interface == NULL)
        goto err;

    g_free(device->settings.ip);
    device->settings.ip = g_strdup(local);
    if (device->settings.ip == NULL)
        goto err;

    g_strfreev(device->settings.nameservers);
    device->settings.nameservers = g_strdupv((gchar **)dns);
    if (device->settings.nameservers == NULL)
        goto err;

    __ofono_dbus_pending_reply(&device->pending,
                               dbus_message_new_method_return(device->pending));
    device->pending = NULL;

    device->active = TRUE;

    settings_changed(device);
    ofono_dbus_signal_property_changed(conn, device->path,
                                       DUNDEE_DEVICE_INTERFACE, "Active",
                                       DBUS_TYPE_BOOLEAN, &device->active);

    return;

err:
    g_free(device->settings.interface);
    g_free(device->settings.ip);
    g_strfreev(device->settings.nameservers);
    device->settings.interface = NULL;
    device->settings.ip = NULL;
    device->settings.nameservers = NULL;

    __ofono_dbus_pending_reply(&device->pending,
                               __dundee_error_failed(device->pending));
    device->pending = NULL;
}
Ejemplo n.º 5
0
void view::on_settings(settings_t const& settings)
{
    if (nodes_manager_ && nodes_manager_->get_model() != settings.model)
        nodes_manager_->set_model(settings.model);

    settings_ = settings;
    settings_changed();
}
Ejemplo n.º 6
0
/**
 * @brief Slot called when the user want to apply settings.
 */
void SettingsDialog::apply() {

  for (QString key : edited_settings.keys()) {
    settings.set_value(key, edited_settings[key]);
  }
  reset();
  emit settings_changed();
}
Ejemplo n.º 7
0
static void peer_ip_release(struct connman_ipconfig *ipconfig,
							const char *ifname)
{
	struct connman_peer *peer = __connman_ipconfig_get_data(ipconfig);

	DBG("%s ip release", ifname);

	settings_changed(peer);
}
Ejemplo n.º 8
0
static void peer_ip_bound(struct connman_ipconfig *ipconfig,
							const char *ifname)
{
	struct connman_peer *peer = __connman_ipconfig_get_data(ipconfig);

	DBG("%s ip bound", ifname);

	settings_changed(peer);
	connman_peer_set_state(peer, CONNMAN_PEER_STATE_READY);
}
Ejemplo n.º 9
0
void TrackerDialog::set_custom()
{
	settings.M01[0] = dialog_settings.M01x;
	settings.M01[1] = dialog_settings.M01y;
	settings.M01[2] = dialog_settings.M01z;
	settings.M02[0] = dialog_settings.M02x;
	settings.M02[1] = dialog_settings.M02y;
	settings.M02[2] = dialog_settings.M02z;

	settings_changed();
}
Ejemplo n.º 10
0
void TrackerDialog::set_cap()
{
	settings.M01[0] = -dialog_settings.cap_x;
	settings.M01[1] = -dialog_settings.cap_y;
	settings.M01[2] = -dialog_settings.cap_z;
	settings.M02[0] =  dialog_settings.cap_x;
	settings.M02[1] = -dialog_settings.cap_y;
	settings.M02[2] = -dialog_settings.cap_z;

	settings_changed();
}
Ejemplo n.º 11
0
void TrackerDialog::set_clip()
{
	settings.M01[0] =  0;
	settings.M01[1] =  dialog_settings.clip_ty;
	settings.M01[2] = -dialog_settings.clip_tz;
	settings.M02[0] =  0;
	settings.M02[1] = -dialog_settings.clip_by;
	settings.M02[2] = -dialog_settings.clip_bz;

	settings_changed();
}
Ejemplo n.º 12
0
RotatedHeader::RotatedHeader(Qt::Orientation orientation, QWidget *parent)
	: QHeaderView(orientation, parent)
    , m_hovered_column(-1)
{
	setClickable(true);
	setSortIndicatorShown(true);
	setMouseTracking(true);

	read_settings();
	connect(DT, SIGNAL(settings_changed()), this, SLOT(read_settings()));
}
Ejemplo n.º 13
0
/**
 * @brief Slot called when the user want to restore default settings.
 */
void SettingsDialog::restore_default() {

  int result = QMessageBox::question(
    this, tr("Restore default settings"),
    tr("Do you really want to restore default settings?"),
    QMessageBox::Ok | QMessageBox::Cancel);

  if (result == QMessageBox::Ok) {
    settings.restore_default();
    reset();
    emit settings_changed();
  }
}
Ejemplo n.º 14
0
void TrackerDialog::startstop_trans_calib(bool start)
{
	if (start)
	{
		qDebug()<<"TrackerDialog:: Starting translation calibration";
		trans_calib.reset();
		trans_calib_running = true;
	}
	else
	{
		qDebug()<<"TrackerDialog:: Stoppping translation calibration";
		trans_calib_running = false;
		settings.t_MH = trans_calib.get_estimate();
		settings_changed();
	}
}
Ejemplo n.º 15
0
void FormOptimization::do_run()
{
  ui->pushStop->setEnabled(true);
  my_run_ = true;
  emit toggleIO(false);

  bits = ui->spinBits->value();

  optimizing_.bits = bits;
  int optchan = ui->comboTarget->currentData().toInt();
  optimizing_.add_pattern.resize(optchan + 1, 0);
  optimizing_.add_pattern[optchan] = 1;
  optimizing_.match_pattern.resize(optchan + 1, 0);
  optimizing_.match_pattern[optchan] = 1;
  optimizing_.appearance = generateColor().rgba();

  XMLableDB<Qpx::Spectrum::Template> db("SpectrumTemplates");
  db.add(optimizing_);

  current_spectra_.clear();
  current_spectra_.set_spectra(db);
  peaks_.push_back(Qpx::Peak());
  spectra_.push_back(Qpx::Fitter());

  ui->plotSpectrum->update_spectrum();

  Qpx::Setting set(current_setting_);
  set.indices.clear();
  set.indices.insert(optchan);

  set.value_dbl = val_current;
  Qpx::Engine::getInstance().set_setting(set, Qpx::Match::id | Qpx::Match::indices);
  QThread::sleep(1);
  Qpx::Engine::getInstance().get_all_settings();
  set = Qpx::Engine::getInstance().pull_settings().get_setting(set, Qpx::Match::id | Qpx::Match::indices);
  setting_values_.push_back(set.value_dbl);
  setting_fwhm_.push_back(0);
  emit settings_changed();

  interruptor_.store(false);
  opt_runner_thread_.do_run(current_spectra_, interruptor_, 0);
}
Ejemplo n.º 16
0
Dwarf::Dwarf(DFInstance *df, const uint &index, QObject *parent)
	: QObject(parent)
	, m_df(df)
 	, m_total_xp(0)
   , m_index(index)
    , m_raw_profession(-1)
	, m_migration_wave(0)
    , m_current_job_id(-1)
    , m_squad_leader_id(-1)
{
	read_settings();
	refresh_data();
	connect(DT, SIGNAL(settings_changed()), SLOT(read_settings()));

	// setup context actions
	m_actions.clear();
    QAction *show_details = new QAction(tr("Show Details..."), this);
    connect(show_details, SIGNAL(triggered()), SLOT(show_details()));
    m_actions << show_details;

    QAction *zoom_to_dwarf = new QAction(tr("Zoom To Dwarf..."),this);
    connect(zoom_to_dwarf, SIGNAL(triggered()), SLOT(move_view_to()));
    m_actions << zoom_to_dwarf;
}
Ejemplo n.º 17
0
void Timed::send_time_settings()
{
  log_debug() ;
  log_debug("settings=%p", settings) ;
  log_debug("settings->cellular_zone=%p", settings->cellular_zone) ;
  log_debug("settings->cellular_zone='%s'", settings->cellular_zone->zone().c_str()) ;
  nanotime_t diff = systime_back ;
  clear_invokation_flag() ;
  save_settings() ;
  settings->fix_etc_localtime() ;
  sent_signature = dst_signature(time(NULL)) ;
  Maemo::Timed::WallClock::Info info(settings->get_wall_clock_info(diff)) ;
  log_notice("sending signal 'settings_changed': %s", info.str().toStdString().c_str()) ;
  emit settings_changed(info, not diff.is_zero()) ;
  log_notice("signal 'settings_changed' sent") ;
  // emit settings_changed_1(systime) ;
  am->reshuffle_queue(diff) ;
  if(q_pause)
  {
    delete q_pause ;
    q_pause = NULL ;
  }
  check_dst() ; // reschedule dst timer
}
Ejemplo n.º 18
0
static gboolean
gst_ffmpegauddec_negotiate (GstFFMpegAudDec * ffmpegdec,
    AVCodecContext * context, AVFrame * frame, gboolean force)
{
  GstFFMpegAudDecClass *oclass;
  GstAudioFormat format;
  gint channels;
  GstAudioChannelPosition pos[64] = { 0, };

  oclass = (GstFFMpegAudDecClass *) (G_OBJECT_GET_CLASS (ffmpegdec));

  format = gst_ffmpeg_smpfmt_to_audioformat (frame->format);
  if (format == GST_AUDIO_FORMAT_UNKNOWN)
    goto no_caps;
  channels =
      av_get_channel_layout_nb_channels (av_frame_get_channel_layout (frame));
  if (channels == 0)
    channels = av_frame_get_channels (frame);
  if (channels == 0)
    goto no_caps;

  if (!force && !settings_changed (ffmpegdec, frame))
    return TRUE;

  GST_DEBUG_OBJECT (ffmpegdec,
      "Renegotiating audio from %dHz@%dchannels (%d) to %dHz@%dchannels (%d)",
      ffmpegdec->info.rate, ffmpegdec->info.channels,
      ffmpegdec->info.finfo->format, av_frame_get_sample_rate (frame), channels,
      format);

  gst_ffmpeg_channel_layout_to_gst (av_frame_get_channel_layout (frame),
      channels, pos);
  memcpy (ffmpegdec->ffmpeg_layout, pos,
      sizeof (GstAudioChannelPosition) * channels);

  /* Get GStreamer channel layout */
  gst_audio_channel_positions_to_valid_order (pos, channels);
  ffmpegdec->needs_reorder =
      memcmp (pos, ffmpegdec->ffmpeg_layout, sizeof (pos[0]) * channels) != 0;
  gst_audio_info_set_format (&ffmpegdec->info, format,
      av_frame_get_sample_rate (frame), channels, pos);

  if (!gst_audio_decoder_set_output_format (GST_AUDIO_DECODER (ffmpegdec),
          &ffmpegdec->info))
    goto caps_failed;

  return TRUE;

  /* ERRORS */
no_caps:
  {
#ifdef HAVE_LIBAV_UNINSTALLED
    /* using internal ffmpeg snapshot */
    GST_ELEMENT_ERROR (ffmpegdec, CORE, NEGOTIATION,
        ("Could not find GStreamer caps mapping for libav codec '%s'.",
            oclass->in_plugin->name), (NULL));
#else
    /* using external ffmpeg */
    GST_ELEMENT_ERROR (ffmpegdec, CORE, NEGOTIATION,
        ("Could not find GStreamer caps mapping for libav codec '%s', and "
            "you are using an external libavcodec. This is most likely due to "
            "a packaging problem and/or libavcodec having been upgraded to a "
            "version that is not compatible with this version of "
            "gstreamer-libav. Make sure your gstreamer-libav and libavcodec "
            "packages come from the same source/repository.",
            oclass->in_plugin->name), (NULL));
#endif
    return FALSE;
  }
caps_failed:
  {
    GST_ELEMENT_ERROR (ffmpegdec, CORE, NEGOTIATION, (NULL),
        ("Could not set caps for libav decoder (%s), not fixed?",
            oclass->in_plugin->name));
    memset (&ffmpegdec->info, 0, sizeof (ffmpegdec->info));

    return FALSE;
  }
}
Ejemplo n.º 19
0
File_list_model::File_list_model(Core *c) : Core_ally(c) {
  connect(core, SIGNAL(settings_changed()),
          this, SLOT(sort_folders_before_files_changed()));
  sort_column = -1;
}
Ejemplo n.º 20
0
void GL_widget_2::keyReleaseEvent(QKeyEvent *e)
{
	emit(s_keyReleaseEvent(e));
	std::vector<Visualization_layer*>::iterator it;
	for(it = layers.begin(); it!= layers.end(); it++)
		if((*it)->is_active())
			(*it)->keyReleaseEvent(e);
	if (e->key()==Qt::Key_Space && e->modifiers() == Qt::ControlModifier) { 
		QSettings settings;
		settings.setValue("npr-render",!settings.value("npr-render").toBool());
		switch_render_effect(); 
		emit settings_changed();
	}
	if (e->key()==Qt::Key_F && e->modifiers() == Qt::ControlModifier) { switch_full_screen(); }

	//if (e->key() == Qt::Key_V && e->modifiers() == (Qt::ControlModifier | Qt::AltModifier | Qt::ShiftModifier)) {
	//	QString bounding_box = tr("%1 %2 %3 %4").arg(x_min()).arg(x_max()).arg(y_min()).arg(y_max());
	//	QSettings settings;
	//	settings.setValue("viewer-buffer-2d-view-state",bounding_box);
	//	std::cout << "Current view stored" << std::endl;
	//}
	//if (e->key() == Qt::Key_V && e->modifiers() == (Qt::ControlModifier | Qt::AltModifier)) {
	//	QSettings settings;
	//	QString doc_text = settings.value("viewer-buffer-2d-view-state").toString();
	//	QTextStream ts(&doc_text);
	//	double xmin, xmax, ymin, ymax;
	//	ts >> xmin; ts >> xmax; ts >> ymin; ts >> ymax;
	//	smooth_zoom(xmin, xmax,ymin,ymax);
	//	std::cout << "Camera view reloaded with "<< doc_text.toStdString() << std::endl;
	//}

	//if (e->key() == Qt::Key_P && e->modifiers() == (Qt::ControlModifier | Qt::AltModifier | Qt::ShiftModifier)) {
	//	QString bounding_box = tr("%1 %2 %3 %4").arg(x_min()).arg(x_max()).arg(y_min()).arg(y_max());
	//	
	//	QSettings settings;
	//	QString file_name = QFileDialog::getSaveFileName(
	//		this,
	//		"Choose a filename to save view",
	//		settings.value("last-data-directory",QString()).toString(),
	//		"View files (*.2view)");
	//	if (file_name=="") return;
	//	if (!file_name.endsWith(".2view")) file_name += ".2view";
	//	QString save_directory = file_name;
	//	save_directory.truncate(file_name.lastIndexOf('/'));
	//	settings.setValue("last-data-directory",save_directory);

	//	QFile f(file_name);
	//	if ( !f.open( QIODevice::WriteOnly ) ) {
	//		std::cout << LOG_ERROR << tr("File `%1' could not be open for writing!").arg(file_name).toStdString() << std::endl;
	//		return;
	//	}
	//	QTextStream fs( &f );
	//	fs << bounding_box;
	//	f.close();

	//	std::cout << "Camera view stored in " << file_name.toStdString()  << std::endl;
	//}
	//if (e->key() == Qt::Key_P && e->modifiers() == (Qt::ControlModifier | Qt::AltModifier)) {
	//	QSettings settings;

	//	QString file_name = QFileDialog::getOpenFileName(
	//		this,
	//		"Choose a filename to load view",
	//		settings.value("last-data-directory",QString()).toString(),
	//		"View files (*.2view)");
	//	if (file_name!="") {
	//		if (!file_name.endsWith(".2view")) file_name += ".2view";
	//		QString save_directory = file_name;
	//		save_directory.truncate(file_name.lastIndexOf('/'));
	//		settings.setValue("last-data-directory",save_directory);

	//		QFile file(file_name);
	//		if (!file.open(QIODevice::ReadOnly)) {
	//			std::cout << LOG_ERROR << tr("File `%1' could not be open for reading!").arg(file_name).toStdString() << std::endl;
	//			return;
	//		}

	//		QTextStream ts(&file);
	//		double xmin, xmax, ymin, ymax;
	//		ts >> xmin; ts >> xmax; ts >> ymin; ts >> ymax;
	//		file.close();

	//		smooth_zoom(xmin, xmax,ymin,ymax);
	//		std::cout << "Camera view reloaded from " << file_name.toStdString() << std::endl;
	//	}


	//}

}