Exemplo n.º 1
0
View::View(QGraphicsScene *scene) :
        QGraphicsView(scene), m_timer(this) ,m_delay(30){

    qDebug()<<"in View now";

    QPixmap bgPix(":/images/koskipuisto_pieni.jpg");
    m_pix = bgPix;

    setupWindow();

    int h = height();
    int y = qAbs(m_imageHeight-h)/2;
    setSceneRect(0, y, width(), h);


    m_sensors.append(InputController::QACCELEROMETER);
    m_sensors.append(InputController::QORIENTATIONSENSOR);
    m_sensors.append(InputController::QMAGNETOMETER);
    m_sensors.append(InputController::QROTATIONSENSOR);
    m_sensors.append(InputController::QTAPSENSOR);
    m_sensors.append(InputController::QCOMPASS);
    m_sensors.append(InputController::QKEYS);


    m_menu = new QMenu(this);
    createActions();
    handleAction(NULL,InputController::QACCELEROMETER);

    m_timer.setSingleShot(false);
    m_timer.start(m_delay);

    connect(&m_timer, SIGNAL(timeout()), this, SLOT(update()));
    connect(this,SIGNAL(sceneRectChanged(QRectF)), this, SLOT(checkSensors(QRectF)));

}
Exemplo n.º 2
0
		void removeFile(const String& name, bool imitEvents = true)
		{
			// bsearch
			KEvent target;
			EntryStruct tempEntry(name.c_str(), 0);
			target.udata = &tempEntry;
			KEvent* ke = (KEvent*)bsearch(&target, &mChangeList, mChangeListCount + 1, sizeof(KEvent), comparator);
			if(!ke)
				throw FileNotFoundException(name);

			tempEntry.mFilename = 0;
			
			// delete
			close(ke->ident);
			delete((EntryStruct*)ke->udata);
			memset(ke, 0, sizeof(KEvent));
			
			// move end to current
			memcpy(ke, &mChangeList[mChangeListCount], sizeof(KEvent));
			memset(&mChangeList[mChangeListCount], 0, sizeof(KEvent));
			--mChangeListCount;
			
			// qsort
			qsort(mChangeList + 1, mChangeListCount, sizeof(KEvent), comparator);
			
			// handle action
			if(imitEvents)
				handleAction(name, Actions::Delete);
		}
Exemplo n.º 3
0
bool FlyingCamera::processEvent(const SimEvent *event)
{
   switch (event->type)
   {
      case SimActionEventType :
      {
         const SimActionEvent *action = 
                               dynamic_cast<const SimActionEvent *>(event);
         
         if (false == handleAction(action->action, action->fValue, action->device))
         {
            return (Parent::processEvent(event));
         }
         
         return (true);
      }
      onEvent(SimGainFocusEvent);
      onEvent(SimLoseFocusEvent);
      onEvent(SimFrameEndNotifyEvent);
      onEvent(SimObjectTransformEvent);

      default :
         return (false);
   }
}
Exemplo n.º 4
0
		void addFile(const String& name, bool imitEvents = true)
		{
			//fprintf(stderr, "ADDED: %s\n", name.c_str());
			
			// create entry
			struct stat attrib;
			stat(name.c_str(), &attrib);
			
			int fd = open(name.c_str(), O_RDONLY | O_EVTONLY);

			if(fd == -1)
				throw FileNotFoundException(name);
			
			++mChangeListCount;
			
			char* namecopy = new char[name.length() + 1];
			strncpy(namecopy, name.c_str(), name.length());
			namecopy[name.length()] = 0;
			EntryStruct* entry = new EntryStruct(namecopy, mWatchID, attrib.st_mtime);
			
			// set the event data at the end of the list
			EV_SET(&mChangeList[mChangeListCount], fd, EVFILT_VNODE,
				   EV_ADD | EV_ENABLE | EV_ONESHOT/* | EV_CLEAR*/,
				   NOTE_DELETE | NOTE_EXTEND | NOTE_WRITE | NOTE_ATTRIB | NOTE_RENAME | NOTE_LINK | NOTE_REVOKE,
				   0, (void*)entry);
			
			// qsort
			qsort(mChangeList + 1, mChangeListCount, sizeof(KEvent), comparator);
			
			// handle action
			if(imitEvents)
				handleAction(name, Actions::Add);
		}
Exemplo n.º 5
0
			QToolButton* PackagesDelegate::GetUpdate (const QModelIndex& index) const
			{
				int row = index.row ();
				if (!Row2Update_.contains (row))
				{
					QAction *action = new QAction (Core::Instance ()
								.GetProxy ()->GetIcon ("update"),
							tr ("Update"),
							Viewport_);
					action->setCheckable (true);
					action->setProperty ("Role", "Update");
					connect (action,
							SIGNAL (triggered ()),
							this,
							SLOT (handleAction ()));

					QToolButton *toolButton = new QToolButton ();
					toolButton->resize (CActionsSize, CActionsSize);
					toolButton->setDefaultAction (action);
					Row2Update_ [row] = toolButton;
				}

				QToolButton *button = Row2Update_ [row];
				QAction *action = button->defaultAction ();

				bool upgradable = index.data (PackagesModel::PMRUpgradable).toBool ();
				action->setEnabled (upgradable);
				action->setData (index.data (PackagesModel::PMRPackageID));

				WasUpgradable_ [index] = upgradable;

				return button;
			}
	//--------
	void FileWatcherLinux::update()
	{
		FD_SET(mFD, &mDescriptorSet);

		int ret = select(mFD + 1, &mDescriptorSet, NULL, NULL, &mTimeOut);
		if(ret < 0)
		{
			perror("select");
		}
		else if(FD_ISSET(mFD, &mDescriptorSet))
		{
			ssize_t len, i = 0;
			char action[81+FILENAME_MAX] = {0};
			char buff[BUFF_SIZE] = {0};

			len = read (mFD, buff, BUFF_SIZE);
		   
			while (i < len)
			{
				struct inotify_event *pevent = (struct inotify_event *)&buff[i];

				WatchStruct* watch = mWatches[pevent->wd];
				handleAction(watch, pevent->name, pevent->mask);
				i += sizeof(struct inotify_event) + pevent->len;
			}
		}
	}
Exemplo n.º 7
0
bool ServerThread::handle(const Packet &p)
{
	qDebug() << "got packet of type" << p.type;
	if(p.type == Command::FileHeader) handleArchive(p);
	else if(p.type == Command::FileAction) handleAction(p);
	else if(p.type == Command::Hangup) return false;
	return true;
}
Exemplo n.º 8
0
void FighterOpponentMilos::update() {
	if (!_field_38 && canInteract(kFightAction1) && !_sequenceIndex2) {

		if (_opponent->getField34() >= 2) {
			switch (rnd(5)) {
			default:
				break;

			case 0:
				setSequenceAndDraw(1, kFightSequenceType0);
				break;

			case 1:
				setSequenceAndDraw(2, kFightSequenceType0);
				break;

			case 2:
				setSequenceAndDraw(2, kFightSequenceType0);
				setSequenceAndDraw(2, kFightSequenceType1);
				break;

			case 3:
				setSequenceAndDraw(1, kFightSequenceType0);
				setSequenceAndDraw(2, kFightSequenceType2);
				break;

			case 4:
				setSequenceAndDraw(1, kFightSequenceType0);
				setSequenceAndDraw(1, kFightSequenceType2);
				break;
			}
		} else {
			setSequenceAndDraw(2, kFightSequenceType0);
		}

		// Update field_38
		if (_opponent->getField34() < 5)
			_field_38 = 6 * (5 - _opponent->getField34());
		else
			_field_38 = 0;
	}

	if (_frame && checkFrame(2)) {
		if (_sequenceIndex == 1 || _sequenceIndex == 2)
			_opponent->handleAction((FightAction)_sequenceIndex);

		if (_opponent->getCountdown() <= 0) {
			getSoundQueue()->removeFromQueue(kEntityTables0);
			handleAction(kFightActionLost);
		}
	}

	Fighter::update();
}
Exemplo n.º 9
0
RazorNotificationPrivate::RazorNotificationPrivate(const QString& summary, RazorNotification* parent) :
    mId(0),
    mSummary(summary),
    mTimeout(-1),
    q_ptr(parent)
{
    mInterface = new OrgFreedesktopNotificationsInterface("org.freedesktop.Notifications",
                                                          "/org/freedesktop/Notifications",
                                                          QDBusConnection::sessionBus(), this);
    connect(mInterface, SIGNAL(NotificationClosed(uint, uint)), this, SLOT(notificationClosed(uint,uint)));
    connect(mInterface, SIGNAL(ActionInvoked(uint,QString)), this, SLOT(handleAction(uint,QString)));
}
Exemplo n.º 10
0
void MythThemedMenu::buttonAction(MythUIButtonListItem *item, bool skipPass)
{
    ThemedButton button = item->GetData().value<ThemedButton>();

    QString password;
    if (!skipPass)
        password = button.password;

    QStringList::Iterator it = button.action.begin();
    for (; it != button.action.end(); it++)
    {
        if (handleAction(*it, password))
            break;
    }
}
Exemplo n.º 11
0
/**
 * This method handles playing a loaded game
 * @remarks	Originally called tjouer
 */
