示例#1
0
void end_lesson(int min,int sec,int eff,int err, int speed)
{
	int change=0,y,x;
	show_summary(min, sec, eff, err, speed);
	draw_3dbox(260,220,320,240,15);
	settextstyle(0,0,1);
	color_text(280,227,"Ok",3);
	showMouse();
	while(1)
	{
		while(1)
		{
			x=getMouseX(); /* get the mouse position*/
			y=getMouseY();
			if(x>=260&&x<=320&&y>=220&&y<=240 && !change)
			{
				change = 1;
				settextstyle(0,0,1);
				hideMouse();
				draw_3dbox(260,220,320,240,6);	/* change the color of the box*/
				/* change the text color*/
				color_text(280,227,"Ok",15);   /*cursor on yes*/
				showMouse();
			}

			if((x<=260||x>=320||y<=220||y>=240)&& change)
			{
				change = 0;
				hideMouse();
				draw_3dbox(260,220,320,240,15);
				/* when mouse moves away change the color to normal one*/
				color_text(280,227,"Ok",3);
				showMouse();         /*cursor on yes/no*/
			}

			if(mouseClicked())
			{
				x=getMouseX();       /*get the position where mouse is clicked*/
				y=getMouseY();
				while(1)
					if(mouseReleased())		/* get the position*/
						break;			/* where mouse is clicked*/
				break;					/* and released */
			}
		}/*end of while 2 which changes color of button*/

		/*check the position of mouse clicked*/
		if(x>=260&&x<=320&&y>=220&&y<=240)  // back
		{
			hideMouse();
			up_down_button(260,220,320,240,280,227,19,15,15,6);
			break;
		}
	}/*end of while 1*/

}
示例#2
0
MainWindow::MainWindow(GLvideo_params& vr_params, Qt_params& qt_params, VideoTransportQT *vt, GLfrontend_old *frontend) :
	vr_params(vr_params), vr_params_orig(vr_params), video_transport(vt), gl_frontend(frontend)
{
	QPalette p = palette();
	p.setColor(QPalette::Window, Qt::black);
	setPalette(p);

	setMouseTracking(true);
	connect(&mouse_hide_timer, SIGNAL(timeout()), this, SLOT(hideMouse()));
	mouse_hide_timer.setSingleShot(true);

	if (qt_params.hidemouse) {
		/* hide the mouse pointer from when new window is created, rather
		 * than waiting for a one second time out */
		setCursor(QCursor(Qt::BlankCursor));
	} else {
		mouse_hide_timer.start(1000);
	}

	gl_frontend->getOptimalDimensions(size_hint_w, size_hint_h);
	setWindowTitle("VideoPlayer");
	setFullScreen(qt_params.start_fullscreen);

	//central widget is the threaded openGL video widget
	//which pulls video from the videoRead
	//and gets stats for the OSD from the readThread
	glvideo_mt = new GLvideo_mt(this, vt, vr_params, gl_frontend);

	setCentralWidget(glvideo_mt);

	//set up menus etc
	createActions();
}
示例#3
0
void find_what(int &recno,int Qus)
 {
  if(!Qus)
   {
    hideMouse();
    stanterdScreen(50,1,9);
    cout<<"\n\n\n";
   }
  if(!Qus)
   {
    cout<<"\n\t\t\tRecord No    :: ";
    cin>>recno;
   }
示例#4
0
void CineEngine::mainLoop(int bootScriptIdx) {
	bool playerAction;
	byte di;
	uint16 mouseButton;

	if (_preLoad == false) {
		resetBgIncrustList();

		setTextWindow(0, 0, 20, 200);

		errorVar = 0;

		addScriptToGlobalScripts(bootScriptIdx);

		menuVar = 0;

//		gfxRedrawPage(page0c, page0, page0c, page0, -1);
//		gfxWaitVBL();
//		gfxRedrawMouseCursor();

		inMenu = false;
		allowPlayerInput = 0;
		checkForPendingDataLoadSwitch = 0;

		fadeRequired = false;
		isDrawCommandEnabled = 0;
		waitForPlayerClick = 0;
		menuCommandLen = 0;

		playerCommand = -1;
		g_cine->_commandBuffer = "";

		g_cine->_globalVars[VAR_MOUSE_X_POS] = 0;
		g_cine->_globalVars[VAR_MOUSE_Y_POS] = 0;
		if (g_cine->getGameType() == Cine::GType_OS) {
			g_cine->_globalVars[VAR_MOUSE_X_POS_2ND] = 0;
			g_cine->_globalVars[VAR_MOUSE_Y_POS_2ND] = 0;
			g_cine->_globalVars[VAR_BYPASS_PROTECTION] = 0; // set to 1 to bypass the copy protection
			g_cine->_globalVars[VAR_LOW_MEMORY] = 0; // set to 1 to disable some animations, sounds etc.
		}

		strcpy(newPrcName, "");
		strcpy(newRelName, "");
		strcpy(newObjectName, "");
		strcpy(newMsgName, "");
		strcpy(currentCtName, "");
		strcpy(currentPartName, "");

		g_sound->stopMusic();
	}

	do {
		// HACK: Force amount of oxygen left to maximum during Operation Stealth's first arcade sequence.
		//       This makes it possible to pass the arcade sequence for now.
		// FIXME: Remove the hack and make the first arcade sequence normally playable.
		if (g_cine->getGameType() == Cine::GType_OS) {
			Common::String bgName(renderer->getBgName());
			// Check if the background is one of the three backgrounds
			// that are only used during the first arcade sequence.
			if (bgName == "28.PI1" || bgName == "29.PI1" || bgName == "30.PI1") {
				static const uint oxygenObjNum = 202, maxOxygen = 264;
				// Force the amount of oxygen left to the maximum.
				g_cine->_objectTable[oxygenObjNum].x = maxOxygen;
			}
		}

		// HACK: In Operation Stealth after the first arcade sequence jump player's position to avoid getting stuck.
		// After the first arcade sequence the player comes up stairs from
		// the water in Santa Paragua's downtown in front of the flower shop.
		// Previously he was completely stuck after getting up the stairs.
		// If the background is the one used in the flower shop scene ("21.PI1")
		// and the player is at the exact location after getting up the stairs
		// then we just nudge him a tiny bit away from the stairs and voila, he's free!
		// Maybe the real problem behind all this is collision data related as it looks
		// like there's some boundary right there near position (204, 110) which we can
		// jump over by moving the character to (204, 109). The script handling the
		// flower shop scene is AIRPORT.PRC's 13th script.
		// FIXME: Remove the hack and solve what's really causing the problem in the first place.
		if (g_cine->getGameType() == Cine::GType_OS) {
			if (scumm_stricmp(renderer->getBgName(), "21.PI1") == 0 && g_cine->_objectTable[1].x == 204 && g_cine->_objectTable[1].y == 110) {
				g_cine->_objectTable[1].y--; // Move the player character upward on-screen by one pixel
			}
		}

		stopMusicAfterFadeOut();
		di = executePlayerInput();

		// Clear the zoneQuery table (Operation Stealth specific)
		if (g_cine->getGameType() == Cine::GType_OS) {
			Common::set_to(g_cine->_zoneQuery.begin(), g_cine->_zoneQuery.end(), 0);
		}

		if (g_cine->getGameType() == Cine::GType_OS) {
			processSeqList();
		}
		executeObjectScripts();
		executeGlobalScripts();

		purgeObjectScripts();
		purgeGlobalScripts();
		if (g_cine->getGameType() == Cine::GType_OS) {
			purgeSeqList();
		}

		if (playerCommand == -1) {
			setMouseCursor(MOUSE_CURSOR_NORMAL);
		} else {
			setMouseCursor(MOUSE_CURSOR_CROSS);
		}

		if (renderer->ready()) {
			renderer->drawFrame();
		}

		// NOTE: In the original Future Wars and Operation Stealth messages
		// were removed when running the drawOverlays function which is
		// currently called from the renderer's drawFrame function.
		removeMessages();

		if (waitForPlayerClick) {
			playerAction = false;

			_messageLen <<= 3;
			if (_messageLen < 0x800)
				_messageLen = 0x800;

			do {
				manageEvents();
				getMouseData(mouseUpdateStatus, &mouseButton, &dummyU16, &dummyU16);
			} while (mouseButton != 0 && !shouldQuit());

			menuVar = 0;

			do {
				manageEvents();
				getMouseData(mouseUpdateStatus, &mouseButton, &dummyU16, &dummyU16);
				playerAction = (mouseButton != 0) || processKeyboard(menuVar);
				mainLoopSub6();
			} while (!playerAction && !shouldQuit());

			menuVar = 0;

			do {
				manageEvents();
				getMouseData(mouseUpdateStatus, &mouseButton, &dummyU16, &dummyU16);
			} while (mouseButton != 0 && !shouldQuit());

			waitForPlayerClick = 0;
		}

		if (checkForPendingDataLoadSwitch) {
			checkForPendingDataLoad();

			checkForPendingDataLoadSwitch = 0;
		}

		if (di) {
			if ("quit"[menuCommandLen] == (char)di) {
				++menuCommandLen;
				if (menuCommandLen == 4) {
					quitGame();
				}
			} else {
				menuCommandLen = 0;
			}
		}

		manageEvents();

	} while (!shouldQuit() && !_restartRequested);

	hideMouse();
	g_sound->stopMusic();
	// if (g_cine->getGameType() == Cine::GType_OS) {
	//	freeUnkList();
	// }
	closePart();
}
示例#5
0
Document::Document(const QString& filename, int& current_wordcount, int& current_time, const QString& theme, QWidget* parent)
	: QWidget(parent),
	m_index(0),
	m_always_center(false),
	m_rich_text(false),
	m_cached_block_count(-1),
	m_cached_current_block(-1),
	m_page_type(0),
	m_page_amount(0),
	m_accurate_wordcount(true),
	m_current_wordcount(current_wordcount),
	m_current_time(current_time)
{
	setMouseTracking(true);

	m_stats = &m_document_stats;

	m_hide_timer = new QTimer(this);
	m_hide_timer->setInterval(5000);
	m_hide_timer->setSingleShot(true);
	connect(m_hide_timer, SIGNAL(timeout()), this, SLOT(hideMouse()));

	// Set up text area
        m_text = new Editor(this);
	m_text->installEventFilter(this);
	m_text->setMouseTracking(true);
	m_text->setFrameStyle(QFrame::NoFrame);
	m_text->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	m_text->viewport()->setMouseTracking(true);
	m_text->viewport()->installEventFilter(this);

	QTextDocument* document = new QTextDocument(m_text);
	document->setUndoRedoEnabled(false);

	// Read file
	bool unknown_rich_text = false;
	if (!filename.isEmpty()) {
		m_rich_text = isRichTextFile(filename.toLower());
		m_filename = QFileInfo(filename).canonicalFilePath();
		updateState();

		if (!m_rich_text) {
			QFile file(filename);
			if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
				QTextStream stream(&file);
				stream.setCodec(QTextCodec::codecForName("UTF-8"));
				stream.setAutoDetectUnicode(true);
				
				QTextCursor cursor(document);
				while (!stream.atEnd()) {
					cursor.insertText(stream.read(8192));
					QApplication::processEvents();
				}
				file.close();
			}
		} else {
            PROSEUP::Reader reader;
			reader.read(filename, document);
			if (reader.hasError()) {
				QMessageBox::warning(this, tr("Sorry"), reader.errorString());
			}
		}                
	}

	// Set text area contents
	document->setUndoRedoEnabled(true);
	document->setModified(false);
	m_text->setDocument(document);
	m_text->setTabStopWidth(50);
	document->setIndentWidth(50);

	m_dictionary = new Dictionary(this);
	m_highlighter = new Highlighter(m_text, m_dictionary);
	connect(m_dictionary, SIGNAL(changed()), this, SLOT(dictionaryChanged()));

	if (m_filename.isEmpty()) {
		findIndex();
		unknown_rich_text = true;
	} else {
		m_text->setReadOnly(!QFileInfo(m_filename).isWritable());
	}

	// Set up scroll bar
	m_text->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	m_scrollbar = m_text->verticalScrollBar();
	m_scrollbar->setPalette(QApplication::palette());
	m_scrollbar->setAutoFillBackground(true);
	m_scrollbar->setVisible(false);
	connect(m_scrollbar, SIGNAL(actionTriggered(int)), this, SLOT(scrollBarActionTriggered(int)));
	connect(m_scrollbar, SIGNAL(rangeChanged(int,int)), this, SLOT(scrollBarRangeChanged(int,int)));
	scrollBarRangeChanged(m_scrollbar->minimum(), m_scrollbar->maximum());

	// Lay out window
	m_layout = new QGridLayout(this);
	m_layout->setSpacing(0);
	m_layout->setMargin(0);
	m_layout->addWidget(m_text, 0, 1);
	m_layout->addWidget(m_scrollbar, 0, 2, Qt::AlignRight);

	// Load settings
	Preferences preferences;
	if (unknown_rich_text) {
		m_rich_text = preferences.richText();
	}
	m_text->setAcceptRichText(m_rich_text);
	loadPreferences(preferences);
	loadTheme(theme);


        if(m_rich_text)
        {
            m_text->setUndoRedoEnabled(false);
            cleanUpDocument();
            m_text->setUndoRedoEnabled(true);
            m_text->document()->setModified(false);
        }




	calculateWordCount();
	connect(m_text->document(), SIGNAL(undoCommandAdded()), this, SLOT(undoCommandAdded()));
	connect(m_text->document(), SIGNAL(contentsChange(int,int,int)), this, SLOT(updateWordCount(int,int,int)));
	connect(m_text, SIGNAL(cursorPositionChanged()), this, SLOT(cursorPositionChanged()));
	connect(m_text, SIGNAL(selectionChanged()), this, SLOT(selectionChanged()));
}
示例#6
0
Document::Document(const QString& filename, int& current_wordcount, int& current_time, QWidget* parent)
    : QWidget(parent),
      m_cache_filename(randomCacheFilename()),
      m_index(0),
      m_always_center(false),
      m_rich_text(false),
      m_cached_block_count(-1),
      m_cached_current_block(-1),
      m_page_type(0),
      m_page_amount(0),
      m_accurate_wordcount(true),
      m_current_wordcount(current_wordcount),
      m_current_time(current_time)
{
    setMouseTracking(true);

    m_stats = &m_document_stats;

    m_hide_timer = new QTimer(this);
    m_hide_timer->setInterval(5000);
    m_hide_timer->setSingleShot(true);
    connect(m_hide_timer, SIGNAL(timeout()), this, SLOT(hideMouse()));

    // Set up text area
    m_text = new QTextEdit(this);
    m_text->installEventFilter(this);
    m_text->setMouseTracking(true);
    m_text->setFrameStyle(QFrame::NoFrame);
    m_text->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    m_text->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    m_text->setTabStopWidth(50);
    m_text->document()->setIndentWidth(50);
    m_text->horizontalScrollBar()->setAttribute(Qt::WA_NoMousePropagation);
    m_text->viewport()->setMouseTracking(true);
    m_text->viewport()->installEventFilter(this);
    connect(m_text, SIGNAL(cursorPositionChanged()), this, SLOT(cursorPositionChanged()));
    connect(m_text, SIGNAL(selectionChanged()), this, SLOT(selectionChanged()));
    connect(m_text->document(), SIGNAL(undoCommandAdded()), this, SLOT(undoCommandAdded()));
    connect(m_text->document(), SIGNAL(contentsChange(int,int,int)), this, SLOT(updateWordCount(int,int,int)));

    m_dictionary = new Dictionary(this);
    m_highlighter = new Highlighter(m_text, m_dictionary);
    m_focusmode = new FocusMode(m_text);
    connect(m_dictionary, SIGNAL(changed()), this, SLOT(dictionaryChanged()));

    // Set filename
    bool unknown_rich_text = false;
    if (!filename.isEmpty()) {
        m_rich_text = isRichTextFile(filename.toLower());
        m_filename = QFileInfo(filename).canonicalFilePath();
        updateState();
    }

    if (m_filename.isEmpty()) {
        findIndex();
        unknown_rich_text = true;
    } else {
        m_text->setReadOnly(!QFileInfo(m_filename).isWritable());
    }

    // Set up scroll bar
    m_scrollbar = m_text->verticalScrollBar();
    m_scrollbar->setAttribute(Qt::WA_NoMousePropagation);
    m_scrollbar->setPalette(QApplication::palette());
    m_scrollbar->setAutoFillBackground(true);
    m_scrollbar->setMouseTracking(true);
    m_scrollbar->installEventFilter(this);
    setScrollBarVisible(false);
    connect(m_scrollbar, SIGNAL(actionTriggered(int)), this, SLOT(scrollBarActionTriggered(int)));
    connect(m_scrollbar, SIGNAL(rangeChanged(int,int)), this, SLOT(scrollBarRangeChanged(int,int)));

    // Lay out window
    m_layout = new QGridLayout(this);
    m_layout->setSpacing(0);
    m_layout->setMargin(0);
    m_layout->addWidget(m_text, 0, 1);
    m_layout->addWidget(m_scrollbar, 0, 2, Qt::AlignRight);

    // Load settings
    Preferences preferences;
    if (unknown_rich_text) {
        m_rich_text = preferences.richText();
    }
    m_text->setAcceptRichText(m_rich_text);
    loadPreferences(preferences);
}
示例#7
0
void advanced_level(int file_no,int MINUTE, int angleINCREASE){

	FILE *file;
	file= fopen(file_name[file_no],"r");

	char choice[2],comp;
	// line & i will keep track wid total lines and chars respectively
	int i=0,chars=0, file_pointer,line,z,char_x,char_y,dummy_choice;
	int j1,ch1,x1,y1,time_up;

	prev= -1;
	time_interval=0, min=0, sec=0, eff=0, err=0, speed=0;
	pressed=0, correct= 0, wrong= 0, cpm=0, correction=0;
	minute=MINUTE, INCREASE= angleINCREASE,second=0;
	tutorial_window();
	hideMouse();

	file_pointer=0; choice[1]='\0';

	setcolor(4);
	settextstyle(0,0,1);
	outtextxy(542,50,"0");
	outtextxy(562,50,":");
	outtextxy(574,50,"00");
	show_number(minute,550,50,4,0,1);
	user_response(250,130,1,3);
	time(&start_time);

	settextstyle(2,0,5);
	color_text(535,76,"ESC to",3);
	color_text(536,76,"ESC to",3);
	color_text(524,92,"quit/pause",3);
	color_text(525,92,"quit/pause",3);

	dummy_choice= 'A'; //just to initialize the drawing of a key
	increase=0, angle=89;

	file_open4_screen(file,173,72,36,1,6,30,0);

	while(!feof(file)){

		i=0;char_x=173;char_y=90; line=0; chars=0;
		rewind(file);
		fseek(file,file_pointer,0);

		while(line<6){
			if(feof(file)){
				summary_content();
				end_lesson(min,sec,eff,err,speed);
				return;
				//break;
			}
			gettime (&new_time);
			time_up= time_control();
			if(time_up)
				return ;

			if(i>=0){
				color_text(char_x+8*i,(char_y+36*line)+1,"_",4);
				color_text(char_x+8*i,(char_y+36*line)-23,"^",4);
			}

			if(kbhit()){

				check_kb_up_down(dummy_choice,0);
				choice[0]= getch(); // user input
				dummy_choice= choice[0];
				pressed++;
				check_kb_up_down(choice[0],1);

				if(chars>29){
					color_text((char_x+i*8),(char_y+36*line)+1,"_",15);
					color_text((char_x+i*8),(char_y+36*line)-23,"^",15);
					i=0; line++; chars=0;
				}

				if(choice[0]==27 )  // ESC
				{
					pressed--;
					make_sound(2000,100);
					if(i>0)
						summary_content();

					z = continue_close(min,sec,eff,err,speed);
					if(z)
						return;
					else
						continue;
				}

				if(choice[0]==0){ // error checking for function keys
					int ch1=getch();
					if(ch1==80||ch1==72||ch1==75||ch1==77)   //error checking  to avoide right,left,up
						continue;
				}

				else if(choice[0]==9)
					continue;    //error checking for tab

				else if(choice[0]==8){  //BACKSPACE
					correction++;

					if(i>0 || line>0){
						if(i>0){
							file_pointer--;
							fseek(file,-1,SEEK_CUR);
							setfillstyle(1,15);
							bar(char_x+i*8,char_y+36*line,char_x+(i*8)-8,char_y+7+36*line);
							color_text((char_x+i*8)-8,(char_y+36*line)+1,"_",4);
							color_text(char_x+i*8,(char_y+36*line)+1,"_",15);
							color_text((char_x+i*8)-8,(char_y+36*line)-23,"^",4);
							color_text(char_x+i*8,(char_y+36*line)-23,"^",15);
							i--; chars--;
						}

						if(i>29){
							line++; i=0;chars=0;
						}

					}
					make_sound(1000,100);

				}

				else{
					file_pointer++; correct++;
					fscanf(file,"%c",&comp);
					setcolor(4);
					if(comp=='\n'){
						i=0; chars=1; line++; continue;

					}
					if(comp!=choice[0] && choice[0]==' ')
					{
						char choice1 = '-';	//when space is pressed instead of any key, print dash
						print_lesson(char_x+i*8,char_y+36*line,choice1,9);
						make_sound(500,100);
						wrong++; correct--;
					}

					else if(comp != choice[0]){
						wrong++; correct--;
						setcolor(9);
						make_sound(500,100);
						outtextxy(char_x+i*8,char_y+36*line,choice);
					}
					else
						outtextxy(char_x+i*8,char_y+36*line,choice);

					color_text((char_x+i*8)+8,(char_y+36*line)-23,"^",4);
					color_text(char_x+i*8,(char_y+36*line)-23,"^",15);
					color_text((char_x+i*8)+8,(char_y+36*line)+1,"_",4);
					color_text(char_x+i*8,(char_y+36*line)+1,"_",15);
					i++; chars++;
				}
			}

		}
		if(feof(file))
			break;
		setfillstyle(1,15);
		bar(165,56,417,300);
		undr_line(165,81,12,250,18,7);
		file_open4_screen(file,173,72,36,1,6,30,file_pointer);
	}
	fclose(file);
	closegraph();
}
示例#8
0
void lesson_practice(int lesson_no,int num,int MINUTE,int angleINCREASE)
{
/* INCREASE= will control time, MINUTE= given time limit of typing */

	int j1,ch1,x1,y1,time_up;
	int char_x, char_y,i,choice,dummy_choice,line,z;
	int rndm,store; /* 'store' is used to store chars serially in
				store array */
	prev= -1;
	time_interval=0, min=0, sec=0, eff=0, err=0, speed=0;
	pressed=0, correct= 0, wrong= 0, cpm=0, correction=0;
	minute=MINUTE, INCREASE= angleINCREASE, second=0;

	char_x = 173;
	char_y = 72;

	tutorial_window();
	run_info_window();
	hideMouse();

	if(!num)
		LETTER= 4;

	else if(!lesson_no)
		LETTER=20;

	line = 1;
	for(i=1,store=0; line<MAX ;i++,store++)
	{
		rndm = random(LETTER); // randomly seeks chars
		if(!num){
			store_chars[store]= lesson[lesson_no-1][rndm];
			print_lesson(char_x, char_y, lesson[lesson_no-1][rndm],1);
		}

		else if(!lesson_no){
			store_chars[store]= numeric[num-1][rndm];
			print_lesson(char_x, char_y, numeric[num-1][rndm],1);
		}
		char_x +=8; //for next character

		if(i%4==0)       // GIVING SPACE AFTER EVERY 4 CHARS
		{
			char_x +=8;
			store++;
			store_chars[store]=' ';
		}

		if(char_x >405)    // NEXT LINE
		{
			char_x = 173;
			char_y+= 36;
			line++;
		}
	}
	setcolor(4);
	outtextxy(542,50,"0");
	outtextxy(562,50,":");
	outtextxy(574,50,"00");
	show_number(minute,550,50,4,0,1);
	run_info(pressed,correct,wrong,correction);
	user_response(250,130,1,3);
	time(&start_time);

	settextstyle(2,0,5);
	color_text(535,76,"ESC to",3);
	color_text(536,76,"ESC to",3);
	color_text(524,92,"quit/pause",3);
	color_text(525,92,"quit/pause",3);
	char_x= 173; 	char_y= 90;  line =1;  i=0;

	dummy_choice= 'A'; //just to initialize the drawing of a key
	increase=0, angle=89;
	while(1)
	{
	      gettime (&new_time);
	      time_up= time_control();
	      if(time_up)
			return;


	      if(line<7){
			color_text(char_x,char_y+1,"_",4);
			color_text(char_x,char_y-23,"^",4);
	      }

	      if(kbhit())
	      {
			check_kb_up_down(dummy_choice,0);

			choice= getch();  // ASSIGN USER INPUT TO 'CHOICE'
			dummy_choice= choice;
			pressed++;

			check_kb_up_down(choice,1);

			if(line>6)
			{
				summary_content();
				end_lesson(min,sec,eff,err,speed);
				return;
			}
			if(choice==27 )  // ESC
			{
				pressed--;
				make_sound(2000,100);
				if(i>0)
					summary_content();

				z = continue_close(min,sec,eff,err,speed);
				if(z)
					return;
				else
					continue;
			}
			else if(choice==0) // error checking for function keys
			{
				ch1=getch();
				if(ch1==80||ch1==72||ch1==75||ch1==77)   //error checking  to avoide right,left,up
					continue;
			}

			else if(choice==9)
				continue;    //error checking for tab

			else if(choice==8)  	// BACKSPACE
			{
				if(i>0)
				{
					correction++;
					if(char_x<=173){
						setfillstyle(1,15);
						bar(char_x+233,char_y-36,char_x+243,char_y-29);
						color_text(char_x,char_y+1,"_",15);
						color_text(char_x,char_y-23,"^",15);
						char_y-=36;
						char_x+=240;

						color_text(char_x-8,char_y+1,"_",4);
						color_text(char_x-8,char_y-23,"^",4);

					}

					else{
						setfillstyle(1,15);
						bar(char_x-8, char_y, char_x,char_y+7);
						color_text(char_x,char_y+1,"_",15);
						color_text(char_x-8,char_y+1,"_",4);
						color_text(char_x,char_y-23,"^",15);
						color_text(char_x-8,char_y-23,"^",4);
					}
					--i;
					char_x-=8;
					sound(1000);
					delay(100);
					nosound();
				}
			}

			else{

				if(choice==store_chars[i]){  			//letter is ok!
					print_lesson(char_x,char_y,choice,4);
					correct++;
				}

				else if(store_chars[i] !=choice && choice==' ')
				{
					char choice1 = '-';	//when space is pressed instead of any key, print dash
					print_lesson(char_x,char_y,choice1,9);
					make_sound(500,100);
					wrong++;
				}
				else
				{
					print_lesson(char_x, char_y,choice,9);
					make_sound(500,100);
					wrong++;
				}

				color_text(char_x+8,char_y-23,"^",4);
				color_text(char_x,char_y-23,"^",15);
				color_text(char_x+8,char_y+1,"_",4);
				color_text(char_x,char_y+1,"_",15);
				char_x +=8;
				if(char_x > 405)
				{
					color_text(char_x,char_y+1,"_",15);
					color_text(char_x,char_y-23,"^",15);
					char_x = 173;
					char_y +=36;
					line++;
				}
				i++;

			}  // end of else or default typing

			run_info(pressed,correct,wrong,correction);
	      } // end of the initial 'if'
	}  // end of while
}
示例#9
0
int continue_close(int min, int sec, int eff, int err, int speed)
{
	unsigned int sum;
	void* summary;
	int x,y,j=-2,pr=-1,i;

    //	sum=imagesize(200,90,380,250);
	sum=imagesize(170,90,410,250);
	summary= malloc(sum);
	getimage(170,90,410,250,summary);

	show_summary(min,sec,eff,err,speed);
	draw_3dbox(210,220,280,240,15);
	draw_3dbox(305,220,370,240,15);
	settextstyle(0,0,1);
	color_text(214,227,"Continue",3);
	color_text(317,227,"Close",3);
	showMouse();
	while(1)
	{
		while(1)
		{
			x=getMouseX(); /* get the mouse position*/
			y=getMouseY();
			for(i=0;i<2;i++)
			{
				if(x>=210+(i*95)&&x<=280+(i*90)&&y>=220&&y<=240 )
				{
					j=i;     /* check the position*/
					break;
				}
			}
			settextstyle(0,0,1);
			if(j>=0&&j<2&& j!=pr)
			{
				hideMouse();
				draw_3dbox(210+(j*95),220,280+(j*90),240,6);	/* change the color of the box*/
				/* change the text color*/
				if(j)
					color_text(317,227,"Close",15);	/*cursor on no*/
				else if(!j)
					color_text(214,227,"Continue",15);   /*cursor on yes*/
				showMouse();
			}
			if(j!=pr && pr>=0 && pr<2)
			{
				hideMouse();
				draw_3dbox(210+(pr*95),220,280+(pr*90),240,15);
				/* when mouse moves away change the color to normal one*/
				if(pr)
					color_text(317,227,"Close",3);
				else if(!pr)
					color_text(214,227,"Continue",3);
				showMouse();         /*cursor on yes/no*/
			}
			pr = j;	/* keeps the current postion to use next time as previous*/
			j = -1;
			if(mouseClicked())
			{
				x=getMouseX();       /*get the position where mouse is clicked*/
				y=getMouseY();
				break;
			}
		}/*end of while 2 which changes color of button*/

		/*check the position of mouse clicked*/
		if(x>=210&&x<=280&&y>=220&&y<=240)  // continue
		{
			hideMouse();
			up_down_button(210,220,280,240,214,227,18,15,15,6);
			putimage(170,90,summary,COPY_PUT);
			//showMouse();     /*if clicked on back return to previous stage*/
			free(summary);
			return 0;
		}
		else if(x>=305&&x<=370&&y>=220&&y<=240)
		{
			hideMouse();
			up_down_button(305,220,370,240,317,227,23,15,15,6);
			free(summary);   //if clicked on close exit from the lesson
			time_interval=0, min=0, sec=0, minute=0,second=0,eff=0, err=0, speed=0;
			pressed=0, correct= 0, wrong= 0, cpm=0, correction=0;
			showMouse();
			return 1;
		}
	}/*end of while 1*/
}
示例#10
0
UIYabause::UIYabause( QWidget* parent )
	: QMainWindow( parent )
{
	mInit = false;
   search.clear();
	searchType = 0;

	// setup dialog
	setupUi( this );
	toolBar->insertAction( aFileSettings, mFileSaveState->menuAction() );
	toolBar->insertAction( aFileSettings, mFileLoadState->menuAction() );
	toolBar->insertSeparator( aFileSettings );
	setAttribute( Qt::WA_DeleteOnClose );
#ifdef USE_UNIFIED_TITLE_TOOLBAR
	setUnifiedTitleAndToolBarOnMac( true );
#endif
	fSound->setParent( 0, Qt::Popup );
	fVideoDriver->setParent( 0, Qt::Popup );
	fSound->installEventFilter( this );
	fVideoDriver->installEventFilter( this );
	// Get Screen res list
	getSupportedResolutions();
	// fill combo driver
	cbVideoDriver->blockSignals( true );
	for ( int i = 0; VIDCoreList[i] != NULL; i++ )
		cbVideoDriver->addItem( VIDCoreList[i]->Name, VIDCoreList[i]->id );
	cbVideoDriver->blockSignals( false );
	// create glcontext
	mYabauseGL = new YabauseGL( this );
	// and set it as central application widget
	setCentralWidget( mYabauseGL );
	// create log widget
	teLog = new QTextEdit( this );
	teLog->setReadOnly( true );
	teLog->setWordWrapMode( QTextOption::NoWrap );
	teLog->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOn );
	teLog->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOn );
	mLogDock = new QDockWidget( this );
	mLogDock->setWindowTitle( "Log" );
	mLogDock->setWidget( teLog );
	addDockWidget( Qt::BottomDockWidgetArea, mLogDock );
	mLogDock->setVisible( false );
	mCanLog = true;
	oldMouseX = oldMouseY = 0;
	mouseCaptured = false;

