OCT 1. 更新测试工具界面

This commit is contained in:
huangxin 2023-04-20 17:48:19 +08:00
parent 2719023967
commit b68a2f2637
3 changed files with 46 additions and 46 deletions

View File

@ -18,6 +18,7 @@ typedef enum {
COL_RESULT,
COL_STATUS,
COL_ATTR_EDITABLE,
NUM_COLS
} COL_NAME;

View File

@ -54,14 +54,12 @@ static double calc_total_progress(PDHCP_INFO pInfo) {
return pre_cnt;
}
static double calc_step_progress(PDHCP_INFO pInfo, DHCP_STEP step) {
double pre_cnt = 0.0;
static gboolean calc_step_progress(PDHCP_INFO pInfo, DHCP_STEP step) {
if (pInfo && pInfo->step == step) {
pre_cnt += pInfo->status * 5;
return TRUE;
}
return pre_cnt;
return FALSE;
}
static void tree_view_data_store_create() {
@ -99,6 +97,7 @@ static void tree_view_data_store_create() {
COL_ACK, calc_step_progress(pInfo, STEP_ACK),
COL_RESULT, "",
COL_STATUS, calc_total_progress(pInfo),
COL_ATTR_EDITABLE, FALSE,
-1);
// clang-format on
}
@ -179,6 +178,7 @@ static gboolean tree_view_data_store_upgade(gpointer pInfo) {
COL_ACK, calc_step_progress(pInfo, STEP_ACK),
COL_RESULT, "",
COL_STATUS, calc_total_progress(pInfo),
COL_ATTR_EDITABLE, FALSE,
-1);
// clang-format on
}
@ -397,7 +397,7 @@ int main(int args, char **argv) {
GtkWidget *macTxt = GTK_WIDGET(gtk_builder_get_object(g_mainBuilder, "txtMacStart"));
GtkWidget *numInc = GTK_WIDGET(gtk_builder_get_object(g_mainBuilder, "sbReqNum"));
GtkAdjustment *adj = gtk_adjustment_new(1000, 1, 100000, 1, 0, 0);
GtkAdjustment *adj = gtk_adjustment_new(1, 1, 100000, 1, 0, 0);
gtk_spin_button_set_adjustment(GTK_SPIN_BUTTON(numInc), adj);
GtkWidget *numVni = GTK_WIDGET(gtk_builder_get_object(g_mainBuilder, "sbVni"));

View File

@ -2,6 +2,12 @@
<interface>
<requires lib="gtk+" version="2.16"/>
<!-- interface-naming-policy project-wide -->
<object class="GtkListStore" id="lsNicName">
<columns>
<!-- column-name cNicName -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkListStore" id="tsDhcpInfo">
<columns>
<!-- column-name cIndex -->
@ -11,23 +17,19 @@
<!-- column-name cHostname -->
<column type="gchararray"/>
<!-- column-name cDiscover -->
<column type="gfloat"/>
<column type="gboolean"/>
<!-- column-name cOffer -->
<column type="gfloat"/>
<column type="gboolean"/>
<!-- column-name cRequest -->
<column type="gfloat"/>
<column type="gboolean"/>
<!-- column-name cAck -->
<column type="gfloat"/>
<column type="gboolean"/>
<!-- column-name cResult -->
<column type="gchararray"/>
<!-- column-name cRltPrgess -->
<column type="gfloat"/>
</columns>
</object>
<object class="GtkListStore" id="lsNicName">
<columns>
<!-- column-name cNicName -->
<column type="gchararray"/>
<!-- column-name cAttrPrgTest -->
<column type="gboolean"/>
</columns>
</object>
<object class="GtkWindow" id="wndMain">
@ -389,7 +391,6 @@
<property name="enable_grid_lines">both</property>
<child>
<object class="GtkTreeViewColumn" id="tvcIndex">
<property name="min_width">32</property>
<property name="title">Index</property>
<property name="alignment">0.5</property>
<child>
@ -402,7 +403,6 @@
</child>
<child>
<object class="GtkTreeViewColumn" id="tvcMac">
<property name="min_width">128</property>
<property name="title">MAC</property>
<property name="alignment">0.5</property>
<child>
@ -415,7 +415,6 @@
</child>
<child>
<object class="GtkTreeViewColumn" id="tvcHostname">
<property name="min_width">64</property>
<property name="title">Hostname</property>
<property name="alignment">0.5</property>
<child>
@ -428,58 +427,60 @@
</child>
<child>
<object class="GtkTreeViewColumn" id="tvcDiscover">
<property name="sizing">autosize</property>
<property name="fixed_width">64</property>
<property name="min_width">96</property>
<property name="title">Discover</property>
<property name="sizing">fixed</property>
<property name="fixed_width">32</property>
<property name="title">D</property>
<property name="alignment">0.5</property>
<child>
<object class="GtkCellRendererProgress" id="crDiscover"/>
<object class="GtkCellRendererToggle" id="crDiscover"/>
<attributes>
<attribute name="value">3</attribute>
<attribute name="sensitive">9</attribute>
<attribute name="active">3</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="tvcOffer">
<property name="sizing">autosize</property>
<property name="fixed_width">64</property>
<property name="min_width">96</property>
<property name="title">Offer</property>
<property name="sizing">fixed</property>
<property name="fixed_width">32</property>
<property name="title">O</property>
<property name="alignment">0.5</property>
<child>
<object class="GtkCellRendererProgress" id="crOffer"/>
<object class="GtkCellRendererToggle" id="crOffer"/>
<attributes>
<attribute name="value">4</attribute>
<attribute name="sensitive">9</attribute>
<attribute name="active">4</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="tvcRequest">
<property name="sizing">autosize</property>
<property name="min_width">96</property>
<property name="title">Request</property>
<property name="sizing">fixed</property>
<property name="fixed_width">32</property>
<property name="title">R</property>
<property name="alignment">0.5</property>
<child>
<object class="GtkCellRendererProgress" id="crRequest"/>
<object class="GtkCellRendererToggle" id="crRequest"/>
<attributes>
<attribute name="value">5</attribute>
<attribute name="sensitive">9</attribute>
<attribute name="active">5</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="tvcAck">
<property name="sizing">autosize</property>
<property name="min_width">96</property>
<property name="title">ACK</property>
<property name="sizing">fixed</property>
<property name="fixed_width">32</property>
<property name="title">A</property>
<property name="alignment">0.5</property>
<child>
<object class="GtkCellRendererProgress" id="crAck"/>
<object class="GtkCellRendererToggle" id="crAck"/>
<attributes>
<attribute name="value">6</attribute>
<attribute name="sensitive">9</attribute>
<attribute name="active">6</attribute>
</attributes>
</child>
</object>
@ -487,7 +488,7 @@
<child>
<object class="GtkTreeViewColumn" id="tvcResult">
<property name="sizing">fixed</property>
<property name="min_width">200</property>
<property name="fixed_width">400</property>
<property name="title">Result</property>
<property name="alignment">0.5</property>
<child>
@ -501,10 +502,8 @@
<child>
<object class="GtkTreeViewColumn" id="tblStatus">
<property name="sizing">fixed</property>
<property name="fixed_width">64</property>
<property name="min_width">64</property>
<property name="max_width">64</property>
<property name="title">Totol Progress</property>
<property name="fixed_width">32</property>
<property name="title">Progress</property>
<property name="alignment">0.5</property>
<child>
<object class="GtkCellRendererProgress" id="cellrendererprogress1"/>