aboutsummaryrefslogtreecommitdiffstats
path: root/ui/qt/main_status_bar.cpp
blob: 4266fb4660ba12b6519d7528847bd8483b6cbfb6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/* main_status_bar.cpp
 *
 * $Id$
 *
 * Wireshark - Network traffic analyzer
 * By Gerald Combs <gerald@wireshark.org>
 * Copyright 1998 Gerald Combs
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */

#ifdef HAVE_CONFIG_H
# include "config.h"
#endif

#include <glib.h>

#include "main_status_bar.h"

#include "main_statusbar.h"

/* Temporary message timeouts */
#define TEMPORARY_MSG_TIMEOUT (7 * 1000)
#define TEMPORARY_FLASH_TIMEOUT (1 * 1000)
#define TEMPORARY_FLASH_INTERVAL (TEMPORARY_FLASH_TIMEOUT / 4)

/*
 * Push a formatted temporary message onto the statusbar.
 */
void
statusbar_push_temporary_msg(const gchar *msg_format, ...)
{
    va_list ap;
    gchar *msg;
    guint msg_id;

    va_start(ap, msg_format);
    msg = g_strdup_vprintf(msg_format, ap);
    va_end(ap);

    g_log(NULL, G_LOG_LEVEL_DEBUG, "FIX: statusbar_push_temporary_msg: %s", msg);

//    msg_id = gtk_statusbar_push(GTK_STATUSBAR(info_bar), main_ctx, msg);
    g_free(msg);

//    flash_time = TEMPORARY_FLASH_TIMEOUT - 1;
//    g_timeout_add(TEMPORARY_FLASH_INTERVAL, statusbar_flash_temporary_msg, NULL);

//    g_timeout_add(TEMPORARY_MSG_TIMEOUT, statusbar_remove_temporary_msg, GUINT_TO_POINTER(msg_id));
}

/*
 * Update the packets statusbar to the current values
 */
void
packets_bar_update(void)
{
    g_log(NULL, G_LOG_LEVEL_DEBUG, "FIX: packets_bar_update");
//    if(packets_bar) {
//        /* Remove old status */
//        if(packets_str) {
//            gtk_statusbar_pop(GTK_STATUSBAR(packets_bar), packets_ctx);
//        } else {
//            packets_str = g_string_new ("");
//	}

//        /* Do we have any packets? */
//        if(cfile.count) {
//            g_string_printf(packets_str, " Packets: %u Displayed: %u Marked: %u",
//                            cfile.count, cfile.displayed_count, cfile.marked_count);
//            if(cfile.drops_known) {
//                g_string_append_printf(packets_str, " Dropped: %u", cfile.drops);
//            }
//            if(cfile.ignored_count > 0) {
//                g_string_append_printf(packets_str, " Ignored: %u", cfile.ignored_count);
//            }
//            if(!cfile.is_tempfile){
//                /* Loading an existing file */
//                gulong computed_elapsed = cf_get_computed_elapsed();
//                g_string_append_printf(packets_str, " Load time: %lu:%02lu.%03lu",
//                                       computed_elapsed/60000,
//                                       computed_elapsed%60000/1000,
//                                       computed_elapsed%1000);
//            }
//        } else {
//            g_string_printf(packets_str, " No Packets");
//        }
//        gtk_statusbar_push(GTK_STATUSBAR(packets_bar), packets_ctx, packets_str->str);
//    }
}

MainStatusBar::MainStatusBar(QWidget *parent) :
    QStatusBar(parent)
{
}