#ifndef SH2_TRACE
	aTraceLogging->setVisible(false);
#endif

	// create emulator thread
	mYabauseThread = new YabauseThread( this );
	// create hide mouse timer
	hideMouseTimer = new QTimer();
	// create mouse cursor timer
	mouseCursorTimer = new QTimer();
	// connections
	connect( mYabauseThread, SIGNAL( requestSize( const QSize& ) ), this, SLOT( sizeRequested( const QSize& ) ) );
	connect( mYabauseThread, SIGNAL( requestFullscreen( bool ) ), this, SLOT( fullscreenRequested( bool ) ) );
	connect( mYabauseThread, SIGNAL( requestVolumeChange( int ) ), this, SLOT( on_sVolume_valueChanged( int ) ) );
	connect( aViewLog, SIGNAL( toggled( bool ) ), mLogDock, SLOT( setVisible( bool ) ) );
	connect( mLogDock->toggleViewAction(), SIGNAL( toggled( bool ) ), aViewLog, SLOT( setChecked( bool ) ) );
	connect( mYabauseThread, SIGNAL( error( const QString&, bool ) ), this, SLOT( errorReceived( const QString&, bool ) ) );
	connect( mYabauseThread, SIGNAL( pause( bool ) ), this, SLOT( pause( bool ) ) );
	connect( mYabauseThread, SIGNAL( reset() ), this, SLOT( reset() ) );
	connect( hideMouseTimer, SIGNAL( timeout() ), this, SLOT( hideMouse() ));
	connect( mouseCursorTimer, SIGNAL( timeout() ), this, SLOT( cursorRestore() ));
	connect( mYabauseThread, SIGNAL( toggleEmulateMouse( bool ) ), this, SLOT( toggleEmulateMouse( bool ) ) );

	// Load shortcuts
	VolatileSettings* vs = QtYabause::volatileSettings();
	QList<QAction *> actions = findChildren<QAction *>();
	foreach ( QAction* action, actions )
	{
		if (action->text().isEmpty())
			continue;

		QString text = vs->value(QString("Shortcuts/") + action->text(), "").toString();
		if (text.isEmpty())
			continue;
		action->setShortcut(text);
	}

	// retranslate widgets
	QtYabause::retranslateWidget( this );

	QList<QAction *> actionList = menubar->actions();
	for(int i = 0;i < actionList.size();i++) {
		addAction(actionList.at(i));
	}

	restoreGeometry( vs->value("General/Geometry" ).toByteArray() );
	mYabauseGL->setMouseTracking(true);
	setMouseTracking(true);
	mouseXRatio = mouseYRatio = 1.0;
	emulateMouse = false;
	mouseSensitivity = vs->value( "Input/GunMouseSensitivity", 100 ).toInt();
	showMenuBarHeight = menubar->height();
	translations = QtYabause::getTranslationList();
	
	VIDSoftSetBilinear(QtYabause::settings()->value( "Video/Bilinear", false ).toBool());
}
示例#11
0
Document::Document(const QString& filename, DailyProgress* daily_progress, QWidget* parent)
	: QWidget(parent),
	m_cache_outdated(false),
	m_index(0),
	m_always_center(false),
	m_mouse_button_down(false),
	m_rich_text(false),
	m_spacings_loaded(false),
	m_focus_mode(0),
	m_scene_list(0),
	m_dictionary(DictionaryManager::instance().requestDictionary()),
	m_cached_block_count(-1),
	m_cached_current_block(-1),
	m_saved_wordcount(0),
	m_page_type(0),
	m_page_amount(0),
	m_wordcount_type(0),
	m_daily_progress(daily_progress)
{
	setMouseTracking(true);

	m_stats = &m_document_stats;

	m_hide_timer = new QTimer(this);
	m_hide_timer->setInterval(5000);
	m_hide_timer->setSingleShot(true);
	connect(m_hide_timer, SIGNAL(timeout()), this, SLOT(hideMouse()));

	// Set up text area
	m_text = new TextEdit(this);
	m_text->installEventFilter(this);
	m_text->setMouseTracking(true);
	m_text->setFrameStyle(QFrame::NoFrame);
	m_text->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	m_text->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	m_text->setTabStopWidth(48);
	m_text->document()->setIndentWidth(48);
	m_text->horizontalScrollBar()->setAttribute(Qt::WA_NoMousePropagation);
	m_text->viewport()->setMouseTracking(true);
	m_text->viewport()->installEventFilter(this);
	connect(m_text, SIGNAL(cursorPositionChanged()), this, SLOT(cursorPositionChanged()));
	connect(m_text, SIGNAL(selectionChanged()), this, SLOT(selectionChanged()));
	connect(m_text->document(), SIGNAL(modificationChanged(bool)), this, SIGNAL(modificationChanged(bool)));

	QShortcut* shortcut_down = new QShortcut(m_text);
	QShortcut* shortcut_up = new QShortcut(m_text);
#ifndef Q_OS_MAC
	shortcut_down->setKey(Qt::CTRL + Qt::Key_Down);
	shortcut_up->setKey(Qt::CTRL + Qt::Key_Up);
#else
	shortcut_down->setKey(Qt::ALT + Qt::Key_Down);
	shortcut_up->setKey(Qt::ALT + Qt::Key_Up);
#endif
	connect(shortcut_down, SIGNAL(activated()), this, SLOT(moveToBlockEnd()));
	connect(shortcut_up, SIGNAL(activated()), this, SLOT(moveToBlockStart()));

	m_scene_model = new SceneModel(m_text, this);

	m_highlighter = new Highlighter(m_text, m_dictionary);
	connect(&DictionaryManager::instance(), SIGNAL(changed()), this, SLOT(dictionaryChanged()));

	// Set filename
	if (!filename.isEmpty()) {
		m_rich_text = FormatManager::isRichText(filename);
		m_filename = QFileInfo(filename).absoluteFilePath();
		updateState();
	}

	if (m_filename.isEmpty()) {
		findIndex();
	}

	// Set up scroll bar
	m_scrollbar = m_text->verticalScrollBar();
	m_scrollbar->setAttribute(Qt::WA_NoMousePropagation);
	m_scrollbar->setPalette(QApplication::palette());
	m_scrollbar->setAutoFillBackground(true);
	m_scrollbar->setMouseTracking(true);
	m_scrollbar->installEventFilter(this);
	setScrollBarVisible(Preferences::instance().alwaysShowScrollBar());
	connect(m_scrollbar, SIGNAL(actionTriggered(int)), this, SLOT(scrollBarActionTriggered(int)));
	connect(m_scrollbar, SIGNAL(rangeChanged(int,int)), this, SLOT(scrollBarRangeChanged(int,int)));

	// Lay out window
	m_layout = new QGridLayout(this);
	m_layout->setSpacing(0);
	m_layout->setMargin(0);
	m_layout->addWidget(m_text, 1, 1);
	m_layout->addWidget(m_scrollbar, 1, 2, Qt::AlignRight);

	// Load settings
	loadPreferences();

	// Make it read-only until content is loaded
	m_text->setReadOnly(true);

	DocumentWatcher::instance()->addWatch(this);
}
示例#12
0
void VoutWindow::showMouse()
{
    m_pTimer->start( mouse_hide_timeout, true );
    hideMouse( false );
}
示例#13
0
CenterWindow::CenterWindow(QWidget *parent) :
    FCenterWindow(parent)
{
    this->version = "3.1.0";
    QDir dir;
    QDir dir2(dir.homePath()+"/视频");
    QDir dir3(dir.homePath()+"/Videos");
    QString dbPath;
    if(dir2.exists())
    {
        dbPath = dir.homePath()+"/视频/MvGather/Database";
    }else if(dir3.exists())
    {
        dbPath = dir.homePath()+"/Videos/MvGather/Database";
    }else
    {
        dbPath = dir.homePath()+"/MvGather";
    }
    dir.mkpath(dbPath);
    QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");//添加数据库驱动,这里用sqlite
    db.setDatabaseName(dbPath+"/MvGather.db");
    //    db.setDatabaseName("MvGather.db");
    if(db.open())
    {
        //tvId:该视频唯一编号,tvName:视频中文名.tvno_hrefs:集数与相应地址...historyNo:上次观看到的集数;quality:清晰度;tvUrl:yunfan视频列表地址;source:视频来源标识
        QSqlQuery query_creat_tb("CREATE TABLE IF NOT EXISTS playlistTB(tvId VARCHAR( 30 ) NOT NULL,tvName VARCHAR( 30 ),tvno_hrefs VARCHAR(100),historyNo VARCHAR( 30 ),quality VARCHAR( 30 ),tvUrl VARCHAR(100),source VARCHAR( 30 ))");
        query_creat_tb.exec();
        //taskId:创建下载任务的id;url任务原地址;fileSavePath:文件保存目录,percent完成的百分比
        QSqlQuery query_creat_tb2("CREATE TABLE IF NOT EXISTS dtaskTB(taskId VARCHAR(30) NOT NULL,url VARCHAR(200) NOT NULL,fileSavePath VARCHAR(200) NOT NULL,percent VARCHAR(5))");
        query_creat_tb2.exec();
    }


    playerWidget = new PlayerWidget(this);
    addWidget(tr("播放器"), tr("Player"), playerWidget);

    browseWidget = new  BrowseWidget(this);
    addWidget(tr("视频库"), tr("MvList"), browseWidget);

    recommendWidget = new RecommendWidget(this);
    addWidget(tr("推荐"), tr("MvRecomend"), recommendWidget);

    magnetWidget = new MagnetWidget(this);
    addWidget(tr("磁力链"), tr("Magnet"), magnetWidget);

    downloadManageWidget = new QScrollArea(this);
    addWidget(tr("下载"), tr("Download"), downloadManageWidget);

    downloadManageScrollAreaWidget = new QWidget(downloadManageWidget);
    downloadManageWidget->setWidget(downloadManageScrollAreaWidget);
    downloadManageScrollAreaWidgetMainLayout = new QVBoxLayout;
    downloadManageScrollAreaWidgetMainLayout->setAlignment(Qt::AlignTop);
    downloadManageScrollAreaWidget->setLayout(downloadManageScrollAreaWidgetMainLayout);

    downloadManageScrollAreaWidget->setStyleSheet("background:transparent");

    getNavgationBar()->setCurrentIndex(0);
    setAlignment(TopCenter);

    QSettings settings("MvGather", "xusongjie");
    QString preferQualitysSetting = settings.value("app/preferQualitys", "").toString();
    if(preferQualitysSetting =="")
    {
        preferQualitysSetting="高清#超清#M3U8#分段_高清_FLV#分段_高清_MP4#分段_高清_M3U8#分段_720P_FLV#分段_720P_MP4#分段_720P_M3U8#分段_1080P_FLV#分段_1080P_MP4#分段_1080P_M3U8#分段_超清_FLV#分段_超清_MP4#分段_超清_M3U8#分段_标清_FLV#分段_标清_MP4#分段_标清_M3U8#分段_高码1080P_FLV#分段_高码1080P_MP4#分段_高码1080P_M3U8#分段_原画_FLV#分段_原画_MP4#分段_原画_M3U8#分段_4K_FLV#分段_4K_MP4#分段_4K_M3U8#分段_高码4K_FLV#分段_高码4K_MP4#分段_高码4K_M3U8#分段_低清_FLV#分段_低清_MP4#分段_低清_M3U8#单段_高清_MP4#单段_高清_M3U8#单段_高清_FLV#单段_720P_FLV#单段_720P_MP4#单段_720P_M3U8#单段_1080P_FLV#单段_1080P_MP4#单段_1080P_M3U8#单段_超清_FLV#单段_超清_MP4#单段_超清_M3U8#单段_标清_FLV#单段_标清_MP4#单段_标清_M3U8#单段_高码1080P_FLV#单段_高码1080P_MP4#单段_高码1080P_M3U8#单段_原画_FLV#单段_原画_MP4#单段_原画_M3U8#单段_4K_FLV#单段_4K_MP4#单段_4K_M3U8#单段_高码4K_FLV#单段_高码4K_MP4#单段_高码4K_M3U8#单段_低清_FLV#单段_低清_MP4#单段_低清_M3U8";
        settings.setValue("app/preferQualitys",preferQualitysSetting);
    }


    connect(browseWidget,SIGNAL(play(QString)),this,SLOT(addMvToPlaylist(QString)));

    connect(playerWidget,SIGNAL(hideToFullScreen(bool)),this,SLOT(getIntofullScreenMode(bool)));
    connect(playerWidget,SIGNAL(getIntoWideModel(bool)),this,SLOT(getIntoWideModel(bool)));

    connect(magnetWidget,SIGNAL(addDownloadTask(QString)),this,SLOT(addDownloadTask(QString)));
    connect(recommendWidget,SIGNAL(addDownloadTaskSignal(QString)),this,SLOT(addDownloadTask(QString)));

    connect(getNavgationBar(),SIGNAL(indexChanged(int)),this,SLOT(firstLoadList(int)));

    hideMouseTimer = new QTimer;
    connect(hideMouseTimer,SIGNAL(timeout()),this,SLOT(hideMouse()));
    hideMouseTimer->start(500);

    loadDownloadSettings();
}