Changeset 465


Ignore:
Timestamp:
12/25/06 10:40:54 (6 years ago)
Author:
tony_guan
Message:

MokoStatus? finished, outgoing call window partly finished.

Location:
trunk/src/target/OM-2007/applications/openmoko-dialer
Files:
3 added
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/target/OM-2007/applications/openmoko-dialer/data/Makefile.am

    r430 r465  
    55                10086.png\ 
    66                chaowei.png\ 
    7                 unkown.png 
     7                unkown.png\ 
     8                status0.png\ 
     9                status1.png\ 
     10                status2.png 
     11                 
    812resourcedir = $(pkgdatadir) 
    913 
     
    1418                10086.png\ 
    1519                chaowei.png\ 
    16                 unkown.png 
    17  
     20                unkown.png\ 
     21                status0.png\ 
     22                status1.png\ 
     23                status2.png 
  • trunk/src/target/OM-2007/applications/openmoko-dialer/src/common.c

    r458 r465  
    158158            DBG_MESSAGE("file_load_person_image_scalable_from_relative_path,width=%d,height=%d",widget->allocation.width, widget->allocation.height); 
    159159             
     160//          dest_pixbuf = gdk_pixbuf_scale_simple (src_pixbuf, widget->requisition.width, widget->requisition.height, GDK_INTERP_NEAREST); 
    160161            dest_pixbuf = gdk_pixbuf_scale_simple (src_pixbuf, widget->allocation.width, widget->allocation.height, GDK_INTERP_NEAREST); 
    161162             gtk_image_set_from_pixbuf (image,dest_pixbuf); 
  • trunk/src/target/OM-2007/applications/openmoko-dialer/src/contacts.c

    r459 r465  
    363363} 
    364364 
     365/** 
     366 * @brief get the name and picture path from the contact list, indexed by the number provided. 
     367 * in the case that contact API returns NULL, we will call this function for debug. 
     368 *  
     369 *  
     370 * 
     371 * @param contacts, the first contact pointer of the list. 
     372 * @param peer, the structure to hold the pointer to the strings in the contact list. 
     373 * @return 0-failed, 1-found the contact. 
     374 * @retval  
     375 */ 
     376 
     377int contact_get_peer_info_from_number(DIALER_CONTACT* contacts, DIALER_CONTACT_PEER_INFO * peer) 
     378{ 
     379 
     380        peer->hasname=0; 
     381        peer->searched=1; 
     382        peer->name=0; 
     383        peer->picpath=0; 
     384 
     385        if(peer->number==0)return 0; 
     386        if(strlen(peer->number)==0)return 0; 
     387         
     388//  DIALER_CONTACT* contacts=g_contactlist.contacts; 
     389 
     390        DIALER_CONTACT_ENTRY* entry; 
     391  
     392   while(contacts!= 0) 
     393   { 
     394     entry=contacts->entry; 
     395 
     396         while(entry) 
     397         { 
     398         
     399         //judge if the entry includes the string 
     400                  
     401         if(strcmp(entry->content,peer->number)==0) 
     402         {       
     403         peer->picpath=contacts->picpath; 
     404         peer->name=contacts->name; 
     405        // DBG_MESSAGE("Yeah, we know the owner is %s.",name); 
     406        peer->hasname=1; 
     407         return 1; 
     408         } 
     409     entry=entry->next; 
     410         } 
     411     
     412          
     413         contacts= contacts->next; 
     414         
     415  } 
     416  //DBG_MESSAGE("Can not find the number."); 
     417  return 0; 
     418} 
     419 
     420 
    365421 
    366422/** 
  • trunk/src/target/OM-2007/applications/openmoko-dialer/src/contacts.h

    r459 r465  
    6262 
    6363/** 
     64 * @brief contact  structure for open dialer. 
     65 */ 
     66typedef struct peer_info_ 
     67{ 
     68//we should at least have the number called. 
     69  char number[MOKO_DIALER_MAX_NUMBER_LEN];        ///<the number of the peer 
     70  char *name;           ///<person name 
     71  char *picpath;  ///<the picture file path for the person 
     72  int searched; ///<if true; no need to search for the name  
     73  int hasname; ///<if true, we the picpath & name can be used. 
     74}DIALER_CONTACT_PEER_INFO; 
     75 
     76 
     77/** 
    6478 * @brief the structure for intelligent search results. 
    6579 */      
     
    8599int contact_init_from_cmd(DIALER_CONTACTS_LIST_HEAD * head); 
    86100int contact_get_info_from_number(DIALER_CONTACT* contacts,char* name,char* picpath,const char* number); 
     101int contact_get_peer_info_from_number(DIALER_CONTACT* contacts, DIALER_CONTACT_PEER_INFO * peer); 
    87102int contact_init_contact_data(DIALER_CONTACTS_LIST_HEAD   *p_contactlist); 
    88103int contact_print_contact_list(DIALER_CONTACTS_LIST_HEAD * head); 
  • trunk/src/target/OM-2007/applications/openmoko-dialer/src/moko-dialer-autolist.h

    r438 r465  
    5757  DIALER_CONTACTS_LIST_HEAD* head; 
    5858 
    59   HISTORY_ENTRY * g_currentselected; ///<pointer to the history entry which in the GUI the user selects. 
     59//  HISTORY_ENTRY * g_currentselected; ///<pointer to the history entry which in the GUI the user selects. 
    6060 
    6161//static PangoFontDescription *font_desc=NULL; ///<the PangoFontDescription which a lot of widget will use it. 
  • trunk/src/target/OM-2007/applications/openmoko-dialer/src/moko-dialer-declares.h

    r458 r465  
    2525//only when user inputs at least MINSENSATIVELEN, should we start to search. 
    2626#define MOKO_DIALER_MIN_SENSATIVE_LEN (1) 
    27 #define MOKO_DIALER_MAX_STATUS_ICONS (1) 
    28 #define MOKO_DIALER_DEFAULT_PERSON_IMAGE_PATH ("./default.png") 
     27#define MOKO_DIALER_MAX_STATUS_ICONS (3) 
     28#define MOKO_DIALER_DEFAULT_PERSON_IMAGE_PATH ("unkown.png") 
    2929#define MOKO_DIALER_MAX_TIPS (3) 
    3030 
  • trunk/src/target/OM-2007/applications/openmoko-dialer/src/moko-dialer-includes.h

    r438 r465  
    2828#include "moko-dialer-textview.h" 
    2929#include "moko-digit-button.h" 
    30  
     30#include "moko-dialer-status.h" 
     31#include <libmokoui/moko-dialog-window.h> 
     32// 
    3133 
    3234 
     
    7880        gint stopsec; ///<indicates when the ticks reaches stopsec, then this timer has to be stopped. 
    7981        gint timeout; ///<indicates wether this timer has timeout to stopsec. 
    80         GtkWidget* label; 
     82 
    8183        gint ticks; //seconds together 
    8284        gint sec;    
    8385        gint min; 
    8486        gint hour; 
    85         char timestring[9] ; 
    86         gint updatewidget; 
    87         TimeExpireCallback expirecallback; 
     87        char timestring[MOKO_DIALER_MAX_NUMBER_LEN] ; 
    8888}TIMER_DATA; 
     89 
    8990enum { 
    9091        COLUMN_TYPE, 
  • trunk/src/target/OM-2007/applications/openmoko-dialer/src/moko-dialer-status.c

    r458 r465  
    4949; ///<the topmost title bar of the status 
    5050moko_dialer_status->labelStatusTitle= gtk_label_new(""); 
     51 
     52/* 
    5153for(gint i=0;i<MOKO_DIALER_MAX_STATUS_ICONS;i++) 
    5254        moko_dialer_status->iconStatus[i]=gtk_image_new(); 
     55*/ 
     56 
     57moko_dialer_status->icon=gtk_image_new(); 
     58 
    5359 
    5460//lower section   
    5561        moko_dialer_status->imagePerson=gtk_image_new();  ///<the image of the person we care 
     62gtk_widget_set_size_request (moko_dialer_status->imagePerson, 130,130); 
     63  gtk_misc_set_alignment (GTK_MISC (moko_dialer_status->imagePerson), 1, 0); 
     64 
     65         
    5666        moko_dialer_status->labelStatus=gtk_label_new("");      ///<the status label 
     67                  gtk_misc_set_alignment (GTK_MISC (moko_dialer_status->labelStatus), 0, 0); 
     68//                gtk_misc_set_padding(GTK_MISC (moko_dialer_status->labelStatus), 20,0); 
    5769        moko_dialer_status->labelPersonName=gtk_label_new(""); ///<the person name 
     70                  gtk_misc_set_alignment (GTK_MISC (moko_dialer_status->labelPersonName), 0, 0); 
    5871        moko_dialer_status->labelNumber=gtk_label_new(""); ///<the number of the person 
     72                  gtk_misc_set_alignment (GTK_MISC (moko_dialer_status->labelNumber), 0, 0); 
    5973//private section 
    6074        moko_dialer_status->number_of_the_icons=0; 
    6175 
    62  gtk_box_pack_start( GTK_BOX(moko_dialer_status),       moko_dialer_status->labelStatusTitle , FALSE, FALSE, 0 ); 
    63  gtk_box_pack_start( GTK_BOX(moko_dialer_status),       moko_dialer_status->iconStatus[0], FALSE, FALSE, 0 ); 
     76 gtk_widget_set_size_request (moko_dialer_status->icon, 64,64); 
     77 gtk_box_pack_start( GTK_BOX(moko_dialer_status),       moko_dialer_status->labelStatusTitle , FALSE, FALSE, 20 ); 
     78 gtk_box_pack_start( GTK_BOX(moko_dialer_status),       moko_dialer_status->icon, FALSE, FALSE, 20); 
    6479  
    6580//ok now, we arrange them in the vbox. 
     
    6782// we create another vbox to hold the status labels. 
    6883    GtkVBox *  vbox2 = gtk_vbox_new( FALSE, 0 ); 
    69    gtk_box_pack_start( GTK_BOX(vbox2),  moko_dialer_status->labelStatus, FALSE, FALSE, 0 ); 
     84   gtk_box_pack_start( GTK_BOX(vbox2),  moko_dialer_status->labelStatus, TRUE, TRUE, 0); 
    7085    
    71    gtk_box_pack_start( GTK_BOX(vbox2),  moko_dialer_status->labelPersonName, FALSE, FALSE, 0 ); 
     86   gtk_box_pack_start( GTK_BOX(vbox2),  moko_dialer_status->labelPersonName, TRUE, TRUE, 0 ); 
    7287 
    7388 
    7489     
    75    gtk_box_pack_start( GTK_BOX(vbox2),  moko_dialer_status->labelNumber, FALSE, FALSE, 0 ); 
     90   gtk_box_pack_start( GTK_BOX(vbox2),  moko_dialer_status->labelNumber, TRUE, TRUE, 0 ); 
    7691// a hbox to hold the image and the vbox2 
    7792    GtkVBox *  hbox2 = gtk_hbox_new( FALSE, 0 ); 
    78     gtk_widget_set_size_request (moko_dialer_status->imagePerson, 64,64); 
    79    gtk_box_pack_start( GTK_BOX(hbox2),  moko_dialer_status->imagePerson, FALSE, FALSE, 0 ); 
    80  
    81    gtk_box_pack_start( GTK_BOX(hbox2),vbox2, FALSE, FALSE, 0 ); 
    82  
    83 gtk_box_pack_start( GTK_BOX(moko_dialer_status),hbox2, FALSE, FALSE, 0 ); 
    84  
    85 gtk_widget_set_size_request (GTK_WIDGET(moko_dialer_status), 480, 40);  
     93 
     94 
     95     
     96//   gtk_box_pack_start( GTK_BOX(hbox2),        moko_dialer_status->imagePerson, FALSE, FALSE, 0 ); 
     97   gtk_box_pack_start( GTK_BOX(hbox2),  moko_dialer_status->imagePerson, TRUE,TRUE, 0 ); 
     98 
     99// gtk_box_pack_start( GTK_BOX(hbox2),vbox2, FALSE, FALSE, 0 ); 
     100 gtk_box_pack_start( GTK_BOX(hbox2),vbox2, TRUE,TRUE, 36 ); 
     101 
     102gtk_box_pack_start( GTK_BOX(moko_dialer_status),hbox2, TRUE, TRUE, 0 ); 
     103 
     104//gtk_widget_set_size_request (GTK_WIDGET(moko_dialer_status), 320, 200);  
    86105 
    87106DBG_LEAVE(); 
     
    107126void moko_dialer_status_set_status_label(MokoDialerStatus *moko_dialer_status,const gchar* text) 
    108127{ 
     128 
     129DBG_MESSAGE("moko_dialer_status_set_status_label:moko_dialer_status=0X%x",moko_dialer_status); 
    109130gtk_label_set_text(GTK_LABEL(moko_dialer_status->labelStatus),text); 
    110131} 
     
    121142void moko_dialer_status_set_person_image(MokoDialerStatus *moko_dialer_status,const gchar* path) 
    122143{ 
    123 file_load_person_image_scalable_from_relative_path(moko_dialer_status->imagePerson,path); 
    124 }  
    125 void moko_dialer_status_set_icons(MokoDialerStatus *moko_dialer_status,const gchar* text) 
    126 { 
    127  
    128 }  
    129  
    130  
     144//file_load_person_image_scalable_from_relative_path(moko_dialer_status->imagePerson,path); 
     145file_load_person_image_from_relative_path(moko_dialer_status->imagePerson,path); 
     146//file_load_person_image_scalable_from_relative_path(moko_dialer_status->imagePerson,path); 
     147}  
     148int moko_dialer_status_add_status_icon(MokoDialerStatus *moko_dialer_status,const gchar* text) 
     149{ 
     150if(moko_dialer_status->number_of_the_icons<MOKO_DIALER_MAX_STATUS_ICONS) 
     151{ 
     152        moko_dialer_status->iconStatus[moko_dialer_status->number_of_the_icons]=create_pixbuf (text); 
     153 
     154        moko_dialer_status->number_of_the_icons++; 
     155        return 1; 
     156} 
     157else 
     158{ 
     159        DBG_ERROR("MOKO_DIALER_MAX_STATUS_ICONS has reached, add no more icons."); 
     160        return 0; 
     161} 
     162}  
     163 
     164void moko_dialer_status_set_error_icon(MokoDialerStatus *moko_dialer_status,const gchar* text) 
     165{ 
     166 
     167 
     168        moko_dialer_status->iconError=create_pixbuf (text); 
     169//      file_load_person_image_from_relative_path(moko_dialer_status->iconError,text); 
     170}  
     171void moko_dialer_status_set_success_icon(MokoDialerStatus *moko_dialer_status,const gchar* text) 
     172{ 
     173        moko_dialer_status->iconError=create_pixbuf (text); 
     174//      file_load_person_image_from_relative_path(moko_dialer_status->iconSuccuss,text); 
     175} 
     176 
     177void moko_dialer_status_set_icon_by_index(MokoDialerStatus *moko_dialer_status,gint index) 
     178{ 
     179if( moko_dialer_status->iconStatus[index]!=0&&index<moko_dialer_status->number_of_the_icons) 
     180        gtk_image_set_from_pixbuf(moko_dialer_status->icon, moko_dialer_status->iconStatus[index]); 
     181} 
     182void moko_dialer_status_update_icon(MokoDialerStatus *moko_dialer_status) 
     183{ 
     184static gint currenticon=0; 
     185currenticon=(currenticon+1)%moko_dialer_status->number_of_the_icons; 
     186if( moko_dialer_status->iconStatus[currenticon]) 
     187        moko_dialer_status_set_icon_by_index(moko_dialer_status,currenticon); 
     188} 
     189         
     190 
     191void moko_dialer_status_set_error(MokoDialerStatus *moko_dialer_status) 
     192{ 
     193if(moko_dialer_status->iconError) 
     194        gtk_image_set_from_pixbuf(moko_dialer_status->icon, moko_dialer_status->iconError); 
     195} 
     196 
     197void moko_dialer_status_set_success(MokoDialerStatus *moko_dialer_status) 
     198{ 
     199if(moko_dialer_status->iconSuccess) 
     200        gtk_image_set_from_pixbuf(moko_dialer_status->icon, moko_dialer_status->iconSuccess); 
     201 
     202} 
     203 
  • trunk/src/target/OM-2007/applications/openmoko-dialer/src/moko-dialer-status.h

    r458 r465  
    5656//upper section 
    5757  GtkWidget * labelStatusTitle; ///<the topmost title bar of the status 
    58   GtkWidget * iconStatus[MOKO_DIALER_MAX_STATUS_ICONS]; 
    59  
     58  GtkWidget * icon; 
     59  GdkPixbuf * iconStatus[MOKO_DIALER_MAX_STATUS_ICONS]; 
     60  GdkPixbuf * iconError; 
     61  GdkPixbuf * iconSuccess; 
    6062//lower section   
    6163  GtkWidget * imagePerson;  ///<the image of the person we care 
  • trunk/src/target/OM-2007/applications/openmoko-dialer/src/moko-dialer-textview.c

    r458 r465  
    179179} 
    180180 
     181 
     182 
    181183 /** 
    182184 * @brief moko_dialer_textview_insert   
     
    299301} 
    300302 
     303//delete all the input  
     304int  moko_dialer_textview_empty(MokoDialerTextview *moko_dialer_textview) 
     305{ 
     306 
     307GtkTextBuffer *buffer; 
     308 
     309buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (moko_dialer_textview)); 
     310 
     311gtk_text_buffer_set_text(buffer,"",-1); 
     312return 1; 
     313} 
     314 
    301315///delete the selection or one character. 
    302316int  moko_dialer_textview_delete(MokoDialerTextview *moko_dialer_textview) 
  • trunk/src/target/OM-2007/applications/openmoko-dialer/src/moko-dialer-textview.h

    r438 r465  
    6868 
    6969int  moko_dialer_textview_get_input(MokoDialerTextview *moko_dialer_textview,gchar* input,int ALL); 
     70int  moko_dialer_textview_empty(MokoDialerTextview *moko_dialer_textview); 
    7071 
    7172G_END_DECLS 
  • trunk/src/target/OM-2007/applications/openmoko-dialer/src/openmoko-dialer-main.h

    r458 r465  
    1717 */ 
    1818 #include "moko-dialer-includes.h" 
     19/* 
    1920 
     21typedef struct _window_outgoing 
     22{ 
     23 
     24MokoDialerStatus * status_outgoing; 
     25 
     26GtkWidget* window_outgoing; 
     27 
     28GtkWidget* buttonSpeaker; 
     29GtkWidget* buttonCancel; 
     30GtkWidget* buttonRedial; 
     31}WindowOutgoing; 
     32*/ 
    2033 typedef struct _dialer_data 
    2134{ 
     
    2942DIALER_CONTACTS_LIST_HEAD       g_contactlist; ///< the whole list of the contacts from the contact book. 
    3043 
     44DIALER_CONTACT_PEER_INFO g_peer_info; ///<hold the peer's name, number, etc. 
     45 
    3146HISTORY_LIST_HEAD g_historylist; ///< the whole list of the talk history 
    3247 
     
    3752TIMER_DATA g_timer_data;///< the data used by the timers 
    3853 
     54MokoDialerStatus * status_outgoing; 
    3955GtkWidget * window_dialer; 
    4056GtkWidget* window_outgoing; 
    4157 
     58//buttons 
     59GtkWidget* buttonSpeaker; 
     60GtkWidget* buttonCancel; 
     61GtkWidget* buttonRedial; 
     62 
     63//WindowOutgoing window_outgoing_data; 
    4264// GtkListStore  *g_list_store_filter;///<the list store used by the gtktreeview, for displaying the history list dynamically. 
    4365 
  • trunk/src/target/OM-2007/applications/openmoko-dialer/src/openmoko-dialer-window-dialer.c

    r458 r465  
    7474void cb_dialer_button_clicked( GtkButton* button, MOKO_DIALER_APP_DATA * appdata) 
    7575{ 
    76     g_debug( "dialer button clicked" ); 
     76 g_debug( "dialer button clicked" ); 
     77gchar codesinput[MOKO_DIALER_MAX_NUMBER_LEN]; 
     78 //get the input digits 
     79 moko_dialer_textview_get_input(appdata->moko_dialer_text_view, codesinput, 0); 
     80if(strlen(codesinput)<=1) 
     81        return; 
     82//empty the textview 
     83moko_dialer_textview_empty(appdata->moko_dialer_text_view); 
     84 
     85//got the number; 
     86strcpy(appdata->g_peer_info.number,codesinput); 
     87 
     88//retrieve the contact information if any. 
     89contact_get_peer_info_from_number(appdata->g_contactlist.contacts , &(appdata->g_peer_info)); 
     90// contact_get_peer_info_from_number 
     91 
    7792if(!appdata->window_outgoing) 
    7893        window_outgoing_init(appdata); 
    7994 
     95//transfer the contact info 
     96window_outgoing_prepare(appdata); 
     97 
     98//start dialling. 
    8099gtk_widget_show(appdata->window_outgoing); 
    81100} 
     
    118137DBG_MESSAGE("And here we are supposed to call out directly"); 
    119138 
     139 
     140 
    120141} 
    121142void 
     
    259280//the buttons 
    260281 
    261 /* 
    262     GtkWidget *iconimage = gtk_image_new(); 
    263    file_load_person_image_from_relative_path( iconimage,"unkown.png"); 
    264  //gtk_image_new_from_stock ("gtk-delete", GTK_ICON_SIZE_BUTTON); 
    265  */ 
    266 //    moko_pixmap_button_set_finger_toolbox_btn_center_image (button1, iconimage); 
    267282    GtkVBox *  vbox2 = gtk_vbox_new( FALSE, 0 ); 
    268283    GtkButton* button1 = moko_pixmap_button_new(); 
    269284    g_signal_connect( G_OBJECT(button1), "clicked", G_CALLBACK(cb_delete_button_clicked), p_dialer_data ); 
    270285    gtk_widget_set_name( GTK_WIDGET(button1), "mokofingerbutton-orange" ); 
    271         moko_pixmap_button_set_action_btn_center_stock(button1,"gtk-delete"); 
     286        moko_pixmap_button_set_center_stock(button1,"gtk-delete"); 
    272287        moko_pixmap_button_set_action_btn_lower_label(button1,"Delete"); 
    273288  gtk_widget_set_size_request (button1, WINDOW_DIALER_BUTTON_SIZE_X, WINDOW_DIALER_BUTTON_SIZE_Y); 
     
    278293    g_signal_connect( G_OBJECT(button3), "clicked", G_CALLBACK(cb_history_button_clicked), p_dialer_data ); 
    279294    gtk_widget_set_name( GTK_WIDGET(button3), "mokofingerbutton-orange" ); 
    280 moko_pixmap_button_set_action_btn_center_stock(button3,"gtk-refresh"); 
     295moko_pixmap_button_set_center_stock(button3,"gtk-refresh"); 
    281296moko_pixmap_button_set_action_btn_lower_label(button3,"History"); 
    282297  gtk_widget_set_size_request (button3, WINDOW_DIALER_BUTTON_SIZE_X, WINDOW_DIALER_BUTTON_SIZE_Y);       
     
    288303    g_signal_connect( G_OBJECT(button2), "clicked", G_CALLBACK(cb_dialer_button_clicked), p_dialer_data ); 
    289304    gtk_widget_set_name( GTK_WIDGET(button2), "mokofingerbutton-black" ); 
    290         moko_pixmap_button_set_action_btn_center_stock(button2,"gtk-yes"); 
     305        moko_pixmap_button_set_center_stock(button2,"gtk-yes"); 
    291306        moko_pixmap_button_set_action_btn_lower_label(button2,"Dial"); 
    292307  gtk_widget_set_size_request (button2, WINDOW_DIALER_BUTTON_SIZE_X+20, WINDOW_DIALER_BUTTON_SIZE_Y+80); 
Note: See TracChangeset for help on using the changeset viewer.