window1.cc
Go to the documentation of this file.
00001 /*------------------------------------------------------------------------
00002  *---------------------           WMPSNIFFER          --------------------
00003  *------------------------------------------------------------------------
00004  *                                                         V7.0B  11/05/10
00005  *
00006  *
00007  *  File: window1.cc
00008  *  Authors: Danilo Tardioli
00009  *  ----------------------------------------------------------------------
00010  *  Copyright (C) 2000-2012, Universidad de Zaragoza, SPAIN
00011  *
00012  *  Contact Addresses: Danilo Tardioli                   dantard@unizar.es
00013  *
00014  *  RT-WMP is free software; you can  redistribute it and/or  modify it
00015  *  under the terms of the GNU General Public License  as published by the
00016  *  Free Software Foundation;  either  version 2, or (at  your option) any
00017  *  later version.
00018  *
00019  *  RT-WMP  is distributed  in the  hope  that  it will be   useful, but
00020  *  WITHOUT  ANY  WARRANTY;     without  even the   implied   warranty  of
00021  *  MERCHANTABILITY  or  FITNESS FOR A  PARTICULAR PURPOSE.    See the GNU
00022  *  General Public License for more details.
00023  *
00024  *  You should have received  a  copy of  the  GNU General Public  License
00025  *  distributed with RT-WMP;  see file COPYING.   If not,  write to the
00026  *  Free Software  Foundation,  59 Temple Place  -  Suite 330,  Boston, MA
00027  *  02111-1307, USA.
00028  *
00029  *  As a  special exception, if you  link this  unit  with other  files to
00030  *  produce an   executable,   this unit  does  not  by  itself cause  the
00031  *  resulting executable to be covered by the  GNU General Public License.
00032  *  This exception does  not however invalidate  any other reasons why the
00033  *  executable file might be covered by the GNU Public License.
00034  *
00035  *----------------------------------------------------------------------*/
00036 
00037 #include "config.h"
00038 #include "window1.hh"
00039 #include "bridge.hh"
00040 #include "main_window.hh"
00041 
00042     void window1::on_button10_clicked(){
00043         entry1->set_text("");
00044         set_title("Search");
00045         m_refTreeModel->clear();
00046         treeview1->remove_all_columns();
00047 
00048     }
00049     int window1::get_selected(){
00050         return selected;
00051     }
00052     void window1::on_button11_clicked(){
00053         m_refTreeModel->clear();
00054         char msg[1000];
00055         char bc_msg[1000];
00056 
00057         //wmpFrame * p= (wmpFrame*) tmp;
00058         io_go_to(0);
00059         int res=0,serial=0,idx=0,pos=0;
00060         treeview1->remove_all_columns();
00061         treeview1->set_model(m_refTreeModel);
00062         treeview1->append_column("ID", m_Columns.m_col_id); //This number will be shown with the default numeric formatting.
00063         treeview1->append_column("Serial", m_Columns.m_col_number);
00064 
00065         if (message_rb->get_active()){
00066                 treeview1->append_column("Message                       ", m_Columns.m_col_name);
00067         }
00068 
00069 
00070         while (res>=0){
00071                 if (token_rb->get_active()){
00072                         res=read_next_token(msg,bc_msg,&serial,&pos,entry1->get_text().c_str());
00073                         if (res>0){
00074                                 Gtk::TreeModel::Row row = *(m_refTreeModel->append());
00075                                 row[m_Columns.m_col_id] = pos;
00076                                 row[m_Columns.m_col_bc] = bc_msg;
00077                                 row[m_Columns.m_col_number] = serial;
00078                                 idx++;
00079                         }
00080                 } else if (message_rb->get_active()){
00081                                 res=read_next_message(msg,bc_msg,&serial,&pos,entry1->get_text().c_str());
00082                             if (res>0){
00083                                 Gtk::TreeModel::Row row = *(m_refTreeModel->append());
00084                                 row[m_Columns.m_col_id] = pos;
00085                                 row[m_Columns.m_col_name] = msg;
00086                                 row[m_Columns.m_col_bc] = bc_msg;
00087                                 row[m_Columns.m_col_number] = serial;
00088                                 idx++;
00089                                 selected=pos;
00090                                 }
00091                 } else if (aut_rb->get_active()){
00092                         res=read_next_authorization(msg,bc_msg,&serial,&pos,entry1->get_text().c_str());
00093                         if (res>0){
00094                                 Gtk::TreeModel::Row row = *(m_refTreeModel->append());
00095                                 row[m_Columns.m_col_id] = pos;
00096                                 row[m_Columns.m_col_bc] = bc_msg;
00097                                 row[m_Columns.m_col_number] = serial;
00098                                 idx++;
00099                         }
00100                 } else if (drop_rb->get_active()){
00101                         res=read_next_drop(msg,bc_msg,&serial,&pos,entry1->get_text().c_str());
00102                         if (res>0){
00103                                 Gtk::TreeModel::Row row = *(m_refTreeModel->append());
00104                                 row[m_Columns.m_col_id] = pos;
00105                                 row[m_Columns.m_col_number] = serial;
00106                                 idx++;
00107                         }
00108                         } else if (all_rb->get_active()){
00109                         res=read_next_bc(msg,bc_msg,&serial,&pos,entry1->get_text().c_str());
00110                         if (res>0){
00111                                 Gtk::TreeModel::Row row = *(m_refTreeModel->append());
00112                                 row[m_Columns.m_col_id] = pos;
00113                                 row[m_Columns.m_col_name] = msg;
00114                                 row[m_Columns.m_col_bc] = bc_msg;
00115                                 row[m_Columns.m_col_number] = serial;
00116                                 idx++;
00117                         }
00118                         }
00119         }
00120         char txt[30];
00121         sprintf(txt,"Search (%d)",idx);
00122         set_title(txt);
00123     }
00124     void window1::on_button12_clicked(){
00125         hide();
00126     }
00127 #include "icon.h"
00128 window1::window1(main_window* mw):window1_glade(){
00129         this->mw=mw;
00130         all_rb->hide();
00131         drop_rb->hide();
00132         set_icon(Gdk::Pixbuf::create_from_xpm_data(icon));
00133         set_size_request(200, 600);
00134         treeview1->signal_cursor_changed().connect(sigc::mem_fun(*this, &window1::on_cursor_changed));
00135         m_refTreeModel = Gtk::TreeStore::create(m_Columns);
00136         //treeview1->append_column("BC Message", m_Columns.m_col_bc);
00137         set_title("Search");
00138         set_keep_above(true);
00139 }
00140 
00141 void window1::on_cursor_changed(){
00142         Glib::RefPtr<Gtk::TreeSelection> refTreeSelection = treeview1->get_selection();
00143     Gtk::TreeModel::iterator iter = refTreeSelection->get_selected();
00144     if(iter){
00145         Gtk::TreeModel::Row row = *iter;
00146         selected = row[m_Columns.m_col_id];
00147         mw->notify_selection(selected);
00148     }
00149 }


ros_rt_wmp_sniffer
Author(s): Danilo Tardioli, dantard@unizar.es
autogenerated on Fri Jan 3 2014 12:08:32