void MortevielleEngine::playGame() {
	gameLoaded();

	// Loop handling actions until the game has to be quit, or show the lose or end sequence
	do {
		handleAction();
		if (shouldQuit())
			return;
	} while (!((_quitGame) || (_endGame) || (_loseGame)));

	if (_endGame)
		endGame();
	else if (_loseGame)
		askRestart();
}
Exemplo n.º 12
0
			QToolButton* PackagesDelegate::GetInstallRemove (const QModelIndex& index) const
			{
				int row = index.row ();
				if (!Row2InstallRemove_.contains (row))
				{
					QAction *action = new QAction (Viewport_);
					action->setCheckable (true);
					action->setProperty ("Role", "InstallRemove");
					connect (action,
							SIGNAL (triggered ()),
							this,
							SLOT (handleAction ()));

					QToolButton *toolButton = new QToolButton ();
					toolButton->resize (CActionsSize, CActionsSize);
					toolButton->setDefaultAction (action);
					Row2InstallRemove_ [row] = toolButton;
				}

				QToolButton *button = Row2InstallRemove_ [row];

				bool installed = index.data (PackagesModel::PMRInstalled).toBool ();
				QString label;
				QString iconName;
				if (installed)
				{
					label = tr ("Remove");
					iconName = "remove";
				}
				else
				{
					label = tr ("Install");
					iconName = "addjob";
				}

				QAction *action = button->defaultAction ();
				WasInstalled_ [index] = installed;

				action->setText (label);
				action->setIcon (Core::Instance ().GetProxy ()->GetIcon (iconName));
				action->setData (index.data (PackagesModel::PMRPackageID));
				action->setProperty ("Installed", index.data (PackagesModel::PMRInstalled));

				return button;
			}
Exemplo n.º 13
0
		void removeAll()
		{
			KEvent* ke = NULL;
			
			// go through list removing each file and sending an event
			for(int i = 0; i < mChangeListCount; ++i)
			{
				ke = &mChangeList[i];
				//handleAction(name, Action::Delete);
				EntryStruct* entry = (EntryStruct*)ke->udata;
				
				handleAction(entry->mFilename, Actions::Delete);
				
				// delete
				close(ke->ident);
				delete((EntryStruct*)ke->udata);
			}
		}
