Example #1
0
DeviceManager::DeviceError GuhCore::removeConfiguredDevice(const DeviceId &deviceId, const QHash<RuleId, RuleEngine::RemovePolicy> &removePolicyList)
{
    QHash<RuleId, RuleEngine::RemovePolicy> toBeChanged;
    QList<RuleId> unhandledRules;
    foreach (const RuleId &ruleId, m_ruleEngine->findRules(deviceId)) {
        bool found = false;
        foreach (const RuleId &policyRuleId, removePolicyList.keys()) {
            if (ruleId == policyRuleId) {
                found = true;
                toBeChanged.insert(ruleId, removePolicyList.value(ruleId));
                break;
            }
        }
        if (!found) {
            unhandledRules.append(ruleId);
        }
    }

    if (!unhandledRules.isEmpty()) {
        qWarning() << "There are unhandled rules which depend on this device.";
        return DeviceManager::DeviceErrorDeviceInUse;
    }

    // Update the rules...
    foreach (const RuleId &ruleId, toBeChanged.keys()) {
        if (toBeChanged.value(ruleId) == RuleEngine::RemovePolicyCascade) {
            m_ruleEngine->removeRule(ruleId);
        } else if (toBeChanged.value(ruleId) == RuleEngine::RemovePolicyUpdate){
            m_ruleEngine->removeDeviceFromRule(ruleId, deviceId);
        }
    }

    return m_deviceManager->removeConfiguredDevice(deviceId);
}
Example #2
0
void PlayerSource::run()
{
    // initial data
    if (m_player == QString("mpd")) {
        // mpd
        QHash<QString, QVariant> data = getPlayerMpdInfo(m_mpdAddress);
        for (auto key : data.keys())
            values[key] = data[key];
    } else if (m_player == QString("mpris")) {
        // players which supports mpris
        QString mpris = m_mpris == QString("auto") ? getAutoMpris() : m_mpris;
        QHash<QString, QVariant> data = getPlayerMprisInfo(mpris);
        for (auto key : data.keys())
            values[key] = data[key];
    }

    // dymanic properties
    // solid
    values[QString("player/salbum")]
        = stripString(values[QString("player/album")].toString(), m_symbols);
    values[QString("player/sartist")]
        = stripString(values[QString("player/artist")].toString(), m_symbols);
    values[QString("player/stitle")]
        = stripString(values[QString("player/title")].toString(), m_symbols);
    // dynamic
    values[QString("player/dalbum")]
        = buildString(values[QString("player/dalbum")].toString(),
                      values[QString("player/album")].toString(), m_symbols);
    values[QString("player/dartist")]
        = buildString(values[QString("player/dartist")].toString(),
                      values[QString("player/artist")].toString(), m_symbols);
    values[QString("player/dtitle")]
        = buildString(values[QString("player/dtitle")].toString(),
                      values[QString("player/title")].toString(), m_symbols);
}
Example #3
0
int SystemCmds::Alias(SystemCommand *command, CommandArgs args)
{
    Q_UNUSED(command);
    if (!args.Parameters.count())
    {
        QHash<QString, QString> hash = CoreWrapper::GrumpyCore->GetCommandProcessor()->GetAliasRdTable();
        unsigned int size = static_cast<unsigned int>(Generic::LongestString(hash.keys()));
        foreach (QString item, hash.keys())
            MainWindow::Main->WriteToCurrentWindow(Generic::ExpandedString(item, size, size) + " -> " + hash[item]);
        return 0;
    }

    if (args.Parameters.count() == 1)
    {
        GRUMPY_ERROR("This need to provide 2 or more parameters for this to work");
        return 1;
    }

    if (CoreWrapper::GrumpyCore->GetCommandProcessor()->Exists(args.Parameters[0]))
    {
        GRUMPY_ERROR("This name is already used by some other");
        return 1;
    }

    QString value = args.ParameterLine.mid(args.Parameters[0].size() + 1);
    CoreWrapper::GrumpyCore->GetCommandProcessor()->RegisterAlias(args.Parameters[0], value);
    return 0;
}
Example #4
0
/**
 * Updates everything.
 */
