{"action":"created","comment":{"url":"https://api.github.com/repos/Tlf/tlf/pulls/comments/23557191","id":23557191,"diff_hunk":"@@ -0,0 +1,1816 @@\n+/*\n+ * Tlf - contest logging program for amateur radio operators\n+ * Copyright (C) 2013-2014 Ervin Hegedüs - HA2OS <airween@gmail.com>\n+ *\n+ * This program is free software; you can redistribute it and/or modify\n+ * it under the terms of the GNU General Public License as published by\n+ * the Free Software Foundation; either version 2 of the License, or\n+ * (at your option) any later version.\n+ *\n+ * This program is distributed in the hope that it will be useful,\n+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\n+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n+ * GNU General Public License for more details.\n+ *\n+ * You should have received a copy of the GNU General Public License\n+ * along with this program; if not, write to the Free Software\n+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n+ */\n+\t/* ------------------------------------------------------------\n+\t *        Handle QTC panel, receive and send QTC, write to log\n+\t *\n+\t *--------------------------------------------------------------*/\n+\n+#include \"qtcwin.h\"\n+\n+#include \"onechar.h\"\n+#include <panel.h>\n+#include \"nicebox.h\"\n+#include \"time_update.h\"\n+#include <ctype.h>\n+#include \"rtty.h\"\n+#include \"sendbuf.h\"\n+#include \"log_recv_qtc_to_disk.h\"\n+#include \"log_sent_qtc_to_disk.h\"\n+#include \"globalvars.h\"\n+#include \"qtcutil.h\"\n+#include \"genqtclist.h\"\n+#include \"speedupndown.h\"\n+#include \"cw_utils.h\"\n+#include \"keyer.h\"\n+#include \"callinput.h\"\n+#include \"get_time.h\"\n+#include \"write_keyer.h\"\n+\n+#include <sys/time.h>\n+\n+#define DIRCLAUSE (direction == RECV) || (direction == SEND && (activefield == 0 || activefield == 2))\n+\n+extern char hiscall[];\n+extern char lastcall[];\n+extern int trxmode;\n+extern t_qtcreclist qtcreclist;\n+extern t_qtclist qtclist;\n+extern int keyerport;\n+extern int nr_qsos;\n+extern char qtc_recv_msgs[12][80];\n+extern char qtc_send_msgs[12][80];\n+extern char qtc_phrecv_message[14][80];\n+extern char qtc_phsend_message[14][80];\n+extern int data_ready;\n+extern struct t_qtc_store_obj *qtc_temp_obj;\n+extern int qtcrec_record;\n+extern char qtcrec_record_command[2][50];\n+extern char qtcrec_record_command_shutdown[50];\n+extern char wkeyerbuffer[];\n+extern t_qtc_ry_line qtc_ry_lines[QTC_RY_LINE_NR];\n+extern int qtc_ry_currline;\n+extern int qtc_ry_capture;\n+\n+enum {\n+  QTCRECVWINBG = 32,\n+  QTCRECVLINE,\n+  QTCRECVINVLINE,\n+  QTCRECVCURRLINE,\n+  QTCRECVBG,\n+  KEYERLINE\n+};\n+\n+char sentqtc_queue[11][30];\n+int sentqtc_p;\n+\n+int qtcpanel = 0;\n+int currrecstate;\n+WINDOW * qtcwin;\n+PANEL * qtc_panel;\n+WINDOW * ry_win;\n+PANEL * ry_panel;\n+WINDOW * ry_help_win;\n+PANEL * ry_help_panel;\n+int activefield;\n+// array values: hor position, cursor position, field len to fill with spaces\n+int pos[6][3] = {{3, 3, 15}, {3, 6, 4}, {8, 8, 2}, {3, 3, 4}, {8, 8, 14}, {24, 24, 4}};\n+int curpos = 0;\n+int curfieldlen = 0;\n+static char last_rtty_line[2][50] = {\"\", \"\"};\t// local copy and store to remain\n+static char prevqtccall[15] = \"\";\n+int curr_rtty_line = 0;\n+int capturing = 0;\n+char help_rec_msgs[6][26] = {\n+    \"Enter callsign\",\n+    \"Enter the QTC serial\",\n+    \"Enter the QTC number\",\n+    \"Enter the time\",\n+    \"Enter the CALL\",\n+    \"Enter the SERIAL\"\n+};\n+char help_send_msgs[7][26] = {\n+    \"Enter callsign\",\n+    \"\",\n+    \"Enter the QTC number\",\n+    \"Press ENTER to send QTC\",\n+    \"\",\n+    \"\",\n+    \"Press CTRL+S to SAVE!\"\n+};\n+\n+char * qtccallsign;\n+int * qtccount;\n+int * qtccurrdiretion;\n+\n+int qtc_main_panel(int direction) {\n+    char qtchead[32], tempc[40];\n+    int i, j, x;\n+    int tfi, tlen = 0;\n+    int currqtc = -1;\n+    char reccommand[100] = \"\";\n+\n+    capturing = 0;\n+    last_rtty_line[0][0] = '\\0'; last_rtty_line[1][0] = '\\0';\n+    init_pair(QTCRECVWINBG,   COLOR_BLUE,   COLOR_GREEN);\n+    init_pair(QTCRECVLINE,    COLOR_WHITE,  COLOR_BLUE);\n+    init_pair(QTCRECVINVLINE, COLOR_YELLOW, COLOR_CYAN);\n+    init_pair(QTCRECVCURRLINE,COLOR_YELLOW, COLOR_MAGENTA);\n+    init_pair(KEYERLINE,      COLOR_WHITE,  COLOR_BLACK);\n+\n+    int line_inverted = COLOR_PAIR(QTCRECVINVLINE) | A_BOLD;\n+    int line_currinverted = COLOR_PAIR(QTCRECVCURRLINE) | A_BOLD;\n+    int line_currnormal = COLOR_PAIR(QTCRECVCURRLINE) | A_NORMAL;\n+    int line_normal = COLOR_PAIR(QTCRECVLINE) | A_NORMAL;\n+    attr_t attributes;\n+    short cpair;\n+\n+    static int record_run = -1;\n+\n+    if (strlen(hiscall) > 0) {\n+\tif (direction == RECV) {\n+\t    strncpy(qtcreclist.callsign, hiscall, strlen(hiscall));\n+\t    qtcreclist.callsign[strlen(hiscall)] = '\\0';\n+\t}\n+\tif (direction == SEND) {\n+\t    strncpy(qtclist.callsign, hiscall, strlen(hiscall));\n+\t    qtclist.callsign[strlen(hiscall)] = '\\0';\n+\t}\n+    }\n+    else if (strlen(lastcall) > 0) {\n+\tif (direction == RECV) {\n+\t    strncpy(qtcreclist.callsign, lastcall, strlen(lastcall));\n+\t    qtcreclist.callsign[strlen(lastcall)] = '\\0';\n+\t}\n+\tif (direction == SEND) {\n+\t    strncpy(qtclist.callsign, lastcall, strlen(lastcall));\n+\t    qtclist.callsign[strlen(lastcall)] = '\\0';\n+\t}\n+    }\n+\n+    qtccurrdiretion = &direction;\n+\n+    if (direction == RECV) {\n+\tif (strcmp(qtcreclist.callsign, prevqtccall) != 0 || strlen(qtcreclist.callsign) == 0) {\n+\t    qtcreclist.count = 0;\n+\t    qtcreclist.serial = 0;\n+\t    qtcreclist.confirmed = 0;\n+\t    qtcreclist.sentcfmall = 0;\n+\t    for(i=0; i<10; i++) {\n+\t\tqtcreclist.qtclines[i].status = 0;\n+\t\tqtcreclist.qtclines[i].time[0] = '\\0';\n+\t\tqtcreclist.qtclines[i].callsign[0] = '\\0';\n+\t\tqtcreclist.qtclines[i].serial[0] = '\\0';\n+\t\tqtcreclist.qtclines[i].receivedtime[0] = '\\0';\n+\t\tqtcreclist.qtclines[i].confirmed = 0;\n+\t    }\n+\t    activefield = 0;\n+\t    curr_rtty_line = 0;\n+\t    //qtc_ry_currline = 0;\n+\t    qtc_ry_copied = 0;\n+\t}\n+\tif (qtcreclist.count == 0) {\n+\t    activefield = 0;\n+\t    curr_rtty_line = 0;\n+\t}\n+\tstrncpy(prevqtccall, qtcreclist.callsign, strlen(qtcreclist.callsign));\n+\tqtccallsign = qtcreclist.callsign;\n+\tqtccount = &qtcreclist.count;\n+    }\n+    if (direction == SEND) {\n+\tif (strcmp(qtclist.callsign, prevqtccall) != 0 || strlen(qtclist.callsign) == 0 || qtclist.count == 0) {\n+\t    qtc_temp_obj = qtc_get(qtclist.callsign);\n+\t    j = genqtclist(qtclist.callsign, (10-(qtc_temp_obj->total)));\n+\t    activefield = 0;\n+\t}\n+\telse {\n+\t    j = qtclist.count;\n+\t}\n+\tstrncpy(prevqtccall, qtclist.callsign, strlen(qtclist.callsign));\n+\tqtccallsign = qtclist.callsign;\n+\tqtccount = &qtclist.count;\n+    }\n+\n+    if (qtcpanel == 0) {\n+      qtcwin = newwin(14, 75, 9, 2);\n+      qtc_panel = new_panel(qtcwin);\n+      hide_panel(qtc_panel);\n+      qtcpanel = 1;\n+      ry_win = newwin(14, 40, 9, 37);\n+      ry_panel = new_panel(ry_win);\n+      hide_panel(ry_panel);\n+      ry_help_win = newwin(5, 75, 4, 2);\n+      ry_help_panel = new_panel(ry_help_win);\n+      hide_panel(ry_help_panel);\n+    }\n+    show_panel(qtc_panel);\n+    top_panel(qtc_panel);\n+    //currrecstate = curs_set(0);\n+    werase(qtcwin);\n+\n+    if (direction == RECV) {\n+      sprintf(qtchead, \"QTC receive\");\n+    }\n+    if (direction == SEND) {\n+      sprintf(qtchead, \"QTC send\");\n+    }\n+    wnicebox(qtcwin, 0, 0, 12, 33, qtchead);\n+    sprintf(qtchead, \"HELP\");\n+    wnicebox(qtcwin, 0, 35, 12, 38, qtchead);\n+    //mvwprintw(qtcwin, 12, 2, \" QTC - F2: all | ENT: curr \");\n+    wbkgd(qtcwin, (chtype)(A_NORMAL | COLOR_PAIR(QTCRECVWINBG)));\n+    wattrset(qtcwin, line_inverted);\n+    mvwprintw(qtcwin, 1, 1, \"                                 \");\n+    if (direction == RECV) {\n+\tmvwprintw(qtcwin, 2, 1, \"      /                          \");\n+    }\n+    if (direction == SEND) {\n+\tmvwprintw(qtcwin, 2, 1, \"     %d/%2d                        \", qtclist.serial, qtclist.count);\n+    }\n+\n+    showfield(0);\t// QTC CALL\n+    if (direction == RECV) {\n+      showfield(1);\t// QTC serial\n+    }\n+    showfield(2);\t// QTC nr of row\n+\n+    clear_help_block();\n+\n+    if (direction == RECV) {\n+\twattrset(qtcwin, line_inverted);\n+\tfor(i=0; i<10; i++) {\n+\t    wattrset(qtcwin, line_inverted);\n+\t    mvwprintw(qtcwin, i+3, 1, \"                                 \");\n+\t    for(j=0; j<3; j++) {\n+\t\tshowfield((i*3)+j+3);\t// QTC fields...\n+\t    }\n+\t}\n+\tnumber_fields();\n+    }\n+    if (direction == SEND) {\n+\tshow_sendto_lines();\n+    }\n+    if (*qtccurrdiretion == RECV && trxmode == DIGIMODE) {\n+\twattrset(qtcwin, line_inverted);\n+\tif (qtc_ry_capture == 0) {\n+\t    mvwprintw(qtcwin, 2, 11, \"CAPTURE OFF\");\n+\t}\n+\telse {\n+\t    mvwprintw(qtcwin, 2, 11, \"CAPTURE ON \");\n+\t    show_rtty_lines();\n+\t}\n+\twattrset(qtcwin, line_normal);\n+    }\n+\n+    showfield(activefield);\n+    curpos = 0;\n+    i=1;\n+\n+    refreshp();\n+\n+    x = -1;\n+    while(x != 27) {\n+\n+        nodelay(stdscr, TRUE);\n+\n+\twhile (x < 1) {\n+\n+\t    usleep(5000);\n+\t    time_update();\n+\t    if (trxmode == DIGIMODE && (keyerport == GMFSK\n+\t           || keyerport == MFJ1278_KEYER)) {\n+\t        show_rtty();\n+\t    }\n+\t    x = onechar();\n+\n+\t}\n+        nodelay(stdscr, FALSE);\n+\n+\tswitch(x) {\n+\t  //case 227:\t\t// ALT-c\n+\t  case 20:\t\t// CTRL-t\n+\t\t    if (trxmode == DIGIMODE) {\n+\t\t\tshow_rtty_lines();\n+\t\t    }\n+\t  case 152:\t\t// up\n+\t\t    if (direction == RECV) {\n+\t\t\tif (activefield > 0) {\t// nr of QTC record field idx\n+\t\t\t    if (activefield == 1 || activefield == 2) {\n+\t\t\t\tactivefield = 0;\n+\t\t\t\tshowfield(1);\n+\t\t\t\tshowfield(2);\n+\t\t\t    }\n+\t\t\t    else if (activefield == 3 || activefield == 4) {\n+\t\t\t\tactivefield -= 2;\n+\t\t\t\tshowfield(activefield+2);\n+\t\t\t    }\n+\t\t\t    else {\n+\t\t\t\tactivefield -= 3;\n+\t\t\t\tshowfield(activefield+3);\n+\t\t\t    }\n+\t\t\t}\n+\t\t\tshowfield(activefield);\n+\t\t\tcurpos = 0;\n+\t\t    }\n+\t\t    if (direction == SEND && ((trxmode != DIGIMODE && qtclist.totalsent < *qtccount) || (trxmode == DIGIMODE && qtclist.totalsent == *qtccount))) {\n+\t\t\tswitch (activefield) {\n+\t\t\t    case 0: activefield = 12;\n+\t\t\t\t    show_help_msg(activefield);\n+\t\t\t\t    showfield(0);\n+\t\t\t\t    wattrset(qtcwin, line_currinverted);\n+\t\t\t\t    mvwprintw(qtcwin, activefield, 4, \"%s\", qtclist.qtclines[9].qtc);\n+\t\t\t\t    break;\n+\t\t\t    case 2: activefield = 0;\n+\t\t\t\t    showfield(2);\n+\t\t\t\t    showfield(0);\n+\t\t\t\t    break;\n+\t\t\t    case 3: activefield = 2;\n+\t\t\t\t    showfield(2);\n+\t\t\t\t    wattrset(qtcwin, line_normal);\n+\t\t\t\t    mvwprintw(qtcwin, activefield+1, 4, \"%s\", qtclist.qtclines[0].qtc);\n+\t\t\t\t    break;\n+\t\t\t    case 4 ... 12:\n+\t\t\t\t    show_help_msg(activefield);\n+\t\t\t\t    wattrset(qtcwin, line_normal);\n+\t\t\t\t    mvwprintw(qtcwin, activefield, 4, \"%s\", qtclist.qtclines[(activefield-3)].qtc);\n+\t\t\t\t    activefield--;\n+\t\t\t\t    wattrset(qtcwin, line_currinverted);\n+\t\t\t\t    mvwprintw(qtcwin, activefield, 4, \"%s\", qtclist.qtclines[(activefield-3)].qtc);\n+\t\t\t\t    break;\n+\t\t\t}\n+\t\t    }\n+\t\t    break;\n+\t  case 153:\t\t// down\n+\t\t    if (direction == RECV) {\n+\t\t\tif (activefield < 30) {\t// last line serial field idx\n+\t\t\t    if (activefield == 0) {\n+\t\t\t\tactivefield = 1;\n+\t\t\t\tshowfield(0);\n+\t\t\t    }\n+\t\t\t    else if (activefield == 1 || activefield == 2) {\n+\t\t\t\tactivefield += 2;\n+\t\t\t\tshowfield(1);\n+\t\t\t\tshowfield(2);\n+\t\t\t    }\n+\t\t\t    else {\n+\t\t\t\tactivefield += 3;\n+\t\t\t\tshowfield(activefield-3);\n+\t\t\t    }\n+\t\t\t}\n+\t\t\tshowfield(activefield);\n+\t\t\tcurpos = 0;\n+\t\t    }\n+\t\t    if (direction == SEND && ((trxmode != DIGIMODE && qtclist.totalsent < *qtccount) || (trxmode == DIGIMODE && qtclist.totalsent == *qtccount))) {\n+\t\t\tswitch (activefield) {\n+\t\t\t    case 0: activefield = 2;\n+\t\t\t\t    showfield(0);\n+\t\t\t\t    showfield(2);\n+\t\t\t\t    break;\n+\t\t\t    //case 2: activefield = 3;\n+\t\t\t\t    //showfield(2);\n+\t\t\t\t    //break;\n+\t\t\t    case 2: activefield = 3;\n+\t\t\t\t    show_help_msg(activefield);\n+\t\t\t\t    showfield(2);\n+\t\t\t\t    wattrset(qtcwin, line_currinverted);\n+\t\t\t\t    mvwprintw(qtcwin, activefield, 4, \"%s\", qtclist.qtclines[0].qtc);\n+\t\t\t\t    break;\n+\t\t\t    case 3 ... 11:\n+\t\t\t\t    show_help_msg(activefield);\n+\t\t\t\t    wattrset(qtcwin, line_normal);\n+\t\t\t\t    mvwprintw(qtcwin, activefield, 4, \"%s\", qtclist.qtclines[(activefield-3)].qtc);\n+\t\t\t\t    activefield++;\n+\t\t\t\t    wattrset(qtcwin, line_currinverted);\n+\t\t\t\t    mvwprintw(qtcwin, activefield, 4, \"%s\", qtclist.qtclines[(activefield-3)].qtc);\n+\t\t\t\t    break;\n+\t\t\t    case 12:\n+\t\t\t\t    activefield = 0;\n+\t\t\t\t    wattrset(qtcwin, line_normal);\n+\t\t\t\t    mvwprintw(qtcwin, 14, 4, \"%s\", qtclist.qtclines[9].qtc);\n+\t\t\t\t    showfield(0);\n+\t\t\t\t    break;\n+\t\t\t}\n+\t\t    }\n+\t\t    break;\n+\t  case 155:\t// left\n+\t\t    if (DIRCLAUSE) {\n+\t\t\tif (curpos < curfieldlen) {\t// curpos is a shift, means lenght - position\n+\t\t\t    curpos++;\n+\t\t\t    showfield(activefield);\n+\t\t\t}\n+\t\t    }\n+\t\t    break;\n+\t  case 154:\t// right\n+\t\t    if (DIRCLAUSE) {\n+\t\t\tif (curpos > 0) {\n+\t\t\t    curpos--;\n+\t\t\t    showfield(activefield);\n+\t\t\t}\n+\t\t    }\n+\t\t    break;\n+\t  case 10:  \t\t// ENTER\n+\t\t    if (activefield > 2) {\n+\t\t\tif (direction == RECV) {\n+\t\t\t    currqtc = ((activefield-3)/3);\n+\t\t\t    //if ((activefield-3)%3 == 2) {\n+\t\t\t    // TODO - is it need to restrict only for last field to allow the ENTER?\n+\t\t\t    if (1) {\n+\t\t\t\tif (qtcreclist.qtclines[currqtc].status == 0 &&\n+\t\t\t\t    strlen(qtcreclist.qtclines[currqtc].time) == 4 &&\n+\t\t\t\t    strlen(qtcreclist.qtclines[currqtc].callsign) > 0 &&\n+\t\t\t\t    strlen(qtcreclist.qtclines[currqtc].serial) > 0\n+\t\t\t\t) {\n+\t\t\t\t    get_time();\n+\t\t\t\t    tempc[0] = '\\0';\n+\t\t\t\t    strftime(tempc, 40, \"%d-%b-%y %H:%M\", time_ptr);\n+\t\t\t\t    strncpy(qtcreclist.qtclines[currqtc].receivedtime, tempc, 15);\n+\t\t\t\t    qtcreclist.qtclines[currqtc].receivedtime[15] = '\\0';\n+\t\t\t\t    qtcreclist.qtclines[currqtc].status = 2;\n+\t\t\t\t    show_status(currqtc);\n+\t\t\t\t    if (currqtc < *qtccount) {\n+\t\t\t\t\tif (trxmode == DIGIMODE) {\n+\t\t\t\t\t    qtcreclist.qtclines[currqtc].confirmed = 1; // compatibility for other modes\n+\t\t\t\t\t    qtcreclist.confirmed++;\n+\t\t\t\t\t    activefield+=3;\t// go to next line exch field\n+\t\t\t\t\t    showfield(activefield-3);\n+\t\t\t\t\t}\n+\t\t\t\t\telse {\n+\t\t\t\t\t    if (qtcreclist.qtclines[currqtc].confirmed == 0) {\n+\t\t\t\t\t\tqtcreclist.qtclines[currqtc].confirmed = 1;\n+\t\t\t\t\t\tqtcreclist.confirmed++;\n+\t\t\t\t\t\tif (trxmode == CWMODE) {\n+\t\t\t\t\t\t    sendmessage(qtc_recv_msgs[2]);\n+\t\t\t\t\t\t}\n+\t\t\t\t\t\tif (trxmode == SSBMODE) {\n+\t\t\t\t\t\t    play_file(qtc_phrecv_message[2]);\n+\t\t\t\t\t\t}\n+\t\t\t\t\t    }\n+\t\t\t\t\t    tfi = (activefield-3)%3;\n+\t\t\t\t\t    //activefield++;\t// go to next line time field\n+\t\t\t\t\t    activefield += (3-tfi);\n+\t\t\t\t\t    showfield(activefield-(3-tfi));\n+\t\t\t\t\t}\n+\t\t\t\t\tshowfield(activefield);\n+\t\t\t\t    }\n+\t\t\t\t}\n+\t\t\t\telse if (qtcreclist.qtclines[currqtc].status == 1 && qtcreclist.qtclines[currqtc].confirmed != 1) {\n+\t\t\t\t    if (trxmode == CWMODE) {\n+\t\t\t\t\tsendmessage(qtc_recv_msgs[7]);\n+\t\t\t\t    }\n+\t\t\t\t    if (trxmode == SSBMODE) {\n+\t\t\t\t\tplay_file(qtc_phrecv_message[7]);\n+\t\t\t\t    }\n+\t\t\t\t    if (trxmode == DIGIMODE) {\n+\t\t\t\t\tchar *str = g_strdup_printf(\"%s %02d %02d\\n\", g_strchomp(qtc_recv_msgs[7]), currqtc+1, currqtc+1);\n+\t\t\t\t\tsendmessage(str);\n+\t\t\t\t\tg_free(str);\n+\t\t\t\t    }\n+\t\t\t\t}\n+\n+\t\t\t\tif (*qtccount > 0 && qtcreclist.confirmed == *qtccount) {\n+\t\t\t\t    if (qtcreclist.sentcfmall == 0) {\n+\t\t\t\t\tqtcreclist.sentcfmall = 1;\n+\t\t\t\t\tif (log_recv_qtc_to_disk(nr_qsos) == 0) {\n+\t\t\t\t\t    // TODO\n+\t\t\t\t\t    // send 'CFM all' to station\n+\t\t\t\t\t  if (qtcrec_record == 1 && record_run > -1) {\n+\t\t\t\t\t      strcpy(reccommand, \"pkill -SIGINT -n \");\n+\t\t\t\t\t      strcat(reccommand, qtcrec_record_command_shutdown);\n+\t\t\t\t\t      system(reccommand);\n+\t\t\t\t\t      record_run = -1;\n+\t\t\t\t\t  }\n+\t\t\t\t\t  if (trxmode == DIGIMODE || trxmode == CWMODE) {\n+\t\t\t\t\t\tsendmessage(qtc_recv_msgs[9]);\n+\t\t\t\t\t    }\n+\t\t\t\t\t    if (trxmode == SSBMODE) {\n+\t\t\t\t\t\tplay_file(qtc_phrecv_message[9]);\n+\t\t\t\t\t    }\n+\t\t\t\t\t    // TODO\n+\t\t\t\t\t}\n+\t\t\t\t    }\n+\t\t\t\t    x = 27;\t// close the window\n+\t\t\t\t}\n+\t\t\t    }\n+\t\t\t}\n+\t\t\tif (direction == SEND && trxmode != DIGIMODE) {\n+\t\t\t    if (qtclist.qtclines[activefield-3].sent == 0) {\n+\t\t\t\tqtclist.qtclines[activefield-3].sent = 1;\n+\t\t\t\tget_time();\n+\t\t\t\ttempc[0] = '\\0';\n+\t\t\t\tstrftime(tempc, 40, \"%d-%b-%y %H:%M\", time_ptr);\n+\t\t\t\tstrncpy(qtclist.qtclines[activefield-3].senttime, tempc, 15);\n+\t\t\t\tqtclist.qtclines[activefield-3].senttime[15] = '\\0';\n+\t\t\t\tqtclist.totalsent++;\n+\t\t\t    }\n+\t\t\t    tempc[0] = '\\0';\n+\t\t\t    strip_spaces(qtclist.qtclines[activefield-3].qtc, tempc);\n+\t\t\t    data_ready = 1;\n+\t\t\t    if (trxmode == CWMODE) {\n+\t\t\t\tsendmessage(tempc);\n+\t\t\t    }\n+\n+\t\t\t    mvwprintw(qtcwin, activefield, 30, \"*\");\n+\t\t\t    qtclist.qtclines[activefield-3].flag = 1;\n+\t\t\t    // scroll down if not at end of qtclist:\n+\t\t\t    if (activefield-3 < *qtccount-1) {\n+\t\t\t\twattrset(qtcwin, line_normal);\n+\t\t\t\tmvwprintw(qtcwin, activefield, 4, \"%s\", qtclist.qtclines[(activefield-3)].qtc);\n+\t\t\t\tactivefield++;\n+\t\t\t\twattrset(qtcwin, line_currinverted);\n+\t\t\t\tmvwprintw(qtcwin, activefield, 4, \"%s\", qtclist.qtclines[(activefield-3)].qtc);\n+\t\t\t    }\n+\t\t\t    if (*qtccount > 0 && qtclist.totalsent == *qtccount) {\n+\t\t\t\twattrset(qtcwin, line_inverted);\n+\t\t\t\tmvwprintw(qtcwin, 2, 11, \"CTRL+S to SAVE!\");\n+\t\t\t\trefreshp();\n+\t\t\t\tshow_help_msg(6);\n+\t\t\t\t// //if (log_send_qtc_to_disk(nr_qsos) == 0) {\n+\t\t\t\t    // //qtcreclist.sentcfmall = 1;\n+\t\t\t\t    // TODO\n+\t\t\t\t    // send 'CFM all' to station\n+\t\t\t\t    // // if (trxmode == DIGIMODE || trxmode == CWMODE) {\n+\t\t\t\t\t// // sendmessage(qtc_send_msgs[9]);\n+\t\t\t\t    // //}\n+\t\t\t\t    // TODO\n+\t\t\t\t// //}\n+\t\t\t\t// // x = 27;\t// close the window\n+\t\t\t    }\n+\t\t\t}\n+\t\t    }\n+\t\t    if (activefield == 2) {\n+\t\t\tif (direction == RECV &&\n+\t\t\t    strlen(qtcreclist.callsign) > 0 &&\n+\t\t\t    qtcreclist.serial > 0 &&\n+\t\t\t    qtcreclist.count > 0 &&\n+\t\t\t    qtcreclist.confirmed == 0\n+\t\t\t) {\n+\t\t\t    if (trxmode == CWMODE) {\n+\t\t\t\tsendmessage(qtc_recv_msgs[1]);\n+\t\t\t    }\n+\t\t\t    if (trxmode == SSBMODE) {\n+\t\t\t\tplay_file(qtc_phrecv_message[1]);\n+\t\t\t    }\n+\t\t\t    if (qtcrec_record == 1 && record_run < 0) {\n+\t\t\t\tstrcpy(reccommand, qtcrec_record_command[0]);\n+\t\t\t\tget_time();\n+\t\t\t\tstrftime(tempc, 60, \"%y%m%d%H%M%S.wav\", time_ptr);\n+\t\t\t\tstrcat(reccommand, tempc);\n+\t\t\t\tstrcat(reccommand, qtcrec_record_command[1]);\n+\t\t\t\trecord_run = system(reccommand);\n+\t\t\t    }\n+\t\t\t    activefield++;\n+\t\t\t    showfield(activefield);\n+\t\t\t}\n+\t\t    }\n+\t\t    if (trxmode == DIGIMODE) {\n+\t\t\tif (direction == SEND && (activefield == 0 || activefield == 2) && qtclist.totalsent == 0) {\n+\t\t\t    if (qtc_send_msgs[1][strlen(qtc_send_msgs[1])-1] == 10) {\n+\t\t\t\tqtc_send_msgs[1][strlen(qtc_send_msgs[1])-1] = '\\0';\n+\t\t\t    }\n+\t\t\t    tlen = strlen(qtc_send_msgs[1])-5; // len(\"sr/nr\") = 5\n+\t\t\t    char tmess[300], timec[40];\n+\t\t\t    int ql;\n+\t\t\t    tmess[0] = '\\0';\n+\t\t\t    if (tlen > 0 && strncmp(qtc_send_msgs[1] + tlen, \"sr/nr\", 5) == 0) {\n+\t\t\t\ttempc[0] = '\\0';\n+\t\t\t\tstrncpy(tempc, qtc_send_msgs[1], tlen-1);\n+\t\t\t\ttempc[tlen-1] = '\\0';\n+\t\t\t\tsprintf(tmess, \"%s %d/%d %s %d/%d\\n\", tempc, qtclist.serial, *qtccount, tempc, qtclist.serial, *qtccount);\n+\t\t\t    }\n+\t\t\t    timec[0] = '\\0';\n+\t\t\t    get_time();\n+\t\t\t    strftime(timec, 40, \"%d-%b-%y %H:%M\", time_ptr);\n+\n+\t\t\t    for(ql = 0; ql < *qtccount; ql++) {\n+\t\t\t\tqtclist.qtclines[ql].sent = 1;\n+\t\t\t\tstrncpy(qtclist.qtclines[ql].senttime, timec, 15);\n+\t\t\t\tqtclist.qtclines[ql].senttime[15] = '\\0';\n+\t\t\t\tqtclist.totalsent++;\n+\n+\t\t\t\ttempc[0] = '\\0';\n+\t\t\t\tstrip_spaces(qtclist.qtclines[ql].qtc, tempc);\n+\t\t\t\tstrcat(tmess, tempc);\n+\t\t\t\tmvwprintw(qtcwin, ql+3, 30, \"*\");\n+\t\t\t\tqtclist.qtclines[ql].flag = 1;\n+\t\t\t\t\n+\t\t\t    }\n+\t\t\t    data_ready = 1;\n+\t\t\t    strncpy(wkeyerbuffer, tmess, strlen(tmess));\n+\t\t\t    write_keyer();\n+\t\t\t    wattrset(qtcwin, line_inverted);\n+\t\t\t    mvwprintw(qtcwin, 2, 11, \"CTRL+S to SAVE!\");\n+\t\t\t    refreshp();\n+\t\t\t    show_help_msg(6);\n+\n+\t\t\t    showfield(activefield);\n+\t\t\t}\n+\t\t\telse {\n+\t\t\t  if (direction == SEND) {\n+\t\t\t\ttempc[0] = '\\0';\n+\t\t\t\tstrip_spaces(qtclist.qtclines[activefield-3].qtc, tempc);\n+\t\t\t\tsendmessage(tempc);\n+\t\t\t    }\n+\t\t\t}\n+\t\t    }\n+\t\t    break;\n+\t  case 19:\t// CTRL-S - save QTC\n+\t\t    if (*qtccurrdiretion == SEND && *qtccount > 0 && qtclist.totalsent == *qtccount) {\n+\t\t\tif (log_sent_qtc_to_disk(nr_qsos) == 0) {\n+\t\t\t    wattrset(qtcwin, line_inverted);\n+\t\t\t    mvwprintw(qtcwin, 2, 11, \"QTC's have been saved!\");\n+\t\t\t    prevqtccall[0] = '\\0';\n+\t\t\t    qtccallsign[0] = '\\0';\n+\t\t\t    refreshp();\n+\t\t\t    sleep(1);\n+\t\t\t    x = 27;\t// close the window\n+\t\t\t}\n+\t\t\t//data_ready = 1;\n+\t\t    }\n+\t\t    if (*qtccurrdiretion == RECV && trxmode == DIGIMODE) {\n+\t\t\tqtc_ry_capture = 1;\n+\t\t\twattr_get(qtcwin, &attributes, &cpair, NULL);\n+\t\t\twattrset(qtcwin, line_inverted);","path":"src/qtcwin.c","position":647,"original_position":647,"commit_id":"c8262f73292bd755a4e59af0d7f9f71308883595","original_commit_id":"89fb40ef975be7fd652008421544943065da17d3","user":{"login":"airween","id":238977,"avatar_url":"https://avatars.githubusercontent.com/u/238977?v=3","gravatar_id":"","url":"https://api.github.com/users/airween","html_url":"https://github.com/airween","followers_url":"https://api.github.com/users/airween/followers","following_url":"https://api.github.com/users/airween/following{/other_user}","gists_url":"https://api.github.com/users/airween/gists{/gist_id}","starred_url":"https://api.github.com/users/airween/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/airween/subscriptions","organizations_url":"https://api.github.com/users/airween/orgs","repos_url":"https://api.github.com/users/airween/repos","events_url":"https://api.github.com/users/airween/events{/privacy}","received_events_url":"https://api.github.com/users/airween/received_events","type":"User","site_admin":false},"body":"May be nobody needs that. I could't solve another way to store the problem. Should I do anything at this issue?","created_at":"2015-01-26T19:30:43Z","updated_at":"2015-01-26T19:30:43Z","html_url":"https://github.com/Tlf/tlf/pull/29#discussion_r23557191","pull_request_url":"https://api.github.com/repos/Tlf/tlf/pulls/29","_links":{"self":{"href":"https://api.github.com/repos/Tlf/tlf/pulls/comments/23557191"},"html":{"href":"https://github.com/Tlf/tlf/pull/29#discussion_r23557191"},"pull_request":{"href":"https://api.github.com/repos/Tlf/tlf/pulls/29"}}},"pull_request":{"url":"https://api.github.com/repos/Tlf/tlf/pulls/29","id":27166158,"html_url":"https://github.com/Tlf/tlf/pull/29","diff_url":"https://github.com/Tlf/tlf/pull/29.diff","patch_url":"https://github.com/Tlf/tlf/pull/29.patch","issue_url":"https://api.github.com/repos/Tlf/tlf/issues/29","number":29,"state":"open","locked":false,"title":"pull waedc-qtc branch please","user":{"login":"dl1jbe","id":934289,"avatar_url":"https://avatars.githubusercontent.com/u/934289?v=3","gravatar_id":"","url":"https://api.github.com/users/dl1jbe","html_url":"https://github.com/dl1jbe","followers_url":"https://api.github.com/users/dl1jbe/followers","following_url":"https://api.github.com/users/dl1jbe/following{/other_user}","gists_url":"https://api.github.com/users/dl1jbe/gists{/gist_id}","starred_url":"https://api.github.com/users/dl1jbe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dl1jbe/subscriptions","organizations_url":"https://api.github.com/users/dl1jbe/orgs","repos_url":"https://api.github.com/users/dl1jbe/repos","events_url":"https://api.github.com/users/dl1jbe/events{/privacy}","received_events_url":"https://api.github.com/users/dl1jbe/received_events","type":"User","site_admin":false},"body":"I made a pull request so we can add comments to the code.","created_at":"2015-01-11T18:24:05Z","updated_at":"2015-01-26T19:30:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4c1673853ab3c7993e7bd2363505caca32748d5d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Tlf/tlf/pulls/29/commits","review_comments_url":"https://api.github.com/repos/Tlf/tlf/pulls/29/comments","review_comment_url":"https://api.github.com/repos/Tlf/tlf/pulls/comments/{number}","comments_url":"https://api.github.com/repos/Tlf/tlf/issues/29/comments","statuses_url":"https://api.github.com/repos/Tlf/tlf/statuses/c8262f73292bd755a4e59af0d7f9f71308883595","head":{"label":"airween:waedc-qtc","ref":"waedc-qtc","sha":"c8262f73292bd755a4e59af0d7f9f71308883595","user":{"login":"airween","id":238977,"avatar_url":"https://avatars.githubusercontent.com/u/238977?v=3","gravatar_id":"","url":"https://api.github.com/users/airween","html_url":"https://github.com/airween","followers_url":"https://api.github.com/users/airween/followers","following_url":"https://api.github.com/users/airween/following{/other_user}","gists_url":"https://api.github.com/users/airween/gists{/gist_id}","starred_url":"https://api.github.com/users/airween/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/airween/subscriptions","organizations_url":"https://api.github.com/users/airween/orgs","repos_url":"https://api.github.com/users/airween/repos","events_url":"https://api.github.com/users/airween/events{/privacy}","received_events_url":"https://api.github.com/users/airween/received_events","type":"User","site_admin":false},"repo":{"id":13527846,"name":"tlf","full_name":"airween/tlf","owner":{"login":"airween","id":238977,"avatar_url":"https://avatars.githubusercontent.com/u/238977?v=3","gravatar_id":"","url":"https://api.github.com/users/airween","html_url":"https://github.com/airween","followers_url":"https://api.github.com/users/airween/followers","following_url":"https://api.github.com/users/airween/following{/other_user}","gists_url":"https://api.github.com/users/airween/gists{/gist_id}","starred_url":"https://api.github.com/users/airween/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/airween/subscriptions","organizations_url":"https://api.github.com/users/airween/orgs","repos_url":"https://api.github.com/users/airween/repos","events_url":"https://api.github.com/users/airween/events{/privacy}","received_events_url":"https://api.github.com/users/airween/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/airween/tlf","description":"TLF - a console based ham radio contest logger","fork":true,"url":"https://api.github.com/repos/airween/tlf","forks_url":"https://api.github.com/repos/airween/tlf/forks","keys_url":"https://api.github.com/repos/airween/tlf/keys{/key_id}","collaborators_url":"https://api.github.com/repos/airween/tlf/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/airween/tlf/teams","hooks_url":"https://api.github.com/repos/airween/tlf/hooks","issue_events_url":"https://api.github.com/repos/airween/tlf/issues/events{/number}","events_url":"https://api.github.com/repos/airween/tlf/events","assignees_url":"https://api.github.com/repos/airween/tlf/assignees{/user}","branches_url":"https://api.github.com/repos/airween/tlf/branches{/branch}","tags_url":"https://api.github.com/repos/airween/tlf/tags","blobs_url":"https://api.github.com/repos/airween/tlf/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/airween/tlf/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/airween/tlf/git/refs{/sha}","trees_url":"https://api.github.com/repos/airween/tlf/git/trees{/sha}","statuses_url":"https://api.github.com/repos/airween/tlf/statuses/{sha}","languages_url":"https://api.github.com/repos/airween/tlf/languages","stargazers_url":"https://api.github.com/repos/airween/tlf/stargazers","contributors_url":"https://api.github.com/repos/airween/tlf/contributors","subscribers_url":"https://api.github.com/repos/airween/tlf/subscribers","subscription_url":"https://api.github.com/repos/airween/tlf/subscription","commits_url":"https://api.github.com/repos/airween/tlf/commits{/sha}","git_commits_url":"https://api.github.com/repos/airween/tlf/git/commits{/sha}","comments_url":"https://api.github.com/repos/airween/tlf/comments{/number}","issue_comment_url":"https://api.github.com/repos/airween/tlf/issues/comments/{number}","contents_url":"https://api.github.com/repos/airween/tlf/contents/{+path}","compare_url":"https://api.github.com/repos/airween/tlf/compare/{base}...{head}","merges_url":"https://api.github.com/repos/airween/tlf/merges","archive_url":"https://api.github.com/repos/airween/tlf/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/airween/tlf/downloads","issues_url":"https://api.github.com/repos/airween/tlf/issues{/number}","pulls_url":"https://api.github.com/repos/airween/tlf/pulls{/number}","milestones_url":"https://api.github.com/repos/airween/tlf/milestones{/number}","notifications_url":"https://api.github.com/repos/airween/tlf/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/airween/tlf/labels{/name}","releases_url":"https://api.github.com/repos/airween/tlf/releases{/id}","created_at":"2013-10-12T19:40:36Z","updated_at":"2015-01-26T19:23:47Z","pushed_at":"2015-01-26T19:23:46Z","git_url":"git://github.com/airween/tlf.git","ssh_url":"git@github.com:airween/tlf.git","clone_url":"https://github.com/airween/tlf.git","svn_url":"https://github.com/airween/tlf","homepage":"","size":4274,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"waedc-qtc"}},"base":{"label":"Tlf:master","ref":"master","sha":"94a6ac9afb8f535ee56fb32d73615efa80e0151b","user":{"login":"Tlf","id":1055026,"avatar_url":"https://avatars.githubusercontent.com/u/1055026?v=3","gravatar_id":"","url":"https://api.github.com/users/Tlf","html_url":"https://github.com/Tlf","followers_url":"https://api.github.com/users/Tlf/followers","following_url":"https://api.github.com/users/Tlf/following{/other_user}","gists_url":"https://api.github.com/users/Tlf/gists{/gist_id}","starred_url":"https://api.github.com/users/Tlf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tlf/subscriptions","organizations_url":"https://api.github.com/users/Tlf/orgs","repos_url":"https://api.github.com/users/Tlf/repos","events_url":"https://api.github.com/users/Tlf/events{/privacy}","received_events_url":"https://api.github.com/users/Tlf/received_events","type":"Organization","site_admin":false},"repo":{"id":2383224,"name":"tlf","full_name":"Tlf/tlf","owner":{"login":"Tlf","id":1055026,"avatar_url":"https://avatars.githubusercontent.com/u/1055026?v=3","gravatar_id":"","url":"https://api.github.com/users/Tlf","html_url":"https://github.com/Tlf","followers_url":"https://api.github.com/users/Tlf/followers","following_url":"https://api.github.com/users/Tlf/following{/other_user}","gists_url":"https://api.github.com/users/Tlf/gists{/gist_id}","starred_url":"https://api.github.com/users/Tlf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tlf/subscriptions","organizations_url":"https://api.github.com/users/Tlf/orgs","repos_url":"https://api.github.com/users/Tlf/repos","events_url":"https://api.github.com/users/Tlf/events{/privacy}","received_events_url":"https://api.github.com/users/Tlf/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Tlf/tlf","description":"TLF - a console based ham radio contest logger","fork":false,"url":"https://api.github.com/repos/Tlf/tlf","forks_url":"https://api.github.com/repos/Tlf/tlf/forks","keys_url":"https://api.github.com/repos/Tlf/tlf/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Tlf/tlf/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Tlf/tlf/teams","hooks_url":"https://api.github.com/repos/Tlf/tlf/hooks","issue_events_url":"https://api.github.com/repos/Tlf/tlf/issues/events{/number}","events_url":"https://api.github.com/repos/Tlf/tlf/events","assignees_url":"https://api.github.com/repos/Tlf/tlf/assignees{/user}","branches_url":"https://api.github.com/repos/Tlf/tlf/branches{/branch}","tags_url":"https://api.github.com/repos/Tlf/tlf/tags","blobs_url":"https://api.github.com/repos/Tlf/tlf/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Tlf/tlf/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Tlf/tlf/git/refs{/sha}","trees_url":"https://api.github.com/repos/Tlf/tlf/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Tlf/tlf/statuses/{sha}","languages_url":"https://api.github.com/repos/Tlf/tlf/languages","stargazers_url":"https://api.github.com/repos/Tlf/tlf/stargazers","contributors_url":"https://api.github.com/repos/Tlf/tlf/contributors","subscribers_url":"https://api.github.com/repos/Tlf/tlf/subscribers","subscription_url":"https://api.github.com/repos/Tlf/tlf/subscription","commits_url":"https://api.github.com/repos/Tlf/tlf/commits{/sha}","git_commits_url":"https://api.github.com/repos/Tlf/tlf/git/commits{/sha}","comments_url":"https://api.github.com/repos/Tlf/tlf/comments{/number}","issue_comment_url":"https://api.github.com/repos/Tlf/tlf/issues/comments/{number}","contents_url":"https://api.github.com/repos/Tlf/tlf/contents/{+path}","compare_url":"https://api.github.com/repos/Tlf/tlf/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Tlf/tlf/merges","archive_url":"https://api.github.com/repos/Tlf/tlf/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Tlf/tlf/downloads","issues_url":"https://api.github.com/repos/Tlf/tlf/issues{/number}","pulls_url":"https://api.github.com/repos/Tlf/tlf/pulls{/number}","milestones_url":"https://api.github.com/repos/Tlf/tlf/milestones{/number}","notifications_url":"https://api.github.com/repos/Tlf/tlf/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Tlf/tlf/labels{/name}","releases_url":"https://api.github.com/repos/Tlf/tlf/releases{/id}","created_at":"2011-09-14T04:21:10Z","updated_at":"2015-01-25T10:05:04Z","pushed_at":"2015-01-25T19:52:20Z","git_url":"git://github.com/Tlf/tlf.git","ssh_url":"git@github.com:Tlf/tlf.git","clone_url":"https://github.com/Tlf/tlf.git","svn_url":"https://github.com/Tlf/tlf","homepage":"","size":3986,"stargazers_count":9,"watchers_count":9,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7,"mirror_url":null,"open_issues_count":5,"forks":7,"open_issues":5,"watchers":9,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Tlf/tlf/pulls/29"},"html":{"href":"https://github.com/Tlf/tlf/pull/29"},"issue":{"href":"https://api.github.com/repos/Tlf/tlf/issues/29"},"comments":{"href":"https://api.github.com/repos/Tlf/tlf/issues/29/comments"},"review_comments":{"href":"https://api.github.com/repos/Tlf/tlf/pulls/29/comments"},"review_comment":{"href":"https://api.github.com/repos/Tlf/tlf/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/Tlf/tlf/pulls/29/commits"},"statuses":{"href":"https://api.github.com/repos/Tlf/tlf/statuses/c8262f73292bd755a4e59af0d7f9f71308883595"}}}}