]> git.llucax.com Git - z.facultad/75.42/plaqui.git/commitdiff
Para enviar comando ahora hay 3 campos : Target, Command y Argumentos, para
authorRicardo Markiewicz <gazer.arg@gmail.com>
Thu, 13 Nov 2003 20:15:41 +0000 (20:15 +0000)
committerRicardo Markiewicz <gazer.arg@gmail.com>
Thu, 13 Nov 2003 20:15:41 +0000 (20:15 +0000)
 poder hacer pruebas bien.

 * Para ver : Cuando se envia server/stop el server no se apaga!

Client/include/principal.h
Client/src/client.glade
Client/src/principal.cpp

index c235ebff15b86f023f9a64f5dacd504f1434740a..0b1472f63be510f6b714cb3e03af3329e437b926 100644 (file)
@@ -21,7 +21,7 @@ protected:
 
        // Dialogo de Conectar
        DlgConectar *dlg_conectar;
-       Gtk::Entry *txt_get;
+       Gtk::Entry *txt_target, *txt_command, *txt_args;
        Gtk::TextView *txt_view;
 
        // Callbacks del menu y la barra
index cb6fd48cc1758ae067e3a3287e80014a8fc36d03..353d6e1256ad8a52fdf39caed8851e7c988f021d 100644 (file)
                <widget class="GtkFrame" id="frame2">
                  <property name="visible">True</property>
                  <property name="label_xalign">0</property>
-                 <property name="label_yalign">0.5</property>
+                 <property name="label_yalign">0</property>
                  <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
 
                  <child>
-                   <widget class="GtkHBox" id="hbox1">
+                   <widget class="GtkTable" id="table2">
                      <property name="visible">True</property>
+                     <property name="n_rows">3</property>
+                     <property name="n_columns">3</property>
                      <property name="homogeneous">False</property>
-                     <property name="spacing">0</property>
+                     <property name="row_spacing">0</property>
+                     <property name="column_spacing">0</property>
 
                      <child>
-                       <widget class="GtkLabel" id="label12">
+                       <widget class="GtkLabel" id="label14">
                          <property name="visible">True</property>
-                         <property name="label" translatable="yes">URI : </property>
+                         <property name="label" translatable="yes">Target : </property>
                          <property name="use_underline">False</property>
                          <property name="use_markup">False</property>
                          <property name="justify">GTK_JUSTIFY_LEFT</property>
                          <property name="wrap">False</property>
                          <property name="selectable">False</property>
-                         <property name="xalign">0.5</property>
+                         <property name="xalign">0</property>
+                         <property name="yalign">0.5</property>
+                         <property name="xpad">0</property>
+                         <property name="ypad">0</property>
+                       </widget>
+                       <packing>
+                         <property name="left_attach">0</property>
+                         <property name="right_attach">1</property>
+                         <property name="top_attach">0</property>
+                         <property name="bottom_attach">1</property>
+                         <property name="x_options">fill</property>
+                         <property name="y_options"></property>
+                       </packing>
+                     </child>
+
+                     <child>
+                       <widget class="GtkLabel" id="label15">
+                         <property name="visible">True</property>
+                         <property name="label" translatable="yes">Command :</property>
+                         <property name="use_underline">False</property>
+                         <property name="use_markup">False</property>
+                         <property name="justify">GTK_JUSTIFY_LEFT</property>
+                         <property name="wrap">False</property>
+                         <property name="selectable">False</property>
+                         <property name="xalign">0</property>
+                         <property name="yalign">0.5</property>
+                         <property name="xpad">0</property>
+                         <property name="ypad">0</property>
+                       </widget>
+                       <packing>
+                         <property name="left_attach">0</property>
+                         <property name="right_attach">1</property>
+                         <property name="top_attach">1</property>
+                         <property name="bottom_attach">2</property>
+                         <property name="x_options">fill</property>
+                         <property name="y_options"></property>
+                       </packing>
+                     </child>
+
+                     <child>
+                       <widget class="GtkLabel" id="label16">
+                         <property name="visible">True</property>
+                         <property name="label" translatable="yes">Arguments :</property>
+                         <property name="use_underline">False</property>
+                         <property name="use_markup">False</property>
+                         <property name="justify">GTK_JUSTIFY_LEFT</property>
+                         <property name="wrap">False</property>
+                         <property name="selectable">False</property>
+                         <property name="xalign">0</property>
                          <property name="yalign">0.5</property>
                          <property name="xpad">0</property>
                          <property name="ypad">0</property>
                        </widget>
                        <packing>
-                         <property name="padding">0</property>
-                         <property name="expand">False</property>
-                         <property name="fill">False</property>
+                         <property name="left_attach">0</property>
+                         <property name="right_attach">1</property>
+                         <property name="top_attach">2</property>
+                         <property name="bottom_attach">3</property>
+                         <property name="x_options">fill</property>
+                         <property name="y_options"></property>
                        </packing>
                      </child>
 
                      <child>
-                       <widget class="GtkEntry" id="txt_uri">
+                       <widget class="GtkEntry" id="txt_target">
                          <property name="visible">True</property>
                          <property name="can_focus">True</property>
                          <property name="editable">True</property>
                          <property name="activates_default">False</property>
                        </widget>
                        <packing>
-                         <property name="padding">0</property>
-                         <property name="expand">True</property>
-                         <property name="fill">True</property>
+                         <property name="left_attach">1</property>
+                         <property name="right_attach">2</property>
+                         <property name="top_attach">0</property>
+                         <property name="bottom_attach">1</property>
+                         <property name="y_options"></property>
+                       </packing>
+                     </child>
+
+                     <child>
+                       <widget class="GtkEntry" id="txt_command">
+                         <property name="visible">True</property>
+                         <property name="can_focus">True</property>
+                         <property name="editable">True</property>
+                         <property name="visibility">True</property>
+                         <property name="max_length">0</property>
+                         <property name="text" translatable="yes"></property>
+                         <property name="has_frame">True</property>
+                         <property name="invisible_char" translatable="yes">*</property>
+                         <property name="activates_default">False</property>
+                       </widget>
+                       <packing>
+                         <property name="left_attach">1</property>
+                         <property name="right_attach">2</property>
+                         <property name="top_attach">1</property>
+                         <property name="bottom_attach">2</property>
+                         <property name="y_options"></property>
+                       </packing>
+                     </child>
+
+                     <child>
+                       <widget class="GtkEntry" id="txt_args">
+                         <property name="visible">True</property>
+                         <property name="can_focus">True</property>
+                         <property name="editable">True</property>
+                         <property name="visibility">True</property>
+                         <property name="max_length">0</property>
+                         <property name="text" translatable="yes"></property>
+                         <property name="has_frame">True</property>
+                         <property name="invisible_char" translatable="yes">*</property>
+                         <property name="activates_default">False</property>
+                       </widget>
+                       <packing>
+                         <property name="left_attach">1</property>
+                         <property name="right_attach">2</property>
+                         <property name="top_attach">2</property>
+                         <property name="bottom_attach">3</property>
+                         <property name="y_options"></property>
                        </packing>
                      </child>
 
                        <widget class="GtkButton" id="btn_get">
                          <property name="visible">True</property>
                          <property name="can_focus">True</property>
-                         <property name="label" translatable="yes">GET</property>
+                         <property name="label" translatable="yes">Enviar</property>
                          <property name="use_underline">True</property>
                          <property name="relief">GTK_RELIEF_NORMAL</property>
                        </widget>
                        <packing>
-                         <property name="padding">0</property>
-                         <property name="expand">False</property>
-                         <property name="fill">False</property>
+                         <property name="left_attach">2</property>
+                         <property name="right_attach">3</property>
+                         <property name="top_attach">0</property>
+                         <property name="bottom_attach">3</property>
+                         <property name="x_options">fill</property>
+                         <property name="y_options">fill</property>
                        </packing>
                      </child>
                    </widget>
                </widget>
                <packing>
                  <property name="shrink">True</property>
-                 <property name="resize">True</property>
+                 <property name="resize">False</property>
                </packing>
              </child>
            </widget>
index e88c8968c42f3a1897516bcea8a9a495d625ae17..09bf9c2117f14de7fd50e9facf1ca032aada5c28 100644 (file)
@@ -7,9 +7,9 @@
 Principal::Principal(BaseObjectType *co, const Glib::RefPtr<Gnome::Glade::Xml> &rg):Gtk::Window(co),refXml(rg)
 {
        Gtk::MenuItem *conect=0, *exit=0, *about=0;
-       Gtk::Button *btn_get=0;
+       Gtk::Button *btn_get=0, *bar_connect=0;
        txt_view = 0;
-       txt_get = 0;
+       txt_target = txt_command = txt_args = 0;
        
        rg->get_widget("mnu_file_connect", conect);
        rg->get_widget("mnu_file_exit", exit);
@@ -17,10 +17,14 @@ Principal::Principal(BaseObjectType *co, const Glib::RefPtr<Gnome::Glade::Xml> &
        rg->get_widget_derived("dlgConectar", dlg_conectar);
        rg->get_widget("btn_get", btn_get);
        rg->get_widget("txt_view", txt_view);
-       rg->get_widget("txt_uri", txt_get);
+       rg->get_widget("txt_target", txt_target);
+       rg->get_widget("txt_command", txt_command);
+       rg->get_widget("txt_args", txt_args);
+       rg->get_widget("bar_connect", bar_connect);
 
        dlg_conectar->get_ok_button()->signal_clicked().connect( SigC::slot(*this, &Principal::on_dlg_connect_ok) );
        conect->signal_activate().connect( SigC::slot(*this, &Principal::on_mnu_file_connect));
+       bar_connect->signal_clicked().connect( SigC::slot(*this, &Principal::on_mnu_file_connect));
        exit->signal_activate().connect( SigC::slot(*this, &Principal::on_mnu_file_exit));
        about->signal_activate().connect( SigC::slot(*this, &Principal::on_mnu_help_about));
        btn_get->signal_clicked().connect( SigC::slot(*this, &Principal::on_get_clicked) );
@@ -38,20 +42,29 @@ void Principal::on_dlg_connect_ok()
        if (conexion == NULL) {
                std::cout << "Conectando ..." << std::endl;
                // Creo la conexion
-               conexion = new PlaQui::Server::ControlClient(dlg_conectar->get_server_name(), dlg_conectar->get_server_port());
+               try {
+                       conexion = new PlaQui::Server::ControlClient(dlg_conectar->get_server_name(), dlg_conectar->get_server_port());
+               }
+               catch (...) {
+                       txt_view->get_buffer()->insert_at_cursor("NO SE PUDO CREAR OBJETO\n");
+                       return;
+               }
+
                // Conecto las señales
                conexion->signal_ok_received().connect( SigC::slot(*this, &Principal::on_conexion_ok) );
                conexion->signal_error_received().connect( SigC::slot(*this, &Principal::on_conexion_error) );
                // Lanzo la conexion!
-               conexion->run();
+               //
+               try {
+                       conexion->run();
+               }
+               catch (...) {
+                       txt_view->get_buffer()->insert_at_cursor("no se puede correr ->run()!!!\n");
+               }
        } else {
                std::cout << "Ya estas conectado" << std::endl;
        }
        dlg_conectar->hide();
-
-       // mando algo para ver que me dice
-       PlaQui::Server::Command command("/", "status");
-       conexion->send(command);
 }
 
 void Principal::on_mnu_file_exit()
@@ -112,12 +125,16 @@ void Principal::on_get_clicked()
                txt_view->get_buffer()->insert_at_cursor("SIN CONEXION\n");
        }
 
-       txt_view->get_buffer()->insert_at_cursor("Enviada URI : ");
-       txt_view->get_buffer()->insert_at_cursor(txt_get->get_text());
-       txt_view->get_buffer()->insert_at_cursor("\n");
        
-       PlaQui::Server::Command command(txt_get->get_text(), "");
-       conexion->send(command);
+       PlaQui::Server::Command command(txt_target->get_text(), txt_command->get_text());
+       command.add_arg( txt_args->get_text() );
+       txt_view->get_buffer()->insert_at_cursor("Enviando comando\n");
+       try {
+               conexion->send(command);
+       }
+       catch (...) {
+               txt_view->get_buffer()->insert_at_cursor("EXCEPTION EN conexion->send !!\n");
+       }
 
 }