diff options
Diffstat (limited to 'tuiclient')
-rw-r--r-- | tuiclient/colors.cpp | 38 | ||||
-rw-r--r-- | tuiclient/colors.h | 11 | ||||
-rw-r--r-- | tuiclient/distfilewindow.cpp | 58 | ||||
-rw-r--r-- | tuiclient/distfilewindow.h | 40 | ||||
-rw-r--r-- | tuiclient/helpwindow.h | 2 | ||||
-rw-r--r-- | tuiclient/mainwindow.cpp | 38 | ||||
-rw-r--r-- | tuiclient/mainwindow.h | 8 | ||||
-rw-r--r-- | tuiclient/scrollwindow.cpp | 8 | ||||
-rw-r--r-- | tuiclient/str.cpp | 45 | ||||
-rw-r--r-- | tuiclient/str.h | 13 | ||||
-rw-r--r-- | tuiclient/tuiclient.cpp | 88 | ||||
-rw-r--r-- | tuiclient/tuiclient.h | 13 | ||||
-rw-r--r-- | tuiclient/tuidistfile.cpp | 31 | ||||
-rw-r--r-- | tuiclient/tuidistfile.h | 55 | ||||
-rw-r--r-- | tuiclient/twindow.cpp | 8 | ||||
-rw-r--r-- | tuiclient/twindow.h | 3 |
16 files changed, 394 insertions, 65 deletions
diff --git a/tuiclient/colors.cpp b/tuiclient/colors.cpp index 4e0ef4a..0b1959d 100644 --- a/tuiclient/colors.cpp +++ b/tuiclient/colors.cpp @@ -26,24 +26,43 @@ #include "colors.h" -void color_downloads(){ +void color_default_window(WINDOW * window){ if(has_colors()){ start_color(); /* Start color */ - attron(COLOR_PAIR(1)); + wbkgd(window, COLOR_PAIR(4)); + wattron(window, COLOR_PAIR(4)); } } -void color_info(){ +void color_scroll_window(WINDOW * window){ if(has_colors()){ start_color(); /* Start color */ - attron(COLOR_PAIR(2)); + wbkgd(window, COLOR_PAIR(5)); + wattron(window, COLOR_PAIR(5)); } } -void color_status(){ +void color_downloads(WINDOW * window){ if(has_colors()){ start_color(); /* Start color */ - attron(COLOR_PAIR(3)); +// wbkgd(window, COLOR_PAIR(1)); + wattron(window, COLOR_PAIR(1)); + } +} + +void color_info(WINDOW * window){ + if(has_colors()){ + start_color(); /* Start color */ +// wbkgd(window, COLOR_PAIR(2)); + wattron(window,COLOR_PAIR(2)); + } +} + +void color_status(WINDOW * window){ + if(has_colors()){ + start_color(); /* Start color */ +// wbkgd(window, COLOR_PAIR(3)); + wattron(window,COLOR_PAIR(3)); } } @@ -54,6 +73,9 @@ void colors_connected(){ init_pair(1, COLOR_WHITE, COLOR_BLUE); init_pair(2, COLOR_BLACK, COLOR_CYAN); init_pair(3, COLOR_GREEN, COLOR_BLUE); + init_pair(4, COLOR_BLACK, COLOR_GREEN); + init_pair(5, COLOR_GREEN, COLOR_BLACK); +// init_pair(4, COLOR_BLACK, COLOR_WHITE); // attrset(A_REVERSE); attrset(A_DIM); } @@ -66,7 +88,9 @@ void colors_disconnected(){ init_pair(1, COLOR_BLACK, COLOR_WHITE); init_pair(2, COLOR_WHITE, COLOR_BLACK); init_pair(3, COLOR_BLACK, COLOR_RED); -// attrset(A_BOLD); + init_pair(4, COLOR_WHITE, COLOR_BLACK); + init_pair(5, COLOR_RED, COLOR_BLACK); +/// attrset(A_BOLD); // attrset(A_REVERSE); } }
\ No newline at end of file diff --git a/tuiclient/colors.h b/tuiclient/colors.h index ba3c591..ea77f02 100644 --- a/tuiclient/colors.h +++ b/tuiclient/colors.h @@ -10,7 +10,8 @@ * This file is part of Segget. * * Segget is free software; you can redistribute it and/or -* modify it under the terms of the GNU Lesser General Public +* modify it under t color_downloads(window); +he terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * @@ -29,9 +30,11 @@ #include <ncurses.h> -void color_downloads(); -void color_info(); -void color_status(); +void color_default_window(WINDOW * window); +void color_scroll_window(WINDOW * window); +void color_downloads(WINDOW * window); +void color_info(WINDOW * window); +void color_status(WINDOW * window); void colors_connected(); void colors_disconnected(); #endif
\ No newline at end of file diff --git a/tuiclient/distfilewindow.cpp b/tuiclient/distfilewindow.cpp new file mode 100644 index 0000000..22c7f49 --- /dev/null +++ b/tuiclient/distfilewindow.cpp @@ -0,0 +1,58 @@ +/* +* Copyright (C) 2010 Robin H.Johnson, Ovechko Kostyantyn <fastinetserver@gmail.com>. +* +* Project: IDFetch. +* Developer: Ovechko Kostyantyn Olexandrovich (Kharkiv State Technical University of Construction and Architecture, Ukraine). +* Mentor: Robin H. Johnson (Gentoo Linux: Developer, Trustee & Infrastructure Lead). +* Mentoring organization: Gentoo Linux. +* Sponsored by GSOC 2010. +* +* This file is part of Segget. +* +* Segget is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; either +* version 2.1 of the License, or (at your option) any later version. +* +* Segget is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with Segget; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "distfilewindow.h" + +void Tdistfile_window::compose(){ + color_default_window(window); + make_frame(); +// box(window, ACS_VLINE, ACS_HLINE); +// getmaxyx(window,height,width); + bottom_screenline_num=height-2; +// color_status(); +// msg_status(); +// color_info(); +// for (uint y=bottom_screenline_num,status_line_num=0; y<height-2; y++,status_line_num++){ +// msg_line(y+1,screen_info_lines[status_line_num]); +// } +// color_downloads(window); +// screenlines[26]="Max_num:"+toString(max_received_screenline_num); + ulong distfile_num=top_position; + for (int y=0; y<bottom_screenline_num and distfile_num<tuidistfiles.size(); y++, distfile_num++){ + msg_line(y+1,field("",distfile_num+1,4)+") " + +"("+toString(tuidistfiles[distfile_num].dld_bytes*100/tuidistfiles[distfile_num].size)+"%) " + +tuidistfiles[distfile_num].name + +" Segments: "+toString(tuidistfiles[distfile_num].dld_segments) + +"/"+toString(tuidistfiles[distfile_num].segments_count) + +" Bytes: "+toString(tuidistfiles[distfile_num].dld_bytes) + +"/"+toString(tuidistfiles[distfile_num].size)); + } + wrefresh(window); +// mainwindow.distfiles_win.add_line(parts[0]+"("+toString(atol(parts[3].c_str())*100/)+"%)"+" "+parts[1]+"/"+parts[2]+" "+parts[3]+"/"+parts[4]); +} + + + diff --git a/tuiclient/distfilewindow.h b/tuiclient/distfilewindow.h new file mode 100644 index 0000000..e7e5593 --- /dev/null +++ b/tuiclient/distfilewindow.h @@ -0,0 +1,40 @@ +/* +* Copyright (C) 2010 Robin H.Johnson, Ovechko Kostyantyn <fastinetserver@gmail.com>. +* +* Project: IDFetch. +* Developer: Ovechko Kostyantyn Olexandrovich (Kharkiv State Technical University of Construction and Architecture, Ukraine). +* Mentor: Robin H. Johnson (Gentoo Linux: Developer, Trustee & Infrastructure Lead). +* Mentoring organization: Gentoo Linux. +* Sponsored by GSOC 2010. +* +* This file is part of Segget. +* +* Segget is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; either +* version 2.1 of the License, or (at your option) any later version. +* +* Segget is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with Segget; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef _DISTFILEWINDOW_H_ +#define _DISTFILEWINDOW_H_ + +#include "twindow.h" +#include "tuidistfile.h" + +using namespace std; + +class Tdistfile_window: public Twindow{ + public: + void compose(); +}; + +#endif
\ No newline at end of file diff --git a/tuiclient/helpwindow.h b/tuiclient/helpwindow.h index 883b586..71826f4 100644 --- a/tuiclient/helpwindow.h +++ b/tuiclient/helpwindow.h @@ -26,10 +26,10 @@ #ifndef _HELPWINDOW_H_ #define _HELPWINDOW_H_ - #include "twindow.h" using namespace std; + class Thelp_window: public Twindow{ public: // Thelp_window(int height_, int width_, int y_, int x_); diff --git a/tuiclient/mainwindow.cpp b/tuiclient/mainwindow.cpp index 6a27022..55a16e7 100644 --- a/tuiclient/mainwindow.cpp +++ b/tuiclient/mainwindow.cpp @@ -40,24 +40,24 @@ void Tmainwindow::disconnected(){ set_status("[Connecting... Attempt:"+toString(attempt_num)+". Waiting for 1 sec, before next reconnect.]"); } void Tmainwindow::msg_status(){ - msg_short(0,width/2-13,"tuiclient to segget daemon"); + msg_short(0,2,"Tuiclient "+status_str); + msg_short(0,width-40,"[h-Help] [q-Quit]"); msg_short(0,width-20,"[Lines:"+toString(top_position+1)+"-"+toString(top_position+1+bottom_screenline_num)+"/"+toString(max_received_screenline_num+1)+"]"); - msg_short(height-1,2,status_str); - msg_short(height-1,width-18,"[h-Help] [q-Quit]"); +// msg_short(height-1,2,status_str); +// msg_short(height-1,width-18,""); } void Tmainwindow::compose(){ //clear(); box(window, ACS_VLINE, ACS_HLINE); getmaxyx(window,height,width); - bottom_screenline_num=height-3; - color_status(); + screenlines[27]=sms; + bottom_screenline_num=height-2; + color_status(window); msg_status(); - color_info(); - for (uint y=bottom_screenline_num,status_line_num=0; y<height-2; y++,status_line_num++){ - msg_line(y+1,screen_info_lines[status_line_num]); - } - color_downloads(); + color_info(window); + msg_short(height-1,2,screen_info_lines[0]); + color_downloads(window); // screenlines[26]="Max_num:"+toString(max_received_screenline_num); for (int y=0, line_num=top_position; y<bottom_screenline_num; y++, line_num++){ msg_line(y+1,screenlines[line_num]); @@ -65,14 +65,19 @@ void Tmainwindow::compose(){ wrefresh(window); //and show children if (log_win.visible && error_log_win.visible){ - int modd = (height-3)%4; - log_win.resize((height-3)/4+modd, width, 1+(height-3)/4*2, 0); - error_log_win.resize((height-3)/4, width, 1+(height-3)/4*3+modd, 0); + int modd = (height-2)%4; + log_win.resize((height-2)/4+modd, width, 1+(height-2)/4*2, 0); + error_log_win.resize((height-2)/4, width, 1+(height-2)/4*3+modd, 0); }else{ - int modd = (height-3)%2; - log_win.resize((height-3)/2+modd, width, 1+(height-3)/2, 0); - error_log_win.resize((height-3)/2+modd, width, 1+(height-3)/2, 0); + int modd = (height-2)%2; + log_win.resize((height-2)/2+modd, width, 1+(height-2)/2, 0); + error_log_win.resize((height-2)/2+modd, width, 1+(height-2)/2, 0); } + int modd = (height-2)%2; + distfiles_win.resize((height-3)/2+modd, width, 1+(height-3)/2, 0); + + distfiles_win.show(); + log_win.show(); error_log_win.show(); @@ -113,6 +118,7 @@ void Tmainwindow::init(){ notfresh=TRUE; help_win.init(" HELP ",14,31,5,5); log_win.init(" LOG ",12,50,5,5); + distfiles_win.init(" DISTFILES ",12,50,5,5); error_log_win.init(" ERROR LOG ",12,50,5,5); } diff --git a/tuiclient/mainwindow.h b/tuiclient/mainwindow.h index cff1c75..0c80c30 100644 --- a/tuiclient/mainwindow.h +++ b/tuiclient/mainwindow.h @@ -29,13 +29,13 @@ #include <ncurses.h> #include <sys/types.h> - -using namespace std; - #include "twindow.h" #include "helpwindow.h" +#include "distfilewindow.h" #include "scrollwindow.h" +using namespace std; + const uint CONNECTION_LINES=5; const uint MAX_LINES=200; @@ -45,6 +45,7 @@ class Tmainwindow: public Twindow{ Thelp_window help_win; Tscroll_window log_win; Tscroll_window error_log_win; + Tdistfile_window distfiles_win; bool exit_flag; bool connected_status; string screenlines[200]; @@ -54,6 +55,7 @@ class Tmainwindow: public Twindow{ help_win(), log_win(), error_log_win(), + distfiles_win(), exit_flag(FALSE), connected_status(FALSE), attempt_num(0) diff --git a/tuiclient/scrollwindow.cpp b/tuiclient/scrollwindow.cpp index 6e7354c..cdfafad 100644 --- a/tuiclient/scrollwindow.cpp +++ b/tuiclient/scrollwindow.cpp @@ -31,10 +31,11 @@ void Tscroll_window::compose(){ // msg_text=msg_text+" "; // - make_frame(); getmaxyx(window,height,width); - bottom_screenline_num=height-1; - color_downloads(); + bottom_screenline_num=height-2; + color_scroll_window(window); + make_frame(); + color_downloads(window); // screenlines[26]="Max_num:"+toString(max_received_screenline_num); top_position=scroll_lines.size()-height+2; // +2 for border lines if (top_position<0) {top_position=0;}; @@ -47,6 +48,7 @@ void Tscroll_window::compose(){ void Tscroll_window::add_line(string line){ + max_received_screenline_num=scroll_lines.size(); scroll_lines.push_back(line); if (scroll_lines.size()>SCROLL_LINES_MAX_NUM){ scroll_lines.erase(scroll_lines.begin(),scroll_lines.begin()+scroll_lines.size()-SCROLL_LINES_MAX_NUM); diff --git a/tuiclient/str.cpp b/tuiclient/str.cpp index cfc4fb9..f831331 100644 --- a/tuiclient/str.cpp +++ b/tuiclient/str.cpp @@ -27,6 +27,35 @@ #include "str.h" using namespace std; +int atoi(string num_str){ + return atoi(num_str.c_str()); +} + +long atol(string num_str){ + return atol(num_str.c_str()); +} + + +Tparts split(string splitter, string str){ + Tparts result; + int splitter_pos=str.find(splitter); + result.before=str.substr(0,splitter_pos); + result.after=str.substr(splitter_pos+splitter.length()); + return result; +} + +vector <string> split_to_vector(string splitter, string str){ + vector <string> parts; + uint splitter_pos=str.find(splitter); + while (splitter_pos!=str.npos){ + parts.push_back(str.substr(0,splitter_pos)); + str=str.substr(splitter_pos+splitter.length()); + splitter_pos=str.find(splitter); + } + parts.push_back(str); + return parts; +} + template<typename T> string toString(T t){ stringstream s; s << t; @@ -82,4 +111,18 @@ string trim(std::string const& source, char const* delims) { error_log("Error in str.cpp: trim()"); return ""; } -}
\ No newline at end of file +} + +string field(string prefix,ulong t, int width){ + try{ + stringstream s1,s2; + s1 << t; + width=width+prefix.length(); + s2.width(width); + s2 << prefix+s1.str(); + return s2.str(); + }catch(...){ + error_log("Error in str.cpp: field()"); + return ""; + } +} diff --git a/tuiclient/str.h b/tuiclient/str.h index ef77aab..ab1ba71 100644 --- a/tuiclient/str.h +++ b/tuiclient/str.h @@ -29,13 +29,26 @@ #include <string> #include <sstream> #include <algorithm> +#include <vector> #include "log.h" using namespace std; +class Tparts{ + public: + string before, after; + Tparts(): + before(""), + after("") + {}; +}; + template<typename T> string toString(T t); +Tparts split(string splitter, string str); +vector <string> split_to_vector(string splitter, string str); string trim(std::string const& source, char const* delims = " \t\r\n"); int lower_char(int c); string noupper(string s); +string field(string prefix,ulong t, int width); #endif
\ No newline at end of file diff --git a/tuiclient/tuiclient.cpp b/tuiclient/tuiclient.cpp index 69531ca..e8ac7b6 100644 --- a/tuiclient/tuiclient.cpp +++ b/tuiclient/tuiclient.cpp @@ -47,27 +47,61 @@ void quit(){ //error while ending curses } } +Twindow * next_window(){ + cur_window_num++; + if (cur_window_num>3) cur_window_num=0; + switch (cur_window_num){ + case 0: + mainwindow.log_win.visible=false; + mainwindow.error_log_win.visible=false; + mainwindow.distfiles_win.visible=false; + return &mainwindow; + case 1: + mainwindow.log_win.visible=true; + mainwindow.error_log_win.visible=false; + mainwindow.distfiles_win.visible=false; + return &mainwindow.log_win; + case 2: + mainwindow.log_win.visible=false; + mainwindow.error_log_win.visible=true; + mainwindow.distfiles_win.visible=false; + return &mainwindow.error_log_win; + case 3: + mainwindow.log_win.visible=false; + mainwindow.error_log_win.visible=false; + mainwindow.distfiles_win.visible=true; + return &mainwindow.distfiles_win; + } + return &mainwindow; +} + void * watch_keyboard_thread_function(void *){ + Twindow * cur_window=&mainwindow.distfiles_win; while (true){ char key=getch(); switch (key){ + //tab - move between windows + case (char)9:cur_window=next_window(); //KEY_DOWN - case (char)2:mainwindow.down(1);break; + case (char)2:cur_window->down(1);mainwindow.screenlines[25]=toString((int)key);break; //KEY_RIGHT - case (char)5:mainwindow.down(1);break; + case (char)5:cur_window->down(1);mainwindow.screenlines[25]=toString((int)key);break; //KEY_UP - case (char)3:mainwindow.up(1);break; + case (char)3:cur_window->up(1);mainwindow.screenlines[25]=toString((int)key);break; //KEY_LEFT - case (char)4:mainwindow.up(1);break; + case (char)4:cur_window->up(1);mainwindow.screenlines[25]=toString((int)key);break; //KEY_PG_DOWN - case (char)82:mainwindow.down(mainwindow.bottom_screenline_num);break; + case (char)82:cur_window->down(mainwindow.bottom_screenline_num);break; //KEY_PG_UP - case (char)83:mainwindow.up(mainwindow.bottom_screenline_num);break; - case 'u': - case 'U':mainwindow.up(1);break; + case (char)83:cur_window->up(mainwindow.bottom_screenline_num);break; case 'd': - case 'D':mainwindow.down(1);break; + case 'D':mainwindow.distfiles_win.toggle(); + mainwindow.log_win.visible=false; + mainwindow.error_log_win.visible=false; + cur_window=&mainwindow.distfiles_win; + mainwindow.show(); + break; case 'q': case 'Q':quit();break; case 'h': @@ -76,7 +110,7 @@ void * watch_keyboard_thread_function(void *){ case 'L':mainwindow.log_win.toggle(); mainwindow.show();break; case 'e': case 'E':mainwindow.error_log_win.toggle(); mainwindow.show();break; -// default: screenlines[25]=toString((int)key); + default: mainwindow.screenlines[25]=toString((int)key); } } return 0; @@ -93,15 +127,6 @@ void * refresh_screen_thread_function(void *){ return 0; } - -Tparts split(string splitter, string str){ - Tparts result; - int splitter_pos=str.find(splitter); - result.before=str.substr(0,splitter_pos); - result.after=str.substr(splitter_pos+splitter.length()); - return result; -} - void decode_connection_msg(string msg_body){ Tparts parts=split("<y>",msg_body); int line_num=atoi(parts.before.c_str()); @@ -114,6 +139,30 @@ void decode_connection_msg(string msg_body){ } } +void decode_downloaded_distfile_msg(string msg_body){ + vector <string> parts; + parts=split_to_vector(" ", msg_body); + if (parts.size()>4){ + for (ulong cur_distfile=0;cur_distfile<tuidistfiles.size();cur_distfile++){ + if (tuidistfiles[cur_distfile].name==parts[0]){ + tuidistfiles[cur_distfile].dld_segments=atol(parts[1]); + tuidistfiles[cur_distfile].segments_count=atol(parts[2]); + tuidistfiles[cur_distfile].dld_bytes=atol(parts[3]); + tuidistfiles[cur_distfile].size=atol(parts[4]); + return; + } + } + Ttuidistfile a_tuidistfile; + a_tuidistfile.name=parts[0]; + a_tuidistfile.dld_segments=atol(parts[1]); + a_tuidistfile.segments_count=atol(parts[2]); + a_tuidistfile.dld_bytes=atol(parts[3]); + a_tuidistfile.size=atol(parts[4]); + tuidistfiles.push_back(a_tuidistfile); + mainwindow.distfiles_win.max_received_screenline_num=tuidistfiles.size(); + } +} + void decode_log_msg(string msg_body){ mainwindow.log_win.add_line(msg_body); } @@ -223,6 +272,7 @@ int main() case 'c': decode_connection_msg(msg_parts.before); break; case 'l': decode_log_msg(msg_parts.before);break; case 'e': decode_error_log_msg(msg_parts.before);break; + case 'd': decode_downloaded_distfile_msg(msg_parts.before);break; } } }; diff --git a/tuiclient/tuiclient.h b/tuiclient/tuiclient.h index ad7cdac..cf1223c 100644 --- a/tuiclient/tuiclient.h +++ b/tuiclient/tuiclient.h @@ -45,6 +45,8 @@ #include "config.cpp" #include "log.cpp" #include "settings.cpp" +#include "tuidistfile.cpp" +#include "distfilewindow.cpp" #define BUFFER_SIZE 2000 @@ -55,18 +57,9 @@ using namespace std; -class Tparts{ - public: - string before, after; - Tparts(): - before(""), - after("") - {}; -}; - - Tmainwindow mainwindow; +int cur_window_num=0; int sockfd; void quit(); void * watch_keyboard_thread_function(void * ptr); diff --git a/tuiclient/tuidistfile.cpp b/tuiclient/tuidistfile.cpp new file mode 100644 index 0000000..09bd414 --- /dev/null +++ b/tuiclient/tuidistfile.cpp @@ -0,0 +1,31 @@ + /* +* Copyright (C) 2010 Robin H.Johnson, Ovechko Kostyantyn <fastinetserver@gmail.com>. +* +* Project: IDFetch. +* Developer: Ovechko Kostyantyn Olexandrovich (Kharkiv State Technical University of Construction and Architecture, Ukraine). +* Mentor: Robin H. Johnson (Gentoo Linux: Developer, Trustee & Infrastructure Lead). +* Mentoring organization: Gentoo Linux. +* Sponsored by GSOC 2010. +* +* This file is part of Segget. +* +* Segget is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; either +* version 2.1 of the License, or (at your option) any later version. +* +* Segget is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with Segget; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "tuidistfile.h" + + + + diff --git a/tuiclient/tuidistfile.h b/tuiclient/tuidistfile.h new file mode 100644 index 0000000..fa857b8 --- /dev/null +++ b/tuiclient/tuidistfile.h @@ -0,0 +1,55 @@ + /* +* Copyright (C) 2010 Robin H.Johnson, Ovechko Kostyantyn <fastinetserver@gmail.com>. +* +* Project: IDFetch. +* Developer: Ovechko Kostyantyn Olexandrovich (Kharkiv State Technical University of Construction and Architecture, Ukraine). +* Mentor: Robin H. Johnson (Gentoo Linux: Developer, Trustee & Infrastructure Lead). +* Mentoring organization: Gentoo Linux. +* Sponsored by GSOC 2010. +* +* This file is part of Segget. +* +* Segget is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; either +* version 2.1 of the License, or (at your option) any later version. +* +* Segget is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with Segget; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef __TUIDISTFILE_H__ +#define __TUIDISTFILE_H__ +#include <string> +#include <vector> + +using namespace std; + +class Ttuidistfile{ + public: + string name; + ulong size; + ulong dld_bytes; + ulong dld_segments; + ulong segments_count; + Ttuidistfile(): + name(""), + size(0), + dld_bytes(0), + dld_segments(0), + segments_count(0) + {}; + ~Ttuidistfile(){}; +}; + +vector <Ttuidistfile> tuidistfiles; +//vector <string> tuidistfiles; +//string tuidistfiles; + +#endif diff --git a/tuiclient/twindow.cpp b/tuiclient/twindow.cpp index e4ee2f7..d451435 100644 --- a/tuiclient/twindow.cpp +++ b/tuiclient/twindow.cpp @@ -26,6 +26,8 @@ #include "twindow.h" +string sms; + void Twindow::init(string caption_, int height_, int width_, int y_, int x_){ caption=caption_; height=height_; @@ -67,6 +69,8 @@ void Twindow::up(int inc){ }else{ top_position=tmp_top_position; } + sms="UP"+toString(top_position); + } void Twindow::down(uint inc){ int tmp_top_position=top_position+inc; @@ -80,6 +84,7 @@ void Twindow::down(uint inc){ top_position=tmp_top_position; } } + sms="DOWN "+toString(top_position)+"------>"+toString(bottom_screenline_num); } void Twindow::center(uint max_y, uint max_x){ @@ -101,9 +106,10 @@ void Twindow::make_frame(){ wclear(window); box(window, ACS_VLINE, ACS_HLINE); mvwaddstr(window,0,(width-caption.length())/2,caption.c_str()); + msg_short(0,width-20,"[Lines:"+toString(top_position+1)+"-"+toString(top_position+bottom_screenline_num)+"/"+toString(max_received_screenline_num)+"]"); + msg_short(height-1,width-27,"[Up/Dn/PgUp/PgDn - scroll]"); } - void Twindow::refresh(){ if (notfresh){ show(); diff --git a/tuiclient/twindow.h b/tuiclient/twindow.h index aa84214..89c5108 100644 --- a/tuiclient/twindow.h +++ b/tuiclient/twindow.h @@ -30,6 +30,7 @@ #include <ncurses.h> #include <sys/types.h> #include "colors.h" +//#include "tuiclient.h" using namespace std; @@ -78,4 +79,6 @@ class Twindow{ void show(); virtual void compose(){}; }; + +extern string sms; #endif
\ No newline at end of file |