HACK: pinfo->private_data points to smb_info again
[wireshark-wip.git] / ui / qt / color_utils.cpp
blob298c34e1b63c7c33eae527b394ef122eb6b0b895
1 /* color_utils.cpp
3 * $Id$
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 #include "color_utils.h"
29 * Initialize a color with R, G, and B values, including any toolkit-dependent
30 * work that needs to be done.
32 gboolean
33 initialize_color(color_t *color, guint16 red, guint16 green, guint16 blue)
35 QColor qc;
37 // color_t uses 16-bit components to match Gtk+. Qt use 8.
38 qc.setRgb(red>>8, green>>8, blue>>8);
39 if (!qc.isValid())
40 return FALSE;
42 // Match what color_filters.c does.
43 color->red = red;
44 color->green = green;
45 color->blue = blue;
46 color->pixel = 0;
47 return TRUE;
50 ColorUtils::ColorUtils(QObject *parent) :
51 QObject(parent)
55 QColor ColorUtils::fromColorT (color_t *color) {
56 if (!color) return QColor();
57 return QColor(color->red >> 8, color->green >> 8, color->blue >> 8);
60 QColor ColorUtils::fromColorT(color_t color)
62 return fromColorT(&color);
66 * Editor modelines
68 * Local Variables:
69 * c-basic-offset: 4
70 * tab-width: 8
71 * indent-tabs-mode: nil
72 * End:
74 * ex: set shiftwidth=4 tabstop=8 expandtab:
75 * :indentSize=4:tabSize=8:noTabs=true: