transactionview::transactionview(qwidget *parent) :
    qwidget(parent), model(0), transactionproxymodel(0),
    transactionview(0)
{
    // build filter row
    setcontentsmargins(0,0,0,0);

    qhboxlayout *hlayout = new qhboxlayout();
    hlayout->setcontentsmargins(0,0,0,0);
#ifdef q_os_mac
    hlayout->setspacing(5);
    hlayout->addspacing(26);
#else
    hlayout->setspacing(0);
    hlayout->addspacing(23);
#endif

    watchonlywidget = new qcombobox(this);
    watchonlywidget->setfixedwidth(24);
    watchonlywidget->additem("", transactionfilterproxy::watchonlyfilter_all);
    watchonlywidget->additem(singlecoloricon(":/icons/eye_plus"), "", transactionfilterproxy::watchonlyfilter_yes);
    watchonlywidget->additem(singlecoloricon(":/icons/eye_minus"), "", transactionfilterproxy::watchonlyfilter_no);
    hlayout->addwidget(watchonlywidget);

    datewidget = new qcombobox(this);
#ifdef q_os_mac
    datewidget->setfixedwidth(121);
#else
    datewidget->setfixedwidth(120);
#endif
    datewidget->additem(tr("all"), all);
    datewidget->additem(tr("today"), today);
    datewidget->additem(tr("this week"), thisweek);
    datewidget->additem(tr("this month"), thismonth);
    datewidget->additem(tr("last month"), lastmonth);
    datewidget->additem(tr("this year"), thisyear);
    datewidget->additem(tr("range..."), range);
    hlayout->addwidget(datewidget);

    typewidget = new qcombobox(this);
#ifdef q_os_mac
    typewidget->setfixedwidth(121);
#else
    typewidget->setfixedwidth(120);
#endif

    typewidget->additem(tr("all"), transactionfilterproxy::all_types);
    typewidget->additem(tr("received with"), transactionfilterproxy::type(transactionrecord::recvwithaddress) |
                        transactionfilterproxy::type(transactionrecord::recvfromother));
    typewidget->additem(tr("sent to"), transactionfilterproxy::type(transactionrecord::sendtoaddress) |
                        transactionfilterproxy::type(transactionrecord::sendtoother));
    typewidget->additem(tr("to yourself"), transactionfilterproxy::type(transactionrecord::sendtoself));
    typewidget->additem(tr("mined"), transactionfilterproxy::type(transactionrecord::generated));
    typewidget->additem(tr("other"), transactionfilterproxy::type(transactionrecord::other));

    hlayout->addwidget(typewidget);

    addresswidget = new qlineedit(this);
#if qt_version >= 0x040700
    addresswidget->setplaceholdertext(tr("enter address or label to search"));
#endif
    hlayout->addwidget(addresswidget);

    amountwidget = new qlineedit(this);
#if qt_version >= 0x040700
    amountwidget->setplaceholdertext(tr("min amount"));
#endif
#ifdef q_os_mac
    amountwidget->setfixedwidth(97);
#else
    amountwidget->setfixedwidth(100);
#endif
    amountwidget->setvalidator(new qdoublevalidator(0, 1e20, 8, this));
    hlayout->addwidget(amountwidget);

    qvboxlayout *vlayout = new qvboxlayout(this);
    vlayout->setcontentsmargins(0,0,0,0);
    vlayout->setspacing(0);

    qtableview *view = new qtableview(this);
    vlayout->addlayout(hlayout);
    vlayout->addwidget(createdaterangewidget());
    vlayout->addwidget(view);
    vlayout->setspacing(0);
    int width = view->verticalscrollbar()->sizehint().width();
    // cover scroll bar width with spacing
#ifdef q_os_mac
    hlayout->addspacing(width+2);
#else
    hlayout->addspacing(width);
#endif
    // always show scroll bar
    view->setverticalscrollbarpolicy(qt::scrollbaralwayson);
    view->settabkeynavigation(false);
    view->setcontextmenupolicy(qt::customcontextmenu);

    view->installeventfilter(this);

    transactionview = view;

    // actions
    qaction *copyaddressaction = new qaction(tr("copy address"), this);
    qaction *copylabelaction = new qaction(tr("copy label"), this);
    qaction *copyamountaction = new qaction(tr("copy amount"), this);
    qaction *copytxidaction = new qaction(tr("copy transaction id"), this);
    qaction *editlabelaction = new qaction(tr("edit label"), this);
    qaction *showdetailsaction = new qaction(tr("show transaction details"), this);

    contextmenu = new qmenu();
    contextmenu->addaction(copyaddressaction);
    contextmenu->addaction(copylabelaction);
    contextmenu->addaction(copyamountaction);
    contextmenu->addaction(copytxidaction);
    contextmenu->addaction(editlabelaction);
    contextmenu->addaction(showdetailsaction);

    mapperthirdpartytxurls = new qsignalmapper(this);

    // connect actions
    connect(mapperthirdpartytxurls, signal(mapped(qstring)), this, slot(openthirdpartytxurl(qstring)));

    connect(datewidget, signal(activated(int)), this, slot(choosedate(int)));
    connect(typewidget, signal(activated(int)), this, slot(choosetype(int)));
    connect(watchonlywidget, signal(activated(int)), this, slot(choosewatchonly(int)));
    connect(addresswidget, signal(textchanged(qstring)), this, slot(changedprefix(qstring)));
    connect(amountwidget, signal(textchanged(qstring)), this, slot(changedamount(qstring)));

    connect(view, signal(doubleclicked(qmodelindex)), this, signal(doubleclicked(qmodelindex)));
    connect(view, signal(customcontextmenurequested(qpoint)), this, slot(contextualmenu(qpoint)));

    connect(copyaddressaction, signal(triggered()), this, slot(copyaddress()));
    connect(copylabelaction, signal(triggered()), this, slot(copylabel()));
    connect(copyamountaction, signal(triggered()), this, slot(copyamount()));
    connect(copytxidaction, signal(triggered()), this, slot(copytxid()));
    connect(editlabelaction, signal(triggered()), this, slot(editlabel()));
    connect(showdetailsaction, signal(triggered()), this, slot(showdetails()));
}
예제 #2
0
파일: locale.c 프로젝트: Hooman3/freebsd
int
main(int argc, char *argv[])
{
	int	ch;
	int	tmp;

	while ((ch = getopt(argc, argv, "ackms:")) != -1) {
		switch (ch) {
		case 'a':
			all_locales = 1;
			break;
		case 'c':
			prt_categories = 1;
			break;
		case 'k':
			prt_keywords = 1;
			break;
		case 'm':
			all_charmaps = 1;
			break;
		default:
			usage();
		}
	}
	argc -= optind;
	argv += optind;

	/* validate arguments */
	if (all_locales && all_charmaps)
		usage();
	if ((all_locales || all_charmaps) && argc > 0)
		usage();
	if ((all_locales || all_charmaps) && (prt_categories || prt_keywords))
		usage();

	/* process '-a' */
	if (all_locales) {
		list_locales();
		exit(0);
	}

	/* process '-m' */
	if (all_charmaps) {
		list_charmaps();
		exit(0);
	}

	/* check for special case '-k list' */
	tmp = 0;
	if (prt_keywords && argc > 0)
		while (tmp < argc)
			if (strcasecmp(argv[tmp++], "list") == 0) {
				showkeywordslist(argv[tmp]);
				exit(0);
			}

	/* process '-c', '-k', or command line arguments. */
	if (prt_categories || prt_keywords || argc > 0) {
		if (argc > 0) {
			setlocale(LC_ALL, "");
			while (argc > 0) {
				showdetails(*argv);
				argv++;
				argc--;
			}
		} else {
			uint i;
			for (i = 0; i < nitems(kwinfo); i++)
				showdetails ((char *)kwinfo [i].name);
		}
		exit(0);
	}

	/* no arguments, show current locale state */
	showlocale();

	return (0);
}
예제 #3
0
void details()
{
cout<<"name";
puts(name);
showdetails(name);
}