Пример #1
0
void
scanboundry(int wrapok, MARK dot, int dir)
{
    if (wrapok) {
	movenext(&dot, dir);
	scanboundpos = dot;
	scanbound_is_header = FALSE;
    } else {
	scanboundpos = curbp->b_line;
	scanbound_is_header = TRUE;
    }
}
movielisty1::movielisty1(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::movielisty1)
{
    ui->setupUi(this);
    QFile file("/home/rakesh/Qt/Reco/python/movielens_1m_uid_aplha");
                file.open(QIODevice::ReadOnly | QIODevice::Text);

                QString path;

                QTextStream in1(&file);
                path= in1.readLine();
                ui->Uidvalue->setText(path);


                QFile file1("/home/rakesh/Qt/Reco/python/movielens_1m_movieWatched.json");
                            file1.open(QIODevice::ReadOnly | QIODevice::Text);

                            QString path1;

                            QTextStream in(&file1);
                            path1= in.readLine();
                            ui->scrollArea->setWidget(new QLabel(path1));


                            QString path2;

                                path2="/home/rakesh/Qt/Reco/python/movielens_1m_Graph.png";



                                QPixmap p(path2);
                                QSize size(ui->img->width(),ui->img->height());
                                p=p.scaled(size);
                                ui->img->setPixmap(p);

                                connect(ui->Next,SIGNAL(clicked()),this,SLOT(movenext()));

}
void userproflisty2::nectclicked()
{
    emit movenext();
}
Пример #4
0
void
attrib_matches(void)
{
#if OPT_HILITEMATCH
    MARK origdot;
    MARK nextdot;
    int status;
    REGIONSHAPE oregionshape = regionshape;
    VIDEO_ATTR vattr;

    assert(curwp != 0);

    ignorecase = window_b_val(curwp, MDIGNCASE);

    if (!need_to_rehilite())
	return;

    if (tb_length(searchpat) == 0 || gregexp == NULL)
	return;

/* #define track_hilite 1 */
#ifdef track_hilite
    mlwrite("rehighlighting");
#endif

    vattr = (VIDEO_ATTR) b_val(curbp, VAL_HILITEMATCH);
    if (vattr == 0)
	return;

    (void) clear_match_attrs(TRUE, 1);

    if (curwp == 0)
	return;

    origdot = DOT;
    DOT.l = buf_head(curbp);
    DOT.o = 0;
    nextdot = DOT;

    scanboundry(FALSE, DOT, FORWARD);
    do {
	if (b_val(curbp, MDHILITEOVERLAP)) {
	    movenext(&(DOT), FORWARD);
	} else {
	    movenext(&nextdot, FORWARD);
	    DOT = nextdot;
	}
	status = scanner(gregexp, FORWARD, FALSE, (int *) 0);
	if (status != TRUE)
	    break;
	if (vattr != VACOLOR)
	    videoattribute = vattr;
	else {
	    int c;
	    for (c = NSUBEXP - 1; c > 0; c--)
		if (gregexp->startp[c] == gregexp->startp[0]
		    && gregexp->endp[c] == gregexp->endp[0])
		    break;
	    if (c > NCOLORS - 1)
		videoattribute = VCOLORATTR(NCOLORS - 1);
	    else
		videoattribute = VCOLORATTR(c + 1);
	}
	MK.l = DOT.l;
	MK.o = DOT.o + (C_NUM) gregexp->mlen;

	/* provide a location for the next non-overlapping match */
	nextdot = MK;
	if (gregexp->mlen > 0)
	    nextdot.o -= BytesBefore(nextdot.l, nextdot.o);

	/* show highlighting from DOT to MK */
	regionshape = rgn_EXACT;
	videoattribute |= VOWN_MATCHES;
	status = attributeregion();
    } while (status == TRUE);

    DOT = origdot;
    regionshape = oregionshape;
    curbp->b_highlight = HILITE_ON;	/* & ~HILITE_DIRTY */
    hilite_suppressed = FALSE;
#endif /* OPT_HILITEMATCH */
}
Пример #5
0
/* extra args -- marking if called from globals, and should mark lines, and
	fromscreen, if the searchpattern is on the screen, so we don't need to
	ask for it.  */
