Cleaning up source - deleted fltkgui folder

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2645 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
chrisparker126 2010-03-27 15:00:16 +00:00
parent 9acfe64d97
commit ee6e3ccfb3
20 changed files with 0 additions and 13200 deletions

View File

@ -1,328 +0,0 @@
//
// "$Id: Fl_File_Item.cc,v 1.3 2007-02-18 21:46:49 rmf24 Exp $"
//
// This is hacked up FLTK code, and so is released under
// their licence. (below)
// Copyright 2004-2006 by Robert Fernie.
//
// Please report all bugs and problems to "retroshare@lunamutt.com".
//
/////////////////////////////////////////////////////////////////////
//
// C function type code for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2004 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This library 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
// Library General Public License for more details.
//
// You should have received a copy of the GNU Library General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA.
//
// Please report all bugs and problems to "fltk-bugs@fltk.org".
//
#include <FL/Fl.H>
#include "Fl_Tree_Browser.h"
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
//
//extern int i18n_type;
//extern const char* i18n_include;
//extern const char* i18n_function;
//extern const char* i18n_file;
//extern const char* i18n_set;
//extern char i18n_program[];
////////////////////////////////////////////////////////////////
// quick check of any C code for legality, returns an error message
static char buffer[128]; // for error messages
// check a quoted string ending in either " or ' or >:
const char *_q_check(const char * & c, int type) {
for (;;) switch (*c++) {
case '\0':
sprintf(buffer,"missing %c",type);
return buffer;
case '\\':
if (*c) c++;
break;
default:
if (*(c-1) == type) return 0;
}
}
// check normal code, match braces and parenthesis:
const char *_c_check(const char * & c, int type) {
const char *d;
for (;;) switch (*c++) {
case 0:
if (!type) return 0;
sprintf(buffer, "missing %c", type);
return buffer;
case '/':
// Skip comments as needed...
if (*c == '/') {
while (*c != '\n' && *c) c++;
} else if (*c == '*') {
c++;
while ((*c != '*' || c[1] != '/') && *c) c++;
if (*c == '*') c+=2;
else {
return "missing '*/'";
}
}
break;
case '#':
// treat cpp directives as a comment:
while (*c != '\n' && *c) c++;
break;
case '{':
if (type==')') goto UNEXPECTED;
d = _c_check(c,'}');
if (d) return d;
break;
case '(':
d = _c_check(c,')');
if (d) return d;
break;
case '\"':
d = _q_check(c,'\"');
if (d) return d;
break;
case '\'':
d = _q_check(c,'\'');
if (d) return d;
break;
case '}':
case ')':
UNEXPECTED:
if (type == *(c-1)) return 0;
sprintf(buffer, "unexpected %c", *(c-1));
return buffer;
}
}
const char *c_check(const char *c, int type) {
return _c_check(c,type);
}
////////////////////////////////////////////////////////////////
// UNSURE
//#include "function_panel.h"
//#include <FL/fl_ask.H>
////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
Fl_Item *Fl_Dir_Item::make(Fl_Item *p) {
//std::cerr << "Fl_Dir_Item::make()" << std::endl;
//Fl_Item *p = Fl_Item::current;
while (p && p->is_file()) p = p->parent;
Fl_Dir_Item *o = new Fl_Dir_Item();
o->name("Dir: printf(\"Hello, World!\\n\");");
o->add(p);
o->factory = this;
return o;
}
void file_requestdir(std::string person, std::string dir);
void Fl_Dir_Item::open()
{
//std::cerr << "open Dir..." << std::endl;
Fl_Item *p = NULL;
int ccount = 0;
for(p = next; (p && (p->parent == this));p = p->next)
{
ccount++;
}
//std::cerr << "count:" << ccount << std::endl;
if (ccount == 0) // && (lload > time(NULL) + MIN_RELOAD))
{
// get our path....
std::string fulldir(name());
int lvl = level;
//std::cerr << "level:" << level << std::endl;
//std::cerr << "prev:" << (int) prev << std::endl;
//std::cerr << "prev->parent:" << (int) prev->parent << std::endl;
for(p = prev; (p && p->parent);p = p->prev)
{
//std::cerr << "fulldir srch: " << p -> name() << std::endl;
if (p->level < lvl)
{
std::string subdir(p->name());
fulldir = subdir + "/" + fulldir;
lvl = p->level;
}
}
fulldir = "/" + fulldir;
if (p)
{
Fl_Person_Item *pi;
if ((pi = dynamic_cast<Fl_Person_Item *>(p)))
{
std::string person(pi->person_hash);
file_requestdir(person, fulldir);
//std::cerr << "Requesting: " << person << ":" << fulldir << std::endl;
}
else
{
//std::cerr << "Not PersonItem" << std::endl;
}
}
else
{
//std::cerr << "No Requesting: NULL" << ":" << fulldir << std::endl;
}
}
else
{
for(p = next; (p && (p->parent == this));p = p->next)
{
//std::cerr << "Setting Item Visible" << std::endl;
p -> visible = 1;
//p -> open_ = 1;
}
redraw_browser();
}
}
Fl_Dir_Item Fl_Dir_Item_type;
////////////////////////////////////////////////////////////////
Fl_Item *Fl_File_Item::make(Fl_Item *p) {
//std::cerr << "Fl_File_Item::make()" << std::endl;
while (p && p->is_file()) p = p->parent;
if (!p) {
//std::cerr << "File in no directory!" << std::endl;
return 0;
}
Fl_File_Item *o = new Fl_File_Item();
o->name("file: hello world");
o->add(p);
o->factory = this;
//redraw_browser();
return o;
}
void Fl_File_Item::open()
{
//std::cerr << "open File? How..." << std::endl;
redraw_browser();
}
Fl_File_Item Fl_File_Item_type;
////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
Fl_Item *Fl_Person_Item::make(Fl_Item *p) {
//std::cerr << "Fl_Person_Item::make()" << std::endl;
//while (p) && p->is_file()) p = p->parent;
//while (p) && p->is_file()) p = p->parent;
p = NULL; // always at top.
Fl_Person_Item *o = new Fl_Person_Item();
o->name("person");
o->add(p);
o->factory = this;
return o;
}
void Fl_Person_Item::open()
{
//std::cerr << "open Person? How..." << std::endl;
Fl_Item *p;
{
for(p = next; (p && (p->parent == this));p = p->next)
{
//std::cerr << "Setting Item Visible" << std::endl;
p -> visible = 1;
}
redraw_browser();
}
}
Fl_Person_Item Fl_Person_Item_type;
////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
Fl_Item *Fl_Msg_Item::make(Fl_Item *p) {
//std::cerr << "Fl_Msg_Item::make()" << std::endl;
while (p && p->is_file()) p = p->parent;
if (!p) {
//std::cerr << "File in no directory!" << std::endl;
return 0;
}
Fl_Msg_Item *o = new Fl_Msg_Item();
o->name("msg");
o->add(p);
o->factory = this;
//redraw_browser();
return o;
}
void Fl_Msg_Item::open()
{
//std::cerr << "open Msg? How..." << std::endl;
redraw_browser();
}
Fl_Msg_Item Fl_Msg_Item_type;
////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
const char* Fl_Item::class_name(const int need_nest) const {
Fl_Item* p = parent;
while (p) {
if (p->is_class()) {
// see if we are nested in another class, we must fully-qualify name:
// this is lame but works...
const char* q = 0;
if(need_nest) q=p->class_name(need_nest);
if (q) {
static char s[256];
if (q != s) fltk_strlcpy(s, q, sizeof(s));
fltk_strlcat(s, "::", sizeof(s));
fltk_strlcat(s, p->name(), sizeof(s));
return s;
}
return p->name();
}
p = p->parent;
}
return 0;
}
//
// End of "$Id: Fl_File_Item.cc,v 1.3 2007-02-18 21:46:49 rmf24 Exp $".
//

File diff suppressed because it is too large Load Diff

View File

@ -1,179 +0,0 @@
/*
* "$Id: Fl_Funky_Browser.h,v 1.4 2007-02-18 21:46:49 rmf24 Exp $"
*
* FltkGUI for RetroShare.
*
* Copyright 2004-2006 by Robert Fernie.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License Version 2 as published by the Free Software Foundation.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*
* Please report all bugs and problems to "retroshare@lunamutt.com".
*
*/
#ifndef RS_FL_FUNKY_BROWSER
#define RS_FL_FUNKY_BROWSER
/* My new funky browser.....
*
* - Designed to sort/display a tree brower
* for search results....
*
* First we need the basic interface class that
* must wrap the Data....
*/
#include <string>
#include <list>
#include <vector>
class DisplayData;
class DisplayItem
{
public:
int expander;
int index;
int flags;
std::string txt;
DisplayData *ref;
};
class DisplayData
{
public:
DisplayData() { return;}
virtual ~DisplayData() { return;}
// a couple of functions that do the work.
virtual int ndix() = 0; // Number of Indices.
std::string txt(int col, int width)
{
std::string out1 = txt(col);
int i;
for(i = (signed) out1.length() + 1; i < width; i++)
{
out1 += " ";
}
if ((signed) out1.length() > width)
{
std::string out2;
for(i = 0; i < width; i++)
{
out2 += out1[i];
}
return out2;
}
return out1;
}
virtual std::string txt(int col) = 0;
virtual int cmp(int col, DisplayData *) = 0;
virtual int check(int n, int v = -1) { return -1;}
// return -1 unless have a check box. then return 0/1
// if v != -1 attempt to set value.
};
#include <FL/Fl_Browser.H>
class Fl_Funky_Browser : public Fl_Browser
{
public:
Fl_Funky_Browser(int, int, int, int, const char *, int ncol);
//Fl_Funky_Browser(int ncol);
// add items.
int selectDD(DisplayData *);
int addItem(DisplayData *);
// add in a batch (faster)
int addItemSeries(DisplayData *);
int ItemSeriesDone();
int setTitle(int col, std::string name);
int setCheck(int col); // enables check for the column;
DisplayData *removeItem(int idx = -1);
DisplayData *removeItem(int (*fn)(DisplayData *)); // remove first matching fn.
DisplayData *getSelected();
DisplayData *getCurrentItem();
int checkSort(); // check if update affected order.
int updateList(); // if affected call this.
int toggleCheckBox(int row, int col = -1);
int getCheckState(int row = -1, int col = -1);
// old - don't use
int current_SetCollapsed(bool col) { return 1;}
void clear();
// change browser config.
int setup(std::string opts);
std::string setup();
// Worker Functions.
int drawList();
// Overload the Browser Functions.......
protected:
virtual void item_draw(void* v, int X, int Y, int W, int H) const;
virtual int handle(int event);
private:
int toggleCollapseLevel(int row);
int toggle_TreeSetting(int);
int toggle_ArrowSetting(int);
int selectItems(int row);
int cmp_upto(int lvl, DisplayItem *i1, DisplayItem *i2);
int cmp(DisplayItem *i1, DisplayItem *i2);
// Worker Functions.
int checkIndices();
int SortList();
int RePopulate();
// drag and ticks mouse stuff
int handle_push(int x, int y);
bool dragging();
int handle_release(int x, int y);
int ncols;
std::list<DisplayItem *> dlist;
std::vector<int> sort_order;
std::vector<int> sort_direction;
std::vector<int> tree;
std::vector<int> display_order;
std::vector<int> widths;
std::vector<std::string> titles;
std::vector<bool> check_box;
int *fl_widths;
int ntrees;
int drag_mode;
int drag_column; // which column
int drag_x, drag_y;
bool one_select;
};
#endif

View File

