Ejemplo n.º 1
0
void Tasksettings::set_task(int task_uid){
    my_task_uid = task_uid;
    ui->progressBarTasktime->setValue(0);
    ui->progressBarCputime->setValue(0);
    timer_refresh->start();
    refresh_info();
}
Ejemplo n.º 2
0
/*	display_dialog draws the part of the dialog specified by w. Also
	refreshes anything that needs to be.
*/
void	display_dialog(Window w)
{
	if(w == dialogwindow) {
		XDrawString(display, dialogwindow, ctable[CGREEN].biggc,
					10, 5 + bigfontinfo->ascent, "You made a high score!",
					strlen("You made a high score!"));
		XDrawString(display, dialogwindow, ctable[CBLUE].biggc,
					10, 10 + bigfontinfo->descent + 2 *
					bigfontinfo->ascent, "Enter your name:",
					strlen("Enter your name:"));
	}
	if(w == dialogstringwindow)
		XDrawString(display, dialogstringwindow,
					ctable[CRED].biggc, 10,
					5 + bigfontinfo->ascent, dtext, strlen(dtext));
	if(w == dialogbuttonwindow)
		XDrawString(display, dialogbuttonwindow,
					ctable[CWHITE].biggc, 10,
					5 + bigfontinfo->ascent, "OK", strlen("OK"));
	if(w == gamewindow) 

#ifdef	BLIT
		XCopyArea(display, drawpixmap, gamewindow, ctable[CBLACK].smallgc,
					0, 0, WINDOWWIDTH, WINDOWHEIGHT, 0, 0);
#else
		refresh();
#endif

	if(w == infowindow) refresh_info();
	XFlush(display);
}
Ejemplo n.º 3
0
/**
 * @brief Start operations after downloading data file.
 * @param refresh  An flag indicating whether the downloading progress is
 * successfully finished or not. Default by 1.
 * @param error  An flag indicating whether the downloading
 * progress is successfully finished or not. Default by 0.
 */