void Monitor::updateAll() {
	QHash<QString, QVariant> list = settings->value("exchange/list").toHash();

	for (int i = 0; i < list.keys().size(); ++i) {
		update(list.keys()[i]);
	}
}
Example #5
0
void DialogLaunch::loadPositions()
{
    this->ui->comboBoxPosSelect->clear();
    QHash<QString, QString> poss;
    poss = genericHelper::getPositions();
    if (poss.keys().length() == 0) {
           this->ui->comboBoxPosSelect->addItem("<default>");
    } else {
        this->ui->comboBoxPosSelect->addItems(poss.keys());
    }
}
Example #6
0
void VectorSelector::fillVectors() {
  if (!_store) {
    return;
  }
  int current_index = _vector->currentIndex();
  VectorPtr current = selectedVector();

  QHash<QString, VectorPtr> vectors;

  VectorList vectorList = _store->getObjects<Vector>();

  VectorList::ConstIterator it = vectorList.constBegin();
  for (; it != vectorList.constEnd(); ++it) {
    VectorPtr vector = (*it);
    if (vector->isScalarList())
      continue;

    vector->readLock();
    vectors.insert(vector->CleanedName(), vector);
    vector->unlock();
  }

  QStringList list = vectors.keys();

  qSort(list);

  _vector->clear();
  foreach (const QString &string, list) {
    VectorPtr v = vectors.value(string);
    _vector->addItem(string, qVariantFromValue(v.data()));
  }
Example #7
0
  void Pipeline::dumpSettings() {
    QList<Module*> modules;
    this->listModules(modules);
    foreach(Module *module, modules) {
      qDebug() << "---------------------------" << module->getModuleName() << ":" << module->getInstanceName();

      QHash<QString, Setting*> *settings = module->getSettings();
      QList<QString> keys = settings->keys();
      foreach(QString key, keys) {
        Setting *setting = module->setting(key);
        qDebug() << "   - setting: " << setting->getName() << ", type: " << setting->getType();

        switch(setting->getType()) {
        case Setting::NONE:
          qDebug() << "     - value: " << "none"; break;
        case Setting::BOOLEAN:
          qDebug() << "     - value: " << setting->asBool(); break;
        case Setting::STRING:
          qDebug() << "     - value: " << setting->asString(); break;
        case Setting::INTEGER:
          qDebug() << "     - value: " << setting->asInteger(); break;
        case Setting::DOUBLE:
          qDebug() << "     - value: " << setting->asDouble(); break;
        case Setting::POINTLIST:
          qDebug() << "     - value: " << "pointlist"; break;
        case Setting::FRAME:
          qDebug() << "     - value: " << setting->getFrameName();
          qDebug() << "     - module pointer: " << setting->getModule();
          break;
        }
      }
Example #8
0
//お気に入りを更新
void WebPageForm::Private::updateFavorite(const QString &url, const QString &title, bool add)
{
    bool exist = false;
    bool update = false;

    settings.beginGroup(QStringLiteral(FAV_USER));

    QHash<QString, QVariant> list = settings.value(QStringLiteral(FAV_USER_BOOKMARK)).toHash();
    foreach (const QString &key, list.keys()) {
        if(url == key){
            //見つかった
            exist = true;
            if(add){
                //追加(ただしすでにある)
            }else{
                //削除
                list.remove(url);
                update = true;
            }
            break;
        }
    }
    if(!exist){
        list.insert(url, title);
        update = true;
    }
    if(update)
        settings.setValue(QStringLiteral(FAV_USER_BOOKMARK), list);

    settings.endGroup();
    settings.sync();

    if(update)
        emit q->updateFavorite();
}
Example #9
0
void UIMain::openFilesFinished()
{
    const QHash<QString, QPair<QString, QString> > contents = mOpenFilesWatcher->result();
    mOpenFilesWatcher->deleteLater();

    foreach ( const QString& filePath, contents.keys() ) {
        const QPair<QString, QString>& pair = contents[ filePath ];

        // File opened
        if ( pair.second.isEmpty() ) {
            QodeEditor* editor = new QodeEditor( this );
            Syntax::Highlighter* highlighter = mManager->highlighterForFilePath( filePath );

            editor->setInitialText( pair.first );
            editor->textDocument()->setSyntaxHighlighter( highlighter );

            QListWidgetItem* item = new QListWidgetItem( ui->lwEditors );
            item->setText( QString( "%1 (%2)" ).arg( QFileInfo( filePath ).fileName() ).arg( highlighter->syntaxDocument().name() ) );
            item->setData( Qt::UserRole, QVariant::fromValue( editor ) );
            ui->swEditors->addWidget( editor );
        }
        // An error occurs
        else {
            qWarning() << pair.second;
        }

        //#warning better use a progressive QtConcurrent way
        QApplication::processEvents();
    }
}
Example #10
0
bool Configuration::save() {
    QDomDocument doc;
    QDomElement root = doc.createElement(ROOT_TAG_NAME);
    doc.appendChild(root);
    QDomElement profiles = doc.createElement(PROFILES_TAG_NAME);
    root.appendChild(profiles);
    profiles.setAttribute(DEFAULT_PROFILE_ATTR_NAME, m_defaultProfileId);
    for (int i = 0; i < m_profiles.size(); ++i) {
        Profile* p = m_profiles.at(i);
        QDomElement pe = doc.createElement(PROFILE_TAG_NAME);
        pe.setAttribute(ID_ATTR_NAME, p->getId());
        pe.setAttribute(NAME_ATTR_NAME, p->getName());
        addNode(EXEC_TAG_NAME, p->getGPGExecutable(), doc, pe);
        addNode(PATH_TAG_NAME, p->getConfigurationPath(), doc, pe);
        const QHash<QString, QColor> validityColors = p->getValidityColors();
        for (QString v : validityColors.keys()) {
            QDomElement e = createColorElement(VALIDITY_COLOR_TAG_NAME, validityColors.value(v), doc);
            e.setAttribute(VALUE_ATTRIBUTE, (QString) v);
            pe.appendChild(e);
        }
        pe.appendChild(createColorElement(SIG_COLOR_TAG_NAME, p->getSignatureColor(), doc));
        profiles.appendChild(pe);
    }

    QFile f(m_filePath);
    if (!f.open(QIODevice::WriteOnly)) {
        return false;
    }
    QTextStream out(&f);
    out << doc.toString();
    f.close();
    return true;
}
void OccupancyPredictor::predictFromGrids(const QHash<QString, OccupancyGrid> &grids)
{
    for (const QString& date: grids.keys())
    {
        updatePrediction(grids[date]);
    }
}
	void AccountFolderManager::Deserialize (const QByteArray& arr)
	{
		QDataStream in (arr);
		quint8 version = 0;
		in >> version;

		if (version < 1 || version > 1)
			throw std::runtime_error (qPrintable ("Unknown folder manager version " + QString::number (version)));

		QHash<QStringList, int> flags;
		in >> Folders_
			>> flags;

		Folders_.erase (std::remove_if (Folders_.begin (), Folders_.end (),
					[] (const Folder& folder)
					{
						return folder.Path_.isEmpty () ||
								std::all_of (folder.Path_.begin (), folder.Path_.end (),
										[] (const QString& elem) { return elem.isEmpty (); });
					}),
				Folders_.end ());

		for (const auto key : flags.keys ())
			Folder2Flags_ [key] = static_cast<FolderFlags> (flags [key]);
	}
int TasNativeUtils::pidOfActiveWindow(const QHash<quint64, TasClient*> clients)
{
    const QList<quint64>& pids = clients.keys();
    TasLogger::logger()->debug("TasNativeUtils::pidOfActiveWindow Querying for active window");
    int pid = -1;

#if defined(Q_WS_X11)
    Display* display = 0;
    display = XOpenDisplay(0); 
    XSetErrorHandler(errorHandler);
    if (!display) return -1;

    int screen = XDefaultScreen(display);
    int window = RootWindow(display, screen);

    // First try to use whatever MeeGo tells us
    //pid = pidOfMeegoWindow(display, window);
    if (pid != -1) {
        TasLogger::logger()->debug("TasNativeUtils::pidOfActiveWindow Found MeeGo pid: " + QString::number(pid));
    } else {
        Window win = queryStack(display, window, pids);
        pid = pidOfXWindow(display, win);
    }
    XCloseDisplay(display);
#elif defined(TAS_WAYLAND)
    // TODO:
#endif

    TasLogger::logger()->debug("TasNativeUtils::pidOfActiveWindow Resolved " + QString::number(pid));
    return pid;
}
void DrugGeneralOptionsPage::checkSettingsValidity()
{
    QHash<QString, QVariant> defaultvalues;
    defaultvalues.insert(S_VIEWFONT, QFont());
    defaultvalues.insert(S_VIEWFONTSIZE, QFont().pointSize());
    defaultvalues.insert(S_HISTORYSIZE, 20);
    defaultvalues.insert(S_DRUGHISTORY, QVariant());
    defaultvalues.insert(S_TOOLBARICONSIZE, 24);
    defaultvalues.insert(DrugsDB::Constants::S_LEVELOFWARNING_STATICALERT, DrugsDB::Constants::MaximumLevelOfWarning);
    defaultvalues.insert(DrugsDB::Constants::S_SHOWICONSINPRESCRIPTION,true);
    defaultvalues.insert(DrugsDB::Constants::S_MARKDRUGSWITHAVAILABLEDOSAGES,true);
    defaultvalues.insert(DrugsDB::Constants::S_AVAILABLEDOSAGESBACKGROUNGCOLOR, DrugsDB::Constants::S_DEF_AVAILABLEDOSAGESBACKGROUNGCOLOR);
    defaultvalues.insert(DrugsDB::Constants::S_USEDYNAMICALERTS, true);
    defaultvalues.insert(DrugsDB::Constants::S_LEVELOFWARNING_DYNAMICALERT, DrugsDB::Constants::MinimumLevelOfWarning);
    defaultvalues.insert(S_PATIENTNAMESORDER, 0);
    defaultvalues.insert(DrugsDB::Constants::S_PRINTLINEBREAKBETWEENDRUGS, true);
    defaultvalues.insert(DrugsDB::Constants::S_PRINTDUPLICATAS, true);
    defaultvalues.insert(DrugsDB::Constants::S_AUTOSORT_ON_PRINTING, true);
    defaultvalues.insert(DrugsDB::Constants::S_ADD_BIOMETRICS_ON_PRINTS, true);

    foreach(const QString &k, defaultvalues.keys()) {
        if (settings()->value(k) == QVariant())
            settings()->setValue(k, defaultvalues.value(k));
    }
    settings()->sync();
}
Example #15
0
/**
 * @details
 * Tests if data specified in this requirements object is
 * contained within the passed hash.
 */
bool DataSpec::isCompatible(const QHash<QString, DataBlob*>& d) const
{
    QSet<QString> temp(_streamData);
    temp.unite(_serviceData);
    temp.subtract(d.keys().toSet());
    return (temp.size() == 0);
}
Example #16
0
void Pipeline::ResizeStage(ImageList images, Task* task)
{
	// Resize images and split it by resolutions
	QHash<QString, ImageList> imagesByRes;
	for(QString res : task->outputRes)
	{
		imagesByRes[res] = resizer.Run(images, task->sourceRes, res, task->potSize);
		UpdateProgress();
	}

	// Pass images to build atals stage
	if(task->atlas) BuildAtlasStage(imagesByRes, task);

	// Save resized images without building atlas
	else
	{
		for(const QString& resolution : imagesByRes.keys())
		{
			for(auto entry : imagesByRes[resolution])
			{
				QString filename = MakeFilename(entry.first, resolution, ExtensionForFormat(task->outputFormat));
				if(!SaveImage(entry.second, task->outputDir, filename, task->outputFormat))
				{
					errors.push_back(ERROR_MASK.arg(task->name).arg(ERROR_SAVE_MASK.arg(filename)));
				}
			}
		}
	}
}
KWInsertPageDialog::KWInsertPageDialog(KWDocument *document, KWView *parent)
    : KDialog(parent),
    m_document(document),
    m_currentPageNumber(parent->currentPage().pageNumber())
{
    m_widget.setupUi(mainWidget());
    setCaption(i18n("Insert Page"));
    setButtons(KDialog::Ok | KDialog::Cancel);
    setModal(true);
    m_widget.afterCurrent->setChecked(true);
    if (m_currentPageNumber < 1) {
        m_widget.beforeCurrent->setEnabled(false);
        m_widget.afterCurrent->setEnabled(false);
        m_widget.afterLast->setChecked(true);
    } else if (parent->currentPage() == m_document->pageManager()->begin()) {
        m_widget.beforeCurrent->setEnabled(false);
    }
    QHash<QString, KWPageStyle> styles = m_document->pageManager()->pageStyles();
    foreach (const QString &style, styles.keys()) {
        m_widget.pageStyle->addItem(style);
    }
    // TODO can we select the page style a bit smarter?

    connect(this, SIGNAL(okClicked()), this, SLOT(doIt()));
}
Example #18
0
void StringSelector::fillStrings() {
  if (!_store) {
    return;
  }

  QHash<QString, StringPtr> strings;

  StringList stringList = _store->getObjects<String>();

  StringList::ConstIterator it = stringList.constBegin();
  for (; it != stringList.constEnd(); ++it) {
    StringPtr string = (*it);

    string->readLock();
    strings.insert(string->CleanedName(), string);
    string->unlock();
  }

  QStringList list = strings.keys();

  qSort(list);

  StringPtr current = selectedString();

  _string->clear();
  foreach (const QString &string, list) {
    StringPtr s = strings.value(string);
    _string->addItem(string, qVariantFromValue(s.data()));
  }
void AppearanceConfigTab::updateVariantsList()
{
    QHash<QString, QString> variants = ui->chatView->chatStyle()->getVariants();
    ui->variantComboBox->clear();
    ui->variantComboBox->addItems(variants.keys());
    ui->variantComboBox->setCurrentItem(ui->chatView->variantName());
}
Example #20
0
void
PlotWidget::removePlot (QString name)
{
  Plot *plot = _plots.value(name);
  if (! plot)
    return;
  
  Entity *e = _settings.value(name);
  if (! e)
    return;
  
  // remove markers
  DataBase db(g_session);
  db.transaction();
  
  QHash<QString, Marker *> markers = plot->markers();
  QList<QString> ml = markers.keys();
  db.remove(ml);
  
  // remove indicator settings
  db.remove(QStringList() << name);
  
  db.commit();
  
  delete plot;
  delete e;
  _plots.remove(name);
  _settings.remove(name);
}
std::tuple <QHash<QString, QString>,
      QHash<QString, QString>,
      QHash<QString, QString>>
      UniversalUpdates::SeparateHtmlCssXmlUpdates(const QHash<QString, QString> &updates)
{
    QHash<QString, QString> html_updates = updates;
    QHash<QString, QString> css_updates;
    QHash<QString, QString> xml_updates;
    QList<QString> keys = updates.keys();
    int num_keys = keys.count();

    for (int i = 0; i < num_keys; ++i) {
        QString key_path = keys.at(i);
        QString extension = QFileInfo(key_path).suffix().toLower();
        // The OPF and NCX files are in the OEBPS folder along with the content folders.
        // This means that the "../" prefix is unnecessary and wrong.

        xml_updates[ key_path ] = QString(html_updates.value(key_path)).remove(QRegularExpression("^../"));

        // Font file updates are CSS updates, not HTML updates
        // Actually with SVG font-face-uri tag and epub3 this is no longer true
        // They can appear in both html and css
        if (FONT_EXTENSIONS.contains(extension)) {
            css_updates[ key_path ] = html_updates.value(key_path);
            // html_updates.remove(key_path);
        } else if (extension == "css") {
            // Needed for CSS updates because of @import rules
            css_updates[ key_path ] = html_updates.value(key_path);
        } else if (IMAGE_EXTENSIONS.contains(extension)) {
            // Needed for CSS updates because of background-image rules
            css_updates[ key_path ] = html_updates.value(key_path);
        }
    }
    return std::make_tuple(html_updates, css_updates, xml_updates);
}
Example #22
0
void Utils::testIncludeUrlParams() {
    QUrl urla(QString("http://example.com"));

    QHash<QString, QString> params;
    params.insert("simple", "c");
    params.insert("withspecial", "a?b");
    params.insert("withspace", "a b");
    params.insert("username", "a123fx b");
    params.insert("password", "!@#+-$%^12&*()qweqesaf\"';`~");
    params.insert("withplus", "a+b");

    QUrl urlb = ::includeQueryParams(urla, params);

    QVERIFY(urla.scheme() == urlb.scheme());
    QVERIFY(urla.host() == urlb.host());

    Q_FOREACH (const QString& key, params.keys()) {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
        QString encoded_key = QUrl::toPercentEncoding(key);
        QString encoded_value = QUrl::toPercentEncoding(params[encoded_key]);
        QUrlQuery query = QUrlQuery(urlb.query());
        QVERIFY(query.queryItemValue(encoded_key, QUrl::FullyEncoded) == encoded_value);
#else
        QVERIFY(urlb.queryItemValue(key) == params[key]);
#endif
    }
}
 void CSConnectionAcquirer::ServerHandleServerStateResponse(
     const Id &, const QHash<QByteArray, QUrl> &id_to_addr, int)
 {
   foreach(const QByteArray &bid, id_to_addr.keys()) {
     CheckAndConnect(bid, id_to_addr[bid]);
   }
 }
    QByteArray PostPrepareStrategyMultipart::GenerateData(const QHash<QString,ContentData> & params)
    {
        QByteArray data;
        QList<QString> keys = params.keys();
        QList<ContentData> values = params.values();


        for(int i = 0;i<params.size();++i)
        {
            data.append("--" + Boundary + "\r\n");
            ContentData Data = values.at(i);
            data.append("Content-Disposition: form-data; name=\"" + keys.at(i) + "\"; ");
            if(!Data.FileName.isEmpty())
                data.append(QString("filename=\"") + Data.FileName + QString("\""));
            data.append("\r\n");


            if(!Data.ContentType.isEmpty())
                data.append("Content-Type: " + Data.ContentType + "\r\n");

            data.append("\r\n");

            if(!Data.DataString.isEmpty())
                data.append(Data.DataString);
            else if(!Data.DataRaw.isEmpty())
                data.append(Data.DataRaw);

            data.append("\r\n");
        }
        data.append("--" + Boundary + "--\r\n");
        return data;
    }
Example #25
0
bool ListCommand::greedyTrigger(const QString& inputText)
{
  kDebug() << "Triggering greedy " << inputText;

  QHash<CommandListElements::Element, VoiceInterfaceCommand*> adaption = getAdaption();

  QList<CommandListElements::Element> adaptionKeys = adaption.keys();
  foreach (const CommandListElements::Element& element, adaptionKeys) {
    QList<VoiceInterfaceCommand*> interfaceCommands = adaption.values(element);
    foreach (VoiceInterfaceCommand* command, interfaceCommands) {
      if (command->matches(0, inputText)) {
        switch (element) {
          case CommandListElements::Back: return processRequest(0);
          case CommandListElements::One: return processRequest(1);
          case CommandListElements::Two: return processRequest(2);
          case CommandListElements::Three: return processRequest(3);
          case CommandListElements::Four: return processRequest(4);
          case CommandListElements::Five: return processRequest(5);
          case CommandListElements::Six: return processRequest(6);
          case CommandListElements::Seven: return processRequest(7);
          case CommandListElements::Eight: return processRequest(8);
          case CommandListElements::Next: return processRequest(9);
          case CommandListElements::Cancel:
            clw->close();
            return true;
        }
      }

    }

  }
Example #26
0
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    QList<QString> list;
    list.append("Nagavavara");
    list.insert(7,"Bangaluru");
    list.insert(1,"Mysore");
    list.insert(2,"Hubli");
    list.insert(3,"Dharawad");
    list.insert(4,"Belgaum");
    list.insert(5,"Gulbarga");
    list.insert(6,"Raichur");

    QListIterator<QString> it(list);
    while(it.hasNext()) {
        QString str = it.next();
        qDebug() << "Valu =" << str;
    }

    QHash<int,QString> myHash;
    myHash.insert(1,"Bangaloru");
    myHash.insert(2,"Mysuru");
    myHash.insert(3,"Hubli");
    myHash.insert(4,"Raichur");
    myHash.insert(5,"Bidar");
    myHash.insert(6,"Bijapur");

    QString valu = myHash.value(1);
    qDebug() << "Key =" << 1 << " Value="<<valu <<endl;

    QList<int> keys = myHash.keys();
    QList<QString> values = myHash.values();

    return a.exec();
}
Example #27
0
QStringList PBIBackend::installedList(QString injail, bool raw, bool orphan){
   QStringList out;
   if( injail.isEmpty() ){ 
     QStringList KL;
     if(!raw){ KL = APPHASH.keys(); }
     else{ KL = PKGHASH.keys(); }
     for(int i=0; i<KL.length(); i++){
       if(APPHASH.contains(KL[i])){
	 if(APPHASH[KL[i]].isOrphan && !orphan && !BASELIST.contains(KL[i]) ){ continue; } // filter out orphans (not base)
         if(APPHASH[KL[i]].isInstalled ){ out << KL[i]; }
       }else if(PKGHASH.contains(KL[i])){
	 if(PKGHASH[KL[i]].isOrphan && !orphan && !BASELIST.contains(KL[i]) ){ continue; } // filter out orphans (not base)
	 if(PKGHASH[KL[i]].isInstalled){ out << KL[i]; }
       }
     }
   }else if( JAILPKGS.contains(injail) ){  
     QHash<QString, NGApp> hash = JAILPKGS[injail];
     QStringList tmp = hash.keys();
     for(int i=0; i<tmp.length(); i++){
       if(hash[tmp[i]].isOrphan && !orphan){ continue; }
       out << tmp[i];
     }
   }
   return out; 
}
Example #28
0
static inline void applyProperties(ModelNode &node, const QHash<PropertyName, QVariant> &propertyHash)
{
    QHash<PropertyName, QVariant> auxiliaryData  = node.auxiliaryData();

    foreach (const PropertyName &propertyName, auxiliaryData.keys()) {
        if (node.hasAuxiliaryData(propertyName))
            node.setAuxiliaryData(propertyName, QVariant());
    }

    QHashIterator<PropertyName, QVariant> propertyIterator(propertyHash);
    while (propertyIterator.hasNext()) {
        propertyIterator.next();
        const PropertyName propertyName = propertyIterator.key();
        if (propertyName == "width" || propertyName == "height") {
            node.setAuxiliaryData(propertyIterator.key(), propertyIterator.value());
        } else if (node.property(propertyIterator.key()).isDynamic() &&
                   node.property(propertyIterator.key()).dynamicTypeName() == "alias" &&
                   node.property(propertyIterator.key()).isBindingProperty()) {
            AbstractProperty targetProperty = node.bindingProperty(propertyIterator.key()).resolveToProperty();
            if (targetProperty.isValid())
                targetProperty.parentModelNode().setAuxiliaryData(targetProperty.name() + "@NodeInstance", propertyIterator.value());
        } else {
            node.setAuxiliaryData(propertyIterator.key() + "@NodeInstance", propertyIterator.value());
        }
    }
}
QVector<QAspectJobPtr> QRenderAspect::jobsToExecute(qint64 time)
{
    Q_D(QRenderAspect);
    d->m_time = time;

    // Create jobs that will get exectued by the threadpool
    QVector<QAspectJobPtr> jobs;

    // Create jobs to load in any meshes that are pending
    if (d->m_renderer != Q_NULLPTR && !d->m_shuttingDown) {
        d->m_framePreparationJob.reset(new Render::FramePreparationJob(d->m_renderer, d->m_renderer->renderSceneRoot()));
        d->m_cleanupJob.reset(new Render::FrameCleanupJob(d->m_renderer));
        d->m_worldTransformJob.reset(new Render::UpdateWorldTransformJob(d->m_renderer->renderSceneRoot()));
        d->m_boundingVolumeJob.reset(new Render::UpdateBoundingVolumeJob(d->m_renderer->renderSceneRoot()));

        QHash<QNodeId, QAbstractMeshFunctorPtr> meshSources = d->m_renderer->meshDataManager()->meshesPending();
        Q_FOREACH (const QNodeId &meshId, meshSources.keys()) {
            Render::LoadMeshDataJobPtr loadMeshJob(new Render::LoadMeshDataJob(meshSources[meshId], meshId));
            loadMeshJob->setRenderer(d->m_renderer);
            jobs.append(loadMeshJob);
        }

        QVector<QNodeId> texturesPending = d->m_renderer->textureDataManager()->texturesPending();
        Q_FOREACH (const QNodeId &textureId, texturesPending) {
            Render::LoadTextureDataJobPtr loadTextureJob(new Render::LoadTextureDataJob(textureId));
            loadTextureJob->setRenderer(d->m_renderer);
            jobs.append(loadTextureJob);
        }
		QList<T> findTops (const QHash<T, int>& counts, int number)
		{
			auto keys = counts.keys ();
			std::sort (keys.begin (), keys.end (),
					[&counts] (const T& t1, const T& t2)
						{ return counts [t1] > counts [t2]; });
			return keys.mid (0, number);
		}