Пример #1
0
bool set_resolution(CVideo& video
		, const unsigned width, const unsigned height)
{
	SDL_Rect rect;
	SDL_GetClipRect(video.getSurface(), &rect);
	if(rect.w == width && rect.h == height) {
		return true;
	}

	const int flags = fullscreen() ? FULL_SCREEN : 0;
	int bpp = video.bppForMode(width, height, flags);

	if(bpp != 0) {
		video.setMode(width, height, bpp, flags);

		if(disp) {
			disp->redraw_everything();
		}

	} else {
        // grzywacz: is this even true?
		gui2::show_transient_message(video,"",_("The video mode could not be changed. Your window manager must be set to 16 bits per pixel to run the game in windowed mode. Your display must support 1024x768x16 to run the game full screen."));
		return false;
	}

	const std::string postfix = fullscreen() ? "resolution" : "windowsize";
	preferences::set('x' + postfix, lexical_cast<std::string>(width));
	preferences::set('y' + postfix, lexical_cast<std::string>(height));

	return true;
}
Пример #2
0
bool set_resolution(display& disp, const unsigned width, const unsigned height)
{
	// - Ayin: disabled the following code. Why would one want to enforce that?
	// Some 16:9, or laptop screens, may have resolutions which do not
	// comply to this rule (see bug 10630).
	// I'm commenting this until it proves absolutely necessary.
	//
	// Make sure resolutions are always divisible by 4
	//res.first &= ~3;
	//res.second &= ~3;

	SDL_Rect rect;
	SDL_GetClipRect(disp.video().getSurface(), &rect);
	if (rect.w == width && rect.h == height) {
		return true;
	}
	if (width < 480 || height < 320) {
		return false;
	}

	CVideo& video = disp.video();
	const int flags = fullscreen() ? SDL_WINDOW_FULLSCREEN : 0;
	int bpp = video.modePossible(width, height, 32, flags);
	VALIDATE(bpp > 0, "bpp must be large than 0!");

	video.setMode(width, height, bpp, flags);
	require_change_resolution = true;

	const std::string postfix = fullscreen() ? "resolution" : "windowsize";
	preferences::set('x' + postfix, lexical_cast<std::string>(width));
	preferences::set('y' + postfix, lexical_cast<std::string>(height));
	
	return true;
}
Пример #3
0
/*! Open an X11 window and create a cairo surface base on that window. If x and
 * y are set to 0 the function opens a full screen window and stores to window
 * dimensions to x and y.
 * @param x Pointer to width of window.
 * @param y Pointer to height of window.
 * @return Returns a pointer to a valid Xlib cairo surface. The function does
 * not return on error (exit(3)).
 */
