Exemple #1
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow),
    lastChanged(false), lastNetworkChanged(true)
{
    ui->setupUi(this);

    createActions();
    createTrayIcon();

    statusLabel = new QLabel(this);
    ui->statusBar->addWidget(statusLabel, 1);

    connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
            this, SLOT(iconActivated(QSystemTrayIcon::ActivationReason)));

    connect(&arpWatcher, SIGNAL(routeUpdated()), this,
            SLOT(routeUpdated()));
    connect(&arpWatcher, SIGNAL(networkChanged(bool)), this,
            SLOT(networkChanged(bool)));
    connect(&arpWatcher, SIGNAL(changeDetected(bool)), this,
            SLOT(changeDetected(bool)));
    connect(&arpWatcher, SIGNAL(newCheck(QString,QString,QString)),
            this, SLOT(newCheck(QString,QString,QString)));

    setIcon("trash", QApplication::applicationName());

    trayIcon->show();

    /* To show the set-up on start */
    routeUpdated();

    arpWatcher.start();
}
Exemple #2
0
void
main(int pointy, char **arguments)
{
    Obj *a, *c;
    Obj *t, *chain;

    chain = ObjChain(a = newButton(1,"A",0,0),
		     newButton(2,"B",0,0));
    chain = ObjChain(chain, c = newCheck(0,0,"C",0,0,0,0));
    chain = ObjChain(chain, newCheck(0,4,"D",0,0,0,0));

    t = ObjChain(chain, chain);

    if (t == (Obj*)0)
	perror("duplicate insert");
    else
	puts("ERROR! duplicate inserts work");

    puts("BACKWARD");
    printPrevObjChain(chain);

    puts("FORWARD");
    printNextObjChain(chain);

    t = copyObj(a);
    setObjTitle(t, "AA");

    chain = extractFromObjChain(chain, a);

    if (chain) {
	puts("FORWARD AFTER EXTRACT");
	printNextObjChain(chain);

	ObjChain(c, a);
	ObjChain(c, t);
	puts("FORWARD AFTER REINSERT");
	printNextObjChain(chain);

	chain = sortObjChain(chain);
	if (chain) {
	    puts("FORWARD AFTER SORT");
	    printNextObjChain(chain);
	}
	else
	    perror("sortObjChain");
    }
    else
	perror("extractFromObjChain");

    deleteObjChain(chain);
    adump();
}
Exemple #3
0
void
main(int argc, char **argv)
{
    void *chain;
    int st;
    char check1 = 0, check2 = 1;
    char name[20];
    char password[20];
    char message[80];
    LIA foo;

    static char msg[] = "This is some text\n"
			"That can be found\n"
			"In a text object\n"
			"At the bottom of the sea\n";

    static ListItem menu[] = {
	/* menuitems need hotkeys */
	{ "A", "Choice A" },
	{ "B", "Choice B" },
	{ "C", "Choice C" },
	{ "D", "Choice D" },
	{ "E", "Choice E" },
	{ "F", "Choice F" },
	{ "G", "Choice G" },
	{ "H", "Choice H" },
    };
    #define NR_MENU	(sizeof menu / sizeof menu[0])

    static ListItem list[] = {
	{ "A", "Choice A", 0, 1 },
	{ "B", "Choice B", 0, 0 },
	{ "C", "Choice C", 0, 0 },
    } ;
    #define NR_LIST	(sizeof list / sizeof list[0])

    strcpy(name, "Fernando Poo");
    name[0] = 0xff;
    strcpy(password, "Sekret");
    strcpy(message, "A MESSAGE");

    setHelpRoot(".");

    chain = ObjChain(newOKButton(1,"OK", 0, 0),
		     newCheck(0,0,"A CHECK ITEM GOES PLONK",0,&check1,0,"demo.html"));
    chain = ObjChain(chain, newCancelButton(2,"CANCEL", 0, "demo.html"));
    chain = ObjChain(chain, newCheck(0,2,0,"Check | your hat?",&check2,0,"demo.html"));
    chain = ObjChain(chain, newString(4,3,10, sizeof name, name,
				      "Name", "Your name", 0, "demo.html"));
    chain = ObjChain(chain, newPWString(0,7,10, sizeof password, password,
				      0, "Your password", 0, "demo.html"));
    chain = ObjChain(chain, newString(0,10,10, sizeof message, message,
				      "String Title", 0, 0, "demo.html"));

    chain = ObjChain(chain, newMenu(30,0,-1,-1,
				    NR_MENU,menu,"A MENU","",
				    MENU_SELECTION, menucallback,"demo.html"));
    chain = ObjChain(chain, list_ying = newList(40,0,-1,-1,
				    NR_LIST,list,"A LIST","",
				    CHECK_SELECTED,0,"demo.html"));
    chain = ObjChain(chain, list_yang = newRadioList(54,0,-1,-1,
					 NR_LIST,list,"SAME LIST","",
					 HIGHLIGHT_SELECTED,0,"demo.html"));

    chain = ObjChain(chain, newText(40,7,20,3,strlen(msg),"Text",0,msg,0,"demo.html"));

    init_dialog();
    if (argc > 1) {
	switch (atoi(argv[1])) {
	default:
		use_helpline("[TAB] to move, [ESC] to exit");
		st = MENU(chain, 0, 0, "title",
		   "SCIENTIFIC PROGRESS\nGOES BONK", FANCY_MENU|ALIGN_RIGHT);
		if (st == MENU_ERROR)
		    perror("MENU");
		break;

	case 1:
		use_helpline("This is an error message");
		Error("Nothing in particular");
		break;

	case 2:
		use_helpline("Counting down");
		errno = 0;
		MENU(0,-1,-1 ,0, " ONE ", 0);
		usleep(400000);
		use_helpline("tick");
		MENU(0,-1,-1, 0, " TWO ", 0);
		usleep(400000);
		use_helpline("tick");
		MENU(0,-1,-1, 0, "THREE", 0);
		usleep(400000);
		break;
	case 4:
		foo = newLIA(0,0);
		addToLIA(foo, "1", "first", 0);
		addToLIA(foo, "2", "second", 0);
		addToLIA(foo, "3", "third", 0);
		addToLIA(foo, "4", "forth", 0);
		addToLIA(foo, "5", "fifth", 0);

		chain = newListWidget(0,0,18,3,foo,"title", 0,0,0,0);
		chain = ObjChain(chain, newCancelButton(0, "Done", 0, 0));

		st = MENU(chain, -1, -1, "list widget", 0, 0);
		if (st == MENU_ERROR)
		    perror("MENU");
		break;
	}
    }
    else {
	use_helpline("[TAB] or the mouse to navigate, [ESC] to exit");
	st = MENU(chain, -1, -1, "title",
		    "SCIENTIFIC PROGRESS\nGOES BONK", ALIGN_RIGHT);
	if (st == MENU_ERROR)
	    perror("MENU");
    }
    end_dialog();
    adump();
}