Exemplo n.º 14
0
void FighterPlayerMilos::update() {
	if (_frame && checkFrame(2)) {

		// Draw sequences
		if (_opponent->getCountdown() <= 0) {
			setSequenceAndDraw(5, kFightSequenceType1);
			_opponent->setSequenceAndDraw(6, kFightSequenceType1);

			getSoundQueue()->removeFromQueue(kEntityTables0);
			getSound()->playSound(kEntityTrain, "MUS029", kFlagDefault);

			handleAction(kFightActionWin);
		}

		if (_sequenceIndex == 4) {
			_opponent->handleAction(kFightAction4);
			_fight->setEndType(Fight::kFightEndLost);
		}
	}

	Fighter::update();
}
Exemplo n.º 15
0
void DirectHandler::handleValue(const JSONEntity& val)
{
	if (0 == icompare(_key, "action"))
	{
		handleAction(val.toString());
	}
	else if (0 == icompare(_key, "method"))
	{
		handleMethod(val.toString());
	}
	else if (0 == icompare(_key, "data"))
	{
		handleData(val);
	}
	else if (0 == icompare(_key, "type"))
	{
		handleType(val.toString());
	}
	else if (0 == icompare(_key, "tid"))
	{
		handleTID(val.toInteger());
	}
}
Exemplo n.º 16
0
void FighterPlayerIvo::update() {

	if ((_sequenceIndex == 3 || _sequenceIndex == 4) && !_frameIndex)
		_opponent->handleAction(kFightAction131);

	if (_frame && checkFrame(2)) {

		// Draw sequences
		if (_opponent->getCountdown() <= 0) {
			setSequenceAndDraw(9, kFightSequenceType1);
			_opponent->setSequenceAndDraw(8, kFightSequenceType1);
			getSoundQueue()->stop(kEntityTables0);

			handleAction(kFightActionWin);
			return;
		}

		if (_sequenceIndex == 3 || _sequenceIndex == 4)
			_opponent->handleAction((FightAction)_sequenceIndex);
	}

	Fighter::update();
}
Exemplo n.º 17
0
static unsigned int handleBeta(ruleset *tree, char *sid, char *mid, char *state, 
                                node *betaNode, void **rulesBinding, unsigned short actionType, unsigned short *commandCount) {
    int prefixLength = 0;
    node *currentNode = betaNode;
    while (currentNode != NULL) {
        int nameLength = strlen(&tree->stringPool[currentNode->nameOffset]);
        prefixLength += nameLength + 1;

        if (currentNode->type == NODE_ACTION) {
            currentNode = NULL;
        } else {
            currentNode = &tree->nodePool[currentNode->value.b.nextOffset];
        }
    }

    node *actionNode;
    char prefix[prefixLength];
    char *currentPrefix = prefix;
    currentNode = betaNode;
    while (currentNode != NULL) {
        char *name = &tree->stringPool[currentNode->nameOffset];
        int nameLength = strlen(&tree->stringPool[currentNode->nameOffset]);
        strncpy(currentPrefix, name, nameLength);
        
        if (currentNode->type == NODE_ACTION) {
            currentPrefix[nameLength] = '\0';
            actionNode = currentNode;
            currentNode = NULL;
        }
        else {
            currentPrefix[nameLength] = '!';
            currentPrefix = &currentPrefix[nameLength + 1];
            currentNode = &tree->nodePool[currentNode->value.b.nextOffset];
        }
    }
    return handleAction(tree, sid, mid, state, prefix, actionNode, rulesBinding, actionType, commandCount);
}
Exemplo n.º 18
0
void View::startMagnetometer(){
    handleAction(m_currentSensor, InputController::QMAGNETOMETER);
}
Exemplo n.º 19
0
//////////////////////////////////////////////////////////////////////////
// Processing
//////////////////////////////////////////////////////////////////////////
void Fighter::process() {
	if (!_fight)
		error("[Fighter::handleAction] Fighter not initialized properly");

	if (!_sequence) {
		if (_frame) {
			getScenes()->removeFromQueue(_frame);
			getScenes()->setCoordinates(_frame);
		}
		SAFE_DELETE(_frame);
		return;
	}

	if (_sequence->count() <= _frameIndex) {
		switch(_action) {
		default:
			break;

		case kFightAction101:
			setSequenceAndDraw(_sequenceIndex2, kFightSequenceType1);
			_sequenceIndex2 = 0;
			break;

		case kFightActionResetFrame:
			_frameIndex = 0;
			break;

		case kFightAction103:
			setSequenceAndDraw(0, kFightSequenceType1);
			handleAction(kFightAction101);
			_opponent->setSequenceAndDraw(0, kFightSequenceType1);
			_opponent->handleAction(kFightAction101);
			_opponent->update();
			break;

		case kFightActionWin:
			_fight->bailout(Fight::kFightEndWin);
			break;

		case kFightActionLost:
			_fight->bailout(Fight::kFightEndLost);
			break;
		}
	}

	if (_fight->isRunning()) {

		// Get the current sequence frame
		SequenceFrame *frame = new SequenceFrame(_sequence, (uint16)_frameIndex);
		frame->getInfo()->location = 1;

		if (_frame == frame) {
			delete frame;
			return;
		}

		getSound()->playFightSound(frame->getInfo()->soundAction, frame->getInfo()->field_31);

		// Add current frame to queue and advance
		getScenes()->addToQueue(frame);
		_frameIndex++;

		if (_frame) {
			getScenes()->removeFromQueue(_frame);

			if (!frame->getInfo()->field_2E)
				getScenes()->setCoordinates(_frame);
		}

		// Replace by new frame
		delete _frame;
		_frame = frame;
	}
}
Exemplo n.º 20
0
		// called when the directory is actually changed
		// means a file has been added or removed
		// rescans the watched directory adding/removing files and sending notices
		void rescan()
		{
			// if new file, call addFile
			// if missing file, call removeFile
			// if timestamp modified, call handleAction(filename, ACTION_MODIFIED);
			DIR* dir = opendir(mDirName.c_str());
			if(!dir)
				return;
			
			struct dirent* dentry;
			KEvent* ke = &mChangeList[1];
			EntryStruct* entry = 0;
			struct stat attrib;			
			
			while((dentry = readdir(dir)) != NULL)
			{
				String fname = mDirName + "/" + dentry->d_name;
				stat(fname.c_str(), &attrib);
				if(!S_ISREG(attrib.st_mode))
					continue;
				
				if(ke <= &mChangeList[mChangeListCount])
				{
					entry = (EntryStruct*)ke->udata;
					int result = strcmp(entry->mFilename, fname.c_str());
					//fprintf(stderr, "[%s cmp %s]\n", entry->mFilename, fname.c_str());
					if(result == 0)
					{
						stat(entry->mFilename, &attrib);
						time_t timestamp = attrib.st_mtime;
						
						if(entry->mModifiedTime != timestamp)
						{
							entry->mModifiedTime = timestamp;
							handleAction(entry->mFilename, Actions::Modified);
						}
						ke++;
					}
					else if(result < 0)
					{
						// f1 was deleted
						removeFile(entry->mFilename);
						ke++;
					}
					else
					{
						// f2 was created
						addFile(fname);
						ke++;
					}
				}
				else
				{
					// just add
					addFile(fname);
					ke++;
				}
			}//end while
			
			closedir(dir);
		};
		// called when the directory is actually changed
		// means a file has been added or removed
		// rescans the watched directory adding/removing files and sending notices
		void rescan()
		{
			// if new file, call addFile
			// if missing file, call removeFile
			// if timestamp modified, call handleAction(filename, ACTION_MODIFIED);
			DIR* dir = opendir(mDirName.c_str());
			if(!dir)
				return;
			
			struct dirent* dentry;
			size_t fileIndex = 0;
			struct stat attrib;			
			bool bRescanRequired = false; //if files are added or deleted we need a rescan.
			while((dentry = readdir(dir)) != NULL)
			{
                std::string fname = mDirName.m_string + "/" + dentry->d_name;
				stat(fname.c_str(), &attrib);
				if(!S_ISREG(attrib.st_mode))
					continue;
				
				if( fileIndex < mFileListCount )
				{
					FileInfo& entry = mFileList[fileIndex];
					int result = strcmp(entry.mFilename, fname.c_str());
					if(result == 0)
					{
						stat(entry.mFilename, &attrib);
						time_t timestamp = attrib.st_mtime;
						
						if(entry.mModifiedTime != timestamp)
						{
							entry.mModifiedTime = timestamp;
							handleAction(entry.mFilename, Actions::Modified);
						}
						++fileIndex;
					}
                    else
                    {
                        // file might have been added or deleted
                        // if we find the file in our list, then we have some deletions up to that point
                        // otherwise we have an add
                        bRescanRequired = true;
                        size_t currFile = fileIndex+1;
                        while( currFile < mFileListCount )
                        {
                            FileInfo& entry = mFileList[currFile];
                            int res = strcmp(entry.mFilename, fname.c_str());
                            if(res == 0)
                            {
                                //have found the file in our list
                                break;
                            }
                            ++currFile;
                        }
                        
                        //process events but don't add/remove to list.
                        if( currFile < mFileListCount )
                        {
                           //have some deletions.
                           while( fileIndex < currFile )
                           {
                               FileInfo& entry = mFileList[currFile];
                               handleAction(entry.mFilename, Actions::Delete);
                               ++fileIndex;
                           }
                            ++fileIndex;
                        }
                        else
                        {
                            //we don't increment fileIndex here as it's an add in the middle.
                            handleAction(fname.c_str(), Actions::Add);
                        }
                    }
 				}
				else
				{
					// just add
 					addFile(fname);
                    handleAction(fname.c_str(), Actions::Add);
					++fileIndex;
				}
			}//end while
			
			closedir(dir);
            
            while( fileIndex < mFileListCount )
            {
                // the last files have been deleted...
                bRescanRequired = true;
                FileInfo& entry = mFileList[fileIndex];
                handleAction(entry.mFilename, Actions::Delete);
                ++fileIndex;
            }
            
            if( bRescanRequired )
            {
                removeAll();
                addAll(false);
            }
		};