cairo_surface_t* 
cairo_create_x11_surface(int *x, int *y) {

   Display *dsp;
   Drawable da;
   Screen *scr;
   int screen;
   cairo_surface_t *sfc;

   if ((dsp = XOpenDisplay(NULL)) == NULL)
      exit(1);
   screen = DefaultScreen(dsp);
   scr = DefaultScreenOfDisplay(dsp);
   if (!*x || !*y)
   {
      *x = WidthOfScreen(scr), *y = HeightOfScreen(scr);
      da = XCreateSimpleWindow(dsp, DefaultRootWindow(dsp), 0, 0, *x, *y, 0, 0, 0);
      fullscreen (dsp, da);
   }
   else
      da = XCreateSimpleWindow(dsp, DefaultRootWindow(dsp), 0, 0, *x, *y, 0, 0, 0);
   XSelectInput(dsp, da, ButtonPressMask | KeyPressMask);
   XMapWindow(dsp, da);

   sfc = cairo_xlib_surface_create(dsp, da, DefaultVisual(dsp, screen), *x, *y);
   cairo_xlib_surface_set_size(sfc, *x, *y);

   return sfc;
}
Пример #4
0
char *
message_client(Client *c, IxpMsg *m) {
	char *s;
	int i;

	s = getword(m);

	switch(getsym(s)) {
	case LKILL:
		kill_client(c);
		break;
	case LURGENT:
		i = gettoggle(m);
		if(i == -1)
			return Ebadusage;
		set_urgent(c, i, True);
		break;
	case LFULLSCREEN:
		i = gettoggle(m);
		if(i == -1)
			return Ebadusage;
		fullscreen(c, i);
		break;
	default:
		return Ebadcmd;
	}
	return nil;
}
Пример #5
0
void Client::keyPressEvent(QKeyEvent *event)
{
	if (event->key() == Qt::Key_Escape && this->isFullScreen())
	{
		fullscreen();
	}
}
Пример #6
0
Файл: com.c Проект: stqism/DEMOS
drawcmd ()
{
	int c;
	CURSOR cursor;

	if (H==LINES-7 && strlen (cur->shortcwd) + 3 + esclen (command) > 79) {
		fullscreen ();
		draw ();
	}
	for (c=H+5; c<LINES-1; ++c) {
		VMove (c, 0);
		VClearLine ();
	}
	VSetDim ();
	VMPutString (H+5, 0, cur->shortcwd);
	VSetBold ();
	VPutString (" > ");
	VSetNormal ();
	cursor = VGetCursor ();
	putescstr (command);
	if (c = command [cpos]) {
		VSetCursor (cursor);
		command [cpos] = 0;
		putescstr (command);
		command [cpos] = c;
	}
}
/**
* @brief キーボードイベント関数
*/
void keyboard(unsigned char key, int x, int y)
{
  switch (key)
  {
  case '\033': // ESC でも終了させる
    exit(0);
    break;

  case ' ':    // スペースキーでフルスクリーンモードにする
    if (!Change)
      Change = true;
    else
      Change = false;
    fullscreen();
    break;

  case 'r':    // 方向転換
    if (!moveChange)
      moveChange = true;
    else
      moveChange = false;
    break;
  }

  glutPostRedisplay(); // 再描画要求
}
SFAbstractApplicationUI::SFAbstractApplicationUI(bb::cascades::Application *app) : QObject(app) {

	//register meta types for SF classes and enums
	sfRegisterMetaTypes();

	//Setup SFDC connection info
	SFAccountManager::setClientId(SFRemoteAccessConsumerKey);
	SFAccountManager::setRedirectUri(SFOAuthRedirectURI);
	//In addition, you can set up scope for your token like below.
	/*
	QList<QString> scopes;
	scopes.append("api");
	SFAccountManager::setScopes(scopes);
	*/

	//setup API objects
	SFRestAPI::instance()->setApiVersion(SFDefaultRestApiVersion);

	//Expose API objects to QML
	QDeclarativeEngine *engine = QmlDocument::defaultDeclarativeEngine();
	QDeclarativeContext *context = engine ? engine->rootContext() : NULL;
	if (context) {
		context->setContextProperty("SFAccountManager", SFAccountManager::instance());
		context->setContextProperty("SFAuthenticationManager", SFAuthenticationManager::instance());
		context->setContextProperty("SFRestAPI", SFRestAPI::instance());
	} else {
		sfWarning() << "[SFAbstractApplicationUI] Failed to grab shared QML declarative engine. SF APIs may not be accessible in QML.";
	}

	//connect some slots
	connect(app, SIGNAL(aboutToQuit()), SFAuthenticationManager::instance(), SLOT(onAboutToQuit()));
	connect(app, SIGNAL(fullscreen()), SFAuthenticationManager::instance(), SLOT(onAppStart()));
}
Пример #9
0
void key(unsigned char key , int x , int y) {
	if(key == ' '){//スペースキーでウインドウモードを切り替え
		if(Change == false){Change = true;}
		else{Change = false;}
		fullscreen();
	}
}
Пример #10
0
QVariant ApplicationManager::data(const QModelIndex& index, int role) const {
    if (index.row() < 0 || index.row() >= m_runningApplications.size())
        return QVariant();

    auto app = m_runningApplications.at(index.row());
    switch(role) {
    case RoleAppId:
        return app->appId();
    case RoleName:
        return app->name();
    case RoleComment:
        return app->comment();
    case RoleIcon:
        return app->icon();
    case RoleStage:
        return app->stage();
    case RoleState:
        return app->state();
    case RoleFocused:
        return app->focused();
    case RoleSession:
        return QVariant::fromValue(app->session());
    case RoleFullscreen:
        return app->fullscreen();
    default:
        return QVariant();
    }
}
Пример #11
0
void playerWindow::on_fullscreen_clicked
(
	void
)
{
	// hide all useless stuff for fullscreen mode
	menubar->set_visible(!menubar->get_visible());
	borderleft->set_visible(!borderleft->get_visible());
	borderright->set_visible(!borderright->get_visible());
	// show/hide window decoration 
	set_decorated(!get_decorated());
	// switch between the fullscreen and the unfullscreen button
	unfullscreenBtn->set_visible(!unfullscreenBtn->get_visible());
	fullscreenBtn->set_visible(!fullscreenBtn->get_visible());
	// switch between fullscreen and a decorated window 
	(get_decorated()) ? unmaximize () : maximize ();
	(get_decorated()) ? unfullscreen() : fullscreen();
	// set the fullscreen state
	isFullscreen = !isFullscreen;
	/* Call timeout function at a 3000ms interval to hide or show 
	player controls when it is in fullscreen mode. When the window 
	is no more in the fullscreen mode, timeout signals are
	disconnected motion detector */
	if (isFullscreen) { 
		// set the timer to call periodically the timeout function
		timeout_fullscreen =  Glib::signal_timeout().connect
		(
			sigc::mem_fun
			(
				*this, 
				&playerWindow::on_timeout_fullscreen
			), 
			3000
		);
		// set a motion detector into the drawing area
		mouse_motion_signal_drawingArea = 
			videoDrawingArea->signal_motion_notify_event().connect
		(
			sigc::mem_fun
			(
				*this, 
				&playerWindow::on_mousemove
			)
		);
		/* set the focus into the drawing area. Without the focus, 
		the motion detection doesn't occurs when a movie is playing*/
		videoDrawingArea->set_can_focus
		(
			!videoDrawingArea->get_can_focus()
		);
		// next trigger to attempt to hide the mediaplayer controler
		nextmotiondetection = time(NULL)+3;
	} else {
		// disconnect signals
		timeout_fullscreen.disconnect() ;
		mouse_motion_signal_drawingArea.disconnect();
		// remove the focus
		videoDrawingArea->set_can_focus(!videoDrawingArea->get_can_focus());
	}
}
Пример #12
0
void sdl_window_info::update_cursor_state()
{
#if (USE_XINPUT && USE_XINPUT_WII_LIGHTGUN_HACK)
	// Hack for wii-lightguns:
	// they stop working with a grabbed mouse;
	// even a ShowCursor(SDL_DISABLE) already does this.
	// To make the cursor disappear, we'll just set an empty cursor image.
	unsigned char data[]={0,0,0,0,0,0,0,0};
	SDL_Cursor *c;
	c=SDL_CreateCursor(data, data, 8, 8, 0, 0);
	SDL_SetCursor(c);
#else
	// do not do mouse capture if the debugger's enabled to avoid
	// the possibility of losing control
	if (!(machine().debug_flags & DEBUG_FLAG_OSD_ENABLED))
	{
		bool should_hide_mouse = downcast<sdl_osd_interface&>(machine().osd()).should_hide_mouse();

		if (!fullscreen() && !should_hide_mouse)
		{
			show_pointer();
			release_pointer();
		}
		else
		{
			hide_pointer();
			capture_pointer();
		}

		SDL_SetCursor(nullptr); // Force an update in case the underlying driver has changed visibility
	}
#endif
}
Пример #13
0
void MainWindow::on_view_fullscreen() {
	if(m_itemViewFullscreen->property_active()) {
		fullscreen();
	}
	else {
		unfullscreen();
	}
}
Пример #14
0
bool detect_video_settings(CVideo& video, std::pair<int,int>& resolution, int& bpp, int& video_flags)
{
	video_flags = fullscreen() ? SDL_WINDOW_FULLSCREEN: 0;
	resolution = preferences::resolution();

	bpp = 32;
	return true;
}
Пример #15
0
bool detect_video_settings(CVideo& video, std::pair<int,int>& resolution, int& bpp, int& video_flags)
{
	video_flags = fullscreen() ? FULL_SCREEN : 0;
	resolution = preferences::resolution();

	int DefaultBPP = 24;
	const SDL_VideoInfo* const video_info = SDL_GetVideoInfo();
	if(video_info != NULL && video_info->vfmt != NULL) {
		DefaultBPP = video_info->vfmt->BitsPerPixel;
	}

	std::cerr << "Checking video mode: " << resolution.first << 'x'
		<< resolution.second << 'x' << DefaultBPP << "...\n";

	typedef std::pair<int, int> res_t;
	std::vector<res_t> res_list;
    if(fullscreen()){
        res_list.push_back(res_t(2560, 1600));
        res_list.push_back(res_t(1920, 1200));
        res_list.push_back(res_t(1920, 1080));
        res_list.push_back(res_t(1680, 1050));
        res_list.push_back(res_t(1440, 900));
        res_list.push_back(res_t(1360, 768));
    }
    res_list.push_back(res_t(1024, 768));


	bpp = video.modePossible(resolution.first, resolution.second,
		DefaultBPP, video_flags, true);

	BOOST_FOREACH(const res_t &res, res_list)
	{
		if (bpp != 0) break;
		std::cerr << "Video mode " << resolution.first << 'x'
			<< resolution.second << 'x' << DefaultBPP
			<< " is not supported; attempting " << res.first
			<< 'x' << res.second << 'x' << DefaultBPP << "...\n";
		resolution = res;
		bpp = video.modePossible(resolution.first, resolution.second,
			DefaultBPP, video_flags);
	}

	preferences::set_resolution(resolution);
	return bpp != 0;
}
Пример #16
0
void ActionsManager::doAction( int id_action )
{
    switch( id_action )
    {
        case PLAY_ACTION:
            play(); break;
        case STOP_ACTION:
            THEMIM->stop(); break;
        case OPEN_ACTION:
            THEDP->openDialog(); break;
        case PREVIOUS_ACTION:
            THEMIM->prev(); break;
        case NEXT_ACTION:
            THEMIM->next(); break;
        case SLOWER_ACTION:
            THEMIM->getIM()->slower(); break;
        case FASTER_ACTION:
            THEMIM->getIM()->faster(); break;
        case FULLSCREEN_ACTION:
            fullscreen(); break;
        case EXTENDED_ACTION:
            THEDP->extendedDialog(); break;
        case PLAYLIST_ACTION:
            playlist(); break;
        case SNAPSHOT_ACTION:
            snapshot(); break;
        case RECORD_ACTION:
            record(); break;
        case FRAME_ACTION:
            frame(); break;
        case ATOB_ACTION:
            THEMIM->getIM()->setAtoB(); break;
        case REVERSE_ACTION:
            THEMIM->getIM()->reverse(); break;
        case SKIP_BACK_ACTION:
            skipBackward();
            break;
        case SKIP_FW_ACTION:
            skipForward();
            break;
        case QUIT_ACTION:
            THEDP->quit();  break;
        case RANDOM_ACTION:
            THEMIM->toggleRandom(); break;
        case INFO_ACTION:
            THEDP->mediaInfoDialog(); break;
        case OPEN_SUB_ACTION:
            THEDP->loadSubtitlesFile(); break;
        case FULLWIDTH_ACTION:
            if( p_intf->p_sys->p_mi )
                p_intf->p_sys->p_mi->getFullscreenControllerWidget()->toggleFullwidth();
            break;
        default:
            msg_Warn( p_intf, "Action not supported: %i", id_action );
            break;
    }
}
TiAnalyticsObject::TiAnalyticsObject(NativeObjectFactory* objectFactory)
    : TiProxy("Analytics"), sequence_(1)
{
    objectFactory_ = objectFactory;

    // if analytics is false just return
    bool analytics = defaultSettings.value("analytics").toBool();
    if (analytics == true) {
		// get unique application id
		QString aguid = defaultSettings.value("aguid").toString();
		aguid_ = aguid.toLocal8Bit();

		// get unique mobile device id
		bb::device::HardwareInfo hdi;
		QString mid = hdi.pin();
		mid_ = mid.toLocal8Bit();

		// generate the session id
		QString sid = QUuid::createUuid().toString();
		sid.replace("{", "");
		sid.replace("}", "");
		sid_ = sid.toLocal8Bit();

		// get deploy type if development or production
		QString deployType = defaultSettings.value("deploytype").toString();
		deployType_ = deployType.toLocal8Bit();

		// application version
		QString appVersion = defaultSettings.value("version").toString();
		appVersion_ = appVersion.toLocal8Bit();

		QUrl analyticsSite("https://api.appcelerator.net/p/v3/mobile-track/" + aguid);
		request_.setUrl(analyticsSite);

		// Async callbacks to notify application of HTTP events
		eventHandler_ = new TiAnalyticsHandler(this);
		QObject::connect(&networkAccessManager_, SIGNAL(finished(QNetworkReply*)), eventHandler_, SLOT(finished(QNetworkReply*)));
		QObject::connect(&networkAccessManager_, SIGNAL(sslErrors(QNetworkReply*,QList<QSslError>)), eventHandler_, SLOT(errors(QNetworkReply*)));

		// Hook application life cycle events
		QObject::connect(bb::cascades::Application::instance(), SIGNAL(thumbnail()), eventHandler_, SLOT(thumbnail()));
		QObject::connect(bb::cascades::Application::instance(), SIGNAL(fullscreen()), eventHandler_, SLOT(fullscreen()));
		QObject::connect(bb::cascades::Application::instance(), SIGNAL(manualExit()), eventHandler_, SLOT(manualExit()));

		if (createAnalyticsDatabase()) {
			addAnalyticsEvent("ti.enroll");
		}

		addAnalyticsEvent("ti.start");
		sendPendingAnalyticsEvents();

		//  Set up timer and every 10 minutes send out analytics events if any are pending
		TiAnalyticsHandler* eventHandler = new TiAnalyticsHandler(this);
		timer_ = new QTimer(eventHandler);
		QObject::connect(timer_, SIGNAL(timeout()), eventHandler,  SLOT(sendPendingRequests()));
		timer_->start(60000*10);
    }
Пример #18
0
void Window::vToggleFullscreen()
{
    if (!m_bFullscreen) {
        fullscreen();
        m_poMenuBar->hide();
    } else {
        unfullscreen();
        m_poMenuBar->show();
    }
}
Пример #19
0
void Environment::setFullscreen(bool enable) {
  if (fullscreen() == enable) return;

  if (enable)
    view()->showFullScreen();
  else
    view()->show();

  emit fullscreenChanged();
}
Пример #20
0
void mixer_window::toggle_fullscreen()
{
    fullscreen_state_ = !fullscreen_state_;

    if(fullscreen_state_)
    {
    	fullscreen();
    } else {
    	unfullscreen();
    }
}
Пример #21
0
void sdl_window_info::complete_destroy()
{
	if (fullscreen() && video_config.switchres)
	{
		SDL_SetWindowFullscreen(platform_window<SDL_Window*>(), 0);    // Try to set mode
		SDL_SetWindowDisplayMode(platform_window<SDL_Window*>(), &m_original_mode->mode);    // Try to set mode
		SDL_SetWindowFullscreen(platform_window<SDL_Window*>(), SDL_WINDOW_FULLSCREEN);    // Try to set mode
	}
	SDL_DestroyWindow(platform_window<SDL_Window*>());
	// release all keys ...
	downcast<sdl_osd_interface &>(machine().osd()).release_keys();
}
Пример #22
0
void set_resolution(const std::pair<int,int>& resolution)
{
	if(disp) {
		set_resolution(disp->video(), resolution.first, resolution.second);
	} else {
		/* This part is needed when wesnoth is started with the -r parameter. */
		const std::string postfix = fullscreen() ? "resolution" : "windowsize";
		preferences::set(
				'x' + postfix, lexical_cast<std::string>(resolution.first));
		preferences::set(
				'y' + postfix, lexical_cast<std::string>(resolution.second));
	}
}
Пример #23
0
void sdl_window_info::toggle_full_screen()
{
	// if we are in debug mode, never go full screen
	if (machine().debug_flags & DEBUG_FLAG_OSD_ENABLED)
		return;

	// If we are going fullscreen (leaving windowed) remember our windowed size
	if (!fullscreen())
	{
		m_windowed_dim = get_size();
	}

	// reset UI to main menu
	machine().ui().menu_reset();
	// kill off the drawers
	renderer_reset();
	bool is_osx = false;
#ifdef SDLMAME_MACOSX
	// FIXME: This is weird behaviour and certainly a bug in SDL
	is_osx = true;
#endif
	if (fullscreen() && (video_config.switchres || is_osx))
	{
		SDL_SetWindowFullscreen(platform_window(), 0);    // Try to set mode
		SDL_SetWindowDisplayMode(platform_window(), &m_original_mode->mode);    // Try to set mode
		SDL_SetWindowFullscreen(platform_window(), SDL_WINDOW_FULLSCREEN);    // Try to set mode
	}
	SDL_DestroyWindow(platform_window());
	set_platform_window(nullptr);

	downcast<sdl_osd_interface &>(machine().osd()).release_keys();

	set_renderer(osd_renderer::make_for_type(video_config.mode, shared_from_this()));

	// toggle the window mode
	set_fullscreen(!fullscreen());

	complete_create();
}
Пример #24
0
std::pair<int,int> resolution()
{
	const std::string postfix = fullscreen() ? "resolution" : "windowsize";
	std::string x = prefs['x' + postfix], y = prefs['y' + postfix];

	if (!x.empty() && !y.empty()) {
		return std::make_pair(
			std::max(atoi(x.c_str()), min_allowed_width()),
			std::max(atoi(y.c_str()), min_allowed_height()));
	} else {
		return std::pair<int,int>(1024,768);
	}
}
Пример #25
0
void ActionsManager::doAction( int id_action )
{
    switch( id_action )
    {
        case PLAY_ACTION:
            play(); break;
        case STOP_ACTION:
            THEMIM->stop(); break;
        case OPEN_ACTION:
            THEDP->openDialog(); break;
        case PREVIOUS_ACTION:
            THEMIM->prev(); break;
        case NEXT_ACTION:
            THEMIM->next(); break;
        case SLOWER_ACTION:
            THEMIM->getIM()->slower(); break;
        case FASTER_ACTION:
            THEMIM->getIM()->faster(); break;
        case FULLSCREEN_ACTION:
            fullscreen(); break;
        case EXTENDED_ACTION:
            THEDP->extendedDialog(); break;
        case PLAYLIST_ACTION:
            playlist(); break;
        case SNAPSHOT_ACTION:
            snapshot(); break;
        case RECORD_ACTION:
            record(); break;
        case FRAME_ACTION:
            frame(); break;
        case ATOB_ACTION:
            THEMIM->getIM()->setAtoB(); break;
        case REVERSE_ACTION:
            THEMIM->getIM()->reverse(); break;
        case SKIP_BACK_ACTION:
            skipBackward();
            break;
        case SKIP_FW_ACTION:
            skipForward();
            break;
        case QUIT_ACTION:
            THEDP->quit();  break;
        case RANDOM_ACTION:
            THEMIM->toggleRandom(); break;
        case INFO_ACTION:
            THEDP->mediaInfoDialog(); break;
        default:
            msg_Dbg( p_intf, "Action: %i", id_action );
            break;
    }
}
Пример #26
0
void Client::init(int w, IplImage *i, Cursor c)
{
	image = i;
	curseur = new Cursor;
	*curseur = c; 

	// Construction de l'interface
	ui->setupUi(this);

	// Classes utilisées
	camManager = new WebcamManager();
	camWidget = new WidgetWebcam();
	
	this->setWindowTitle("Tableau virtuel interactif");
	
	// Demarrage de la webcam
	camManager->setWebcam(w);
	camManager->runWebcam();
	
	// Connexion à la fonction d'exportation
	connect(ui->actionExporter, SIGNAL(triggered()), this, SLOT(exportDraw()));
	
	// Fonction pour vider la scène
	connect(ui->actionFlushScene, SIGNAL(triggered()), this, SLOT(flushScene()));
	
	// Connexion au plein écrans
	connect(ui->actionPleinEcran, SIGNAL(triggered()), this, SLOT(fullscreen()));
	
	// Connecion au changement de couleur
	connect(ui->actioncouleur, SIGNAL(triggered()), this, SLOT(changeColor()));	
	
	// Création de la zone centrale
	scroll = new QScrollArea();
	mainWidget = new QWidget();
	layout = new QHBoxLayout();
	mainWidget->setLayout(layout);
	
	// Ajout des widgets
	layout->addWidget(drawingBoard);
	layout->addWidget(camWidget);
	
	// Zone de défilement
	scroll->setWidget(mainWidget);
	this->setCentralWidget(scroll);
	
	// Démarrage du timer
	QTimer *timer = new QTimer(this);
	connect(timer, SIGNAL(timeout()), this, SLOT(tick()));
	timer->start(40);
}
Пример #27
0
void KCommonDecoration::updateWindowShape()
{
    // don't mask the widget...
    if (!decorationBehaviour(DB_WindowMask) )
        return;

    int w = widget()->width();
    int h = widget()->height();

    bool tl=true,tr=true,bl=true,br=true; // is there a transparent rounded corner in top-left? etc

    QDesktopWidget *desktop=KApplication::desktop();
    // no transparent rounded corners if this window corner lines up with a screen corner
    for(int screen=0; screen < desktop->numScreens(); ++screen)
    {
        QRect fullscreen(desktop->screenGeometry(screen));
        QRect window = geometry();

        if(window.topLeft()    == fullscreen.topLeft() ) tl = false;
        if(window.topRight()   == fullscreen.topRight() ) tr = false;
        if(window.bottomLeft() == fullscreen.bottomLeft() ) bl = false;
        if(window.bottomRight()== fullscreen.bottomRight() ) br = false;
    }

    QRegion mask(0, 0, w, h);

    // Remove top-left corner.
    if(tl)
    {
        mask -= cornerShape(WC_TopLeft);
    }
    // Remove top-right corner.
    if(tr)
    {
        mask -= cornerShape(WC_TopRight);
    }
        // Remove top-left corner.
    if(bl)
    {
        mask -= cornerShape(WC_BottomLeft);
    }
    // Remove top-right corner.
    if(br)
    {
        mask -= cornerShape(WC_BottomRight);
    }

    setMask( mask );
}
Пример #28
0
void ActionsManager::doAction( int id_action )
{
    switch( id_action )
    {
        case PLAY_ACTION:
            play(); break;
        case STOP_ACTION:
            THEMIM->stop(); break;
        case OPEN_ACTION:
            THEDP->openDialog(); break;
        case PREVIOUS_ACTION:
            THEMIM->prev(); break;
        case NEXT_ACTION:
            THEMIM->next(); break;
        case SLOWER_ACTION:
            THEMIM->getIM()->slower(); break;
        case FASTER_ACTION:
            THEMIM->getIM()->faster(); break;
        case FULLSCREEN_ACTION:
            fullscreen(); break;
        case EXTENDED_ACTION:
            THEDP->extendedDialog(); break;
        case PLAYLIST_ACTION:
            playlist(); break;
        case SNAPSHOT_ACTION:
            snapshot(); break;
        case RECORD_ACTION:
            record(); break;
        case FRAME_ACTION:
            frame(); break;
        case ATOB_ACTION:
            THEMIM->getIM()->setAtoB(); break;
        case REVERSE_ACTION:
            THEMIM->getIM()->reverse(); break;
        case SKIP_BACK_ACTION:
            var_SetInteger( p_intf->p_libvlc, "key-action",
                    ACTIONID_JUMP_BACKWARD_SHORT );
            break;
        case SKIP_FW_ACTION:
            var_SetInteger( p_intf->p_libvlc, "key-action",
                    ACTIONID_JUMP_FORWARD_SHORT );
            break;
        case QUIT_ACTION:
            THEDP->quit();  break;
        default:
            msg_Dbg( p_intf, "Action: %i", id_action );
            break;
    }
}
Пример #29
0
QueryView::QueryView(Database *database, QString command)
{
    this->database = database;

    //Identify this object with thisTableViewId for constructing database connection
    //specific to this object and this object alone.
    thisQueryViewId = queryViewObjectId++;

    //Thread busy indicator to avoid crashing of app when
    //QueryView receives a close signal before data retrieval.
    thread_busy = false;

    //Start the timer.
    t.start();

    errors_model = new QStandardItemModel(0,1);
    query_model = new QueryModel;
    qview = new QTableView(this);
    qview->resizeColumnsToContents();
    setCentralWidget(qview);
    statusBar()->showMessage(QApplication::translate("QueryView", "Fetching data...", 0, QApplication::UnicodeUTF8));
    //qview->setModel(model);
    //setWindowTitle(name);
    qview->setStyleSheet("QTableView {font-weight: 400;}");
    qview->setAlternatingRowColors(true);
    //setGeometry(100,100,640,480);

    //Create Ctrl+Shift+C key combo to copy selected table contents with headers.
    QShortcut *shortcut_ctrl_c = new QShortcut(QKeySequence::Copy, this);
    connect(shortcut_ctrl_c, SIGNAL(activated()), this, SLOT(copyc()));

    //Create Ctrl+Shift+C key combo to copy selected table contents with headers.
    QShortcut *shortcut_ctrl_shft_c = new QShortcut(QKeySequence("Ctrl+Shift+C"), this);
    connect(shortcut_ctrl_shft_c, SIGNAL(activated()), this, SLOT(copych()));

    //Create key-sequences for fullscreen and restore.
    shortcut_fullscreen = new QShortcut(QKeySequence(Qt::Key_F11), this);
    connect(shortcut_fullscreen, SIGNAL(activated()), this, SLOT(fullscreen()));
    shortcut_restore = new QShortcut(QKeySequence(Qt::Key_Escape), this);
    connect(shortcut_restore, SIGNAL(activated()), this, SLOT(restore()));

    //Tie thread finish to an update slot that refreshes meta-information.
    connect(this, SIGNAL(updRowCntSignal(QString)), this, SLOT(updRowCntSlot(QString)));

    //Tie a busy signal to a slot that changes the cursor to wait cursor.
    connect(this, SIGNAL(busySignal()), this, SLOT(busySlot()));

    QFuture<void> future = QtConcurrent::run(this, &QueryView::fetchData, command);
}
Пример #30
0
std::pair<int,int> resolution()
{
	const std::string postfix = fullscreen() ? "resolution" : "windowsize";
	std::string x = prefs['x' + postfix], y = prefs['y' + postfix];
	if (!x.empty() && !y.empty()) {
		std::pair<int,int> res(std::max(atoi(x.c_str()), min_allowed_width()),
		                       std::max(atoi(y.c_str()), min_allowed_height()));

		// Make sure resolutions are always divisible by 4
		//res.first &= ~3;
		//res.second &= ~3;
		return res;
	} else {
		return std::pair<int,int>(1024,768);
	}
}