Пример #1
0
/**
 * \brief Simpler version of MediaMonitorUnix::AddDevice()
 *
 * This doesn't do the stat() or duplicate checking.
 */
bool MediaMonitorDarwin::AddDevice(MythMediaDevice* pDevice)
{
    if ( !pDevice )
    {
        LOG(VB_GENERAL, LOG_ERR, "MediaMonitor::AddDevice(null)");
        return false;
    }

    // If the user doesn't want this device to be monitored, stop now: 
    if (shouldIgnore(pDevice)) 
        return false;

    m_Devices.push_back( pDevice );
    m_UseCount[pDevice] = 0;


    // Devices on Mac OS X don't change status the way Linux ones do,
    // so we force a status change for mediaStatusChanged() to send an event
    if (m_SendEvent)
    {
        pDevice->setStatus(MEDIASTAT_NODISK);
        connect(pDevice, SIGNAL(statusChanged(MythMediaStatus, MythMediaDevice*)),
                this, SLOT(mediaStatusChanged(MythMediaStatus, MythMediaDevice*)));
        pDevice->setStatus(MEDIASTAT_USEABLE);
    }


    return true;
}
Пример #2
0
 void DeclCollector::HandleInterestingDecl(DeclGroupRef DGR) {
   assert(m_CurTransaction && "Missing transction");
   Transaction::DelayCallInfo DCI(DGR, Transaction::kCCIHandleInterestingDecl);
   m_CurTransaction->append(DCI);
   if (m_Consumer
       && (!comesFromASTReader(DGR) || !shouldIgnore(*DGR.begin())))
     m_Consumer->HandleTopLevelDecl(DGR);
 }
Пример #3
0
  bool DeclCollector::HandleTopLevelDecl(DeclGroupRef DGR) {
    if (!Transform(DGR))
      return false;

    if (DGR.isNull())
      return true;

    assert(m_CurTransaction && "Missing transction");
    Transaction::DelayCallInfo DCI(DGR, Transaction::kCCIHandleTopLevelDecl);
    m_CurTransaction->append(DCI);
    if (!m_Consumer
        || getTransaction()->getIssuedDiags() == Transaction::kErrors)
      return true;

    if (comesFromASTReader(DGR)) {
      for (DeclGroupRef::iterator DI = DGR.begin(), DE = DGR.end();
           DI != DE; ++DI) {
        DeclGroupRef SplitDGR(*DI);
        // FIXME: The special namespace treatment (not sending itself to
        // CodeGen, but only its content - if the contained decl should be
        // emitted) works around issue with the static initialization when
        // having a PCH and loading a library. We don't want to generate
        // code for the static that will come through the library.
        //
        // This will be fixed with the clang::Modules. Make sure we remember.
        // assert(!getCI()->getLangOpts().Modules && "Please revisit!");
        if (NamespaceDecl* ND = dyn_cast<NamespaceDecl>(*DI)) {
          for (NamespaceDecl::decl_iterator NDI = ND->decls_begin(),
               EN = ND->decls_end(); NDI != EN; ++NDI) {
            // Recurse over decls inside the namespace, like
            // CodeGenModule::EmitNamespace() does.
            if (!shouldIgnore(*NDI))
              m_Consumer->HandleTopLevelDecl(DeclGroupRef(*NDI));
          }
        } else if (!shouldIgnore(*DI)) {
          m_Consumer->HandleTopLevelDecl(DeclGroupRef(*DI));
        }
        continue;
      }
    } else {
      m_Consumer->HandleTopLevelDecl(DGR);
    }
    return true;
  }
Пример #4
0
 void DeclCollector::HandleCXXStaticMemberVarInstantiation(VarDecl *D) {
   assert(m_CurTransaction && "Missing transction");
   Transaction::DelayCallInfo DCI(DeclGroupRef(D),
                                  Transaction::kCCIHandleCXXStaticMemberVarInstantiation);
   m_CurTransaction->append(DCI);
   if (m_Consumer
       && (!comesFromASTReader(DeclGroupRef(D))
           || !shouldIgnore(D)))
   m_Consumer->HandleCXXStaticMemberVarInstantiation(D);
 }
Пример #5
0
 void DeclCollector::HandleTagDeclDefinition(TagDecl* TD) {
   assert(m_CurTransaction && "Missing transction");
   Transaction::DelayCallInfo DCI(DeclGroupRef(TD),
                                  Transaction::kCCIHandleTagDeclDefinition);
   m_CurTransaction->append(DCI);
   if (m_Consumer
       && (!comesFromASTReader(DeclGroupRef(TD))
           || !shouldIgnore(TD)))
     m_Consumer->HandleTagDeclDefinition(TD);
 }
Пример #6
0
 void DeclCollector::CompleteTentativeDefinition(VarDecl* VD) {
   assert(m_CurTransaction && "Missing transction");
   // C has tentative definitions which we might need to deal with when running
   // in C mode.
   Transaction::DelayCallInfo DCI(DeclGroupRef(VD),
                                  Transaction::kCCICompleteTentativeDefinition);
   m_CurTransaction->append(DCI);
   if (m_Consumer
       && (!comesFromASTReader(DeclGroupRef(VD))
           || !shouldIgnore(VD)))
   m_Consumer->CompleteTentativeDefinition(VD);
 }