Exemplo n.º 22
0
void View::startCompass(){
    handleAction(m_currentSensor, InputController::QCOMPASS);
}
Exemplo n.º 23
0
void FighterOpponentVesna::update() {
	if (!_field_38 && canInteract(kFightAction1) && !_sequenceIndex2) {

		if (_opponent->getField34() == 1) {
			setSequenceAndDraw(2, kFightSequenceType0);
		} else {
			switch (rnd(6)) {
			default:
				break;

			case 0:
				setSequenceAndDraw(1, kFightSequenceType0);
				break;

			case 1:
				setSequenceAndDraw(1, kFightSequenceType0);
				setSequenceAndDraw(1, kFightSequenceType2);
				break;

			case 2:
				setSequenceAndDraw(2, kFightSequenceType0);
				break;

			case 3:
				setSequenceAndDraw(2, kFightSequenceType0);
				setSequenceAndDraw(2, kFightSequenceType2);
				break;

			case 4:
				setSequenceAndDraw(1, kFightSequenceType0);
				setSequenceAndDraw(2, kFightSequenceType2);
				break;

			case 5:
				setSequenceAndDraw(2, kFightSequenceType0);
				setSequenceAndDraw(1, kFightSequenceType2);
				break;
			}
		}

		// Update field_38
		_field_38 = 4 * _countdown;
	}

	if (_frame && checkFrame(2)) {
		if (_sequenceIndex == 1 || _sequenceIndex == 2 || _sequenceIndex == 5)
			_opponent->handleAction((FightAction)_sequenceIndex);

		if (_opponent->getCountdown() <= 0) {

			switch (_sequenceIndex) {
			default:
				break;

			case 1:
				setSequenceAndDraw(3, kFightSequenceType1);
				break;

			case 2:
				setSequenceAndDraw(4, kFightSequenceType1);
				break;

			case 5:
				setSequenceAndDraw(6, kFightSequenceType1);
				break;
			}

			_opponent->setSequenceAndDraw(4, kFightSequenceType1);

			handleAction(kFightActionLost);
			_opponent->update();
			Fighter::update();

			getSoundQueue()->stop(kEntityTables0);

			// Stop processing
			return;
		}
	}

	Fighter::update();
}
Exemplo n.º 24
0
void ActionHandler::runCommand(const std::string &command, const std::string &args) {
  assert ((m_initialised == true) && "ActionHandler not initialised");
  if (command == LOAD_CONFIG) loadConfiguration(args);
  else if (command == DO_ACTION) handleAction(args, NULL);
}
Exemplo n.º 25
0
void View::startOrientationSensor(){
    handleAction(m_currentSensor, InputController::QORIENTATIONSENSOR);
}
Exemplo n.º 26
0
void View::startAccelerometer(){
    handleAction(m_currentSensor, InputController::QACCELEROMETER);
}
Exemplo n.º 27
0
/** \brief keyboard/LIRC event handler.
 *
 *  This translates key presses through the "Main Menu" context into MythTV
 *  actions and then handles them as appropriate.
 */