@ -1,752 +0,0 @@
//
// "$Id: Fl_Tree_Browser.cc,v 1.3 2007-02-18 21:46:49 rmf24 Exp $"
//
// This is hacked up FLTK code, and so is released under
// their licence. (below)
// Copyright 2004-2006 by Robert Fernie.
//
// Please report all bugs and problems to "retroshare@lunamutt.com".
//
/////////////////////////////////////////////////////////////////////
//
// Widget type code for the Fast Light Tool Kit (FLTK).
//
// Each object described by Fluid is one of these objects. They
// are all stored in a double-linked list.
//
// They "type" of the object is covered by the virtual functions.
// There will probably be a lot of these virtual functions.
//
// The type browser is also a list of these objects, but they
// are "factory" instances, not "real" ones. These objects exist
// only so the "make" method can be called on them. They are
// not in the linked list and are not written to files or
// copied or otherwise examined.
//
// Copyright 1998-2004 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This library 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
// Library General Public License for more details.
//
// You should have received a copy of the GNU Library General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA.
//
// Please report all bugs and problems to "fltk-bugs@fltk.org".
//
#include <FL/Fl.H>
#include <FL/Fl_Browser_.H>
#include <FL/fl_draw.H>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <iostream>
#include "Fl_Tree_Browser.h"
#include <FL/Fl_Pixmap.H>
//static Fl_Pixmap lock_pixmap(lock_xpm);
//static Fl_Pixmap unlock_pixmap(unlock_xpm);
void selection_changed(Fl_Item *p);
size_t fltk_strlcpy(char *dst, const char *src, size_t size);
const char* subclassname(Fl_Item *i) { return i -> type_name(); }
////////////////////////////////////////////////////////////////
class Fl_Tree_Browser : public Fl_Browser_ {
friend class Fl_Item;
// required routines for Fl_Browser_ subclass:
void *item_first() const ;
void *item_next(void *) const ;
void *item_prev(void *) const ;
int item_selected(void *) const ;
void item_select(void *,int);
int item_width(void *) const ;
int item_height(void *) const ;
void item_draw(void *,int,int,int,int) const ;
int incr_height() const ;
public:
int handle(int);
void callback();
Fl_Tree_Browser(int,int,int,int,const char * =0);
};
static Fl_Tree_Browser *tree_browser;
Fl_Widget *make_tree_browser(int x,int y,int w,int h, const char *) {
return (tree_browser = new Fl_Tree_Browser(x,y,w,h));
}
void select(Fl_Item *o, int v) {
tree_browser->select(o,v,1);
// Fl_Item::current = o;
}
void select_only(Fl_Item *o) {
tree_browser->select_only(o,1);
}
void deselect() {
tree_browser->deselect();
//Fl_Item::current = 0; // this breaks the paste & merge functions
}
Fl_Item *Fl_Item::first;
Fl_Item *Fl_Item::last;
Fl_Item *Fl_Item::current;
static void Fl_Tree_Browser_callback(Fl_Widget *o,void *) {
((Fl_Tree_Browser *)o)->callback();
}
Fl_Tree_Browser::Fl_Tree_Browser(int X,int Y,int W,int H,const char*l)
: Fl_Browser_(X,Y,W,H,l) {
type(FL_MULTI_BROWSER);
Fl_Widget::callback(Fl_Tree_Browser_callback);
when(FL_WHEN_RELEASE);
}
void *Fl_Tree_Browser::item_first() const {return Fl_Item::first;}
void *Fl_Tree_Browser::item_next(void *l) const {return ((Fl_Item*)l)->next;}
void *Fl_Tree_Browser::item_prev(void *l) const {return ((Fl_Item*)l)->prev;}
int Fl_Tree_Browser::item_selected(void *l) const {return ((Fl_Item*)l)->new_selected;}
void Fl_Tree_Browser::item_select(void *l,int v) {((Fl_Item*)l)->new_selected = v;}
int Fl_Tree_Browser::item_height(void *l) const {
return ((Fl_Item *)l)->visible ? textsize()+2 : 0;
}
int Fl_Tree_Browser::incr_height() const {return textsize()+2;}
static Fl_Item* pushedtitle;
// Generate a descriptive text for this item, to put in browser & window titles
const char* Fl_Item::title() {
const char* c = name(); if (c) return c;
return type_name();
}
extern const char* subclassname(Fl_Item*);
void Fl_Tree_Browser::item_draw(void *v, int X, int Y, int, int) const {
Fl_Item *l = (Fl_Item *)v;
X += 3 + 18 + l->level * 12;
if (l->new_selected) fl_color(fl_contrast(FL_BLACK,FL_SELECTION_COLOR));
else fl_color(FL_BLACK);
Fl_Pixmap *pm = NULL; //pixmap[l->pixmapID()];
if (pm) pm->draw(X-18, Y);
//if (l->is_public() == 0) lock_pixmap.draw(X - 17, Y);
//else if (l->is_public() > 0) ; //unlock_pixmap.draw(X - 17, Y);
if (l->is_parent()) {
if (!l->next || l->next->level <= l->level) {
if (l->open_!=(l==pushedtitle)) {
fl_loop(X,Y+7,X+5,Y+12,X+10,Y+7);
} else {
fl_loop(X+2,Y+2,X+7,Y+7,X+2,Y+12);
}
} else {
if (l->open_!=(l==pushedtitle)) {
fl_polygon(X,Y+7,X+5,Y+12,X+10,Y+7);
} else {
fl_polygon(X+2,Y+2,X+7,Y+7,X+2,Y+12);
}
}
X += 10;
}
if (l->is_widget() || l->is_class()) {
//if (l->is_widget()) {
const char* c = subclassname(l);
if (!strncmp(c,"Fl_",3)) c += 3;
fl_font(textfont(), textsize());
fl_draw(c, X, Y+13);
X += int(fl_width(c)+fl_width('n'));
c = l->name();
if (c) {
fl_font(textfont()|FL_BOLD, textsize());
fl_draw(c, X, Y+13);
} else if ((c=l->label())) {
char buf[50]; char* p = buf;
*p++ = '"';
for (int i = 20; i--;) {
if (! (*c & -32)) break;
*p++ = *c++;
}
if (*c) {strcpy(p,"..."); p+=3;}
*p++ = '"';
*p = 0;
fl_draw(buf, X, Y+13);
}
} else {
const char* c = l->title();
char buf[60]; char* p = buf;
for (int i = 55; i--;) {
if (! (*c & -32)) break;
*p++ = *c++;
}
if (*c) {strcpy(p,"..."); p+=3;}
*p = 0;
fl_font(textfont() | (l->is_code_block() && (l->level==0 || l->parent->is_class())?0:FL_BOLD), textsize());
fl_draw(buf, X, Y+13);
}
}
int Fl_Tree_Browser::item_width(void *v) const {
Fl_Item *l = (Fl_Item *)v;
if (!l->visible) return 0;
int W = 3 + 16 + 18 + l->level*10;
if (l->is_parent()) W += 10;
if (l->is_widget() || l->is_class()) {
const char* c = l->type_name();
if (!strncmp(c,"Fl_",3)) c += 3;
fl_font(textfont(), textsize());
W += int(fl_width(c) + fl_width('n'));
c = l->name();
if (c) {
fl_font(textfont()|FL_BOLD, textsize());
W += int(fl_width(c));
} else if ((c=l->label())) {
char buf[50]; char* p = buf;
*p++ = '"';
for (int i = 20; i--;) {
if (! (*c & -32)) break;
*p++ = *c++;
}
if (*c) {strcpy(p,"..."); p+=3;}
*p++ = '"';
*p = 0;
W += int(fl_width(buf));
}
} else {
const char* c = l->title();
char buf[60]; char* p = buf;
for (int i = 55; i--;) {
if (! (*c & -32)) break;
*p++ = *c++;
}
if (*c) {strcpy(p,"..."); p+=3;}
*p = 0;
fl_font(textfont() | (l->is_code_block() && (l->level==0 || l->parent->is_class())?0:FL_BOLD), textsize());
W += int(fl_width(buf));
}
return W;
}
void redraw_browser() {
tree_browser->redraw();
}
void Fl_Tree_Browser::callback() {
selection_changed((Fl_Item*)selection());
}
int Fl_Tree_Browser::handle(int e) {
static Fl_Item *title;
Fl_Item *l;
int X,Y,W,H; bbox(X,Y,W,H);
switch (e) {
case FL_PUSH:
if (!Fl::event_inside(X,Y,W,H)) break;
l = (Fl_Item*)find_item(Fl::event_y());
if (l) {
X += 12*l->level + 18 - hposition();
if (l->is_parent() && Fl::event_x()>X && Fl::event_x()<X+13) {
title = pushedtitle = l;
redraw_line(l);
return 1;
}
}
break;
case FL_DRAG:
if (!title) break;
l = (Fl_Item*)find_item(Fl::event_y());
if (l) {
X += 12*l->level + 18 - hposition();
if (l->is_parent() && Fl::event_x()>X && Fl::event_x()<X+13) ;
else l = 0;
}
if (l != pushedtitle) {
if (pushedtitle) redraw_line(pushedtitle);
if (l) redraw_line(l);
pushedtitle = l;
}
return 1;
case FL_RELEASE:
if (!title) {
l = (Fl_Item*)find_item(Fl::event_y());
if (l && l->new_selected && (Fl::event_clicks() || Fl::event_state(FL_CTRL)))
l->open();
break;
}
l = pushedtitle;
title = pushedtitle = 0;
if (l) {
if (l->open_) {
l->open_ = 0;
for (Fl_Item*k = l->next; k&&k->level>l->level; k = k->next)
k->visible = 0;
} else {
l->open_ = 1;
for (Fl_Item*k=l->next; k&&k->level>l->level;) {
k->visible = 1;
if (k->is_parent() && !k->open_) {
Fl_Item *j;
for (j = k->next; j && j->level>k->level; j = j->next);
k = j;
} else
k = k->next;
}
}
redraw();
}
return 1;
}
return Fl_Browser_::handle(e);
}
Fl_Item::Fl_Item() {
factory = 0;
parent = 0;
next = prev = 0;
selected = new_selected = 0;
visible = 0;
name_ = 0;
label_ = 0;
user_data_ = 0;
user_data_type_ = 0;
callback_ = 0;
rtti = 0;
level = 0;
}
static void fixvisible(Fl_Item *p) {
Fl_Item *t = p;
for (;;) {
if (t->parent) t->visible = t->parent->visible && t->parent->open_;
else t->visible = 1;
t = t->next;
if (!t || t->level <= p->level) break;
}
}
// turn a click at x,y on this into the actual picked object:
Fl_Item* Fl_Item::click_test(int,int) {return 0;}
void Fl_Item::add_child(Fl_Item*, Fl_Item*) {}
void Fl_Item::move_child(Fl_Item*, Fl_Item*) {}
void Fl_Item::remove_child(Fl_Item*) {}
// add a list of widgets as a new child of p:
void Fl_Item::add(Fl_Item *p) {
if (p && parent == p) return;
parent = p;
Fl_Item *end = this;
while (end->next) end = end->next;
Fl_Item *q;
int newlevel;
if (p) {
for (q = p->next; q && q->level > p->level; q = q->next);
newlevel = p->level+1;
} else {
q = 0;
newlevel = 0;
}
for (Fl_Item *t = this->next; t; t = t->next) t->level += (newlevel-level);
//std::cerr << "add -> level = " << newlevel << std::endl;
level = newlevel;
if (q) {
prev = q->prev;
prev->next = this;
q->prev = end;
end->next = q;
} else if (first) {
prev = last;
prev->next = this;
end->next = 0;
last = end;
} else {
first = this;
last = end;
prev = end->next = 0;
}
if (p) p->add_child(this,0);
open_ = 1;
fixvisible(this);
//modflag = 1;
tree_browser->redraw();
}
// add to a parent before another widget:
void Fl_Item::insert(Fl_Item *g) {
Fl_Item *end = this;
while (end->next) end = end->next;
parent = g->parent;
int newlevel = g->level;
visible = g->visible;
for (Fl_Item *t = this->next; t; t = t->next) t->level += newlevel-level;
level = newlevel;
prev = g->prev;
if (prev) prev->next = this; else first = this;
end->next = g;
g->prev = end;
fixvisible(this);
if (parent) parent->add_child(this, g);
tree_browser->redraw();
}
// Return message number for I18N...
int
Fl_Item::msgnum() {
int count;
Fl_Item *p;
for (count = 0, p = this; p;) {
if (p->label()) count ++;
//if (p != this && p->is_widget() && ((Fl_Widget_Type *)p)->tooltip()) count ++;
if (p != this && p->is_widget()) count ++;
if (p->prev) p = p->prev;
else p = p->parent;
}
return count;
}
// delete from parent:
Fl_Item *Fl_Item::remove() {
Fl_Item *end = this;
for (;;) {
if (!end->next || end->next->level <= level) break;
end = end->next;
}
if (prev) prev->next = end->next;
else first = end->next;
if (end->next) end->next->prev = prev;
else last = prev;
Fl_Item *r = end->next;
prev = end->next = 0;
if (parent) parent->remove_child(this);
parent = 0;
tree_browser->redraw();
selection_changed(0);
return r;
}
// update a string member:
int storestring(const char *n, const char * & p, int nostrip) {
if (n == p) return 0;
int length = 0;
if (n) { // see if blank, strip leading & trailing blanks
if (!nostrip) while (isspace(*n)) n++;
const char *e = n + strlen(n);
if (!nostrip) while (e > n && isspace(*(e-1))) e--;
length = e-n;
if (!length) n = 0;
}
if (n == p) return 0;
if (n && p && !strncmp(n,p,length) && !p[length]) return 0;
if (p) free((void *)p);
if (!n || !*n) {
p = 0;
} else {
char *q = (char *)malloc(length+1);
fltk_strlcpy(q,n,length+1);
p = q;
}
//modflag = 1;
return 1;
}
void Fl_Item::name(const char *n) {
if (storestring(n,name_)) {
if (visible) tree_browser->redraw();
}
}
void Fl_Item::label(const char *n) {
if (storestring(n,label_,1)) {
setlabel(label_);
if (visible && !name_) tree_browser->redraw();
}
}
void Fl_Item::callback(const char *n) {
storestring(n,callback_);
}
void Fl_Item::user_data(const char *n) {
storestring(n,user_data_);
}
void Fl_Item::user_data_type(const char *n) {
storestring(n,user_data_type_);
}
void Fl_Item::open() {
printf("Open of '%s' is not yet implemented\n",type_name());
}
void Fl_Item::setlabel(const char *) {}
Fl_Item::~Fl_Item() {
// warning: destructor only works for widgets that have been add()ed.
if (tree_browser) tree_browser->deleting(this);
if (prev) prev->next = next; else first = next;
if (next) next->prev = prev; else last = prev;
if (current == this) current = 0;
//modflag = 1;
if (parent) parent->remove_child(this);
}
int Fl_Item::is_parent() const {return 0;}
int Fl_Item::is_widget() const {return 0;}
int Fl_Item::is_valuator() const {return 0;}
int Fl_Item::is_button() const {return 0;}
int Fl_Item::is_menu_item() const {return 0;}
int Fl_Item::is_menu_button() const {return 0;}
int Fl_Item::is_group() const {return 0;}
int Fl_Item::is_window() const {return 0;}
int Fl_Item::is_code_block() const {return 0;}
int Fl_Item::is_decl_block() const {return 0;}
int Fl_Item::is_class() const {return 1;}
int Fl_Item::is_public() const {return 1;}
int Fl_Item::is_file() const {return 0;}
int Fl_File_Item::is_public()const { return 1; }
int Fl_Dir_Item::is_public()const { return 1; }
int Fl_File_Item::is_parent() const {return 0;}
int Fl_Dir_Item::is_parent() const {return 1;}
int Fl_Person_Item::is_public()const { return 1; }
int Fl_Person_Item::is_parent() const {return 1;}
int Fl_Msg_Item::is_public()const { return 1; }
int Fl_Msg_Item::is_parent() const {return 0;}
////////////////////////////////////////////////////////////////
Fl_Item *in_this_only; // set if menu popped-up in window
void select_all_cb(Fl_Widget *,void *) {
Fl_Item *p = Fl_Item::current ? Fl_Item::current->parent : 0;
if (in_this_only) {
Fl_Item *t = p;
for (; t && t != in_this_only; t = t->parent);
if (t != in_this_only) p = in_this_only;
}
for (;;) {
if (p) {
int foundany = 0;
for (Fl_Item *t = p->next; t && t->level>p->level; t = t->next) {
if (!t->new_selected) {tree_browser->select(t,1,0); foundany = 1;}
}
if (foundany) break;
p = p->parent;
} else {
for (Fl_Item *t = Fl_Item::first; t; t = t->next)
tree_browser->select(t,1,0);
break;
}
}
selection_changed(p);
}
// rmfern - removed static....
void delete_children(Fl_Item *p) {
Fl_Item *f;
for (f = p; f && f->next && f->next->level > p->level; f = f->next);
for (; f != p; ) {
Fl_Item *g = f->prev;
delete f;
f = g;
}
}
void delete_all(int selected_only) {
for (Fl_Item *f = Fl_Item::first; f;) {
if (f->selected || !selected_only) {
delete_children(f);
Fl_Item *g = f->next;
delete f;
f = g;
} else f = f->next;
}
//if(!selected_only) include_H_from_C=1;
selection_changed(0);
}
// move f (and it's children) into list before g:
// returns pointer to whatever is after f & children
void Fl_Item::move_before(Fl_Item* g) {
if (level != g->level) printf("move_before levels don't match! %d %d\n",
level, g->level);
Fl_Item* n;
for (n = next; n && n->level > level; n = n->next);
if (n == g) return;
Fl_Item *l = n ? n->prev : Fl_Item::last;
prev->next = n;
if (n) n->prev = prev; else Fl_Item::last = prev;
prev = g->prev;
l->next = g;
if (prev) prev->next = this; else Fl_Item::first = this;
g->prev = l;
if (parent) parent->move_child(this,g);
tree_browser->redraw();
}
// move selected widgets in their parent's list:
void earlier_cb(Fl_Widget*,void*) {
Fl_Item *f;
for (f = Fl_Item::first; f; ) {
Fl_Item* nxt = f->next;
if (f->selected) {
Fl_Item* g;
for (g = f->prev; g && g->level > f->level; g = g->prev);
if (g && g->level == f->level && !g->selected) f->move_before(g);
}
f = nxt;
}
}
void later_cb(Fl_Widget*,void*) {
Fl_Item *f;
for (f = Fl_Item::last; f; ) {
Fl_Item* prv = f->prev;
if (f->selected) {
Fl_Item* g;
for (g = f->next; g && g->level > f->level; g = g->next);
if (g && g->level == f->level && !g->selected) g->move_before(f);
}
f = prv;
}
}
// FROM Fl_Widget_Type.cxx
// Called when ui changes what objects are selected:
// p is selected object, null for all deletions (we must throw away
// old panel in that case, as the object may no longer exist)
void selection_changed(Fl_Item *p) {
// store all changes to the current selected objects:
//if (p && the_panel && the_panel->visible()) {
if (p) {
//set_cb(0,0);
// if there was an error, we try to leave the selected set unchanged:
// if (haderror) {
// Fl_Item *q = 0;
// for (Fl_Item *o = Fl_Item::first; o; o = o->next) {
// o->new_selected = o->selected;
// if (!q && o->selected) q = o;
// }
// if (!p || !p->selected) p = q;
// Fl_Item::current = p;
// redraw_browser();
// return;
// }
}
// update the selected flags to new set:
Fl_Item *q = 0;
for (Fl_Item *o = Fl_Item::first; o; o = o->next) {
o->selected = o->new_selected;
if (!q && o->selected) q = o;
}
if (!p || !p->selected) p = q;
Fl_Item::current = p;
}
/*
* 'fltk_strlcpy()' - Safely copy two strings. (BSD style)
* Taken from fltk/src/flstring.c
*/
size_t /* O - Length of string */
fltk_strlcpy(char *dst, /* O - Destination string */
const char *src, /* I - Source string */
size_t size) { /* I - Size of destination string buffer */
size_t srclen; /* Length of source string */
/*
* Figure out how much room is needed...
*/
size --;
srclen = strlen(src);
/*
* Copy the appropriate amount...
*/
if (srclen > size) srclen = size;
memcpy(dst, src, srclen);
dst[srclen] = '\0';
return (srclen);
}
size_t /* O - Length of string */
fltk_strlcat(char *dst, /* O - Destination string */
const char *src, /* I - Source string */
size_t size) { /* I - Size of destination string buffer */
size_t srclen; /* Length of source string */
size_t dstlen; /* Length of destination string */
/*
* * Figure out how much room is left...
* */
dstlen = strlen(dst);
size -= dstlen + 1;
if (!size) return (dstlen); /* No room, return immediately... */
/*
* * Figure out how much room is needed...
* */
srclen = strlen(src);
/*
* * Copy the appropriate amount...
* */
if (srclen > size) srclen = size;
memcpy(dst + dstlen, src, srclen);
dst[dstlen + srclen] = '\0';
return (dstlen + srclen);
}
//
// End of "$Id: Fl_Tree_Browser.cc,v 1.3 2007-02-18 21:46:49 rmf24 Exp $".
//

View File

@ -1,210 +0,0 @@
//
// "$Id: Fl_Tree_Browser.h,v 1.2 2007-02-18 21:46:49 rmf24 Exp $"
//
// This is hacked up FLTK code, and so is released under
// their licence. (below)
// Copyright 2004-2006 by Robert Fernie.
//
// Please report all bugs and problems to "retroshare@lunamutt.com".
//
///////////////////////////////////////////////////////////////////
//
// Widget type header file for the Fast Light Tool Kit (FLTK).
//
// Each object described by Fluid is one of these objects. They
// are all stored in a double-linked list.
//
// There is also a single "factory" instance of each type of this.
// The method "make()" is called on this factory to create a new
// instance of this object. It could also have a "copy()" function,
// but it was easier to implement this by using the file read/write
// that is needed to save the setup anyways.
// Copyright 1998-2004 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This library 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
// Library General Public License for more details.
//
// You should have received a copy of the GNU Library General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA.
//
// Please report all bugs and problems to "fltk-bugs@fltk.org".
//
#include <FL/Fl_Widget.H>
#include <FL/Fl_Menu.H>
#include <stdlib.h>
#include <string>
size_t fltk_strlcpy(char *dst, const char *src, size_t size);
size_t fltk_strlcat(char *dst, const char *src, size_t size);
Fl_Widget *make_tree_browser(int,int,int,int,const char *l=0);
void redraw_browser();
void delete_all(int selected_only);
class Fl_Item {
friend class Tree_Browser;
friend Fl_Widget *make_tree_browser(int,int,int,int,const char *l);
friend class Fl_Window_Type;
virtual void setlabel(const char *); // virtual part of label(char*)
protected:
Fl_Item();
const char *name_;
const char *label_;
const char *callback_;
const char *user_data_;
const char *user_data_type_;
public: // things that should not be public:
Fl_Item *parent; // parent, which is previous in list
char new_selected; // browser highlight
char selected; // copied here by selection_changed()
char open_; // state of triangle in browser
char visible; // true if all parents are open
char rtti; // hack because I have no rtti, this is 0 for base class
int level; // number of parents over this
static Fl_Item *first, *last; // linked list of all objects
Fl_Item *next, *prev; // linked list of all objects
Fl_Item *factory;
const char *callback_name();
public:
virtual ~Fl_Item();
virtual Fl_Item *make(Fl_Item *p) = 0;
void add(Fl_Item *parent); // add as new child
void insert(Fl_Item *n); // insert into list before n
Fl_Item* remove(); // remove from list
void move_before(Fl_Item*); // move before a sibling
virtual const char *title(); // string for browser
virtual const char *type_name() = 0; // type for code output
const char *name() const {return name_;}
void name(const char *);
const char *label() const {return label_;}
void label(const char *);
const char *callback() const {return callback_;}
void callback(const char *);
const char *user_data() const {return user_data_;}
void user_data(const char *);
const char *user_data_type() const {return user_data_type_;}
void user_data_type(const char *);
virtual Fl_Item* click_test(int,int);
virtual void add_child(Fl_Item*, Fl_Item* beforethis);
virtual void move_child(Fl_Item*, Fl_Item* beforethis);
virtual void remove_child(Fl_Item*);
static Fl_Item *current; // most recently picked object
virtual void open(); // what happens when you double-click
// get message number for I18N
int msgnum();
// fake rtti:
virtual int is_parent() const;
virtual int is_widget() const;
virtual int is_button() const;
virtual int is_valuator() const;
virtual int is_menu_item() const;
virtual int is_menu_button() const;
virtual int is_public() const;
virtual int is_group() const;
virtual int is_window() const;
virtual int is_code_block() const;
virtual int is_decl_block() const;
virtual int is_class() const;
virtual int is_file() const;
virtual int pixmapID() { return 0; }
const char* class_name(const int need_nest) const;
};
class Fl_Dir_Item : public Fl_Item {
public:
Fl_Item *make(Fl_Item *p);
void open();
virtual const char *type_name() {return "dir";}
int is_file() const {return 0;}
int is_parent() const; /* {return 1;} */
int pixmapID() { return 8; }
virtual int is_public() const;
};
extern Fl_Dir_Item Fl_Dir_Item_type;
class Fl_File_Item : public Fl_Item {
public:
int size;
std::string filename;
Fl_Item *make(Fl_Item *p);
void open();
virtual const char *type_name() {return "file";}
int is_file() const {return 1;}
int is_parent() const; /* {return 0;} */
virtual int is_public() const;
int pixmapID() { return 9; }
};
extern Fl_File_Item Fl_File_Item_type;
class Fl_Person_Item : public Fl_Item {
public:
Fl_Item *make(Fl_Item *p);
void open();
virtual const char *type_name() {return "Person:";}
int is_file() const {return 0;}
int is_parent() const; /* {return 1;} */
virtual int is_public() const;
int pixmapID() { return 1; }
std::string person_hash;
};
extern Fl_Person_Item Fl_Person_Item_type;
class Fl_Msg_Item : public Fl_Item {
public:
Fl_Item *make(Fl_Item *p);
void open();
virtual const char *type_name() {return "msg";}
int is_file() const {return 0;}
int is_parent() const; /* {return 1;} */
virtual int is_public() const;
int pixmapID() { return 2; }
};
extern Fl_Msg_Item Fl_Msg_Item_type;
// bonus helper function.
void delete_children(Fl_Item *p);
// replace a string pointer with new value, strips leading/trailing blanks:
int storestring(const char *n, const char * & p, int nostrip=0);
//
// End of "$Id: Fl_Tree_Browser.h,v 1.2 2007-02-18 21:46:49 rmf24 Exp $".
//

View File

@ -1,39 +0,0 @@
RS_TOP_DIR = ..
include ../make.opt
STRIP=strip
OBJ = fltkserver.o guitab.o Fl_Funky_Browser.o pqibrowseitem.o pqistrings.o \
Fl_Tree_Browser.o Fl_File_Item.o fltkpqi.o alertbox.o
WIN_OBJ = retrotray.o
# add in windows objs
ifeq ($(OS),Linux)
else
OBJ += $(WIN_OBJ)
endif
all : $(OBJ) RetroShare
RetroShare : $(OBJ)
$(CC) $(CFLAGS) -static -o RetroShare $(OBJ) -lfltk $(RSLIBS)
# $(STRIP) -s RetroShare.exe
# $(STRIP) -s RetroShare
.cc.o:
$(CC) $(CFLAGS) -c $<
clean:
-$(RM) $(OBJ)
clobber: clean
-$(RM) RetroShare

View File

@ -1,197 +0,0 @@
/*
* "$Id: alertbox.cc,v 1.3 2007-02-18 21:46:49 rmf24 Exp $"
*
* FltkGUI for RetroShare.
*
* Copyright 2004-2006 by Robert Fernie.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License Version 2 as published by the Free Software Foundation.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*
* Please report all bugs and problems to "retroshare@lunamutt.com".
*
*/
#include "fltkgui/pqistrings.h"
#include "fltkgui/alertbox.h"
#include <sstream>
alertBox::alertBox(Fl_Window *w, Fl_Text_Display *box)
:showThreshold(2), alert_win(w), alert_box(box),
maxMessages(40)
{
/* can't call virtual fn here! */
alertBox::loadInitMsg();
return;
}
alertBox::~alertBox()
{
/* clean up msgs */
return;
}
int alertBox::loadInitMsg()
{
sendMsg(0, 10,"Welcome to RetroShare ----", "");
return 1;
}
int chatterBox::loadInitMsg()
{
sendMsg(0, 10,"", "");
sendMsg(0, 10,"\tThis is your Universal ChatterBox Window", "");
sendMsg(0, 10,"", "");
sendMsg(0, 10,"\tYou can use it to chat with everyone", "");
sendMsg(0, 10,"\tthat is online at this moment", "");
sendMsg(0, 10,"", "");
sendMsg(0, 10,"\tSometimes the conversations can seem", "");
sendMsg(0, 10,"\tweird and wonderful, if you're not", "");
sendMsg(0, 10,"\tconnected all the same people.", "");
sendMsg(0, 10,"", "");
sendMsg(0, 10,"\tIt is a bit of an experiment, so", "");
sendMsg(0, 10,"\tlet me know if you enjoy it or hate it!", "");
sendMsg(0, 10,"", "");
sendMsg(0, 10,"Note. Your ChatterBox only pop up once, when the", "");
sendMsg(0, 10,"first message is received. After that it'll leave", "");
sendMsg(0, 10,"you in peace. Use the \"Chat\" Button on the main", "");
sendMsg(0, 10,"window to open and close your ChatterBox", "");
sendMsg(0, 10,"", "");
sendMsg(0, 10,"", "");
return 1;
}
int alertBox::sendMsg(int type, int severity,
std::string msg, std::string source)
{
alertMsg newal;
newal.epoch = time(NULL);
newal.type = type;
newal.severity = severity;
newal.msg = msg;
newal.source = source;
msgs.push_front(newal);
if (msgs.size() > (unsigned) maxMessages)
{
msgs.pop_back();
}
displayMsgs();
showMsgs(severity);
return 1;
}
int alertBox::showMsgs(int severity)
{
if (severity <= showThreshold)
{
alert_win -> show();
return 1;
}
return 0;
}
/* chatterbox will only pop up for the first chat */
int chatterBox::showMsgs(int severity)
{
if ((firstMsg) && (alertBox::showMsgs(severity)))
{
firstMsg = false;
return 1;
}
return 0;
}
void alertBox::displayMsgs()
{
std::ostringstream msg;
std::deque<alertMsg>::reverse_iterator it;
for(it = msgs.rbegin(); it != msgs.rend(); it++)
{
if (it -> severity <= showThreshold)
{
msg << "----------------->>>> ALERT: ";
msg << timeFormat(it -> epoch, TIME_FORMAT_NORMAL);
msg << std::endl;
msg << std::endl;
msg << it -> msg << std::endl;
msg << std::endl;
msg << "<<<<----------------";
msg << std::endl;
msg << std::endl;
}
else
{
msg << timeFormat(it -> epoch, TIME_FORMAT_NORMAL);
msg << ":" << it -> msg << std::endl;
msg << std::endl;
}
}
Fl_Text_Buffer *buf = alert_box -> buffer();
buf -> text(msg.str().c_str());
int c = buf -> length();
int lines = buf -> count_lines(0, c-1);
// want to scroll to the bottom.
alert_box -> scroll(lines, 0);
}
void chatterBox::displayMsgs()
{
std::ostringstream msg;
std::deque<alertMsg>::reverse_iterator it;
std::string lsrc = "";
int lts = 0;
for(it = msgs.rbegin(); it != msgs.rend(); it++)
{
if ((it->epoch-lts > 30) || // more than 30 seconds.
(it->source != lsrc)) // not same source
{
msg << "\t\t\t\t\t\t[";
msg << it->source;
msg << " @ ";
msg << timeFormat(it -> epoch, TIME_FORMAT_NORMAL);
msg << "]";
msg << std::endl;
}
msg << it -> msg;
msg << std::endl;
/* store last one */
lts = it->epoch;
lsrc = it->source;
}
Fl_Text_Buffer *buf = alert_box -> buffer();
buf -> text(msg.str().c_str());
int c = buf -> length();
int lines = buf -> count_lines(0, c-1);
// want to scroll to the bottom.
alert_box -> scroll(lines, 0);
}

