void QuickOutput::initialize() { Q_D(QuickOutput); QWaylandQuickOutput::initialize(); QQuickWindow *quickWindow = qobject_cast<QQuickWindow *>(window()); if (!quickWindow) { qCWarning(gLcCore, "Could not locate QQuickWindow on initializing" "GreenIsland::Server::Output %p.\n", this); return; } // We want to read contents for the screencaster connect(quickWindow, &QQuickWindow::afterRendering, this, &QuickOutput::readContent); // Add modes QList<Screen::Mode> modes = d->nativeScreen->modes(); if (d->nativeScreen && modes.size() > 0 && !sizeFollowsWindow()) { int modeId = 0; Q_FOREACH (const Screen::Mode &mode, modes) { Mode::Flags flags; if (modeId == d->nativeScreen->preferredMode()) flags |= Mode::Flag::Preferred; addMode(mode.size, flags, mode.refreshRate); modeId++; }
ChallengeModeSet::ChallengeModeSet(QObject *parent) :Package("challenge_modes") { setParent(parent); addMode("@4lords", "caocao+liubei+sunquan+zhangjiao"); addMode("@disaster4fr", "guojia+simayi+wolong+luxun"); addMode("@p4luoyi","xuchu+liubei+ganning+zhangliao"); addMode("@test4pile", "sunshangxiang+huangyueying+luxun+zhenji"); addMode("@mythology", "shencaocao+shenzhugeliang+shenzhouyu+shenlumeng"); addMode("@2strike", "diaochan+zhouyu+dianwei+xiahouyuan"); addMode("@tortoise", "liubei+huatuo+sunshangxiang+guojia"); addMode("@manshow", "liubei+lumeng+zhangliao+daqiao"); addMode("@greatrange", "machao+pangde+xiahouyuan+taishici"); addMode("@p4cure", "liubei+menghuo+huatuo+weiyan"); }
QuartzToggler::QuartzToggler() : originalMode(NULL), activeDspys(NULL), widgetScreen(0), isFull(false) { CGDisplayCount dspyCnt = 0; CGGetActiveDisplayList(0, 0, &dspyCnt); activeDspys = new CGDirectDisplayID[dspyCnt]; CGGetActiveDisplayList(dspyCnt, activeDspys, &dspyCnt); infoVector.resize(dspyCnt); fullResIndex.resize(dspyCnt); fullRateIndex.resize(dspyCnt); for (CGDisplayCount i = 0; i < dspyCnt; ++i) { CGDirectDisplayID display = activeDspys[i]; CFDictionaryRef currentMode = CGDisplayCurrentMode(display); CFArrayRef modesArray = CGDisplayAvailableModes(display); CFIndex numModes = CFArrayGetCount(modesArray); CFNumberRef bpp = static_cast<CFNumberRef>(CFDictionaryGetValue(currentMode, kCGDisplayBitsPerPixel)); for (CFIndex j = 0; j < numModes; ++j) { CFDictionaryRef mode = static_cast<CFDictionaryRef>(CFArrayGetValueAtIndex(modesArray, j)); if (CFNumberCompare(bpp, static_cast<CFNumberRef>(CFDictionaryGetValue(mode, kCGDisplayBitsPerPixel)), NULL) == kCFCompareEqualTo) { addMode(mode, infoVector[i], NULL, NULL); } } } originalMode = CGDisplayCurrentMode(activeDspys[widgetScreen]); for (CGDisplayCount i = 0; i < dspyCnt; ++i) { unsigned resIndex = 0; unsigned rateIndex = 0; addMode(CGDisplayCurrentMode(activeDspys[i]), infoVector[i], &resIndex, &rateIndex); fullResIndex[i] = resIndex; fullRateIndex[i] = rateIndex; } }
bool QLCFixtureDef::loadXML(QXmlStreamReader& doc) { bool retval = false; if (doc.readNextStartElement() == false) return false; if (doc.name() == KXMLQLCFixtureDef) { while (doc.readNextStartElement()) { if (doc.name() == KXMLQLCCreator) { loadCreator(doc); } else if (doc.name() == KXMLQLCFixtureDefManufacturer) { setManufacturer(doc.readElementText()); } else if (doc.name() == KXMLQLCFixtureDefModel) { setModel(doc.readElementText()); } else if (doc.name() == KXMLQLCFixtureDefType) { setType(doc.readElementText()); } else if (doc.name() == KXMLQLCChannel) { QLCChannel* ch = new QLCChannel(); if (ch->loadXML(doc) == true) { /* Loading succeeded */ if (addChannel(ch) == false) { /* Channel already exists */ delete ch; } } else { /* Loading failed */ delete ch; } } else if (doc.name() == KXMLQLCFixtureMode) { QLCFixtureMode* mode = new QLCFixtureMode(this); if (mode->loadXML(doc) == true) { /* Loading succeeded */ if (addMode(mode) == false) { /* Mode already exists */ delete mode; } } else { /* Loading failed */ delete mode; } } else { qWarning() << Q_FUNC_INFO << "Unknown Fixture tag: " << doc.name(); doc.skipCurrentElement(); } } retval = true; } else { qWarning() << Q_FUNC_INFO << "Fixture node not found"; retval = false; } if (retval == true) m_isLoaded = true; return retval; }
void CBitPatternTreeMethod::buildFluxModes() { CStepMatrix::const_iterator it = mpStepMatrix->begin(); CStepMatrix::const_iterator end = mpStepMatrix->end(); CVector< size_t > Indexes; C_INT NumSpecies = mExpandedStoiTranspose.numCols(); for (; it != end; ++it) { getUnsetBitIndexes(*it, Indexes); C_INT NumReactions = Indexes.size(); // Remove trivial modes, i.e., reversible reactions if (NumReactions == 2 && (*mpReorderedReactions)[mReactionForward[Indexes[0]].first] == (*mpReorderedReactions)[mReactionForward[Indexes[1]].first]) { continue; } // Build the stoichiometry matrix reduced to the reactions participating in the current mode. CMatrix< C_INT64 > A(NumReactions, NumSpecies); size_t * pIndex = Indexes.array(); size_t * pIndexEnd = pIndex + NumReactions; C_INT64 * pARow = A.array(); for (; pIndex != pIndexEnd; ++pIndex, pARow += NumSpecies) { memcpy(pARow, &mExpandedStoiTranspose(*pIndex, 0), NumSpecies * sizeof(C_INT64)); } // Calculate the kernel of the matrix CMatrix< C_INT64 > ExpandedStoiTranspose(A); CMatrix< C_INT64 > Kernel; CVector< size_t > Pivot; CalculateKernel(ExpandedStoiTranspose, Kernel, Pivot); size_t NumCols = Kernel.numCols(); // Now we create the flux mode as we have the multiplier and reaction indexes. // We need to invert the sign of the multiplier for reactions which are not forward. // A flux mode is reversible if all reactions are reversible; C_INT64 * pColumn = Kernel.array(); C_INT64 * pColumnEnd = pColumn + NumCols; for (; pColumn != pColumnEnd; ++pColumn) { std::map< size_t, C_FLOAT64 > Reactions; bool Reversible = true; pIndex = Indexes.array(); C_INT64 * pFluxMultiplier = pColumn; for (; pIndex != pIndexEnd; ++pIndex, pFluxMultiplier += NumCols) { if (*pFluxMultiplier < 0) { break; } else if (*pFluxMultiplier < 0) { continue; } std::pair< size_t, bool > & ReactionForward = mReactionForward[*pIndex]; Reactions[ReactionForward.first] = (ReactionForward.second == true) ? *pFluxMultiplier : -*pFluxMultiplier; if (!(*mpReorderedReactions)[ReactionForward.first]->isReversible()) { Reversible = false; } } if (pIndex != pIndexEnd) { continue; } addMode(CFluxMode(Reactions, Reversible)); } } }
bool QLCFixtureDef::loadXML(const QDomDocument& doc) { bool retval = false; QDomElement root = doc.documentElement(); if (root.tagName() == KXMLQLCFixtureDef) { QDomNode node = root.firstChild(); while (node.isNull() == false) { QDomElement tag = node.toElement(); if (tag.tagName() == KXMLQLCCreator) { loadCreator(tag); } else if (tag.tagName() == KXMLQLCFixtureDefManufacturer) { setManufacturer(tag.text()); } else if (tag.tagName() == KXMLQLCFixtureDefModel) { setModel(tag.text()); } else if (tag.tagName() == KXMLQLCFixtureDefType) { setType(tag.text()); } else if (tag.tagName() == KXMLQLCChannel) { QLCChannel* ch = new QLCChannel(); if (ch->loadXML(tag) == true) { /* Loading succeeded */ if (addChannel(ch) == false) { /* Channel already exists */ delete ch; } } else { /* Loading failed */ delete ch; } } else if (tag.tagName() == KXMLQLCFixtureMode) { QLCFixtureMode* mode = new QLCFixtureMode(this); if (mode->loadXML(tag) == true) { /* Loading succeeded */ if (addMode(mode) == false) { /* Mode already exists */ delete mode; } } else { /* Loading failed */ delete mode; } } else { qWarning() << Q_FUNC_INFO << "Unknown Fixture tag: " << tag.tagName(); } node = node.nextSibling(); } retval = true; } else { qWarning() << Q_FUNC_INFO << "Fixture node not found"; retval = false; } return retval; }