Ejemplo n.º 1
0
PreferencesDialog::PreferencesDialog(QWidget *parent) :
    GeometryStateDialog(parent),
    pd_ui_(new Ui::PreferencesDialog),
    model_(this),
    advancedPrefsModel_(this),
    advancedPrefsDelegate_(this),
    modulePrefsModel_(this)
{
    advancedPrefsModel_.setSourceModel(&model_);
    modulePrefsModel_.setSourceModel(&model_);
    saved_capture_no_extcap_ = prefs.capture_no_extcap;

    // Some classes depend on pref_ptr_to_pref_ so this MUST be called after
    // model_.populate().
    pd_ui_->setupUi(this);
    loadGeometry();

    setWindowTitle(wsApp->windowTitleString(tr("Preferences")));

    pd_ui_->advancedView->setModel(&advancedPrefsModel_);
    pd_ui_->advancedView->setItemDelegate(&advancedPrefsDelegate_);
    advancedPrefsModel_.setFirstColumnSpanned(pd_ui_->advancedView);

    pd_ui_->prefsView->setModel(&modulePrefsModel_);

    pd_ui_->splitter->setStretchFactor(0, 1);
    pd_ui_->splitter->setStretchFactor(1, 5);
    pd_ui_->prefsView->sortByColumn(ModulePrefsModel::colName, Qt::AscendingOrder);

    //Set the Appearance leaf to expanded
    pd_ui_->prefsView->setExpanded(modulePrefsModel_.index(APPEARANCE_ITEM, 0), true);


    // PreferencesPane, prefsView, and stackedWidget must all correspond to each other.
    prefs_pane_to_item_[PrefsModel::APPEARANCE_PREFERENCE_TREE_NAME] = pd_ui_->appearanceFrame;
    prefs_pane_to_item_[PrefsModel::LAYOUT_PREFERENCE_TREE_NAME] = pd_ui_->layoutFrame;
    prefs_pane_to_item_[PrefsModel::COLUMNS_PREFERENCE_TREE_NAME] = pd_ui_->columnFrame;
    prefs_pane_to_item_[PrefsModel::FONT_AND_COLORS_PREFERENCE_TREE_NAME] = pd_ui_->fontandcolorFrame;
    prefs_pane_to_item_[PrefsModel::CAPTURE_PREFERENCE_TREE_NAME] = pd_ui_->captureFrame;
    prefs_pane_to_item_[PrefsModel::EXPERT_PREFERENCE_TREE_NAME] = pd_ui_->expertFrame;
    prefs_pane_to_item_[PrefsModel::FILTER_BUTTONS_PREFERENCE_TREE_NAME] = pd_ui_->filterExpressonsFrame;
    prefs_pane_to_item_[PrefsModel::ADVANCED_PREFERENCE_TREE_NAME] = pd_ui_->advancedFrame;
    prefs_pane_to_item_[MODULES_NAME] = NULL;

    pd_ui_->filterExpressonsFrame->setUat(uat_get_table_by_name("Display expressions"));
    pd_ui_->expertFrame->setUat(uat_get_table_by_name("Expert Info Severity Level Configuration"));

    connect(pd_ui_->prefsView, SIGNAL(goToPane(QString)), this, SLOT(selectPane(QString)));
}
Ejemplo n.º 2
0
void FilterExpressionToolBar::onActionMoved(QAction* action, int oldPos, int newPos)
{
    gchar* err = NULL;
    if ( oldPos == newPos )
        return;

    QString label = action->property(dfe_property_label_).toString();
    QString expr = action->property(dfe_property_expression_).toString();

    int idx = uatRowIndexForFilter(label, expr);

    if ( idx > -1 && oldPos > -1 && newPos > -1 )
    {
        uat_t * table = uat_get_table_by_name("Display expressions");
        uat_move_index(table, oldPos, newPos);
        uat_save(table, &err);

        g_free(err);
    }
}
Ejemplo n.º 3
0
GtkWidget*
nameres_prefs_show(void)
{
	guint		table_row;
	GtkWidget	*main_tb, *main_vb;
	GtkWidget	*m_resolv_cb, *n_resolv_cb, *t_resolv_cb;
#if defined(HAVE_C_ARES) || defined(HAVE_GNU_ADNS)
	GtkWidget	*c_resolv_cb;
	GtkWidget	*resolv_concurrency_te;
	char		concur_str[10+1];
#endif /* HAVE_C_ARES || HAVE_GNU_ADNS */
#ifdef HAVE_LIBSMI
	GtkWidget	*load_smi_modules_cb, *suppress_smi_errors_cb;
	uat_t *smi_paths_uat;
	uat_t *smi_modules_uat;
#endif
#ifdef HAVE_GEOIP
	uat_t		*geoip_db_paths_uat;
#endif
	/*
	 * XXX - it would be nice if the current setting of the resolver
	 * flags could be different from the preference flags, so that
	 * the preference flags would represent what the user *typically*
	 * wants, but they could override them for particular captures
	 * without a subsequent editing of the preferences recording the
	 * temporary settings as permanent preferences.
	 */
	prefs.name_resolve = gbl_resolv_flags;

	/* Main vertical box */
	main_vb = gtk_vbox_new(FALSE, 7);
	gtk_container_set_border_width(GTK_CONTAINER(main_vb), 5);

	/* Main table */
	main_tb = gtk_table_new(RESOLV_TABLE_ROWS, 3, FALSE);
	gtk_box_pack_start(GTK_BOX(main_vb), main_tb, FALSE, FALSE, 0);
	gtk_table_set_row_spacings(GTK_TABLE(main_tb), 10);
	gtk_table_set_col_spacings(GTK_TABLE(main_tb), 15);
	gtk_widget_show(main_tb);

	/* Resolve MAC addresses */
	table_row = 0;
	m_resolv_cb = create_preference_check_button(main_tb, table_row,
	    "Enable MAC name resolution:", "e.g. Ethernet address to manufacturer name",
	    prefs.name_resolve & RESOLV_MAC);
	g_object_set_data(G_OBJECT(main_vb), M_RESOLVE_KEY, m_resolv_cb);

	/* Resolve network addresses */
	table_row++;
	n_resolv_cb = create_preference_check_button(main_tb, table_row,
	    "Enable network name resolution:", "e.g. IP address to DNS name (hostname)",
	    prefs.name_resolve & RESOLV_NETWORK);
	g_object_set_data(G_OBJECT(main_vb), N_RESOLVE_KEY, n_resolv_cb);

	/* Resolve transport addresses */
	table_row++;
	t_resolv_cb = create_preference_check_button(main_tb, table_row,
	    "Enable transport name resolution:", "e.g. TCP/UDP port to service name",
	    prefs.name_resolve & RESOLV_TRANSPORT);
	g_object_set_data(G_OBJECT(main_vb), T_RESOLVE_KEY, t_resolv_cb);

#if defined(HAVE_C_ARES) || defined(HAVE_GNU_ADNS)
	/* Enable concurrent (asynchronous) DNS lookups */
	table_row++;
	c_resolv_cb = create_preference_check_button(main_tb, table_row,
	    "Enable concurrent DNS name resolution:", "be sure to enable network name resolution",
	    prefs.name_resolve & RESOLV_CONCURRENT);
	g_object_set_data(G_OBJECT(main_vb), C_RESOLVE_KEY, c_resolv_cb);

	/* Max concurrent requests */
	table_row++;
	g_snprintf(concur_str, sizeof(concur_str), "%d", prefs.name_resolve_concurrency);
	resolv_concurrency_te = create_preference_entry(main_tb, table_row,
	    "Maximum concurrent requests:", "maximum parallel running DNS requests", concur_str);
	g_object_set_data(G_OBJECT(main_vb), RESOLVE_CONCURRENCY_KEY, resolv_concurrency_te);

#else /* HAVE_C_ARES || HAVE_GNU_ADNS */
	table_row++;
	create_preference_static_text(main_tb, table_row,
	    "Enable concurrent DNS name resolution: N/A",
	    "Support for this feature was not compiled into this version of Wireshark");
#endif /* HAVE_C_ARES || HAVE_GNU_ADNS */
#ifdef HAVE_LIBSMI
	/* Enable OID resolution */
	table_row++;
	load_smi_modules_cb = create_preference_check_button(main_tb, table_row,
		"Enable OID resolution:", "You must restart Wireshark for this change to"
		" take effect. [If True the 'SMI paths' and 'SMI modules' preferences will be shown].",
                prefs.load_smi_modules);
	g_object_set_data(G_OBJECT(main_vb), LOAD_SMI_MODULES_KEY, load_smi_modules_cb);

	/* Suppress smi errors */
	table_row++;
	suppress_smi_errors_cb = create_preference_check_button(main_tb, table_row,
	    "Suppress SMI errors:", "Some errors can be ignored. If unsure, set to false.",
	    prefs.suppress_smi_errors);
	g_object_set_data(G_OBJECT(main_vb), SUPPRESS_SMI_ERRORS_KEY, suppress_smi_errors_cb);

	/* SMI paths UAT */
	smi_paths_uat = uat_get_table_by_name("SMI Paths");
	if (smi_paths_uat) {
		table_row++;
		create_preference_uat(main_tb, table_row,
		    "SMI (MIB and PIB) paths",
                    "Search paths for SMI (MIB and PIB) modules. You must\n"
                    "restart Wireshark for these changes to take effect.",
                    smi_paths_uat);
	}

	/* SMI modules UAT */
	smi_modules_uat = uat_get_table_by_name("SMI Modules");
	if (smi_modules_uat) {
		table_row++;
		create_preference_uat(main_tb, table_row,
		    "SMI (MIB and PIB) modules",
                    "List of enabled SMI (MIB and PIB) modules. You must\n"
                    "restart Wireshark for these changes to take effect.",
                    smi_modules_uat);
	}
#else /* HAVE_LIBSMI */
	table_row++;
	create_preference_static_text(main_tb, table_row,
	    "SMI (MIB and PIB) modules and paths: N/A",
	    "Support for this feature was not compiled into this version of Wireshark");
	table_row++;
	create_preference_static_text(main_tb, table_row,
	    "Enable OID resolution: N/A",
	    "Support for this feature was not compiled into this version of Wireshark");
	table_row++;
	create_preference_static_text(main_tb, table_row,
	    "Suppress SMI errors: N/A",
	    "Support for this feature was not compiled into this version of Wireshark");
#endif /* HAVE_LIBSMI */

#ifdef HAVE_GEOIP
	/* GeoIP databases http://www.maxmind.com/app/api */
	geoip_db_paths_uat = uat_get_table_by_name("GeoIP Database Paths");

	if (geoip_db_paths_uat) {
		table_row++;
		create_preference_uat(main_tb, table_row,
		    "GeoIP database directories",
		    "Search paths for GeoIP address mapping databases.\n"
		    "Wireshark will look in each directory for files beginning\n"
		    "with \"Geo\" and ending with \".dat\".\n"
		    "You must restart Wireshark for these changes to take\n"
		    "effect.",
                    geoip_db_paths_uat);
	}
#else /* HAVE_GEOIP */
	table_row++;
	create_preference_static_text(main_tb, table_row,
	    "GeoIP database search paths: N/A",
	    "Support for this feature was not compiled into this version of Wireshark");
#endif /* HAVE_GEOIP */

	/* Show 'em what we got */
	gtk_widget_show_all(main_vb);

	return(main_vb);
}