View File

@ -1,91 +0,0 @@
/*
* "$Id: alertbox.h,v 1.4 2007-02-18 21:46:49 rmf24 Exp $"
*
* FltkGUI for RetroShare.
*
* Copyright 2004-2006 by Robert Fernie.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License Version 2 as published by the Free Software Foundation.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*
* Please report all bugs and problems to "retroshare@lunamutt.com".
*
*/
#ifndef RETROSHARE_ALERT_H
#define RETROSHARE_ALERT_H
#include <string>
#include <deque>
#include <FL/Fl_Window.H>
#include <FL/Fl_Text_Display.H>
class alertMsg
{
public:
int epoch;
int type;
int severity;
std::string msg;
std::string source;
};
class alertBox
{
public:
alertBox(Fl_Window *w, Fl_Text_Display *box);
virtual ~alertBox();
int sendMsg(int type, int severity,
std::string msg, std::string source);
protected:
int loadInitMsg();
virtual void displayMsgs();
virtual int showMsgs(int severity);
int showThreshold; // At what severity we show ourselves.
Fl_Window *alert_win;
Fl_Text_Display *alert_box;
int maxMessages;
std::deque<alertMsg> msgs;
};
class chatterBox: public alertBox
{
public:
chatterBox(Fl_Window *w, Fl_Text_Display *box)
:alertBox(w, box), firstMsg(true)
{
chatterBox::loadInitMsg();
return;
}
protected:
int loadInitMsg();
virtual void displayMsgs();
virtual int showMsgs(int severity);
private:
bool firstMsg;
};
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,222 +0,0 @@
/*
* "$Id: fltkserver.h,v 1.15 2007-02-18 21:46:49 rmf24 Exp $"
*
* FltkGUI for RetroShare.
*
* Copyright 2004-2006 by Robert Fernie.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License Version 2 as published by the Free Software Foundation.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*
* Please report all bugs and problems to "retroshare@lunamutt.com".
*
*/
#ifndef MRK_FLTK_PQI_INTERFACE
#define MRK_FLTK_PQI_INTERFACE
#include "server/filedexserver.h"
#include "pqi/pqipersongrp.h"
#include "pqi/pqissl.h"
#include "fltkgui/Fl_Funky_Browser.h"
#include "fltkgui/pqistrings.h"
#include "fltkgui/alertbox.h"
#include "fltkgui/guitab.h"
#include "pqi/p3disc.h"
class fltkserver
{
public:
fltkserver();
~fltkserver();
int init();
int run();
// setup pqissl
int setuppqissl(filedexserver *fd, pqipersongrp *ph, sslroot *r, UserInterface *u);
int addAutoDiscovery(p3disc *a) {ad = a; return 1; }
int addAlerts(alertBox *msg, alertBox *chat);
int ownchatmsg(std::string);
int chatmsg(std::string msg, std::string source);
int alertmsg(int type, int sev, std::string msg, std::string source);
// flags to indicate if something needs updating.
// This are public advisory flags that
// can be altered by callbacks.
bool cert_list_ok;
bool cert_item_ok;
bool cert_neighbour_list_ok;
bool cert_neighbour_item_ok;
bool search_list_ok;
bool result_list_ok;
bool result_item_ok;
bool msg_list_ok;
bool msg_item_ok;
bool msg_dialog_ok;
bool transfer_ok;
bool transfer_item_ok;
bool dir_list_ok;
bool save_dir_ok;
bool server_set_ok;
bool transfer_rates_ok;
// Neighbour fns
cert * cert_get_current_neighbour();
int cert_add_neighbour();
int neigh_display(cert*);
int neigh_update_auth();
cert * cert_get_current();
int cert_allow_current();
int cert_deny_current();
int cert_listen_current();
int cert_connect_current();
int cert_remove_current();
int cert_tag_current();
/* int cert_save_config(const char *fname); */
int cert_save_config();
int cert_load_gui_config();
int cert_save_servaddr();
int cert_saveaddr_connect();
int cert_check_auto();
int cert_toggle_auto();
int cert_sign_current();
int cert_trust_current_toggle();
int cert_update_auth();
std::string getHomePath();
int config_remove_dir();
int file_select(int);
int file_updateName();
int file_completeIO();
int config_server_update();
int config_server_change();
int fselect_type; // what type of file selection is in progress.
int search_new(); // read words from keyboard.
int search_download();
int search_recommend();
int search_remove();
// new results display system.
int update_search_browser();
int set_recommend(PQFileItem *rec);
PQFileItem *get_recommend();
int getnsend_chat();
int msg_send();
int msg_channel_select();
int msg_remove();
int msg_reply();
int download_recommend();
int transfer_select();
int transfer_cancel();
int transfer_clear();
int transfer_rates();
int load_dir(std::string person, std::string dir);
int dirlist_download();
int dirlist_recommend();
private:
int update();
int update_quick_stats();
int update_other_stats();
int update_certs();
// display certificate details.
int cert_display(cert*, bool);
int update_neighbour_certs();
int update_search();
int update_msgs();
int update_transfer();
int update_config();
int update_dirs();
int update_dirlist();
int check_dirlist();
int check_dirlist2();
#ifdef PQI_USE_CHANNELS
int update_channels();
bool channel_list_ok;
bool channel_msg_list_ok;
bool channel_msg_item_ok;
#endif
std::list<FileTransferItem *> transfers;
// pointers to pqissl stuff.
filedexserver *server;
pqipersongrp *pqih;
sslroot *sslr;
UserInterface *ui;
p3disc *ad;
alertBox *msg;
alertBox *chat;
// recommendation.
PQFileItem *recommend;
// File Import/Export Flags.
bool fileio_import;
int loop;
Fl_Funky_Browser *search_browser;
};
#define FILE_CHOOSER_IMPORT 1
#define FILE_CHOOSER_EXPORT 2
#define FILE_CHOOSER_DIR 3
#define FILE_CHOOSER_SAVEDIR 4
#define FILE_CHOOSER_KEY 5
#define FILE_CHOOSER_CERT 6
/* Helper function to convert windows paths
* into unix (ie switch \ to /) for FLTK's file chooser
*/
std::string make_path_unix(std::string winpath);
#endif

View File