Пример #7
0
bool Accelerators::HandleKeyEvent(wxKeyEvent& event) {
	int hash = event.GetModifiers();

#ifdef __WXMSW__
	// GetModifiers does not report the windows keys
	if (::GetKeyState(VK_LWIN) < 0) hash |= 0x0008; // wxMOD_META (Left Windows key)
	if (::GetKeyState(VK_RWIN) < 0) hash |= 0x0008; // wxMOD_META (Right Windows key)
#endif

	if(shouldIgnore(event.GetKeyCode())) return true;

	wxLogDebug(wxT("Hash: %d %d %d"), ((hash << 24) | event.GetKeyCode()), hash, event.GetKeyCode());
	hash = (hash << 24) | event.GetKeyCode();

	return MatchMenus(hash);
}
Пример #8
0
  void DeclCollector::HandleVTable(CXXRecordDecl* RD) {
    assert(m_CurTransaction && "Missing transction");
    Transaction::DelayCallInfo DCI(DeclGroupRef(RD),
                                   Transaction::kCCIHandleVTable);
    m_CurTransaction->append(DCI);

    if (m_Consumer
        && (!comesFromASTReader(DeclGroupRef(RD))
            || !shouldIgnore(RD)))
      m_Consumer->HandleVTable(RD);
    // Intentional no-op. It comes through Sema::DefineUsedVTables, which
    // comes either Sema::ActOnEndOfTranslationUnit or while instantiating a
    // template. In our case we will do it on transaction commit, without
    // keeping track of used vtables, because we have cases where we bypass the
    // clang/AST and directly ask the module so that we have to generate
    // everything without extra smartness.
  }
Пример #9
0
/**
 * This method is called when ParseBundles is finished with all the bundles.
 * It activates a chord / sees if any bundle items will match / determines what set of bindings to search later on.
 */
bool Accelerators::BundlesParsed(int code, int flags) {
	if(shouldIgnore(code)) return true;
	int hash = (flags << 24) | code;


	if(m_activeBundleChord) { // A chord for a bundle was previously activated
		m_searchBundleChords = true;
		bool ret = m_activeBundleChord->bindings.find(hash) != m_activeBundleChord->bindings.end();
		m_actionReturned = ret;
		return ret;
	} else if(m_activeChord) { // A chord was previously activated, but no bundle uses it
		return false;
	} else {
		// No chord is activated yet
		std::map<int, BundleKeyChord*>::iterator bundleChords = m_bundleChords.find(hash);
		std::map<int, KeyChord*>::iterator chords = m_chords.find(hash);
		std::map<int, bool>::iterator bundleBindings = m_bundleBindings.find(hash);

		if(bundleChords != m_bundleChords.end()) {
			m_activeBundleChord = bundleChords->second;
		}
		if(chords != m_chords.end()) {
			m_activeChord = chords->second;
		}

		if(m_activeBundleChord != NULL || m_activeChord != NULL) {
			m_chordActivated = true;
			return true;
		}

		if(bundleBindings != m_bundleBindings.end()) {
			m_searchBundleBindings = true;
			m_actionReturned = true;
			return true;
		}

		return false;
	}
}
Пример #10
0
bool CenzorMessageFilter::acceptMessage(const Message &message)
{
	if (MessageTypeSent == message.type())
		return true;

	if (!m_cenzorConfiguration->enabled())
		return true;

	if (!shouldIgnore(htmlToPlain(message.content())))
		return true;

	Account account = message.messageChat().chatAccount();

	Protocol *protocol = account.protocolHandler();
	if (!protocol)
		return false;


	if (m_messageManager->sendMessage(message.messageChat(), m_cenzorConfiguration->admonition(), true))
		m_cenzorNotificationService->notifyCenzored(message.messageChat());

	return false;
}
Пример #11
0
/**
 * This method is called once for each bundle.
 * If it returns true, the bundle will be run.
 * It uses the results of BundlesParsed to check if this bundle matches the set of pressed keys.
 */
bool Accelerators::MatchBundle(int code, int flags, const tmAction* x) {
	if(shouldIgnore(code)) return false;
	int hash = (flags << 24) | code;

	int chordHash, finalHash;
	wxString chordString;
	ParseBundleForHash(x, chordHash, finalHash, chordString);

	if(chordHash > -1) {
		if(!m_searchBundleChords) return false;
		if(finalHash != hash) return false;

		std::map<int, BundleKeyChord*>::iterator iterator;
		iterator = m_bundleChords.find(chordHash);

		if(iterator == m_bundleChords.end()) return false;
		BundleKeyChord* chord = iterator->second;

		return chord->bindings.find(finalHash) != chord->bindings.end();
	} else {
		if(!m_searchBundleBindings) return false;
		return hash == finalHash;
	}
}