bool MythThemedMenu::keyPressEvent(QKeyEvent *event)
{
    if (m_ignorekeys)
        return false;

    m_ignorekeys = true;

    MythUIType *type = GetFocusWidget();
    if (type && type->keyPressEvent(event))
    {
        m_ignorekeys = false;
        return true;
    }

    QStringList actions;
    bool handled = false;

    handled = GetMythMainWindow()->TranslateKeyPress("Main Menu", event,
                                                     actions);

    for (int i = 0; i < actions.size() && !handled; i++)
    {
        QString action = actions[i];
        handled = true;

        if (action == "ESCAPE" || action == "EXIT" || action == "EXITPROMPT")
        {
            bool    callbacks  = m_state->m_callback;
            bool    lastScreen = (GetMythMainWindow()->GetMainStack()
                                                     ->TotalScreens() == 1);
            QString menuaction = "UPMENU";
            QString selExit    = "EXITING_APP_PROMPT";
            if (action == "EXIT")
                selExit = "EXITING_APP";

            if (!m_allocedstate)
                handleAction(menuaction);
            else if (m_state->m_killable)
            {
                m_wantpop = true;
                if (callbacks)
                {
                    QString sel = "EXITING_MENU";
                    m_state->m_callback(m_state->m_callbackdata, sel);
                }

                if (lastScreen)
                {
                    if (callbacks)
                        m_state->m_callback(m_state->m_callbackdata, selExit);
                    QCoreApplication::exit();
                }
            }
            else if ((action == "EXIT" || action == "EXITPROMPT" ||
                      (action == "ESCAPE" &&
                       (QCoreApplication::applicationName() ==
                        MYTH_APPNAME_MYTHTV_SETUP))) && lastScreen)
            {
                if (callbacks)
                    m_state->m_callback(m_state->m_callbackdata, selExit);
                else
                {
                    QCoreApplication::exit();
                    m_wantpop = true;
                }
            }
        }
        else if (action == "HELP")
        {
            aboutScreen();
        }
        else if (action == "EJECT")
        {
            handleAction(action);
        }
        else
            handled = false;
    }

    if (!handled && MythScreenType::keyPressEvent(event))
        handled = true;

    m_ignorekeys = false;

    if (m_wantpop)
        m_ScreenStack->PopScreen();

    return handled;
}
Exemplo n.º 28
0
void View::startRotationSensor(){
    handleAction(m_currentSensor, InputController::QROTATIONSENSOR);
}
Exemplo n.º 29
0
void View::startTapSensor(){
    handleAction(m_currentSensor, InputController::QTAPSENSOR);
}
Exemplo n.º 30
0
void View::startKeys(){
    handleAction(m_currentSensor, InputController::QKEYS);
}