@ -1,675 +0,0 @@
// generated by Fast Light User Interface Designer (fluid) version 1.0107
#include "guitab.h"
Fl_Double_Window* UserInterface::make_windows() {
Fl_Double_Window* w;
{ Fl_Double_Window* o = main_win = new Fl_Double_Window(710, 535, "RetroShare");
w = o;
o->box(FL_DOWN_BOX);
o->user_data((void*)(this));
{ Fl_Tabs* o = gui_tabs = new Fl_Tabs(10, 10, 690, 470);
o->box(FL_UP_BOX);
{ Fl_Group* o = neighbours_tab = new Fl_Group(15, 40, 680, 435, "Connect");
o->labelfont(1);
{ Fl_Button* o = new Fl_Button(50, 439, 280, 31, "Load Certificate from File");
o->callback((Fl_Callback*)file_import);
}
{ Fl_Funky_Browser* o = cert_neighbour_list = new Fl_Funky_Browser(25, 70, 350, 355, "", 4);
o->box(FL_NO_BOX);
o->color(FL_BACKGROUND2_COLOR);
o->selection_color(FL_SELECTION_COLOR);
o->labeltype(FL_NORMAL_LABEL);
o->labelfont(0);
o->labelsize(14);
o->labelcolor(FL_FOREGROUND_COLOR);
o->textfont(4);
o->callback((Fl_Callback*)cert_neighbour_list_select);
o->align(FL_ALIGN_BOTTOM);
o->when(FL_WHEN_RELEASE_ALWAYS);
}
{ Fl_Button* o = neigh_add_button = new Fl_Button(420, 440, 240, 30, "Sign + Add to Friends >>>");
o->callback((Fl_Callback*)cert_move_to_friends);
}
{ Fl_Box* o = new Fl_Box(35, 49, 290, 20, "Your Neighbour List");
o->box(FL_FLAT_BOX);
o->labelfont(1);
}
{ Fl_Input* o = neigh_authcode = new Fl_Input(540, 397, 70, 30, "AUTH CODE:");
o->labelfont(1);
o->callback((Fl_Callback*)neigh_auth_callback);
o->when(FL_WHEN_CHANGED);
}
{ Fl_Group* o = new Fl_Group(390, 54, 295, 305);
o->box(FL_DOWN_BOX);
{ Fl_Box* o = new Fl_Box(395, 65, 125, 20, "Peer Details");
o->box(FL_FLAT_BOX);
o->labelfont(1);
o->labelsize(16);
}
{ Fl_Browser* o = neigh_signers = new Fl_Browser(440, 195, 225, 140, "Certificate signers");
o->type(2);
o->textfont(4);
o->callback((Fl_Callback*)cert_neigh_signers_select);
Fl_Group::current()->resizable(o);
}
neigh_name = new Fl_Output(450, 90, 226, 20, "Name:");
neigh_org = new Fl_Output(450, 115, 226, 20, "Org:");
neigh_loc = new Fl_Output(450, 140, 225, 20, "Loc:");
neigh_country = new Fl_Output(495, 165, 168, 20, "Country:");
neigh_trust = new Fl_Output(565, 65, 110, 20, "Trust:");
o->end();
}
{ Fl_Box* o = neigh_auth_notice = new Fl_Box(405, 369, 270, 26, "AUTH CODE REQUIRED");
o->box(FL_FLAT_BOX);
o->labelfont(1);
o->labelsize(18);
o->labelcolor(FL_YELLOW);
}
o->end();
}
{ Fl_Group* o = connect_tab = new Fl_Group(15, 40, 680, 435, "Friends");
o->labelfont(1);
o->hide();
{ Fl_Button* o = new Fl_Button(62, 440, 185, 25, "<<< Remove Friend");
o->callback((Fl_Callback*)cert_remove_cert);
}
{ Fl_Button* o = new Fl_Button(264, 440, 185, 25, "Configure Friend");
o->callback((Fl_Callback*)cert_show_config);
}
{ Fl_Funky_Browser* o = cert_list = new Fl_Funky_Browser(25, 70, 660, 360, "", 5);
o->type(2);
o->box(FL_NO_BOX);
o->color(FL_BACKGROUND2_COLOR);
o->selection_color(FL_SELECTION_COLOR);
o->labeltype(FL_NORMAL_LABEL);
o->labelfont(0);
o->labelsize(14);
o->labelcolor(FL_FOREGROUND_COLOR);
o->textfont(4);
o->callback((Fl_Callback*)cert_list_select);
o->align(FL_ALIGN_BOTTOM);
o->when(FL_WHEN_RELEASE_ALWAYS);
}
{ Fl_Button* o = new Fl_Button(466, 440, 185, 25, "Export Friend");
o->callback((Fl_Callback*)file_export);
}
{ Fl_Box* o = new Fl_Box(190, 50, 340, 20, "Your Friends ");
o->box(FL_FLAT_BOX);
o->labelfont(1);
}
o->end();
}
{ Fl_Group* o = new Fl_Group(15, 40, 680, 435, "File Listing");
o->labelfont(1);
o->hide();
{ Fl_Widget *o = file_results = make_tree_browser(25, 50, 660, 380);
}
// { Fl_File_Browser* o = file_results = new Fl_File_Browser(45, 50, 625, 380);
// o->callback((Fl_Callback*)file_result_select);
// }
{ Fl_Button* o = file_download_button = new Fl_Button(65, 440, 185, 25, "Download");
o->callback((Fl_Callback*)file_download);
}
{ Fl_Button* o = file_recommend_button = new Fl_Button(465, 440, 185, 25, "Recommend to Friends");
o->callback((Fl_Callback*)file_recommend);
o->deactivate();
}
{ Fl_Button* o = file_channel_button = new Fl_Button(265, 440, 185, 25, "Broadcast on Channel");
o->callback((Fl_Callback*)file_channel_broadcast);
o->deactivate();
}
o->end();
}
{ Fl_Group* o = new Fl_Group(15, 40, 680, 435, "Search ");
o->labelfont(1);
o->hide();
{ Fl_Input* o = new_search = new Fl_Input(105, 50, 225, 25, "Terms:");
o->labelfont(1);
o->callback((Fl_Callback*)do_new_search);
}
{ Fl_Button* o = new Fl_Button(535, 50, 125, 25, "Remove Search");
o->callback((Fl_Callback*)search_remove);
}
{ Fl_Button* o = recommend_button = new Fl_Button(460, 440, 185, 25, "Recommend to Friends");
o->callback((Fl_Callback*)search_recommend);
o->deactivate();
}
{ Fl_Funky_Browser* o = srch_results = new Fl_Funky_Browser(25, 80, 660, 350, "", 5);
o->type(2);
o->box(FL_NO_BOX);
o->color(FL_BACKGROUND2_COLOR);
o->selection_color(FL_SELECTION_COLOR);
o->labeltype(FL_NORMAL_LABEL);
o->labelfont(0);
o->labelsize(14);
o->labelcolor(FL_FOREGROUND_COLOR);
o->callback((Fl_Callback*)search_result_select);
o->align(FL_ALIGN_BOTTOM);
o->when(FL_WHEN_RELEASE_ALWAYS);
}
{ Fl_Button* o = search_button = new Fl_Button(340, 50, 79, 25, "Search");
o->labelfont(1);
o->callback((Fl_Callback*)do_search_button);
}
{ Fl_Button* o = download_button = new Fl_Button(60, 440, 185, 25, "Download");
o->callback((Fl_Callback*)search_download);
}
{ Fl_Button* o = search_channel_button = new Fl_Button(260, 440, 185, 25, "Broadcast on Channel");
o->callback((Fl_Callback*)search_channel_broadcast);
o->deactivate();
}
o->end();
}
{ Fl_Group* o = new Fl_Group(15, 40, 680, 435, "File Transfer");
o->hide();
{ Fl_Funky_Browser* o = transfer_downloads = new Fl_Funky_Browser(25, 50, 660, 250, "", 5);
o->type(2);
o->box(FL_NO_BOX);
o->color(FL_BACKGROUND2_COLOR);
o->selection_color(FL_SELECTION_COLOR);
o->labeltype(FL_NORMAL_LABEL);
o->labelfont(0);
o->labelsize(14);
o->labelcolor(FL_FOREGROUND_COLOR);
o->callback((Fl_Callback*)transfer_select);
o->align(FL_ALIGN_BOTTOM);
o->when(FL_WHEN_RELEASE_ALWAYS);
}
{ Fl_Button* o = transfer_cancel = new Fl_Button(70, 310, 165, 25, "Cancel");
o->callback((Fl_Callback*)file_transfer_cancel);
}
{ Fl_Button* o = transfer_clear = new Fl_Button(275, 310, 155, 25, "Clear Finished");
o->callback((Fl_Callback*)file_transfer_clear);
}
{ Fl_Text_Display* o = transfer_overview = new Fl_Text_Display(25, 345, 450, 120);
o->textfont(5);
}
{ Fl_Counter* o = rate_total = new Fl_Counter(510, 380, 135, 25, "Max Total Data Rate (kB/s)");
o->step(0.1);
o->callback((Fl_Callback*)file_transfer_total_rate);
}
{ Fl_Counter* o = rate_indiv = new Fl_Counter(510, 425, 135, 25, "Rate Per Person (kB/s)");
o->step(0.1);
o->callback((Fl_Callback*)file_transfer_indiv_rate);
}
o->end();
}
{ Fl_Group* o = new Fl_Group(15, 40, 680, 435, "Messages");
o->labelfont(1);
o->hide();
o->deactivate();
{ Fl_Funky_Browser* o = msg_list = new Fl_Funky_Browser(25, 65, 660, 270, "", 5);
o->type(2);
o->box(FL_NO_BOX);
o->color(FL_BACKGROUND2_COLOR);
o->selection_color(FL_SELECTION_COLOR);
o->labeltype(FL_NORMAL_LABEL);
o->labelfont(0);
o->labelsize(14);
o->labelcolor(FL_FOREGROUND_COLOR);
o->callback((Fl_Callback*)msg_select);
o->align(FL_ALIGN_BOTTOM);
o->when(FL_WHEN_RELEASE_ALWAYS);
}
{ Fl_Button* o = new Fl_Button(45, 350, 125, 25, "New Msg");
o->callback((Fl_Callback*)msg_dialog_show);
}
{ Fl_Button* o = new Fl_Button(45, 380, 125, 25, "Reply to Msg");
o->callback((Fl_Callback*)msg_dialog_reply);
}
{ Fl_Button* o = new Fl_Button(245, 450, 380, 25, "(2) -- Get The Recommended File");
o->labelfont(1);
o->callback((Fl_Callback*)msg_get_recommendation);
}
{ Fl_Button* o = new Fl_Button(45, 410, 125, 25, "Remove Msg");
o->callback((Fl_Callback*)msg_remove);
}
{ Fl_Text_Display* o = msg_details = new Fl_Text_Display(180, 340, 485, 105);
o->textfont(5);
}
{ Fl_Box* o = new Fl_Box(55, 45, 305, 20, "(1) -- Select Message");
o->box(FL_FLAT_BOX);
o->labelfont(1);
}
o->end();
}
{ Fl_Group* o = channels = new Fl_Group(15, 40, 680, 435, "Channels");
o->hide();
o->deactivate();
{ Fl_Funky_Browser* o = channel_list = new Fl_Funky_Browser(25, 80, 660, 225, "", 5);
o->type(2);
o->box(FL_NO_BOX);
o->color(FL_BACKGROUND2_COLOR);
o->selection_color(FL_SELECTION_COLOR);
o->labeltype(FL_NORMAL_LABEL);
o->labelfont(0);
o->labelsize(14);
o->labelcolor(FL_FOREGROUND_COLOR);
o->callback((Fl_Callback*)channel_list_select);
o->align(FL_ALIGN_BOTTOM);
o->when(FL_WHEN_RELEASE_ALWAYS);
}
{ Fl_Box* o = new Fl_Box(40, 61, 170, 19, "Available Channels");
o->labelfont(1);
}
{ Fl_Group* o = new Fl_Group(25, 310, 655, 160);
o->box(FL_DOWN_BOX);
{ Fl_Funky_Browser* o = channel_file_list = new Fl_Funky_Browser(35, 345, 635, 120, "", 5);
o->box(FL_NO_BOX);
o->color(FL_BACKGROUND2_COLOR);
o->selection_color(FL_SELECTION_COLOR);
o->labeltype(FL_NORMAL_LABEL);
o->labelfont(0);
o->labelsize(14);
o->labelcolor(FL_FOREGROUND_COLOR);
o->callback((Fl_Callback*)channel_file_list_select);
o->align(FL_ALIGN_BOTTOM);
o->when(FL_WHEN_RELEASE_ALWAYS);
}
{ Fl_Output* o = channel_selected_name = new Fl_Output(185, 315, 270, 25, "Msgs on Channel");
o->labelfont(1);
}
{ Fl_Button* o = channel_show_button = new Fl_Button(485, 315, 160, 25, "Show Msg Details");
o->callback((Fl_Callback*)channel_show_callback);
}
o->end();
}
{ Fl_Button* o = channel_delete_button = new Fl_Button(290, 50, 160, 25, "Delete Channel");
o->callback((Fl_Callback*)channel_delete_callback);
}
{ Fl_Button* o = channel_create_button = new Fl_Button(475, 50, 160, 25, "Create Channel Msg");
o->callback((Fl_Callback*)channel_create);
}
o->end();
}
{ Fl_Group* o = new Fl_Group(15, 40, 680, 435, "Config");
o->hide();
{ Fl_Group* o = new Fl_Group(460, 55, 210, 80);
o->box(FL_DOWN_BOX);
o->hide();
{ Fl_Check_Button* o = config_local_disc = new Fl_Check_Button(490, 80, 145, 25, "local discovery");
o->down_box(FL_DOWN_BOX);
}
{ Fl_Check_Button* o = config_remote_disc = new Fl_Check_Button(490, 100, 145, 25, "remote discovery");
o->down_box(FL_DOWN_BOX);
}
{ Fl_Box* o = new Fl_Box(470, 60, 165, 20, "Discovery Options:");
o->box(FL_FLAT_BOX);
o->labelfont(1);
}
o->end();
}
{ Fl_Group* o = new Fl_Group(25, 225, 405, 240);
o->box(FL_DOWN_BOX);
{ Fl_Browser* o = config_search_dir = new Fl_Browser(40, 245, 355, 105);
o->type(2);
}
{ Fl_Button* o = new Fl_Button(40, 370, 135, 25, "Add Directory");
o->callback((Fl_Callback*)config_add_dir);
}
{ Fl_Button* o = new Fl_Button(40, 400, 135, 25, "Remove Directory");
o->callback((Fl_Callback*)config_remove_dir);
}
config_save_dir = new Fl_Output(145, 435, 250, 20, "Save Directory");
{ Fl_Button* o = new Fl_Button(230, 405, 165, 25, "Select save directory");
o->callback((Fl_Callback*)config_save_dir_change);
}
{ Fl_Box* o = new Fl_Box(41, 230, 174, 15, "Share Directories:");
o->box(FL_FLAT_BOX);
o->labelfont(1);
}
o->end();
}
{ Fl_Group* o = new Fl_Group(25, 55, 405, 160);
o->box(FL_DOWN_BOX);
config_local_addr = new Fl_Input(165, 80, 130, 20, "Local Address:");
config_local_port = new Fl_Value_Input(335, 80, 60, 20, "Port:");
config_server_addr = new Fl_Input(165, 145, 130, 25, "External Address:");
config_server_port = new Fl_Value_Input(335, 145, 60, 25, "Port:");
{ Fl_Check_Button* o = config_firewall = new Fl_Check_Button(195, 100, 190, 25, "behind firewall");
o->down_box(FL_DOWN_BOX);
o->callback((Fl_Callback*)config_server_update);
}
{ Fl_Check_Button* o = config_forward = new Fl_Check_Button(195, 120, 190, 25, "forwarded external port");
o->down_box(FL_DOWN_BOX);
o->callback((Fl_Callback*)config_server_update);
}
{ Fl_Box* o = new Fl_Box(45, 60, 150, 20, "Server Settings:");
o->box(FL_FLAT_BOX);
o->labelfont(1);
}
{ Fl_Button* o = config_server_button = new Fl_Button(185, 180, 190, 25, "Change + Restart Server");
o->callback((Fl_Callback*)config_server_change);
}
o->end();
}
{ Fl_Button* o = new Fl_Button(485, 434, 170, 25, "Save Configuration");
o->callback((Fl_Callback*)cert_save_config);
}
o->end();
}
{ Fl_Group* o = about_help_tab = new Fl_Group(15, 40, 680, 435, "About");
o->hide();
help_view = new Fl_Help_View(25, 50, 660, 415);
o->end();
}
o->end();
}
onlinecounter = new Fl_Value_Output(100, 485, 35, 20, "#Online:");
new Fl_Value_Output(100, 505, 35, 20, "New Msgs:");
{ Fl_Button* o = new Fl_Button(605, 490, 85, 30, "Hide");
o->callback((Fl_Callback*)gui_quit);
}
new Fl_Text_Display(140, 485, 360, 40);
{ Fl_Button* o = chat_button = new Fl_Button(510, 490, 85, 30, "Chat");
o->callback((Fl_Callback*)chat_open_callback);
}
o->end();
}
{ Fl_Double_Window* o = msg_dialog = new Fl_Double_Window(580, 355, "Msg Dialog");
w = o;
o->user_data((void*)(this));
msg_online = new Fl_Check_Browser(20, 25, 140, 215);
{ Fl_Button* o = msg_button_select = new Fl_Button(20, 240, 140, 25, "Select All/None");
o->callback((Fl_Callback*)msg_toggle_select);
}
{ Fl_Text_Editor* o = msg_text = new Fl_Text_Editor(175, 25, 385, 240, "(1) -- Enter Message Text:");
o->labelfont(1);
}
msg_recommend = new Fl_Output(175, 275, 385, 30, "Recommendation:");
{ Fl_Button* o = new Fl_Button(245, 315, 160, 30, "(2) -- Send Msg");
o->labelfont(1);
o->callback((Fl_Callback*)msg_send);
}
{ Fl_Button* o = new Fl_Button(415, 315, 115, 30, "Cancel");
o->callback((Fl_Callback*)msg_dialog_hide);
}
o->end();
}
{ Fl_Double_Window* o = cert_config = new Fl_Double_Window(430, 535, "Certificate Configuration");
w = o;
o->user_data((void*)(this));
{ Fl_Group* o = new Fl_Group(10, 10, 410, 490);
o->box(FL_UP_BOX);
{ Fl_Group* o = new Fl_Group(25, 355, 380, 135);
o->box(FL_DOWN_BOX);
cert_server = new Fl_Input(155, 430, 130, 25, "Server Address:");
{ Fl_Button* o = new Fl_Button(165, 460, 220, 25, "Save and attempt to Connect");
o->callback((Fl_Callback*)cert_save_n_connect);
}
{ Fl_Button* o = new Fl_Button(35, 460, 115, 25, "Save Address");
o->callback((Fl_Callback*)cert_save_servaddr);
}
cert_port = new Fl_Value_Input(325, 430, 60, 25, "Port:");
{ Fl_Check_Button* o = cert_connect = new Fl_Check_Button(30, 410, 365, 20, "Outgoing Connections (Server Address Required)");
o->down_box(FL_DOWN_BOX);
o->callback((Fl_Callback*)cert_connect_change);
}
{ Fl_Check_Button* o = cert_allow = new Fl_Check_Button(30, 380, 115, 20, "Allow Access");
o->down_box(FL_DOWN_BOX);
o->callback((Fl_Callback*)cert_allow_change);
}
{ Fl_Check_Button* o = cert_listen = new Fl_Check_Button(30, 395, 170, 20, "Listen for connection");
o->down_box(FL_DOWN_BOX);
o->callback((Fl_Callback*)cert_listen_change);
}
{ Fl_Check_Button* o = cert_local = new Fl_Check_Button(220, 385, 130, 20, "Local Network");
o->down_box(FL_DOWN_BOX);
o->callback((Fl_Callback*)cert_local_change);
}
{ Fl_Check_Button* o = cert_auto = new Fl_Check_Button(220, 362, 140, 20, "Auto Connect");
o->down_box(FL_DOWN_BOX);
o->labelfont(1);
o->callback((Fl_Callback*)cert_auto_change);
}
{ Fl_Box* o = new Fl_Box(32, 363, 190, 20, "Connectivity Options:");
o->box(FL_FLAT_BOX);
o->labelfont(1);
}
o->end();
}
cert_status = new Fl_Output(80, 20, 130, 25, "Status:");
cert_details = new Fl_Text_Display(25, 50, 380, 210);
{ Fl_Group* o = new Fl_Group(25, 267, 380, 82);
o->box(FL_DOWN_BOX);
{ Fl_Button* o = cert_sign_button = new Fl_Button(239, 295, 145, 29, "Sign Certificate");
o->callback((Fl_Callback*)cert_sign);
}
{ Fl_Check_Button* o = cert_trust_person = new Fl_Check_Button(95, 323, 230, 25, "Trust This Person\'s Signature");
o->down_box(FL_DOWN_BOX);
o->callback((Fl_Callback*)cert_trust_person_change);
}
{ Fl_Input* o = cert_authcode = new Fl_Input(145, 295, 80, 28, "AUTH CODE:");
o->labelfont(1);
o->callback((Fl_Callback*)cert_auth_callback);
o->when(FL_WHEN_CHANGED);
}
{ Fl_Box* o = new Fl_Box(35, 272, 360, 20, "Authenticate Friend By Entering Their Code");
o->box(FL_FLAT_BOX);
o->labelfont(1);
}
o->end();
}
cert_trust = new Fl_Output(260, 20, 140, 25, "Trust:");
o->end();
}
{ Fl_Button* o = new Fl_Button(305, 505, 100, 25, "Done");
o->callback((Fl_Callback*)cert_hide_config);
}
o->end();
}
{ Fl_Double_Window* o = new Fl_Double_Window(360, 290);
w = o;
o->user_data((void*)(this));
{ //Fl_File_Chooser* o = file_chooser = new Fl_File_Chooser(5, 5, 350, 280);
Fl_File_Chooser* o = file_chooser = new Fl_File_Chooser("/",
"Certificate Files (*.{pem,pqi})", 0, "Select File/Dir");
// o->box(FL_NO_BOX);
// o->color(FL_BACKGROUND_COLOR);
// o->selection_color(FL_BACKGROUND_COLOR);
// o->labeltype(FL_NORMAL_LABEL);
// o->labelfont(0);
// o->labelsize(14);
// o->labelcolor(FL_FOREGROUND_COLOR);
// o->callback((Fl_Callback*)file_chooser_select);
o->callback(file_chooser_select);
// o->align(FL_ALIGN_TOP);
// o->when(FL_WHEN_RELEASE);
// o->end();
}
o->end();
}
{ Fl_Double_Window* o = welcome_window = new Fl_Double_Window(405, 580, "RetroShare Setup");
w = o;
o->user_data((void*)(this));
{ Fl_Group* o = new Fl_Group(10, 10, 385, 35);
o->box(FL_DOWN_BOX);
{ Fl_Box* o = new Fl_Box(85, 15, 230, 20, "Welcome to RetroShare");
o->box(FL_FLAT_BOX);
o->labelfont(1);
o->labelsize(16);
}
o->end();
}
{ Fl_Group* o = new Fl_Group(10, 55, 385, 140);
o->box(FL_DOWN_BOX);
{ Fl_Box* o = new Fl_Box(75, 65, 285, 20, "Please login ....");
o->box(FL_FLAT_BOX);
o->labelfont(1);
}
load_name = new Fl_Output(90, 90, 250, 25, "Name:");
{ Fl_Input* o = load_passwd = new Fl_Input(90, 125, 250, 25, "Password");
o->type(5);
o->callback((Fl_Callback*)load_passwd_callback);
o->when(FL_WHEN_ENTER_KEY);
}
{ Fl_Button* o = load_button = new Fl_Button(110, 160, 210, 30, "Load Existing User");
o->callback((Fl_Callback*)load_existing);
}
o->end();
}
{ Fl_Group* o = new Fl_Group(10, 205, 385, 365);
o->box(FL_DOWN_BOX);
{ Fl_Box* o = new Fl_Box(55, 210, 300, 20, "Or create a New User...");
o->box(FL_FLAT_BOX);
o->labelfont(1);
}
{ Fl_Group* o = new Fl_Group(50, 360, 300, 5);
o->box(FL_UP_BOX);
o->end();
}
{ Fl_Group* o = new Fl_Group(50, 440, 300, 5);
o->box(FL_UP_BOX);
o->end();
}
{ Fl_Group* o = new Fl_Group(50, 511, 300, 5);
o->box(FL_UP_BOX);
o->end();
}
gen_name = new Fl_Input(120, 235, 250, 25, "Name:");
gen_org = new Fl_Input(120, 265, 250, 25, "Organisation:");
gen_loc = new Fl_Input(120, 295, 250, 25, "Location:");
gen_country = new Fl_Input(120, 325, 250, 25, "Country:");
{ Fl_Input* o = gen_passwd = new Fl_Input(170, 375, 130, 25, "New Password");
o->type(5);
}
{ Fl_Input* o = gen_passwd2 = new Fl_Input(170, 405, 130, 25, "Password (Again)");
o->type(5);
}
{ Fl_Check_Button* o = gen_trusted_tick_box = new Fl_Check_Button(50, 450, 305, 20, "Load Trusted Certificate (Optional)");
o->down_box(FL_DOWN_BOX);
o->labelfont(1);
o->callback((Fl_Callback*)gen_trusted_tick_callback);
}
gen_trusted_peer = new Fl_Output(105, 474, 135, 25, "Friend:");
{ Fl_Button* o = gen_trusted_select_button = new Fl_Button(252, 470, 93, 30, "Select File");
o->callback((Fl_Callback*)gen_load_trusted);
}
{ Fl_Button* o = gen_button = new Fl_Button(100, 528, 210, 30, "Generate New Certificate");
o->callback((Fl_Callback*)generate_certificate);
}
o->end();
}
o->end();
}
{ Fl_Double_Window* o = chatter_window = new Fl_Double_Window(455, 435, "ChatterBox");
w = o;
o->user_data((void*)(this));
chatter_box = new Fl_Text_Display(5, 10, 445, 370);
{ Fl_Input* o = chatter_input = new Fl_Input(5, 390, 445, 40);
o->callback((Fl_Callback*)chatterbox_message);
o->when(FL_WHEN_ENTER_KEY);
}
o->end();
}
{ Fl_Double_Window* o = alert_window = new Fl_Double_Window(540, 200, "Alerts");
w = o;
o->user_data((void*)(this));
{ Fl_Return_Button* o = alert_okay = new Fl_Return_Button(75, 175, 180, 20, "OK");
o->callback((Fl_Callback*)alert_okay_msg);
}
alert_box = new Fl_Text_Display(15, 5, 515, 165);
{ Fl_Button* o = alert_cancel = new Fl_Button(270, 175, 180, 20, "Cancel");
o->labelfont(3);
o->labelsize(16);
o->labelcolor((Fl_Color)80);
o->callback((Fl_Callback*)alert_cancel_msg);
}
o->end();
}
{ Fl_Double_Window* o = channel_create_window = new Fl_Double_Window(460, 535, "Create New Channel Msg");
w = o;
o->user_data((void*)(this));
{ Fl_Funky_Browser* o = chan_createmsg_filelist = new Fl_Funky_Browser(10, 195, 440, 265, "", 2);
o->type(2);
o->box(FL_NO_BOX);
o->color(FL_BACKGROUND2_COLOR);
o->selection_color(FL_SELECTION_COLOR);
o->labeltype(FL_NORMAL_LABEL);
o->labelfont(0);
o->labelsize(14);
o->labelcolor(FL_FOREGROUND_COLOR);
o->callback((Fl_Callback*)chan_createmsg_list_select);
o->align(FL_ALIGN_BOTTOM);
o->when(FL_WHEN_RELEASE_ALWAYS);
}
{ Fl_Button* o = chan_createmsg_sendmsg_button = new Fl_Button(25, 500, 125, 25, "Send Msg");
o->callback((Fl_Callback*)chan_createmsg_sendmsg_callback);
}
{ Fl_Button* o = chan_createmsg_postpone_button = new Fl_Button(165, 500, 125, 25, "Postpone Msg");
o->callback((Fl_Callback*)chan_createmsg_postpone_callback);
}
{ Fl_Button* o = chan_createmsg_cancel_button = new Fl_Button(305, 500, 125, 25, "Cancel Msg");
o->callback((Fl_Callback*)chan_createmsg_cancel_callback);
}
chan_createmsg_msg = new Fl_Text_Editor(10, 110, 440, 75);
{ Fl_Box* o = new Fl_Box(10, 91, 135, 19, "Message Text:");
o->labelfont(1);
}
{ Fl_Button* o = chan_createmsg_remove_button = new Fl_Button(305, 470, 125, 25, "Remove File");
o->callback((Fl_Callback*)chan_createmsg_remove_callback);
}
{ Fl_Group* o = new Fl_Group(10, 5, 440, 80);
o->box(FL_DOWN_BOX);
{ Fl_Input* o = chan_createmsg_newname = new Fl_Input(155, 50, 280, 25);
o->callback((Fl_Callback*)chan_createmsg_newname_callback);
}
chan_createmsg_title = new Fl_Output(155, 15, 280, 25);
{ Fl_Round_Button* o = chan_createmsg_newname_button = new Fl_Round_Button(20, 55, 135, 20, "Create Channel");
o->type(102);
o->down_box(FL_ROUND_DOWN_BOX);
o->callback((Fl_Callback*)chan_createmsg_newname_button_callback);
}
{ Fl_Round_Button* o = chan_createmsg_title_button = new Fl_Round_Button(20, 15, 135, 20, "Active Channel");
o->type(102);
o->down_box(FL_ROUND_DOWN_BOX);
o->callback((Fl_Callback*)chan_createmsg_title_button_callback);
}
{ Fl_Box* o = new Fl_Box(45, 33, 70, 22, "OR");
o->labelfont(3);
}
o->end();
}
o->end();
}
{ Fl_Double_Window* o = channel_details_window = new Fl_Double_Window(460, 445, "Channel Msg Details");
w = o;
o->user_data((void*)(this));
{ Fl_Funky_Browser* o = chan_msgdetails_filelist = new Fl_Funky_Browser(10, 146, 440, 255, "", 2);
o->type(2);
o->box(FL_NO_BOX);
o->color(FL_BACKGROUND2_COLOR);
o->selection_color(FL_SELECTION_COLOR);
o->labeltype(FL_NORMAL_LABEL);
o->labelfont(0);
o->labelsize(14);
o->labelcolor(FL_FOREGROUND_COLOR);
o->callback((Fl_Callback*)chan_msgdetails_list_select);
o->align(FL_ALIGN_BOTTOM);
o->when(FL_WHEN_RELEASE_ALWAYS);
}
{ Fl_Button* o = chan_msgdetails_download_button = new Fl_Button(165, 410, 125, 25, "Download Files");
o->callback((Fl_Callback*)chan_msgdetails_download_callback);
}
{ Fl_Box* o = new Fl_Box(10, 42, 135, 19, "Message Text:");
o->labelfont(1);
}
{ Fl_Button* o = chan_msgdetails_subscribe_button = new Fl_Button(25, 410, 125, 25, "Subscribe ");
o->callback((Fl_Callback*)chan_msgdetails_subscribe_callback);
}
{ Fl_Output* o = chan_msgdetails_title = new Fl_Output(75, 10, 210, 25, "Channel");
o->labelfont(1);
}
chan_msgdetails_msg = new Fl_Text_Display(10, 61, 440, 75);
{ Fl_Output* o = chan_msgdetails_date = new Fl_Output(330, 10, 120, 25, "Date");
o->labelfont(1);
}
{ Fl_Button* o = chan_msgdetails_close_button = new Fl_Button(305, 410, 125, 25, "Close WIndow");
o->callback((Fl_Callback*)chan_msgdetails_close_callback);
}
o->end();
}
return w;
}

View File