void QDialogDaemon::finish_fetch(int refresh, int error)
{
    down_flag_ = 0;
    if(error){
        //Error occurred while downloading
        set_down_progress(0, QApplication::translate("Util", "Error"));
        QFile::remove(QString(PATH_PREFIX) + filename_);
        warning_download();
        QString msg_title("Warning");
        QString msg = QApplication::translate("Util", "Incorrect Data file!\n"
                                                      "Please use the \"Download\" key to \n"
                                                      "fetch a new data file.");
        set_message(msg_title, msg);
        set_conn_status(0);
    }else{
        //Data file retrieved successfully
        set_down_progress(100, QApplication::translate("Util", "Download Complete"));
        refresh_info(refresh);
    }
    set_fetch_finish_btns(error);
}
Ejemplo n.º 4
0
/*	demo_event_filter handles events for the demo
*/
int	demo_event_filter()
{
	XEvent	event;

	XNextEvent(display, &event);
	switch(event.type) {
		case ConfigureNotify:
		case Expose:
		case MapNotify:
			refresh_info();
			return(1);
			break;
		case ButtonPress:
			leveldone = 1;
			gameover = 0;
			break;
		case KeyPress:
			title_key_hit(&event.xkey);
			return(1);
			break;
	}
	return(0);
}
Ejemplo n.º 5
0
Tasksettings::Tasksettings(Settingsstore* store, Taskaccessmanager* taskaccessmanager, QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Tasksettings)
{
    ui->setupUi(this);
    my_task_uid = -1;//default value to recognize if task uid has been set already...
    storage = store;
    taskaccess = taskaccessmanager;
    taskpriority = new Taskpriority();
    taskpriority->hide();
    taskevent = new Taskevent(taskaccess);
    taskevent->hide();
    QObject::connect(ui->pushButtonBack, SIGNAL(clicked()), this, SLOT(hide_me()));
    QObject::connect(ui->pushButtonRefresh, SIGNAL(clicked()), this, SLOT(refresh_info()));
    QObject::connect(ui->pushButtonClose, SIGNAL(clicked()), this, SLOT(close_task()));
    QObject::connect(ui->pushButtonKill, SIGNAL(clicked()), this, SLOT(kill_task()));
    QObject::connect(ui->pushButtonPriority, SIGNAL(clicked()), this, SLOT(set_task_priority()));
    QObject::connect(ui->pushButtonEvent, SIGNAL(clicked()), this, SLOT(send_system_event()));

    refresh_interval = 1000;
    timer_refresh = new QTimer();
    timer_refresh->setInterval(refresh_interval);
    QObject::connect(timer_refresh, SIGNAL(timeout()), this, SLOT(refresh_stats()));
}
Ejemplo n.º 6
0
/*	event_filter handles game events
*/
int	event_filter()
{
	XEvent	event;

	XNextEvent(display, &event);
	switch(event.type) {
		case ConfigureNotify:
		case Expose:
		case MapNotify:
			refresh_info();

#ifdef	BLIT
			XCopyArea(display, drawpixmap, gamewindow,
						ctable[CBLACK].smallgc, 0, 0,
						WINDOWWIDTH, WINDOWHEIGHT, 0, 0);
#else
			refresh();
#endif

			return(1);
			break;
		case ButtonPress:
			if(!waiting) {
				if(event.xbutton.button == Button2) burn = 1;
				if(event.xbutton.button == Button1) {
					if(event.xbutton.state & Button3Mask) {
						playerdir = STOP;
					} else {
						playerdir = GOLEFT;
					}
				}
				if(event.xbutton.button == Button3) {
					if(event.xbutton.state & Button1Mask) {
						playerdir = STOP;
					} else {
						playerdir = GORIGHT;
					}
				}
			}
			return(1);
			break;
		case ButtonRelease:
			if((event.xbutton.state & Button2Mask) && 
				(event.xbutton.button == Button2))
				burn = 0;
			if(event.xbutton.button == Button3) {
				if(event.xbutton.state & Button1Mask) {
					playerdir = GOLEFT;
				} else {
					playerdir = STOP;
				}
			}
			if(event.xbutton.button == Button1) {
				if(event.xbutton.state & Button3Mask) {
					playerdir = GORIGHT;
				} else {
					playerdir = STOP;
				}
			}
			return(1);
			break;
		case KeyPress:
			key_hit(&event.xkey);
			return(1);
			break;
	}
	return(0);
}
Ejemplo n.º 7
0
static int display_activate_force(struct uterm_display *disp,
				  struct uterm_mode *mode,
				  bool force)
{
	static const char depths[] = { 32, 24, 16, 0 };
	struct fb_var_screeninfo *vinfo;
	struct fb_fix_screeninfo *finfo;
	int ret, i;
	uint64_t quot;
	size_t len;

	if (!disp->video || !video_is_awake(disp->video))
		return -EINVAL;
	if (!force && (disp->flags & DISPLAY_ONLINE))
		return 0;

	/* TODO: We do not support explicit modesetting in fbdev, so we require
	 * @mode to be NULL. You can still switch modes via "fbset" on the
	 * console and then restart the app. It will automatically adapt to the
	 * new mode. The only values changed here are bpp and color mode. */
	if (mode)
		return -EINVAL;

	ret = refresh_info(disp);
	if (ret)
		return ret;

	finfo = &disp->fbdev.finfo;
	vinfo = &disp->fbdev.vinfo;

	vinfo->xoffset = 0;
	vinfo->yoffset = 0;
	vinfo->activate = FB_ACTIVATE_NOW | FB_ACTIVATE_FORCE;
	vinfo->xres_virtual = vinfo->xres;
	vinfo->yres_virtual = vinfo->yres * 2;
	vinfo->bits_per_pixel = 32;

	log_info("activating display %s to %ux%u %u bpp", disp->fbdev.node,
		 vinfo->xres, vinfo->yres, vinfo->bits_per_pixel);

	ret = ioctl(disp->fbdev.fd, FBIOPUT_VSCREENINFO, vinfo);
	if (ret) {
		disp->flags &= ~DISPLAY_DBUF;
		vinfo->yres_virtual = vinfo->yres;
		ret = ioctl(disp->fbdev.fd, FBIOPUT_VSCREENINFO, vinfo);
		if (ret) {
			log_err("cannot set vinfo (%d): %m",
				errno);
			return -EFAULT;
		}
		log_debug("disabling double buffering");
	} else {
		disp->flags |= DISPLAY_DBUF;
		log_debug("enabling double buffering");
	}

	ret = refresh_info(disp);
	if (ret)
		return ret;

	/* We require TRUECOLOR mode here. That is, each pixel has a color value
	 * that is split into rgba values that we can set directly. Other visual
	 * modes like pseudocolor or direct-color do not provide this. As I have
	 * never seen a device that does not support TRUECOLOR, I think we can
	 * ignore them here. */
	if (finfo->visual != FB_VISUAL_TRUECOLOR) {
		for (i = 0; depths[i]; ++i) {
			vinfo->bits_per_pixel = depths[i];
			vinfo->activate = FB_ACTIVATE_NOW | FB_ACTIVATE_FORCE;

			ret = ioctl(disp->fbdev.fd, FBIOPUT_VSCREENINFO,
				    vinfo);
			if (ret < 0)
				continue;

			ret = refresh_info(disp);
			if (ret)
				return ret;

			if (finfo->visual == FB_VISUAL_TRUECOLOR)
				break;
		}
	}

	if (vinfo->xres_virtual < vinfo->xres ||
	    (disp->flags & DISPLAY_DBUF &&
	     vinfo->yres_virtual < vinfo->yres * 2) ||
	    vinfo->yres_virtual < vinfo->yres) {
		log_error("device %s does not support out buffer sizes",
			  disp->fbdev.node);
		return -EFAULT;
	}

	if (vinfo->bits_per_pixel % 8) {
		log_error("device %s uses no power of 8 bpp: %u",
			  disp->fbdev.node, vinfo->bits_per_pixel);
		return -EFAULT;
	}

	if (finfo->visual != FB_VISUAL_TRUECOLOR ||
	    vinfo->bits_per_pixel < 16) {
		log_error("device %s does not support true-color bpp >= 16",
			  disp->fbdev.node);
		return -EFAULT;
	}

	/* TODO: remove this check and correctly provide conversions for the
	 * blitting functions. In fact, the for-loop above is totally useless
	 * while using this restriction here but lets be optimistic and say that
	 * this will be replaced soon. */
	if (vinfo->red.offset != 16 || vinfo->red.length != 8 ||
	    vinfo->green.offset != 8 || vinfo->green.length != 8 ||
	    vinfo->blue.offset != 0 || vinfo->green.length != 8 ||
	    vinfo->bits_per_pixel != 32) {
		log_error("device %s does not support xrgb32",
			  disp->fbdev.node);
		return -EFAULT;
	}

	/* calculate monitor rate, default is 60 Hz */
	quot = (vinfo->upper_margin + vinfo->lower_margin + vinfo->yres);
	quot *= (vinfo->left_margin + vinfo->right_margin + vinfo->xres);
	quot *= vinfo->pixclock;
	if (quot)
		disp->fbdev.rate = 1000000000000000LLU / quot;
	else
		disp->fbdev.rate = 60 * 1000;

	len = finfo->line_length * vinfo->yres;
	if (disp->flags & DISPLAY_DBUF)
		len *= 2;

	disp->fbdev.map = mmap(0, len, PROT_WRITE, MAP_SHARED,
			       disp->fbdev.fd, 0);
	if (disp->fbdev.map == MAP_FAILED) {
		log_error("cannot mmap device %s (%d): %m", disp->fbdev.node,
			  errno);
		return -EFAULT;
	}

	memset(disp->fbdev.map, 0, len);
	disp->fbdev.xres = vinfo->xres;
	disp->fbdev.yres = vinfo->yres;
	disp->fbdev.len = len;
	disp->fbdev.bpp = vinfo->bits_per_pixel / 8;
	disp->fbdev.stride = finfo->line_length;
	disp->fbdev.bufid = 0;

	ret = mode_new(&disp->modes, &fbdev_mode_ops);
	if (ret) {
		munmap(disp->fbdev.map, disp->fbdev.len);
		return ret;
	}
	disp->modes->fbdev.width = disp->fbdev.xres;
	disp->modes->fbdev.height = disp->fbdev.yres;
	disp->current_mode = disp->modes;

	disp->flags |= DISPLAY_ONLINE;
	return 0;
}