int
fsearch(int f, int n, int marking, int fromscreen)
{
    int status = TRUE;
    int wrapok;
    MARK curpos;
    int didmark = FALSE;
    int didwrap;

    assert(curwp != 0);

    if (f && n < 0)
	return rsearch(f, -n, FALSE, FALSE);

    if (n == 0)
	n = 1;

    wrapok = marking || window_b_val(curwp, MDWRAPSCAN);

    last_srch_direc = FORWARD;

    /* ask the user for a regular expression to search for.  if
     * "marking", then we were called to do line marking for the
     * global command.
     */

    if (!marking) {
	status = readpattern("Search: ", &searchpat, &gregexp,
			     lastkey, fromscreen);
	if (status != TRUE)
	    return status;
    }

    ignorecase = window_b_val(curwp, MDIGNCASE);

    if (curwp == 0)
	return FALSE;

    curpos = DOT;
    scanboundry(wrapok, curpos, FORWARD);
    didwrap = FALSE;
    while (marking || n--) {
	movenext(&(DOT), FORWARD);
	status = scanner(gregexp, FORWARD, wrapok, &didwrap);
	if (status == ABORT) {
	    mlwarn("[Aborted]");
	    DOT = curpos;
	    return status;
	}
	/* if found, mark the line */
	if (status && marking) {
	    /* if we were on a match when we started, then
	       scanner returns TRUE, even though it's
	       on a boundary. quit if we find ourselves
	       marking a line twice */
	    if (lismarked(DOT.l))
		break;
	    lsetmarked(DOT.l);
	    /* and, so the next movenext gets to next line */
	    DOT.o = llength(DOT.l);
	    didmark = TRUE;
	}
	if (!marking && didwrap) {
	    mlwrite("[Search wrapped past end of buffer]");
	    didwrap = FALSE;
	}
	if (status != TRUE)
	    break;
    }

    if (!marking && !status)
	movenext(&(DOT), REVERSE);

    if (marking) {		/* restore dot and offset */
	DOT = curpos;
    } else if (status) {
	savematch(DOT, gregexp->mlen);
	if (samepoint(DOT, curpos)) {
	    mlwrite(onlyonemsg);
	}
    }

    /* Complain if not there.  */
    if ((marking && didmark == FALSE) ||
	(!marking && status == FALSE)) {
	not_found_msg(wrapok, FORWARD);
	return FALSE;
    }

    attrib_matches();
    return TRUE;
}
Пример #6
0
/*
 * backhunt -- repeat previous forward search
 */
int
backhunt(int f, int n)
{
    int status = TRUE;
    int wrapok;
    MARK curpos;
    int didwrap;

    assert(curwp != 0);

    wrapok = window_b_val(curwp, MDWRAPSCAN);

    if (f && n < 0)		/* search forwards */
	return (forwhunt(f, -n));

    if (n == 0)
	n = 1;

    /* Make sure a pattern exists */
    if (tb_length(searchpat) == 0) {
	mlforce("[No pattern set]");
	return FALSE;
    }

    ignorecase = window_b_val(curwp, MDIGNCASE);

    if (curwp == 0)
	return FALSE;

    /* find n'th occurrence of pattern
     */
    curpos = DOT;
    scanboundry(wrapok, DOT, REVERSE);
    didwrap = FALSE;
    while (n--) {
	movenext(&(DOT), REVERSE);
	status = scanner(gregexp, REVERSE, wrapok, &didwrap);
	if (didwrap) {
	    mlwrite("[Search wrapped past start of buffer]");
	    didwrap = FALSE;
	}
	if (status != TRUE)
	    break;
    }

    if (status == TRUE) {
	savematch(DOT, gregexp->mlen);
	if (samepoint(DOT, curpos)) {
	    mlwrite(onlyonemsg);
	}
    } else if (status == FALSE) {
	movenext(&(DOT), FORWARD);
	not_found_msg(wrapok, REVERSE);
    } else if (status == ABORT) {
	mlwarn("[Aborted]");
	DOT = curpos;
	return status;
    }

    attrib_matches();
    return status;
}
Пример #7
0
/* ARGSUSED */
static int
rsearch(int f, int n, int dummy GCC_UNUSED, int fromscreen)
{
    int status;
    int wrapok;
    MARK curpos;
    int didwrap;

    assert(curwp != 0);

    if (f && n < 0)		/* reverse direction */
	return fsearch(f, -n, FALSE, fromscreen);

    if (n == 0)
	n = 1;

    wrapok = window_b_val(curwp, MDWRAPSCAN);

    last_srch_direc = REVERSE;

    /* ask the user for the regular expression to search for, and
     * find n'th occurrence.
     */
    status = readpattern("Reverse search: ", &searchpat, &gregexp,
			 EOS, fromscreen);
    if (status != TRUE)
	return status;

    ignorecase = window_b_val(curwp, MDIGNCASE);

    if (curwp == 0)
	return FALSE;

    curpos = DOT;
    scanboundry(wrapok, DOT, REVERSE);
    didwrap = FALSE;
    while (n--) {
	movenext(&(DOT), REVERSE);
	status = scanner(gregexp, REVERSE, wrapok, &didwrap);
	if (didwrap) {
	    mlwrite(
		       "[Search wrapped past start of buffer]");
	    didwrap = FALSE;
	}
	if (status != TRUE)
	    break;
    }

    if (status == TRUE) {
	savematch(DOT, gregexp->mlen);
	if (samepoint(DOT, curpos)) {
	    mlwrite(onlyonemsg);
	}
    } else if (status == FALSE) {
	movenext(&(DOT), FORWARD);
	not_found_msg(wrapok, REVERSE);
    } else if (status == ABORT) {
	mlwarn("[Aborted]");
	DOT = curpos;
	return status;
    }
    attrib_matches();
    return status;
}