@ -1,788 +0,0 @@
# data file for the Fltk User Interface Designer (fluid)
version 1.0107
header_name {.h}
code_name {.cxx}
class UserInterface {open
} {
Function {make_windows()} {open
} {
Fl_Window main_win {
label RetroShare open
xywh {10 180 710 535} type Double box DOWN_BOX visible
} {
Fl_Tabs gui_tabs {open
xywh {10 10 690 470} box UP_BOX
} {
Fl_Group neighbours_tab {
label Connect
xywh {15 40 680 435} labelfont 1
} {
Fl_Button {} {
label {Load Certificate from File}
callback file_import
xywh {50 439 280 31}
}
Fl_Browser cert_neighbour_list {
callback cert_neighbour_list_select
xywh {25 70 350 355} type Hold textfont 4
code0 {\#include "Fl_Funky_Browser.h"}
class Fl_Funky_Browser
}
Fl_Button neigh_add_button {
label {Sign + Add to Friends >>>}
callback cert_move_to_friends
xywh {420 440 240 30}
}
Fl_Box {} {
label {Your Neighbour List}
xywh {35 49 290 20} box FLAT_BOX labelfont 1
}
Fl_Input neigh_authcode {
label {AUTH CODE:}
callback neigh_auth_callback selected
xywh {540 397 70 30} labelfont 1
}
Fl_Group {} {open
xywh {390 54 295 305} box DOWN_BOX
} {
Fl_Box {} {
label {Peer Details}
xywh {395 65 125 20} box FLAT_BOX labelfont 1 labelsize 16
}
Fl_Browser neigh_signers {
label {Certificate signers}
callback cert_neigh_signers_select
xywh {440 195 225 140} type Hold textfont 4 resizable
}
Fl_Output neigh_name {
label {Name:}
xywh {450 90 226 20}
}
Fl_Output neigh_org {
label {Org:}
xywh {450 115 226 20}
}
Fl_Output neigh_loc {
label {Loc:}
xywh {450 140 225 20}
}
Fl_Output neigh_country {
label {Country:}
xywh {495 165 168 20}
}
Fl_Output neigh_trust {
label {Trust:}
xywh {565 65 110 20}
}
}
Fl_Box neigh_auth_notice {
label {AUTH CODE REQUIRED}
xywh {405 369 270 26} box FLAT_BOX labelfont 1 labelsize 18 labelcolor 95
}
}
Fl_Group connect_tab {
label Friends
xywh {15 40 680 435} labelfont 1 hide
} {
Fl_Button {} {
label {<<< Remove Friend}
callback cert_remove_cert
xywh {62 440 185 25}
}
Fl_Button {} {
label {Configure Friend}
callback cert_show_config
xywh {264 440 185 25}
}
Fl_Browser cert_list {
callback cert_list_select
xywh {25 70 660 360} type Hold textfont 4
code0 {\#include "Fl_Funky_Browser.h"}
class Fl_Funky_Browser
}
Fl_Button {} {
label {Export Friend}
callback file_export
xywh {466 440 185 25}
}
Fl_Box {} {
label {Your Friends }
xywh {190 50 340 20} box FLAT_BOX labelfont 1
}
}
Fl_Group {} {
label {File Listing}
xywh {15 40 680 435} labelfont 1 hide
} {
Fl_File_Browser file_results {
callback file_result_select
xywh {25 50 660 380}
}
Fl_Button file_download_button {
label Download
callback file_download
xywh {65 440 185 25}
}
Fl_Button file_recommend_button {
label {Recommend to Friends}
callback file_recommend
xywh {465 440 185 25} deactivate
}
Fl_Button file_channel_button {
label {Broadcast on Channel}
callback file_channel_broadcast
xywh {265 440 185 25} deactivate
}
}
Fl_Group {} {
label {Search }
xywh {15 40 680 435} labelfont 1 hide
} {
Fl_Input new_search {
label {Terms:}
callback do_new_search
xywh {105 50 225 25} labelfont 1
}
Fl_Button {} {
label {Remove Search}
callback search_remove
xywh {535 50 125 25}
}
Fl_Button recommend_button {
label {Recommend to Friends}
callback search_recommend
xywh {460 440 185 25} deactivate
}
Fl_Browser srch_results {
callback search_result_select
xywh {25 80 660 350} type Hold
code0 {\#include "Fl_Funky_Browser.h"}
class Fl_Funky_Browser
}
Fl_Button search_button {
label Search
callback do_search_button
xywh {340 50 79 25} labelfont 1
}
Fl_Button download_button {
label Download
callback search_download
xywh {60 440 185 25}
}
Fl_Button search_channel_button {
label {Broadcast on Channel}
callback search_channel_broadcast
xywh {260 440 185 25} deactivate
}
}
Fl_Group {} {
label {File Transfer} open
xywh {15 40 680 435} hide
} {
Fl_Browser transfer_downloads {
callback transfer_select
xywh {25 50 660 250} type Hold
class Fl_Funky_Browser
}
Fl_Button transfer_cancel {
label Cancel
callback file_transfer_cancel
xywh {70 310 165 25}
}
Fl_Button transfer_clear {
label {Clear Finished}
callback file_transfer_clear
xywh {275 310 155 25}
}
Fl_Text_Display transfer_overview {
xywh {25 345 450 120} textfont 5
}
Fl_Counter rate_total {
label {Max Total Data Rate (kB/s)}
callback file_transfer_total_rate
xywh {510 380 135 25}
}
Fl_Counter rate_indiv {
label {Rate Per Person (kB/s)}
callback file_transfer_indiv_rate
xywh {510 425 135 25}
}
}
Fl_Group {} {
label Messages
xywh {15 40 680 435} labelfont 1 hide deactivate
} {
Fl_Browser msg_list {
callback msg_select
xywh {25 65 660 270} type Hold
class Fl_Funky_Browser
}
Fl_Button {} {
label {New Msg}
callback msg_dialog_show
xywh {45 350 125 25}
}
Fl_Button {} {
label {Reply to Msg}
callback msg_dialog_reply
xywh {45 380 125 25}
}
Fl_Button {} {
label {(2) -- Get The Recommended File}
callback msg_get_recommendation
xywh {245 450 380 25} labelfont 1
}
Fl_Button {} {
label {Remove Msg}
callback msg_remove
xywh {45 410 125 25}
}
Fl_Text_Display msg_details {
xywh {180 340 485 105} textfont 5
}
Fl_Box {} {
label {(1) -- Select Message}
xywh {55 45 305 20} box FLAT_BOX labelfont 1
}
}
Fl_Group channels {
label Channels
xywh {15 40 680 435} hide deactivate
} {
Fl_Browser channel_list {
callback channel_list_select
xywh {25 80 660 225} type Hold
code0 {\#include "Fl_Funky_Browser.h"}
class Fl_Funky_Browser
}
Fl_Box {} {
label {Available Channels}
xywh {40 61 170 19} labelfont 1
}
Fl_Group {} {open
xywh {25 310 655 160} box DOWN_BOX
} {
Fl_Browser channel_file_list {
callback channel_file_list_select
xywh {35 345 635 120}
code0 {\#include "Fl_Funky_Browser.h"}
class Fl_Funky_Browser
}
Fl_Output channel_selected_name {
label {Msgs on Channel}
xywh {185 315 270 25} labelfont 1
}
Fl_Button channel_show_button {
label {Show Msg Details}
callback channel_show_callback
xywh {485 315 160 25}
}
}
Fl_Button channel_delete_button {
label {Delete Channel}
callback channel_delete_callback
xywh {290 50 160 25}
}
Fl_Button channel_create_button {
label {Create Channel Msg}
callback channel_create
xywh {475 50 160 25}
}
}
Fl_Group {} {
label Config
xywh {15 40 680 435} hide
} {
Fl_Group {} {open
xywh {460 55 210 80} box DOWN_BOX hide
} {
Fl_Check_Button config_local_disc {
label {local discovery}
xywh {490 80 145 25} down_box DOWN_BOX
}
Fl_Check_Button config_remote_disc {
label {remote discovery}
xywh {490 100 145 25} down_box DOWN_BOX
}
Fl_Box {} {
label {Discovery Options:}
xywh {470 60 165 20} box FLAT_BOX labelfont 1
}
}
Fl_Group {} {open
xywh {25 225 405 240} box DOWN_BOX
} {
Fl_Browser config_search_dir {
xywh {40 245 355 105} type Hold
}
Fl_Button {} {
label {Add Directory}
callback config_add_dir
xywh {40 370 135 25}
}
Fl_Button {} {
label {Remove Directory}
callback config_remove_dir
xywh {40 400 135 25}
}
Fl_Output config_save_dir {
label {Save Directory}
xywh {145 435 250 20}
}
Fl_Button {} {
label {Select save directory}
callback config_save_dir_change
xywh {230 405 165 25}
}
Fl_Box {} {
label {Share Directories:}
xywh {41 230 174 15} box FLAT_BOX labelfont 1
}
}
Fl_Group {} {open
xywh {25 55 405 160} box DOWN_BOX
} {
Fl_Input config_local_addr {
label {Local Address:}
xywh {165 80 130 20}
}
Fl_Value_Input config_local_port {
label {Port:}
xywh {335 80 60 20}
}
Fl_Input config_server_addr {
label {External Address:}
xywh {165 145 130 25}
}
Fl_Value_Input config_server_port {
label {Port:}
xywh {335 145 60 25}
}
Fl_Check_Button config_firewall {
label {behind firewall}
callback config_server_update
xywh {195 100 190 25} down_box DOWN_BOX
}
Fl_Check_Button config_forward {
label {forwarded external port}
callback config_server_update
xywh {195 120 190 25} down_box DOWN_BOX
}
Fl_Box {} {
label {Server Settings:}
xywh {45 60 150 20} box FLAT_BOX labelfont 1
}
Fl_Button config_server_button {
label {Change + Restart Server}
callback config_server_change
xywh {185 180 190 25}
}
}
Fl_Button {} {
label {Save Configuration}
callback cert_save_config
xywh {485 434 170 25}
}
}
Fl_Group about_help_tab {
label About
xywh {15 40 680 435} hide
} {
Fl_Help_View help_view {
xywh {25 50 660 415}
}
}
}
Fl_Value_Output onlinecounter {
label {\#Online:}
xywh {100 485 35 20}
}
Fl_Value_Output {} {
label {New Msgs:}
xywh {100 505 35 20}
}
Fl_Button {} {
label Hide
callback gui_quit
xywh {605 490 85 30}
}
Fl_Text_Display {} {
xywh {140 485 360 40}
}
Fl_Button chat_button {
label Chat
callback chat_open_callback
xywh {510 490 85 30}
}
}
Fl_Window msg_dialog {
label {Msg Dialog}
xywh {1 30 580 355} type Double hide
} {
Fl_Check_Browser msg_online {
xywh {20 25 140 215}
}
Fl_Button msg_button_select {
label {Select All/None}
callback msg_toggle_select
xywh {20 240 140 25}
}
Fl_Text_Editor msg_text {
label {(1) -- Enter Message Text:}
xywh {175 25 385 240} labelfont 1
}
Fl_Output msg_recommend {
label {Recommendation:}
xywh {175 275 385 30}
}
Fl_Button {} {
label {(2) -- Send Msg}
callback msg_send
xywh {245 315 160 30} labelfont 1
}
Fl_Button {} {
label Cancel
callback msg_dialog_hide
xywh {415 315 115 30}
}
}
Fl_Window cert_config {
label {Certificate Configuration}
xywh {168 116 430 535} type Double hide
} {
Fl_Group {} {open
xywh {10 10 410 490} box UP_BOX
} {
Fl_Group {} {
xywh {25 355 380 135} box DOWN_BOX
} {
Fl_Input cert_server {
label {Server Address:}
xywh {155 430 130 25}
}
Fl_Button {} {
label {Save and attempt to Connect}
callback cert_save_n_connect
xywh {165 460 220 25}
}
Fl_Button {} {
label {Save Address}
callback cert_save_servaddr
xywh {35 460 115 25}
}
Fl_Value_Input cert_port {
label {Port:}
xywh {325 430 60 25}
}
Fl_Check_Button cert_connect {
label {Outgoing Connections (Server Address Required)}
callback cert_connect_change
xywh {30 410 365 20} down_box DOWN_BOX
}
Fl_Check_Button cert_allow {
label {Allow Access}
callback cert_allow_change
xywh {30 380 115 20} down_box DOWN_BOX
}
Fl_Check_Button cert_listen {
label {Listen for connection}
callback cert_listen_change
xywh {30 395 170 20} down_box DOWN_BOX
}
Fl_Check_Button cert_local {
label {Local Network}
callback cert_local_change
xywh {220 385 130 20} down_box DOWN_BOX
}
Fl_Check_Button cert_auto {
label {Auto Connect}
callback cert_auto_change
xywh {220 362 140 20} down_box DOWN_BOX labelfont 1
}
Fl_Box {} {
label {Connectivity Options:}
xywh {32 363 190 20} box FLAT_BOX labelfont 1
}
}
Fl_Output cert_status {
label {Status:}
xywh {80 20 130 25}
}
Fl_Text_Display cert_details {
xywh {25 50 380 210}
}
Fl_Group {} {
xywh {25 267 380 82} box DOWN_BOX
} {
Fl_Button cert_sign_button {
label {Sign Certificate}
callback cert_sign
xywh {239 295 145 29}
}
Fl_Check_Button cert_trust_person {
label {Trust This Person's Signature}
callback cert_trust_person_change
xywh {95 323 230 25} down_box DOWN_BOX
}
Fl_Input cert_authcode {
label {AUTH CODE:}
callback cert_auth_callback
xywh {145 295 80 28} labelfont 1 when 1
}
Fl_Box {} {
label {Authenticate Friend By Entering Their Code}
xywh {35 272 360 20} box FLAT_BOX labelfont 1
}
}
Fl_Output cert_trust {
label {Trust:}
xywh {260 20 140 25}
}
}
Fl_Button {} {
label Done
callback cert_hide_config
xywh {305 505 100 25}
}
}
Fl_Window {} {
xywh {-32000 -32000 360 290} type Double hide
} {
Fl_Group file_chooser {
callback file_chooser_select open
xywh {5 5 350 280}
code0 {\#include <Fl/Fl_File_Chooser.H>}
class Fl_File_Chooser
} {}
}
Fl_Window welcome_window {
label {RetroShare Setup}
xywh {618 195 405 580} type Double hide
} {
Fl_Group {} {open
xywh {10 10 385 35} box DOWN_BOX
} {
Fl_Box {} {
label {Welcome to RetroShare}
xywh {85 15 230 20} box FLAT_BOX labelfont 1 labelsize 16
}
}
Fl_Group {} {open
xywh {10 55 385 140} box DOWN_BOX
} {
Fl_Box {} {
label {Please login ....}
xywh {75 65 285 20} box FLAT_BOX labelfont 1
}
Fl_Output load_name {
label {Name:}
xywh {90 90 250 25}
}
Fl_Input load_passwd {
label Password
callback load_passwd_callback
xywh {90 125 250 25} type Secret when 8
}
Fl_Button load_button {
label {Load Existing User}
callback load_existing
xywh {110 160 210 30}
}
}
Fl_Group {} {open
xywh {10 205 385 365} box DOWN_BOX
} {
Fl_Box {} {
label {Or create a New User...}
xywh {55 210 300 20} box FLAT_BOX labelfont 1
}
Fl_Group {} {
xywh {50 360 300 5} box UP_BOX
} {}
Fl_Group {} {
xywh {50 440 300 5} box UP_BOX
} {}
Fl_Group {} {
xywh {50 511 300 5} box UP_BOX
} {}
Fl_Input gen_name {
label {Name:}
xywh {120 235 250 25}
}
Fl_Input gen_org {
label {Organisation:}
xywh {120 265 250 25}
}
Fl_Input gen_loc {
label {Location:}
xywh {120 295 250 25}
}
Fl_Input gen_country {
label {Country:}
xywh {120 325 250 25}
}
Fl_Input gen_passwd {
label {New Password}
xywh {170 375 130 25} type Secret
}
Fl_Input gen_passwd2 {
label {Password (Again)}
xywh {170 405 130 25} type Secret
}
Fl_Check_Button gen_trusted_tick_box {
label {Load Trusted Certificate (Optional)}
callback gen_trusted_tick_callback
xywh {50 450 305 20} down_box DOWN_BOX labelfont 1
}
Fl_Output gen_trusted_peer {
label {Friend:}
xywh {105 474 135 25}
}
Fl_Button gen_trusted_select_button {
label {Select File}
callback gen_load_trusted
xywh {252 470 93 30}
}
Fl_Button gen_button {
label {Generate New Certificate}
callback generate_certificate
xywh {100 528 210 30}
}
}
}
Fl_Window chatter_window {
label ChatterBox
xywh {457 94 455 435} type Double hide
} {
Fl_Text_Display chatter_box {
xywh {5 10 445 370}
}
Fl_Input chatter_input {
callback chatterbox_message
xywh {5 390 445 40} when 8
}
}
Fl_Window alert_window {
label Alerts
xywh {46 543 540 200} type Double hide
} {
Fl_Return_Button alert_okay {
label OK
callback alert_okay_msg
xywh {75 175 180 20}
}
Fl_Text_Display alert_box {
xywh {15 5 515 165}
}
Fl_Button alert_cancel {
label Cancel
callback alert_cancel_msg
xywh {270 175 180 20} labelfont 3 labelsize 16 labelcolor 80
}
}
Fl_Window channel_create_window {
label {Create New Channel Msg}
xywh {30 127 460 535} type Double hide
} {
Fl_Browser chan_createmsg_filelist {
callback chan_createmsg_list_select
xywh {10 195 440 265} type Hold
code0 {\#include "Fl_Funky_Browser.h"}
class Fl_Funky_Browser
}
Fl_Button chan_createmsg_sendmsg_button {
label {Send Msg}
callback chan_createmsg_sendmsg_callback
xywh {25 500 125 25}
}
Fl_Button chan_createmsg_postpone_button {
label {Postpone Msg}
callback chan_createmsg_postpone_callback
xywh {165 500 125 25}
}
Fl_Button chan_createmsg_cancel_button {
label {Cancel Msg}
callback chan_createmsg_cancel_callback
xywh {305 500 125 25}
}
Fl_Text_Editor chan_createmsg_msg {
xywh {10 110 440 75}
}
Fl_Box {} {
label {Message Text:}
xywh {10 91 135 19} labelfont 1
}
Fl_Button chan_createmsg_remove_button {
label {Remove File}
callback chan_createmsg_remove_callback
xywh {305 470 125 25}
}
Fl_Group {} {
xywh {10 5 440 80} box DOWN_BOX
} {
Fl_Input chan_createmsg_newname {
callback chan_createmsg_newname_callback
xywh {155 50 280 25}
}
Fl_Output chan_createmsg_title {
xywh {155 15 280 25}
}
Fl_Round_Button chan_createmsg_newname_button {
label {Create Channel}
callback chan_createmsg_newname_button_callback
xywh {20 55 135 20} type Radio down_box ROUND_DOWN_BOX
}
Fl_Round_Button chan_createmsg_title_button {
label {Active Channel}
callback chan_createmsg_title_button_callback
xywh {20 15 135 20} type Radio down_box ROUND_DOWN_BOX
}
Fl_Box {} {
label OR
xywh {45 33 70 22} labelfont 3
}
}
}
Fl_Window channel_details_window {
label {Channel Msg Details}
xywh {714 557 460 445} type Double hide
} {
Fl_Browser chan_msgdetails_filelist {
callback chan_msgdetails_list_select
xywh {10 146 440 255} type Hold
code0 {\#include "Fl_Funky_Browser.h"}
class Fl_Funky_Browser
}
Fl_Button chan_msgdetails_download_button {
label {Download Files}
callback chan_msgdetails_download_callback
xywh {165 410 125 25}
}
Fl_Box {} {
label {Message Text:}
xywh {10 42 135 19} labelfont 1
}
Fl_Button chan_msgdetails_subscribe_button {
label {Subscribe }
callback chan_msgdetails_subscribe_callback
xywh {25 410 125 25}
}
Fl_Output chan_msgdetails_title {
label Channel
xywh {75 10 210 25} labelfont 1
}
Fl_Text_Display chan_msgdetails_msg {
xywh {10 61 440 75}
}
Fl_Output chan_msgdetails_date {
label Date
xywh {330 10 120 25} labelfont 1
}
Fl_Button chan_msgdetails_close_button {
label {Close WIndow}
callback chan_msgdetails_close_callback
xywh {305 410 125 25}
}
}
}
}

View File

@ -1,226 +0,0 @@
// generated by Fast Light User Interface Designer (fluid) version 1.0107
#ifndef guitab_h
#define guitab_h
#include <FL/Fl.H>
#include <FL/Fl_Double_Window.H>
#include <FL/Fl_Tabs.H>
#include <FL/Fl_Group.H>
#include <FL/Fl_Button.H>
extern void file_import(Fl_Button*, void*);
#include "Fl_Tree_Browser.h"
#include "Fl_Funky_Browser.h"
extern void cert_neighbour_list_select(Fl_Funky_Browser*, void*);
extern void cert_move_to_friends(Fl_Button*, void*);
#include <FL/Fl_Box.H>
#include <FL/Fl_Input.H>
extern void neigh_auth_callback(Fl_Input*, void*);
#include <FL/Fl_Browser.H>
extern void cert_neigh_signers_select(Fl_Browser*, void*);
#include <FL/Fl_Output.H>
extern void cert_remove_cert(Fl_Button*, void*);
extern void cert_show_config(Fl_Button*, void*);
extern void cert_list_select(Fl_Funky_Browser*, void*);
extern void file_export(Fl_Button*, void*);
#include <FL/Fl_File_Browser.H>
extern void file_result_select(Fl_File_Browser*, void*);
extern void file_download(Fl_Button*, void*);
extern void file_recommend(Fl_Button*, void*);
extern void file_channel_broadcast(Fl_Button*, void*);
extern void do_new_search(Fl_Input*, void*);
extern void search_remove(Fl_Button*, void*);
extern void search_recommend(Fl_Button*, void*);
extern void search_result_select(Fl_Funky_Browser*, void*);
extern void do_search_button(Fl_Button*, void*);
extern void search_download(Fl_Button*, void*);
extern void search_channel_broadcast(Fl_Button*, void*);
extern void transfer_select(Fl_Funky_Browser*, void*);
extern void file_transfer_cancel(Fl_Button*, void*);
extern void file_transfer_clear(Fl_Button*, void*);
#include <FL/Fl_Text_Display.H>
#include <FL/Fl_Counter.H>
extern void file_transfer_total_rate(Fl_Counter*, void*);
extern void file_transfer_indiv_rate(Fl_Counter*, void*);
extern void msg_select(Fl_Funky_Browser*, void*);
extern void msg_dialog_show(Fl_Button*, void*);
extern void msg_dialog_reply(Fl_Button*, void*);
extern void msg_get_recommendation(Fl_Button*, void*);
extern void msg_remove(Fl_Button*, void*);
extern void channel_list_select(Fl_Funky_Browser*, void*);
extern void channel_file_list_select(Fl_Funky_Browser*, void*);
extern void channel_show_callback(Fl_Button*, void*);
extern void channel_delete_callback(Fl_Button*, void*);
extern void channel_create(Fl_Button*, void*);
#include <FL/Fl_Check_Button.H>
extern void config_add_dir(Fl_Button*, void*);
extern void config_remove_dir(Fl_Button*, void*);
extern void config_save_dir_change(Fl_Button*, void*);
#include <FL/Fl_Value_Input.H>
extern void config_server_update(Fl_Check_Button*, void*);
extern void config_server_change(Fl_Button*, void*);
extern void cert_save_config(Fl_Button*, void*);
#include <FL/Fl_Help_View.H>
#include <FL/Fl_Value_Output.H>
extern void gui_quit(Fl_Button*, void*);
extern void chat_open_callback(Fl_Button*, void*);
#include <FL/Fl_Check_Browser.H>
extern void msg_toggle_select(Fl_Button*, void*);
#include <FL/Fl_Text_Editor.H>
extern void msg_send(Fl_Button*, void*);
extern void msg_dialog_hide(Fl_Button*, void*);
extern void cert_save_n_connect(Fl_Button*, void*);
extern void cert_save_servaddr(Fl_Button*, void*);
extern void cert_connect_change(Fl_Check_Button*, void*);
extern void cert_allow_change(Fl_Check_Button*, void*);
extern void cert_listen_change(Fl_Check_Button*, void*);
extern void cert_local_change(Fl_Check_Button*, void*);
extern void cert_auto_change(Fl_Check_Button*, void*);
extern void cert_sign(Fl_Button*, void*);
extern void cert_trust_person_change(Fl_Check_Button*, void*);
extern void cert_auth_callback(Fl_Input*, void*);
extern void cert_hide_config(Fl_Button*, void*);
#include <Fl/Fl_File_Chooser.H>
extern void file_chooser_select(Fl_File_Chooser*, void*);
extern void load_passwd_callback(Fl_Input*, void*);
extern void load_existing(Fl_Button*, void*);
extern void gen_trusted_tick_callback(Fl_Check_Button*, void*);
extern void gen_load_trusted(Fl_Button*, void*);
extern void generate_certificate(Fl_Button*, void*);
extern void chatterbox_message(Fl_Input*, void*);
#include <FL/Fl_Return_Button.H>
extern void alert_okay_msg(Fl_Return_Button*, void*);
extern void alert_cancel_msg(Fl_Button*, void*);
extern void chan_createmsg_list_select(Fl_Funky_Browser*, void*);
extern void chan_createmsg_sendmsg_callback(Fl_Button*, void*);
extern void chan_createmsg_postpone_callback(Fl_Button*, void*);
extern void chan_createmsg_cancel_callback(Fl_Button*, void*);
extern void chan_createmsg_remove_callback(Fl_Button*, void*);
extern void chan_createmsg_newname_callback(Fl_Input*, void*);
#include <FL/Fl_Round_Button.H>
extern void chan_createmsg_newname_button_callback(Fl_Round_Button*, void*);
extern void chan_createmsg_title_button_callback(Fl_Round_Button*, void*);
extern void chan_msgdetails_list_select(Fl_Funky_Browser*, void*);
extern void chan_msgdetails_download_callback(Fl_Button*, void*);
extern void chan_msgdetails_subscribe_callback(Fl_Button*, void*);
extern void chan_msgdetails_close_callback(Fl_Button*, void*);
class UserInterface {
public:
Fl_Double_Window* make_windows();
Fl_Double_Window *main_win;
Fl_Tabs *gui_tabs;
Fl_Group *neighbours_tab;
Fl_Funky_Browser *cert_neighbour_list;
Fl_Button *neigh_add_button;
Fl_Input *neigh_authcode;
Fl_Browser *neigh_signers;
Fl_Output *neigh_name;
Fl_Output *neigh_org;
Fl_Output *neigh_loc;
Fl_Output *neigh_country;
Fl_Output *neigh_trust;
Fl_Box *neigh_auth_notice;
Fl_Group *connect_tab;
Fl_Funky_Browser *cert_list;
Fl_Widget *file_results;
Fl_Button *file_download_button;
Fl_Button *file_recommend_button;
Fl_Button *file_channel_button;
Fl_Input *new_search;
Fl_Button *recommend_button;
Fl_Funky_Browser *srch_results;
Fl_Button *search_button;
Fl_Button *download_button;
Fl_Button *search_channel_button;
Fl_Funky_Browser *transfer_downloads;
Fl_Button *transfer_cancel;
Fl_Button *transfer_clear;
Fl_Text_Display *transfer_overview;
Fl_Counter *rate_total;
Fl_Counter *rate_indiv;
Fl_Funky_Browser *msg_list;
Fl_Text_Display *msg_details;
Fl_Group *channels;
Fl_Funky_Browser *channel_list;
Fl_Funky_Browser *channel_file_list;
Fl_Output *channel_selected_name;
Fl_Button *channel_show_button;
Fl_Button *channel_delete_button;
Fl_Button *channel_create_button;
Fl_Check_Button *config_local_disc;
Fl_Check_Button *config_remote_disc;
Fl_Browser *config_search_dir;
Fl_Output *config_save_dir;
Fl_Input *config_local_addr;
Fl_Value_Input *config_local_port;
Fl_Input *config_server_addr;
Fl_Value_Input *config_server_port;
Fl_Check_Button *config_firewall;
Fl_Check_Button *config_forward;
Fl_Button *config_server_button;
Fl_Group *about_help_tab;
Fl_Help_View *help_view;
Fl_Value_Output *onlinecounter;
Fl_Button *chat_button;
Fl_Double_Window *msg_dialog;
Fl_Check_Browser *msg_online;
Fl_Button *msg_button_select;
Fl_Text_Editor *msg_text;
Fl_Output *msg_recommend;
Fl_Double_Window *cert_config;
Fl_Input *cert_server;
Fl_Value_Input *cert_port;
Fl_Check_Button *cert_connect;
Fl_Check_Button *cert_allow;
Fl_Check_Button *cert_listen;
Fl_Check_Button *cert_local;
Fl_Check_Button *cert_auto;
Fl_Output *cert_status;
Fl_Text_Display *cert_details;
Fl_Button *cert_sign_button;
Fl_Check_Button *cert_trust_person;
Fl_Input *cert_authcode;
Fl_Output *cert_trust;
Fl_File_Chooser *file_chooser;
Fl_Double_Window *welcome_window;
Fl_Output *load_name;
Fl_Input *load_passwd;
Fl_Button *load_button;
Fl_Input *gen_name;
Fl_Input *gen_org;
Fl_Input *gen_loc;
Fl_Input *gen_country;
Fl_Input *gen_passwd;
Fl_Input *gen_passwd2;
Fl_Check_Button *gen_trusted_tick_box;
Fl_Output *gen_trusted_peer;
Fl_Button *gen_trusted_select_button;
Fl_Button *gen_button;
Fl_Double_Window *chatter_window;
Fl_Text_Display *chatter_box;
Fl_Input *chatter_input;
Fl_Double_Window *alert_window;
Fl_Return_Button *alert_okay;
Fl_Text_Display *alert_box;
Fl_Button *alert_cancel;
Fl_Double_Window *channel_create_window;
Fl_Funky_Browser *chan_createmsg_filelist;
Fl_Button *chan_createmsg_sendmsg_button;
Fl_Button *chan_createmsg_postpone_button;
Fl_Button *chan_createmsg_cancel_button;
Fl_Text_Editor *chan_createmsg_msg;
Fl_Button *chan_createmsg_remove_button;
Fl_Input *chan_createmsg_newname;
Fl_Output *chan_createmsg_title;
Fl_Round_Button *chan_createmsg_newname_button;
Fl_Round_Button *chan_createmsg_title_button;
Fl_Double_Window *channel_details_window;
Fl_Funky_Browser *chan_msgdetails_filelist;
Fl_Button *chan_msgdetails_download_button;
Fl_Button *chan_msgdetails_subscribe_button;
Fl_Output *chan_msgdetails_title;
Fl_Text_Display *chan_msgdetails_msg;
Fl_Output *chan_msgdetails_date;
Fl_Button *chan_msgdetails_close_button;
};
#endif

View File

@ -1,996 +0,0 @@
/*
* "$Id: pqibrowseitem.cc,v 1.11 2007-02-18 21:46:49 rmf24 Exp $"
*
* FltkGUI for RetroShare.
*
* Copyright 2004-2006 by Robert Fernie.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License Version 2 as published by the Free Software Foundation.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*
* Please report all bugs and problems to "retroshare@lunamutt.com".
*
*/
#include "fltkgui/pqibrowseitem.h"
#include "pqi/pqichannel.h" /* for mode bits */
// for a helper fn.
#include "fltkgui/pqistrings.h"
#include <sstream>
// a couple of functions that do the work.
int FileDisItem::ndix() // Number of Indices.
{
return 4;
}
static const int FI_COL_SOURCE_NAME = 0;
static const int FI_COL_SEARCH_TERMS = 1;
static const int FI_COL_NAME = 2;
static const int FI_COL_SIZE = 3;
std::string FileDisItem::txt(int col)
{
char numstr[100]; // this will be used regularly....
std::string out;
switch(col)
{
case FI_COL_SOURCE_NAME:
if ((item -> p) != NULL)
{
out = item -> p -> Name();
//std::cerr << "FDI::txt() Returning sn: " << out << std::endl;
return out;
}
return std::string("Local");
//std::cerr << "FDI::txt() person = NULL" << std::endl;
break;
case FI_COL_SEARCH_TERMS:
if (terms != NULL)
{
out = terms -> data;
//std::cerr << "FDI::txt() Returning terms: " << out << std::endl;
return out;
}
//std::cerr << "FDI::txt() terms = NULL" << std::endl;
break;
case FI_COL_NAME:
out = item -> name;
//std::cerr << "FDI::txt() Returning name: " << out << std::endl;
return out;
break;
case FI_COL_SIZE:
sprintf(numstr, "%d kB", item -> size / 1000);
out = numstr;
//std::cerr << "FDI::txt() Returning size: " << out << std::endl;
return out;
break;
default:
break;
}
out = "";
return out;
}
int FileDisItem::cmp(int col, DisplayData *fdi)
{
FileDisItem *other = (FileDisItem *) fdi;
int ret = 0;
switch(col)
{
case FI_COL_SOURCE_NAME:
// std::cerr << "FileDisItem::cmp() SRC NAME" << std::endl;
if (item -> p ==
other -> item -> p)
{
ret = 0;
break;
}
if (item -> p == NULL)
{
ret = -1;
break;
}
if (other -> item -> p == NULL)
{
ret = 1;
break;
}
ret = strcmp((item -> p -> Name()).c_str(),
(other -> item -> p -> Name()).c_str());
break;
case FI_COL_SEARCH_TERMS:
// std::cerr << "FileDisItem::cmp() TERMS" << std::endl;
if (terms == other -> terms)
{
ret = 0;
break;
}
if (terms == NULL)
{
ret = -1;
break;
}
if (other -> terms == NULL)
{
ret = 1;
break;
}
ret = strcmp((terms -> data).c_str(),
(other -> terms -> data).c_str());
break;
case FI_COL_NAME:
// std::cerr << "FileDisItem::cmp() NAME" << std::endl;
ret = strcmp((item -> name).c_str(),
(other -> item -> name).c_str());
break;
case FI_COL_SIZE:
// std::cerr << "FileDisItem::cmp() SIZE" << std::endl;
if (item -> size == other -> item -> size)
{
ret = 0;
break;
}
if (item -> size > other -> item -> size)
{
ret = 1;
break;
}
ret = -1;
break;
default:
// std::cerr << "FileDisItem::cmp() Default" << std::endl;
ret = 0;
break;
}
//std::cerr << "FileDisItem::cmp() ret: " << ret << std::endl;
return ret;
}
// a couple of functions that do the work.
int PersonDisItem::ndix() // Number of Indices.
{
return 5;
}
static const int PI_COL_NAME = 0;
static const int PI_COL_STATUS = 1;
static const int PI_COL_AUTOCONNECT = 2;
static const int PI_COL_TRUST = 3;
static const int PI_COL_SERVER = 4;
std::string PersonDisItem::txt(int col)
{
char numstr[100]; // this will be used regularly....
std::string out;
if (item == NULL)
return out;
switch(col)
{
case PI_COL_NAME:
out = item -> Name();
break;
case PI_COL_STATUS:
out = get_status_string(item -> Status());
break;
case PI_COL_AUTOCONNECT:
out = get_autoconnect_string(item);
break;
case PI_COL_TRUST:
out = get_trust_string(item);
break;
case PI_COL_SERVER:
out = get_server_string(item);
break;
default:
break;
}
return out;
}
int PersonDisItem::cmp(int col, DisplayData *fdi)
{
PersonDisItem *other = (PersonDisItem *) fdi;
switch(col)
{
case PI_COL_NAME:
return strcmp((item -> Name()).c_str(),
(other -> item -> Name()).c_str());
break;
case PI_COL_STATUS:
if (item -> Connected() ==
other -> item -> Connected())
{
if (item -> Accepted() ==
other -> item -> Accepted())
{
return 0;
}
if (item -> Accepted())
return -1;
return 1;
}
if (item -> Connected())
return -1;
return 1;
break;
case PI_COL_AUTOCONNECT:
return 0;
break;
case PI_COL_TRUST:
return other->item->trustLvl - item->trustLvl;
break;
case PI_COL_SERVER:
return 0;
break;
default:
return 0;
break;
}
return 0;
}
// a couple of functions that do the work.
int NeighDisItem::ndix() // Number of Indices.
{
return 3;
}
static const int NI_COL_STATUS = 0;
static const int NI_COL_TRUST = 1;
static const int NI_COL_CONNECT = 2;
static const int NI_COL_NAME = 3;
std::string NeighDisItem::txt(int col)
{
char numstr[100]; // this will be used regularly....
std::string out;
if (item == NULL)
return out;
switch(col)
{
case NI_COL_STATUS:
if (item->Accepted())
{
out = "Accept";
}
else
{
out = "Deny";
}
break;
case NI_COL_TRUST:
out = get_trust_string(item);
break;
case NI_COL_CONNECT:
out = get_lastconnecttime_string(item);
break;
case NI_COL_NAME:
out = item -> Name();
break;
default:
break;
}
return out;
}
int NeighDisItem::cmp(int col, DisplayData *fdi)
{
NeighDisItem *other = (NeighDisItem *) fdi;
switch(col)
{
case NI_COL_STATUS:
if (item -> Accepted() ==
other -> item -> Accepted())
{
return 0;
}
if (item -> Accepted())
return 1;
return -1;
break;
case NI_COL_TRUST:
return other->item->trustLvl - item->trustLvl;
break;
case NI_COL_CONNECT:
return get_lastconnecttime(item)
- get_lastconnecttime(other->item);
break;
case NI_COL_NAME:
return strcmp((item -> Name()).c_str(),
(other -> item -> Name()).c_str());
break;
default:
return 0;
break;
}
return 0;
}
// a couple of functions that do the work.
int MsgDisItem::ndix() // Number of Indices.
{
return 5;
}
static const int MI_COL_NAME = 0;
static const int MI_COL_MSG = 1;
static const int MI_COL_DATE = 2;
static const int MI_COL_REC_NAME = 3;
static const int MI_COL_REC_SIZE = 4;
std::string MsgDisItem::txt(int col)
{
char numstr[100]; // this will be used regularly....
std::string out;
switch(col)
{
case MI_COL_NAME:
if ((item -> p) != NULL)
{
out = item -> p -> Name();
return out;
}
return std::string("Local");
break;
case MI_COL_MSG:
out = "";
// remove \n and \t...
for(unsigned int i =0; i < item -> msg.length(); i++)
{
if ((item -> msg[i] == '\n') ||
(item -> msg[i] == '\t'))
{
out += " ";
}
else
{
out += item -> msg[i];
}
}
return out;
break;
case MI_COL_DATE:
out = timeFormat(item->epoch, TIME_FORMAT_OLDVAGUE);
//out = "Today!";
return out;
break;
case MI_COL_REC_NAME:
out = item -> recommendname;
return out;
break;
case MI_COL_REC_SIZE:
//sprintf(numstr, "%d kB", item -> recommendsize / 1000);
//out = numstr;
out = "N/A";
return out;
break;
default:
break;
}
out = "";
return out;
}
int MsgDisItem::cmp(int col, DisplayData *fdi)
{
MsgDisItem *other = (MsgDisItem *) fdi;
switch(col)
{
case MI_COL_NAME:
if (item -> p ==
other -> item -> p)
{
return 0;
}
if (item -> p == NULL)
{
return -1;
}
if (other -> item -> p == NULL)
{
return 1;
}
return strcmp((item -> p -> Name()).c_str(),
(other -> item -> p -> Name()).c_str());
break;
case MI_COL_MSG:
return strcmp((item -> msg).c_str(),
(other -> item -> msg).c_str());
break;
case MI_COL_DATE:
return 0;
break;
case MI_COL_REC_NAME:
return strcmp((item -> recommendname).c_str(),
(other -> item -> recommendname).c_str());
break;
case MI_COL_REC_SIZE:
return 0;
// if (item -> recommend_size ==
// other -> item -> recommend_size)
// {
// return 0;
// }
// if (item -> recommend_size >
// other -> item -> recommend_size)
// {
// return 1;
// }
// return -1;
break;
default:
return 0;
break;
}
return 0;
}
// a couple of functions that do the work.
int FTDisItem::ndix() // Number of Indices.
{
return 5;
}
static const int FT_COL_SOURCE_NAME = 0;
static const int FT_COL_DIRECTION = 1;
static const int FT_COL_FILE_NAME = 2;
static const int FT_COL_FILE_SIZE = 3;
static const int FT_COL_FILE_RATE = 4;
static const int SEC_PER_DAY = 24 * 3600;
std::string FTDisItem::txt(int col)
{
char numstr[100]; // this will be used regularly....
std::string out;
switch(col)
{
case FT_COL_SOURCE_NAME:
if ((item -> p) != NULL)
{
out = item -> p -> Name();
return out;
}
return std::string("Unknown");
break;
case FT_COL_DIRECTION: /* This has now become state.... */
switch(item -> state)
{
case FT_STATE_OKAY:
if (item->crate > 0)
{
out += "Downloading";
}
else
{
out += "Waiting";
}
break;
case FT_STATE_FAILED:
out += "Failed";
break;
case FT_STATE_COMPLETE:
out += "Complete";
break;
default:
out += "UNKNOWN";
break;
}
return out;
break;
case FT_COL_FILE_NAME:
out = item -> name;
return out;
break;
case FT_COL_FILE_SIZE:
{
float trans = item -> transferred;
float size = item -> size;
float percent = 100 * trans / size;
char lets[] = "kMGT";
char let = ' ';
// if bigger than 50 kbytes -> display
for(int i = 0; (i < 4) && (size / 1024 > 1); i++)
{
size /= 1024;
trans /= 1024;
let = lets[i];
}
sprintf(numstr, "%.2f/%.2f %cBytes (%.2f%%)",
trans, size, let, percent);
out = numstr;
return out;
}
break;
case FT_COL_FILE_RATE:
if (item->size == item->transferred)
{
sprintf(numstr, "Done");
}
else if (item->crate > 0.01) /* 10 bytes / sec */
{
float secs = item->size - item->transferred;
secs /= (item -> crate * 1000.0);
if (secs > SEC_PER_DAY)
{
sprintf(numstr, "%.2f kB/s, %d days to go.", item -> crate,
(int) (secs + SEC_PER_DAY / 2) / SEC_PER_DAY);
}
else
{
int hours = (int) secs / 3600;
secs -= 3600 * hours;
int min = (int) secs / 60;
secs -= 60 * min;
sprintf(numstr, "%.2f kB/s, %d:%02d:%02d to go.", item -> crate,
hours, min, (int) secs);
}
}
else
{
sprintf(numstr, "%.2f kB/s, ... Forever", item -> crate);
}
out = numstr;
return out;
break;
default:
break;
}
out = "";
return out;
}
int FTDisItem::cmp(int col, DisplayData *fdi)
{
FTDisItem *other = (FTDisItem *) fdi;
switch(col)
{
case FT_COL_SOURCE_NAME:
if (item -> p ==
other -> item -> p)
{
return 0;
}
if (item -> p == NULL)
{
return -1;
}
if (other -> item -> p == NULL)
{
return 1;
}
return strcmp((item -> p -> Name()).c_str(),
(other -> item -> p -> Name()).c_str());
break;
case FT_COL_DIRECTION:
if (item -> in == other -> item -> in)
{
return 0;
}
if (item -> in == true)
{
return 1;
}
return -1;
break;
case FT_COL_FILE_NAME:
return strcmp((item -> name).c_str(),
(other -> item -> name).c_str());
break;
case FT_COL_FILE_SIZE:
if (item -> size == other -> item -> size)
{
return 0;
}
if (item -> size > other -> item -> size)
{
return 1;
}
return -1;
break;
case FT_COL_FILE_RATE:
if (item -> crate == other -> item -> crate)
{
return 0;
}
if (item -> crate > other -> item -> crate)
{
return 1;
}
return -1;
break;
default:
return 0;
break;
}
return 0;
}
// a couple of functions that do the work.
int ChanDisItem::ndix() // Number of Indices.
{
return 5;
}
static const int CDI_COL_MODE = 0;
static const int CDI_COL_RANK = 1;
static const int CDI_COL_TITLE = 2;
static const int CDI_COL_COUNT = 3;
static const int CDI_COL_SIGN = 4;
ChanDisItem::ChanDisItem(pqichannel *i)
:mode(0), name("NULL CHANNEL")
{
if (!i)
{
mode = -1;
return;
}
cs = i->getSign();
mode = i->getMode();
name = i->getName();
ranking = i->getRanking();
msgcount = i->getMsgCount();
return;
}
std::string ChanDisItem::txt(int col)
{
char numstr[100]; // this will be used regularly....
std::ostringstream out;
switch(col)
{
case CDI_COL_MODE:
{
if (mode == -1)
{
out << "Invalid";
}
else if (mode & 0x040)
{
out << "Publisher";
}
else if (mode & 0x020)
{
out << "Subscriber";
}
else if (mode & 0x010)
{
out << "Listener";
}
else
{
out << "Other";
}
return out.str();
}
break;
case CDI_COL_RANK:
{
out << ranking;
return out.str();
}
break;
case CDI_COL_TITLE:
{
return name;
}
break;
case CDI_COL_COUNT:
{
out << msgcount;
return out.str();
}
break;
case CDI_COL_SIGN:
{
cs.printHex(out);
return out.str();
}
return std::string("<BAD CHAN>");
break;
default:
break;
}
return out.str();
}
int ChanDisItem::cmp(int col, DisplayData *fdi)
{
ChanDisItem *other = (ChanDisItem *) fdi;
switch(col)
{
case CDI_COL_MODE:
{
return mode - other->mode;
}
case CDI_COL_RANK:
{
return (int) (100.0 * (ranking - other->ranking));
}
case CDI_COL_TITLE:
{
return strcmp(name.c_str(), other->name.c_str());
}
case CDI_COL_COUNT:
{
return msgcount-other->msgcount;
}
break;
case CDI_COL_SIGN:
{
if (cs == other->cs)
return 0;
if (cs < other->cs)
return -1;
return 1;
}
break;
default:
break;
}
return 0;
}
// a couple of functions that do the work.
int ChanMsgDisItem::ndix() // Number of Indices.
{
return 5;
}
static const int CMDI_COL_DATE = 0;
static const int CMDI_COL_MSG = 1;
static const int CMDI_COL_NOFILES = 2;
static const int CMDI_COL_SIZE = 3;
static const int CMDI_COL_MSGHASH = 4;
ChanMsgDisItem::ChanMsgDisItem(chanMsgSummary &s)
:msg(s.msg), mh(s.mh), nofiles(s.nofiles),
totalsize(s.totalsize), recvd(s.recvd)
{
/* change \t & \n into " " */
for(unsigned int i =0; i < msg.length(); i++)
{
if ((msg[i] == '\n') ||
(msg[i] == '\t'))
{
msg[i] = ' ';
}
}
}
std::string ChanMsgDisItem::txt(int col)
{
char numstr[100]; // this will be used regularly....
std::ostringstream out;
switch(col)
{
case CMDI_COL_DATE:
{
int t = time(NULL);
int ago_sec = t - recvd;
out << ago_sec << " secs";
return out.str();
}
break;
case CMDI_COL_MSG:
// remove \n and \t... (done at init)
return msg;
break;
case CMDI_COL_NOFILES:
{
out << nofiles;
return out.str();
}
break;
case CMDI_COL_SIZE:
{
if (totalsize > 1000000)
{
out << (totalsize / 1000000.0) << " MB";
}
else if (totalsize > 1000)
{
out << (totalsize / 1000.0) << " kB";
}
else
{
out << totalsize << " B";
}
return out.str();
}
break;
case CMDI_COL_MSGHASH:
{
mh.printHex(out);
return out.str();
}
break;
default:
break;
}
return out.str();
}
int ChanMsgDisItem::cmp(int col, DisplayData *fdi)
{
ChanMsgDisItem *other = (ChanMsgDisItem *) fdi;
switch(col)
{
case CMDI_COL_DATE:
{
return recvd - other->recvd;
}
break;
case CMDI_COL_MSG:
{
return strcmp(msg.c_str(),
other->msg.c_str());
}
break;
case CMDI_COL_NOFILES:
{
return nofiles-other->nofiles;
}
break;
case CMDI_COL_SIZE:
{
return totalsize-other->totalsize;
}
break;
case CMDI_COL_MSGHASH:
{
if (mh == other->mh)
return 0;
if (mh < other->mh)
return -1;
return 1;
}
break;
default:
break;
}
return 0;
}
static const int CFDI_COL_SIZE = 0;
static const int CFDI_COL_NAME = 1;
// a couple of functions that do the work.
int ChanFileDisItem::ndix() // Number of Indices.
{
return 2;
}
ChanFileDisItem::ChanFileDisItem(std::string n, int s)
:name(n), size(s)
{
return;
}
std::string ChanFileDisItem::txt(int col)
{
char numstr[100]; // this will be used regularly....
std::ostringstream out;
switch(col)
{
case CFDI_COL_SIZE:
{
if (size > 1000000)
{
out << (size / 1000000.0) << " MB";
}
else if (size > 1000)
{
out << (size / 1000.0) << " kB";
}
else
{
out << size << " B";
}
return out.str();
}
break;
case CFDI_COL_NAME:
return name;
break;
default:
break;
}
return out.str();
}
int ChanFileDisItem::cmp(int col, DisplayData *fdi)
{
ChanFileDisItem *other = (ChanFileDisItem *) fdi;
switch(col)
{
case CFDI_COL_SIZE:
{
return size - other->size;
}
break;
case CFDI_COL_NAME:
{
return strcmp(name.c_str(),
other->name.c_str());
}
break;
default:
break;
}
return 0;
}

View File

@ -1,219 +0,0 @@
/*
* "$Id: pqibrowseitem.h,v 1.7 2007-02-18 21:46:49 rmf24 Exp $"
*
* FltkGUI for RetroShare.
*
* Copyright 2004-2006 by Robert Fernie.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License Version 2 as published by the Free Software Foundation.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*
* Please report all bugs and problems to "retroshare@lunamutt.com".
*
*/
#ifndef MRKS_PQI_BROWSER_ITEMS
#define MRKS_PQI_BROWSER_ITEMS
/* My new funky browser.....
*
* - Designed to sort/display a tree brower
* for search results....
*
* First we need the basic interface class that
* must wrap the Data....
*/
#include "fltkgui/Fl_Funky_Browser.h"
#include "pqi/pqi.h"
#include "pqi/p3channel.h"
class FileDisItem: public DisplayData
{
public:
FileDisItem(PQFileItem *i, SearchItem *s) :item(i), terms(s) { return; }
// a couple of functions that do the work.
virtual int ndix(); // Number of Indices.
virtual std::string txt(int col);
virtual int cmp(int col, DisplayData *);
PQFileItem *getItem() { return item;}
void setItem(PQFileItem *i) {item = i;}
SearchItem *getSearchItem() { return terms;}
void setSearchItem(SearchItem *s) {terms = s;}
private:
PQFileItem *item;
SearchItem *terms;
};
class PersonDisItem: public DisplayData
{
public:
PersonDisItem(Person *i) :item(i), checked(false) { return; }
// a couple of functions that do the work.
virtual int ndix(); // Number of Indices.
virtual std::string txt(int col);
virtual int cmp(int col, DisplayData *);
virtual int check(int n, int v = -1)
{
if (v == -1)
return (int) checked;
if (v == 0)
return checked = false;
return checked = true;
};
Person *getItem() { return item;}
void setItem(Person *i) {item = i;}
private:
Person *item;
bool checked;
};
class NeighDisItem: public DisplayData
{
public:
NeighDisItem(Person *i) :item(i) { return; }
// a couple of functions that do the work.
virtual int ndix(); // Number of Indices.
virtual std::string txt(int col);
virtual int cmp(int col, DisplayData *);
Person *getItem() { return item;}
void setItem(Person *i) {item = i;}
private:
Person *item;
};
class MsgDisItem: public DisplayData
{
public:
MsgDisItem(MsgItem *i) :item(i) { return; }
// a couple of functions that do the work.
virtual int ndix(); // Number of Indices.
virtual std::string txt(int col);
virtual int cmp(int col, DisplayData *);
MsgItem *getItem() { return item;}
void setItem(MsgItem *i) {item = i;}
private:
MsgItem *item;
};
class FTDisItem: public DisplayData
{
public:
FTDisItem(FileTransferItem *i) :item(i) { return; }
// a couple of functions that do the work.
virtual int ndix(); // Number of Indices.
virtual std::string txt(int col);
virtual int cmp(int col, DisplayData *);
FileTransferItem *getItem() { return item;}
void setItem(FileTransferItem *i) {item = i;}
private:
FileTransferItem *item;
};
/* NOTE The Channel classes should be changed to just
* carry the channelSign around.... this is enough
* to refer to the channels....
*
* don't want pointers to pqichannels....
*/
class ChanDisItem: public DisplayData
{
public:
ChanDisItem(pqichannel *i);
// a couple of functions that do the work.
virtual int ndix(); // Number of Indices.
virtual std::string txt(int col);
virtual int cmp(int col, DisplayData *);
virtual int check(int n, int v = -1)
{
if (v == -1)
return (int) checked;
if (v == 0)
return checked = false;
return checked = true;
};
public:
channelSign cs;
int mode;
std::string name;
float ranking;
int msgcount;
bool checked; // subscribed..
};
class ChanMsgDisItem: public DisplayData
{
public:
ChanMsgDisItem(chanMsgSummary &s);
// a couple of functions that do the work.
virtual int ndix(); // Number of Indices.
virtual std::string txt(int col);
virtual int cmp(int col, DisplayData *);
public:
std::string msg;
MsgHash mh;
int nofiles;
int totalsize;
long recvd;
};
class ChanFileDisItem: public DisplayData
{
public:
ChanFileDisItem(std::string n, int s);
// a couple of functions that do the work.
virtual int ndix(); // Number of Indices.
virtual std::string txt(int col);
virtual int cmp(int col, DisplayData *);
//private:
std::string name;
int size;
};
#endif

View File

@ -1,745 +0,0 @@
/*
* "$Id: pqistrings.cc,v 1.11 2007-02-18 21:46:49 rmf24 Exp $"
*
* FltkGUI for RetroShare.
*
* Copyright 2004-2006 by Robert Fernie.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License Version 2 as published by the Free Software Foundation.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*
* Please report all bugs and problems to "retroshare@lunamutt.com".
*
*/
#include "pqi/pqi.h"
#include "pqi/pqinetwork.h"
/**************** PQI_USE_XPGP ******************/
#if defined(PQI_USE_XPGP)
#include "pqi/xpgpcert.h"
#else /* X509 Certificates */
/**************** PQI_USE_XPGP ******************/
#include "pqi/sslcert.h"
#endif /* X509 Certificates */
/**************** PQI_USE_XPGP ******************/
#include "fltkgui/pqistrings.h"
#include <iostream>
#include <iomanip>
#include <sstream>
#include <time.h>
/**************** PQI_USE_XPGP ******************/
#if defined(PQI_USE_XPGP)
std::string getXPGPInfo(XPGP *cert);
#endif /* XPGP Certificates */
/**************** PQI_USE_XPGP ******************/
std::string get_status_string(int status)
{
std::string sstr("");
if (status & PERSON_STATUS_CONNECTED)
{
sstr += "Online";
return sstr;
}
if (!(status & PERSON_STATUS_ACCEPTED))
{
sstr += "Denied Access";
return sstr;
}
if (status & PERSON_STATUS_INUSE)
{
sstr += "Connecting";
/*
if (status & PERSON_STATUS_WILL_LISTEN)
{
sstr += "Listening";
}
sstr += "/";
if (status & PERSON_STATUS_WILL_CONNECT)
{
sstr += "Connecting";
}
sstr += "]";
*/
return sstr;
}
sstr += "Unknown";
return sstr;
}
std::string get_neighbourstatus_string(Person *p)
{
// if connected - show how long
// if !autoconnected - tick to connect.
//
// if connecting.
// show time to next connect attempt.
// else show the last connect time.
std::ostringstream connstr;
connstr << "Last Conn/Recv: ";
int lct = time(NULL) - p -> lc_timestamp;
int lrt = time(NULL) - p -> lr_timestamp;
if (lct < 100000000)
{
connstr << get_timeperiod_string(lct);
}
else
{
connstr << "Never";
}
connstr << "/";
if (lrt < 100000000)
{
connstr << get_timeperiod_string(lrt);
}
else
{
connstr << "Never";
}
return connstr.str();
}
int get_lastconnecttime(Person *p)
{
std::ostringstream connstr;
int lct = time(NULL) - p -> lc_timestamp;
int lrt = time(NULL) - p -> lr_timestamp;
if (lrt < lct)
{
lct = lrt;
}
return lct;
}
std::string get_lastconnecttime_string(Person *p)
{
int lct = get_lastconnecttime(p);
if (lct < 32000000)
{
return get_timeperiod_string(lct);
}
else
{
return std::string("Never");
}
}
std::string get_autoconnect_string(Person *p)
{
// if connected - show how long
// if !autoconnected - tick to connect.
//
// if connecting.
// show time to next connect attempt.
// else show the last connect time.
std::ostringstream connstr;
Person *own = getSSLRoot() -> getOwnCert();
if (p == own)
{
connstr << "Yourself";
return connstr.str();
}
if (p -> Connected())
{
/*
long ct = p->lc_timestamp;
if (ct < p->lr_timestamp)
ct = p->lr_timestamp;
connstr << "Online: " << get_timeperiod_string(time(NULL) - ct);
*/
connstr << "Online";
}
else if (p -> Manual())
{
if (p->trustLvl < TRUST_SIGN_AUTHEN)
{
connstr << "Please Authenticate";
}
else
{
connstr << "Tick to Connect";
}
}
else
{
connstr << "Offline";
}
/*
else if (p -> WillConnect())
{
connstr << "Connect in:";
connstr << get_timeperiod_string(p->nc_timestamp - time(NULL));
}
else
{
connstr << "Last Conn:";
long ct = p->lc_timestamp;
if (ct < p->lr_timestamp)
{
ct = p->lr_timestamp;
connstr << "(I):";
}
else
{
connstr << "(O):";
}
connstr << get_timeperiod_string(time(NULL) - ct);
}
*/
return connstr.str();
}
std::string get_trust_string(Person *p)
{
std::ostringstream srvstr;
/* This is now changing to display 2 things.
*
* (1) - Proxy
* (2) - Auth Level.
*/
Person *own = getSSLRoot() -> getOwnCert();
if (p == own)
{
srvstr << "Yourself"; // Certificate";
return srvstr.str();
}
switch(p -> trustLvl)
{
case TRUST_SIGN_OWN:
srvstr << "Auth (S)"; //Good: Own Signature";
break;
case TRUST_SIGN_TRSTED:
srvstr << "Trusted (ST)"; //Good: Trusted Signer";
break;
case TRUST_SIGN_AUTHEN:
srvstr << "Auth"; //Good: Authenticated";
break;
case TRUST_SIGN_BASIC:
srvstr << "Untrusted"; // : Acquaintance ";
break;
case TRUST_SIGN_UNTRUSTED:
srvstr << "Unknown (2)";
break;
case TRUST_SIGN_UNKNOWN:
srvstr << "Unknown (1)";
break;
case TRUST_SIGN_NONE:
srvstr << "Unknown (0)";
break;
case TRUST_SIGN_BAD: /* not checked yet */
srvstr << "Not Avail";
break;
default:
srvstr << "UNKNOWN";
break;
}
return srvstr.str();
}
std::string get_server_string(Person *p)
{
std::ostringstream srvstr;
if ((0 == inaddr_cmp(p -> serveraddr, 0)) || (p -> Local()))
{
if (0 == inaddr_cmp(p -> localaddr, 0))
{
srvstr << "Unknown Addr";
}
else
{
srvstr << "L: " << inet_ntoa(p -> localaddr.sin_addr);
srvstr << ":" << ntohs(p -> localaddr.sin_port);
}
}
else
{
srvstr << "S: " << inet_ntoa(p -> serveraddr.sin_addr);
srvstr << ":" << ntohs(p -> serveraddr.sin_port);
}
// need own cert!
Person *own = getSSLRoot() -> getOwnCert();
if ((isValidNet(&(p->serveraddr.sin_addr))) &&
(!isPrivateNet(&(p->serveraddr.sin_addr))) &&
(!sameNet(&(own->localaddr.sin_addr), &(p->serveraddr.sin_addr))))
{
srvstr << " (Proxy-S) ";
}
else if ((!p->Firewalled()) && (isValidNet(&(p->localaddr.sin_addr))) &&
(!isPrivateNet(&(p->localaddr.sin_addr))) &&
(!sameNet(&(own->localaddr.sin_addr), &(p->localaddr.sin_addr))))
{
srvstr << " (Proxy-L) ";
}
return srvstr.str();
}
const int sec_per_min = 60;
const int sec_per_hour = 3600;
const int sec_per_day = 3600 * 24;
std::string get_timeperiod_string(int secs)
{
int days = secs / sec_per_day;
secs -= days * sec_per_day;
int hours = secs / sec_per_hour;
secs -= hours * sec_per_hour;
int mins = secs / sec_per_min;
secs -= mins * sec_per_min;
std::ostringstream srvstr;
if (days > 0)
{
srvstr << days << " days ";
}
else if (hours > 0)
{
srvstr << hours << ":" << mins << " hours";
}
else
{
srvstr << mins << ":" << secs << " min";
}
return srvstr.str();
}
std::string get_neighbour_info(cert *c)
{
std::ostringstream ostr;
/**************** PQI_USE_XPGP ******************/
#if defined(PQI_USE_XPGP)
ostr << getX509CNString(c -> certificate -> subject -> subject);
#else /* X509 Certificates */
/**************** PQI_USE_XPGP ******************/
ostr << getX509CNString(c -> certificate -> cert_info -> subject);
#endif /* X509 Certificates */
/**************** PQI_USE_XPGP ******************/
ostr << "\t" << get_neighbourstatus_string(c);
return ostr.str();
}
std::string get_cert_info(cert *c)
{
std::ostringstream ostr;
ostr << "************ Certificate **************" << std::endl;
/**************** PQI_USE_XPGP ******************/
#if defined(PQI_USE_XPGP)
ostr << getXPGPInfo(c -> certificate);
#else /* X509 Certificates */
/**************** PQI_USE_XPGP ******************/
ostr << getX509Info(c -> certificate);
#endif /* X509 Certificates */
/**************** PQI_USE_XPGP ******************/
ostr << "********** Connection Info ************" << std::endl;
ostr << "Local Addr : " << inet_ntoa(c -> localaddr.sin_addr);
ostr << ":" << ntohs(c -> localaddr.sin_port) << std::endl;
ostr << "Server Addr : " << inet_ntoa(c -> serveraddr.sin_addr);
ostr << ":" << ntohs(c -> serveraddr.sin_port) << std::endl;
ostr << "FLAGS: ";
if (!c -> Firewalled())
{
ostr << "Not ";
}
ostr << "Firewalled, ";
if (!c -> Forwarded())
{
ostr << "Not ";
}
ostr << "Forwarded" << std::endl;
ostr << std::endl;
ostr << "Last Connect Addr: " << inet_ntoa(c -> lastaddr.sin_addr);
ostr << ":" << ntohs(c -> lastaddr.sin_port) << std::endl;
ostr << "Last Connect Time: ";
ostr << get_timeperiod_string(time(NULL) - c -> lc_timestamp);
ostr << std::endl;
ostr << "Last Receive Time: ";
ostr << get_timeperiod_string(time(NULL) - c -> lr_timestamp);
ostr << std::endl;
ostr << std::endl;
ostr << "Next Connect in : ";
ostr << get_timeperiod_string(c->nc_timestamp - time(NULL));
ostr << std::endl;
ostr << "AutoConnect: " << get_autoconnect_string(c);
ostr << std::endl;
ostr << "***************************************" << std::endl;
return ostr.str();
}
std::string getX509Info(X509 *cert)
{
// Details from the structure
// cert_info (X509_CINF *)
// sig_alg (X509_ALGOR *)
// signature (ASN1_BIT_STRING *)
// valid (int)
// references (int)
// name (char *)
//
// random flags
//
// skid (ASN1_OCTET_STRING *)
// akid (AUTHORITY_KEYID *)
// aux (X509_CERT_AUX *)
std::string certstr;
char numstr[1000];
sprintf(numstr, "%ld", ASN1_INTEGER_get(cert -> cert_info -> version));
certstr += "Version: ";
certstr += numstr;
sprintf(numstr, "%ld", ASN1_INTEGER_get(cert ->
cert_info -> serialNumber));
certstr += "\nSerial Number: ";
certstr += numstr;
// switch(cert -> cert_info -> signature)
// {
// case STANDRD:
// certstr += "\nSig Algorithm: Standard";
// break;
// default:
// certstr += "\nSig Algorithm: Unknown";
// break;
// }
//
certstr += "\nSubject:\n";
certstr += getX509NameString(cert -> cert_info -> subject);
// Validity in Here. cert -> cert_info -> validity;
certstr += "\nIssuer:\n";
certstr += getX509NameString(cert -> cert_info -> issuer);
// Key cert -> cert_info -> key;
//
// IDS + extensions. cert -> cert_info -> issuerUID/subjectUID;
// cert -> cert_info -> extensions;
// END OF INFO.
// Next sigalg again?
// next sig...
certstr += "\nSignature:";
for(int i = 0; i < cert -> signature -> length;)
{
if (i % 128 == 0)
{
certstr += "\n\t";
}
char hbyte = 0;
for(int j = 0; (j < 4) && (i < cert -> signature -> length);
j++, i++)
{
hbyte = hbyte << 1;
if (ASN1_BIT_STRING_get_bit(cert -> signature, i) == 1)
{
hbyte++;
//std::cerr << "1";
}
else
{
//std::cerr << "0";
}
}
if (hbyte > 9)
{
certstr += ('a' + (hbyte - 10));
}
else
{
certstr += ('0' + hbyte);
}
//std::cerr << " " << i << " " << (char) ('0' + hbyte);
//std::cerr << " " << (int) hbyte << std::endl;
}
sprintf(numstr, "%d/%d", cert -> valid, cert -> references);
certstr += "\nValid/References: ";
certstr += numstr;
certstr += "\n";
// That will do for now.
return certstr;
}
/* Helper function to convert a Epoch Timestamp
* into a string.
*/
static char *TIME_FORMAT_STR_BRIEF = "%H:%M:%S";
static char *TIME_FORMAT_STR_OLDVAGUE_NOW = "%H:%M:%S";
static char *TIME_FORMAT_STR_OLDVAGUE_WEEK = "%a %H:%M";
static char *TIME_FORMAT_STR_OLDVAGUE_OLD = "%a, %d %b";
static char *TIME_FORMAT_STR_LONG = "%c";
static char *TIME_FORMAT_STR_NORMAL = "%a, %H:%M:%S";
std::string timeFormat(int epoch, int format)
{
time_t ctime = epoch;
struct tm *stime = localtime(&ctime);
size_t msize = 1024;
char space[msize];
char *fmtstr = NULL;
if (format == TIME_FORMAT_OLDVAGUE)
{
int itime = time(NULL);
int delta = abs(itime - ctime);
if (delta < 12 * 3600)
{
format = TIME_FORMAT_OLDVAGUE_NOW;
}
else if (delta < 3 * 24 * 3600)
{
format = TIME_FORMAT_OLDVAGUE_WEEK;
}
else
{
format = TIME_FORMAT_OLDVAGUE_OLD;
}
}
switch(format)
{
case TIME_FORMAT_BRIEF:
fmtstr = TIME_FORMAT_STR_BRIEF;
break;
case TIME_FORMAT_OLDVAGUE_NOW:
fmtstr = TIME_FORMAT_STR_OLDVAGUE_NOW;
break;
case TIME_FORMAT_OLDVAGUE_WEEK:
fmtstr = TIME_FORMAT_STR_OLDVAGUE_WEEK;
break;
case TIME_FORMAT_OLDVAGUE_OLD:
fmtstr = TIME_FORMAT_STR_OLDVAGUE_OLD;
break;
case TIME_FORMAT_LONG:
fmtstr = TIME_FORMAT_STR_LONG;
break;
case TIME_FORMAT_NORMAL:
default:
fmtstr = TIME_FORMAT_STR_NORMAL;
break;
}
if (fmtstr != NULL) // Short -> Only Time.
{
int usize = strftime(space, msize, fmtstr, stime);
if (usize > 0)
return std::string(space);
}
return std::string("");
}
/**************** PQI_USE_XPGP ******************/
#if defined(PQI_USE_XPGP)
std::string getXPGPInfo(XPGP *cert)
{
std::stringstream out;
long l;
int i,j;
out << "XPGP Certificate:" << std::endl;
l=XPGP_get_version(cert);
out << " Version: " << l+1 << "(0x" << l << ")" << std::endl;
out << " Subject: " << std::endl;
out << " " << getX509NameString(cert -> subject -> subject);
out << std::endl;
out << std::endl;
out << " Signatures:" << std::endl;
for(i = 0; i < sk_XPGP_SIGNATURE_num(cert->signs); i++)
{
out << "Sign[" << i << "] -> [";
XPGP_SIGNATURE *sig = sk_XPGP_SIGNATURE_value(cert->signs,i);
ASN1_BIT_STRING *signature = sig->signature;
int signlen = ASN1_STRING_length(signature);
unsigned char *signdata = ASN1_STRING_data(signature);
/* only show the first 8 bytes */
if (signlen > 8)
signlen = 8;
for(j=0;j<signlen;j++)
{
out << std::hex << std::setw(2) << (int) (signdata[j]);
if ((j+1)%16==0)
{
out << std::endl;
}
else
{
out << ":";
}
}
out << "] by:";
out << std::endl;
out << getX509NameString(sig->issuer);
out << std::endl;
out << std::endl;
}
return out.str();
}
std::string getXPGPAuthCode(XPGP *xpgp)
{
/* get the self signature -> the first signature */
std::stringstream out;
if (1 > sk_XPGP_SIGNATURE_num(xpgp->signs))
{
out.str();
}
XPGP_SIGNATURE *sig = sk_XPGP_SIGNATURE_value(xpgp->signs,0);
ASN1_BIT_STRING *signature = sig->signature;
int signlen = ASN1_STRING_length(signature);
unsigned char *signdata = ASN1_STRING_data(signature);
/* extract the authcode from the signature */
/* convert it to a string, inverse of 2 bytes of signdata */
if (signlen > 2)
signlen = 2;
int j;
for(j=0;j<signlen;j++)
{
out << std::hex << std::setprecision(2) << std::setw(2)
<< std::setfill('0') << (unsigned int) (signdata[j]);
}
return out.str();
}
std::list<std::string> getXPGPsigners(XPGP *cert)
{
std::list<std::string> signers;
int i;
for(i = 0; i < sk_XPGP_SIGNATURE_num(cert->signs); i++)
{
XPGP_SIGNATURE *sig = sk_XPGP_SIGNATURE_value(cert->signs,i);
std::string str = getX509CNString(sig->issuer);
signers.push_back(str);
std::cerr << "XPGPsigners(" << i << ")" << str << std::endl;
}
return signers;
}
#endif /* XPGP Certificates */
/**************** PQI_USE_XPGP ******************/
std::string get_cert_name(cert *c)
{
/**************** PQI_USE_XPGP ******************/
#if defined(PQI_USE_XPGP)
return getX509CNString(c->certificate->subject -> subject);
#else
return getX509CNString(c->certificate->cert_info -> subject);
#endif /* XPGP Certificates */
/**************** PQI_USE_XPGP ******************/
}
std::string get_cert_org(cert *c)
{
/**************** PQI_USE_XPGP ******************/
#if defined(PQI_USE_XPGP)
return getX509OrgString(c->certificate->subject -> subject);
#else
return getX509OrgString(c->certificate->cert_info -> subject);
#endif /* XPGP Certificates */
/**************** PQI_USE_XPGP ******************/
}
std::string get_cert_loc(cert *c)
{
/**************** PQI_USE_XPGP ******************/
#if defined(PQI_USE_XPGP)
return getX509LocString(c->certificate->subject -> subject);
#else
return getX509LocString(c->certificate->cert_info -> subject);
#endif /* XPGP Certificates */
/**************** PQI_USE_XPGP ******************/
}
std::string get_cert_country(cert *c)
{
/**************** PQI_USE_XPGP ******************/
#if defined(PQI_USE_XPGP)
return getX509CountryString(c->certificate->subject -> subject);
#else
return getX509CountryString(c->certificate->cert_info -> subject);
#endif /* XPGP Certificates */
/**************** PQI_USE_XPGP ******************/
}

View File

@ -1,79 +0,0 @@
/*
* "$Id: pqistrings.h,v 1.6 2007-02-18 21:46:49 rmf24 Exp $"
*
* FltkGUI for RetroShare.
*
* Copyright 2004-2006 by Robert Fernie.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License Version 2 as published by the Free Software Foundation.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*
* Please report all bugs and problems to "retroshare@lunamutt.com".
*
*/
#ifndef PQI_STRINGS_H
#define PQI_STRINGS_H
#include <string>
#include <list>
class Person;
class cert;
#include <openssl/ssl.h>
std::string get_cert_country(cert *c);
std::string get_cert_loc(cert *c);
std::string get_cert_org(cert *c);
std::string get_cert_name(cert *c);
std::string get_status_string(int status);
std::string get_autoconnect_string(Person *p);
std::string get_server_string(Person *p);
std::string get_trust_string(Person *p);
std::string get_timeperiod_string(int secs);
std::string get_cert_info(cert *c);
std::string get_neighbour_info(cert *c);
int get_lastconnecttime(Person *p);
std::string get_lastconnecttime_string(Person *p);
std::string getX509NameString(X509_NAME *name);
std::string getX509Info(X509 *cert);
std::string getX509CNString(X509_NAME *name);
#define TIME_FORMAT_BRIEF 0x001
#define TIME_FORMAT_LONG 0x002
#define TIME_FORMAT_NORMAL 0x003
#define TIME_FORMAT_OLDVAGUE 0x004
#define TIME_FORMAT_OLDVAGUE_NOW 0x005
#define TIME_FORMAT_OLDVAGUE_WEEK 0x006
#define TIME_FORMAT_OLDVAGUE_OLD 0x007
std::string timeFormat(int epoch, int format);
#if defined(PQI_USE_XPGP)
std::string getXPGPInfo(XPGP *cert);
std::string getXPGPAuthCode(XPGP *xpgp);
std::list<std::string> getXPGPsigners(XPGP *cert);
#endif /* XPGP Certificates */
#endif

View File

@ -1,338 +0,0 @@
/*
* "$Id: retrotray.cc,v 1.5 2007-02-18 21:46:49 rmf24 Exp $"
*
* FltkGUI for RetroShare.
*
* Copyright 2004-2006 by Robert Fernie.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License Version 2 as published by the Free Software Foundation.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*
* Please report all bugs and problems to "retroshare@lunamutt.com".
*
*/
#include <windows.h>
#include <iostream>
#include <stdlib.h>
#include "fltkgui/retroTray.h"
#include "pqi/pqidebug.h"
static retroTray tray;
static NOTIFYICONDATA s_nid;
static std::string icn_path;
int SetIconPath(const char *iconpath)
{
icn_path = iconpath;
return 1;
}
int InitialiseRetroTray(HINSTANCE hi, HICON icn, UserInterface *ui)
{
tray.init(hi);
std::string iconpath = "/programs/icons";
std::string fname = "tst.ico";
// for now install a default one.
// if (icn == (HICON) NULL)
{
//icn = LoadCursorFromFile(fname.c_str());
icn = LoadCursorFromFile(icn_path.c_str());
//icn = (HICON) LoadImage(hi, fname.c_str(), IMAGE_ICON, 16, 16, 0);
std::cerr << "Loaded ICON: " << icn << std::endl;
}
//tray.loadIcons(iconpath);
tray.installIcon(icn, ui);
// while(1)
// Sleep(1000);
return 1;
}
static LRESULT CALLBACK systray_handler(HWND hwnd, UINT msg, WPARAM type0, LPARAM type) {
static UINT taskbarRestartMsg; /* static here means value is kept across multiple calls to this func */
std::cerr << "Call of The Handler(" << msg << ",";
std::cerr << type0 << "," << type << ")" << std::endl;
switch(msg) {
case WM_CREATE:
std::cerr << "WM_CREATE";
//taskbarRestartMsg = RegisterWindowMessage("TaskbarCreated");
break;
case WM_TIMER:
std::cerr << "WM_TIMER";
break;
case WM_DESTROY:
std::cerr << "WM_DESTROY";
break;
case WM_USER:
{
std::cerr << "WM_USER";
tray.buttonPressed(type0, type);
break;
}
default:
std::cerr << "default";
if (msg == taskbarRestartMsg)
{
std::cerr << " RESTART MSG";
//tray.InstallIcon(0);
}
break;
}
std::cerr << std::endl;
//return CallDefWindowProc(hwnd, msg, type0, type);
return CallWindowProc(DefWindowProc, hwnd, msg, type0, type);
}
retroTray::retroTray()
:hInst(0)
{
//ZeroMemory(&hwin, sizeof(hwin));
ZeroMemory(&nid, sizeof(nid));
return;
}
int retroTray::init(HINSTANCE hi)
{
hInst = hi;
return 1;
}
int retroTray::installIcon(HICON ic, UserInterface *ui)
{
retroRoot = ui;
hIcon = ic;
//(HICON) IDI_QUESTION;
//icn;
// First create hidden window (could be RetroShare)
if (nid.cbSize!=sizeof(NOTIFYICONDATA))
{
WNDCLASSEX wcex;
wcex.style = 0;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hIcon = NULL;
wcex.hIconSm = NULL;
wcex.hCursor = NULL;
wcex.hbrBackground = NULL;
wcex.lpszMenuName = NULL;
wcex.lpszClassName = "retroTray";
wcex.hInstance = hInst;
wcex.lpfnWndProc = (WNDPROC) systray_handler;
wcex.cbSize = sizeof(WNDCLASSEX);
RegisterClassEx(&wcex);
hWnd = CreateWindow("retroTray", "", 0,0,0,0,0,
GetDesktopWindow(), NULL, hInst, 0);
std::cerr << "Created Hidden Window" << std::endl;
}
ZeroMemory(&nid, sizeof(nid));
nid.hWnd = hWnd;
nid.uID = 0; //nextid++;
nid.uFlags= NIF_ICON | NIF_MESSAGE | NIF_TIP;
nid.uCallbackMessage=WM_USER;
nid.hIcon=hIcon;
strcpy(nid.szTip, "Hello World from RetroShare");
nid.cbSize=sizeof(NOTIFYICONDATA);
s_nid = nid;
if (Shell_NotifyIcon(NIM_ADD, &s_nid))
{
std::cerr << "Notify Success" << std::endl;
}
else
{
std::cerr << "Notify Failure" << std::endl;
}
std::cerr << "Icon Installed??" << std::endl;
return 1;
}
int retroTray::buttonPressed(int type0, int type)
{
std::cerr << "retroTray::buttonPressed(" << type0;
std::cerr << "," << type << ")" << std::endl;
if (type == WM_LBUTTONDBLCLK)
{
std::cerr << "Showing RetroShare!" << std::endl;
showRetroShare();
}
else if (type == WM_LBUTTONUP)
{
std::cerr << "Showing RetroShare(B)!" << std::endl;
showRetroShare();
}
else if (type == WM_MBUTTONUP)
{
std::cerr << "Hiding RetroShare!" << std::endl;
hideRetroShare();
}
else if (type == WM_RBUTTONDOWN)
{
std::cerr << "Showing TaskMenu!" << std::endl;
showTrayMenu();
}
else //if (type == WM_RBUTTONUP)
{
std::cerr << "Leaving RetroShare!" << std::endl;
// do nothing.
}
return 1;
}
//
//int retroTray::addIcon()
//{
// return 1;
//}
//
//
//int retroTray::removeIcon()
//{
// return 1;
//}
//
//
//int retroTray::exitCall()
//{
// // if
//static int times = 0;
// if (++times > 20)
// removeIcon();
// return 1;
//}
//
//
//
#define RTRAY_MENU_NULL 0
#define RTRAY_MENU_HIDE 1
#define RTRAY_MENU_SHOW 2
#define RTRAY_MENU_QUIT 3
int retroTray::showTrayMenu(void)
{
long menuChoice;
// First We need a Menu.
HMENU popup;
unsigned int flag;
popup = ::CreatePopupMenu();
flag = MF_BYPOSITION;
::InsertMenu(popup, 0, flag, RTRAY_MENU_QUIT, "Quit");
flag = MF_BYPOSITION | MF_SEPARATOR;
::InsertMenu(popup, 0, flag, 0x000, "Seperator");
flag = MF_BYPOSITION;
::InsertMenu(popup, 0, flag, RTRAY_MENU_HIDE, "Hide RetroShare");
::InsertMenu(popup, 0, flag, RTRAY_MENU_SHOW, "Open RetroShare");
flag = MF_BYPOSITION | MF_SEPARATOR;
::InsertMenu(popup, 0, flag, 0x000, "Seperator");
flag = MF_BYPOSITION;
::InsertMenu(popup, 0, flag, 0x001, "About RetroShare");
POINT pp;
RECT rect;
rect.left = 0;
rect.top = 0;
rect.right = 1000;
rect.bottom = 1000;
::GetCursorPos(&pp);
menuChoice = ::TrackPopupMenu(popup,
TPM_LEFTALIGN |
TPM_LEFTBUTTON |
TPM_RIGHTBUTTON |
TPM_NONOTIFY |
TPM_RETURNCMD,
pp.x,pp.y, 0, hWnd, &rect);
::DestroyMenu(popup);
// The value of SelectionMade is the id of the command selected or 0 if no
// selection was made
switch(menuChoice)
{
case RTRAY_MENU_NULL:
/*
AfxMessageBox("Starting Null");
*/
break;
case RTRAY_MENU_HIDE:
hideRetroShare();
break;
case RTRAY_MENU_SHOW:
showRetroShare();
break;
case RTRAY_MENU_QUIT:
/* before exiting - clear the debug log */
clearDebugCrashLog();
exit(1);
break;
}
return 1;
}
/**********************
HWND CreateDialog(
HINSTANCE hInstance,
LPCTSTR lpTemplate,
HWND hWndParent,
DLGPROC lpDialogFunc
);
**********************/

View File

@ -1,112 +0,0 @@
/*
* "$Id: retrotray.h,v 1.5 2007-02-18 21:46:49 rmf24 Exp $"
*
* FltkGUI for RetroShare.
*
* Copyright 2004-2006 by Robert Fernie.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License Version 2 as published by the Free Software Foundation.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*
* Please report all bugs and problems to "retroshare@lunamutt.com".
*
*/
#ifndef MRK_RETRO_TRAY_H
#define MRK_RETRO_TRAY_H
/**
*
* This class encapsulates the windows? system tray icon.
*
*/
#include <windows.h>
#include <winsock2.h>
#include <process.h>
//#include <winbase.h>
//#include <winuser.h>
#include <shellapi.h>
#include <io.h>
// The Gui type of Window.
#include "fltkgui/guitab.h"
/**************** PQI_USE_XPGP ******************/
#if defined(PQI_USE_XPGP)
#include "pqi/xpgpcert.h"
#else /* X509 Certificates */
/**************** PQI_USE_XPGP ******************/
#include "pqi/sslcert.h"
#endif /* X509 Certificates */
/**************** PQI_USE_XPGP ******************/
int SetIconPath(const char *path);
int InitialiseRetroTray(HINSTANCE hi, HICON icn, UserInterface *ui);
class retroTray
{
public:
retroTray();
int init(HINSTANCE hi);
int installIcon(HICON icn, UserInterface *ui);
int buttonPressed(int, int);
private:
void showRetroShare()
{
if (getSSLRoot() -> active())
{
retroRoot -> main_win -> show();
visible = true;
}
else
{
retroRoot -> welcome_window -> show();
}
}
void hideRetroShare()
{
retroRoot -> main_win -> hide();
retroRoot -> welcome_window -> hide();
retroRoot -> alert_window -> hide();
retroRoot -> chatter_window -> hide();
visible = false;
}
int showTrayMenu();
HINSTANCE hInst;
HWND hWnd;
HICON hIcon;
NOTIFYICONDATA nid;
UserInterface *retroRoot;
bool visible;
};
#endif