//====================================
// init
//------------------------------------
void SCCMonitorDualModel::init ( void ) {
	//====================================
	// create manipulators...
	//------------------------------------
	mSaxDesktop = new SaXManipulateDesktop (
		mSection["Desktop"],mSection["Card"],mSection["Path"]
	);
	//====================================
	// select desktop
	//------------------------------------
	mSaxDesktop -> selectDesktop ( mDisplay );

	//====================================
	// import dualhead profile if set
	//------------------------------------
	QString profile = mSaxDesktop -> getDualHeadProfile();
	if ((! profile.isEmpty()) && (! mSaxDesktop->isXineramaMode())) {
		SaXImportProfile* pProfile = SaXWidgetProfile->getProfile ( profile );
		SaXImport* mImport = pProfile -> getImport ( SAX_CARD );
		if ( mImport ) {
			SaXManipulateCard saxProfileCard ( mImport );
			mProfileDriverOptions = saxProfileCard.getOptions();
		}
	}
	//====================================
	// insert CDB monitors
	//------------------------------------
	mCDBMonitorVendors = mSaxDesktop->getCDBMonitorVendorList();
	QListIterator<QString> it (mCDBMonitorVendors);
	for (; it.current(); ++it) {
		mVendorList -> insertItem (*it.current());
	}
	mVendorList -> sort();
}
Example #2
0
void KdeObservatory::updateViews()
{
    m_viewTransitionTimer->stop();

    foreach(QGraphicsWidget *widget, m_views)
        widget->hide();

    m_views.clear();
    QListIterator< QPair<QString, bool> > i (m_activeViews);
    while (i.hasNext())
    {
        const QPair<QString, bool> &pair = i.next();
        const QString &view = pair.first;
        if (pair.second && m_viewProviders.value(view))
            m_views.append(m_viewProviders[view]->views());
    }

    if (m_views.count() > 0)
    {
        if (m_views.count() != m_lastViewCount)
            m_currentView = m_views.count()-1;
        moveViewRight();
        if (m_enableAutoViewChange && m_views.count() > 1)
            m_viewTransitionTimer->start();
    }
}
Example #3
0
void DialogTwaLine::setStart(QPointF start)
{
    this->start=start;
    if(line!=NULL)
    {
        delete line;
        line=NULL;
    }
    QListIterator<POI*> i (list);
    while(i.hasNext())
    {
        POI * poi=i.next();
        list.removeOne(poi);
        if(poi->isPartOfTwa())
        {
            parent->slot_delPOI_list(poi);
            delete poi;
        }
    }
    this->line=new vlmLine(parent->getProj(),parent->getScene(),Z_VALUE_ROUTE);
    line->setLinePen(pen);
    this->tabWidget->setCurrentIndex(0);
    this->doubleSpinBox->setFocus();
    this->doubleSpinBox->selectAll();
    this->move(position);
    traceIt();
}
Example #4
0
//====================================
// setCommonButtonWidth
//------------------------------------
void SCCMonitor::setCommonButtonWidth ( void ) {
	QListIterator<SCCMonitorDisplay> it (mMonitorDisplay);
	for (; it.current(); ++it) {
		SCCMonitorDisplay* display = it.current();
		display->setCommonButtonWidth();
	}
}
Example #5
0
 void JsUtil::toString(QVariant object,QString &output) {
  	if (object.type() == QVariant::Map) {
         QMapIterator<QString,QVariant> iter(object.value<QVariantMap>());
         QString sep = "";
         if (iter.hasNext()) {
             output += "{";
             do {
             	iter.next();
             	output += sep;
              	output += iter.key();
              	output += ":";
                 toString(iter.value(),output);
                 sep = ",";
             } while (iter.hasNext());
             output += "}";
         }
 	} else if (object.type() == QVariant::List) {
         QListIterator<QVariant> iter (object.value<QVariantList>());
         QString sep = "";
         if (iter.hasNext()) {
         	output += "[";
             do {
             	output += sep;
                 toString(iter.next(),output);
                 sep = ",";
             } while (iter.hasNext());
             output += "]";
         }
  	} else if (object.type() == QVariant::String) {
  		output += "\"" + object.toString() + "\"";
  	} else if (object.type() == QVariant::Bool || object.type() == QVariant::Int || object.type() == QVariant::Double || object.type() == QVariant::LongLong) {
         output += object.toString();
  	}
 }
Example #6
0
void UpdatingModel::setUrl(const QUrl& _url)
{
  qDebug() << "model set_url " << "old " << url << "new " << _url;

  if (_url != url) {
    url = _url;
    qDebug() << "cleared model";
    clear();

    if (settings->contains(url.toString()))
      lastModified = settings->value(url.toString()).toDateTime();

    // attempt to fill from cache
    if (url2listCache->contains(url)) {
      qDebug() << "pulling from cache " << url;

      QList<QString> *itemList = url2listCache->value(url);
      QListIterator<QString> i (*itemList);
      while (i.hasNext()) {
        appendRow(new QStandardItem(i.next()));
      }
      sort(0);

    } else {
      // fire the timer now
      timer->start(50);
    }
  }
}
//====================================
// getArrangement
//------------------------------------
QDict<QString> SCCMonitorArrange::getArrangement ( void ) {
	QDict<QString> result;
	QList<SCCLayoutLine> layout = mMatrix->getLayout();
	QListIterator<SCCLayoutLine> it (layout);
	for (; it.current(); ++it) {
		QString* key   = new QString();
		QString* value = new QString();
		SCCLayoutLine* l = it.current();
		int neighbour[4] = {l->mLeft,l->mRight,l->mTop,l->mBottom};
		key->sprintf("Screen:Screen[%d]",mCardID[l->ID]);
		for (int n=0;n<4;n++) {
		if (neighbour[n] == -1) {
			value->sprintf (
				"%s <none>",value->ascii()
			);
		} else {
			value->sprintf (
				"%s Screen[%d]",value->ascii(),neighbour[n]
			);
		}
		}
		*value = value->stripWhiteSpace();
		result.insert (
			*key,value
		);
	}
	return result;
}
Example #8
0
void MainWindow::joystickTrayShow()
{
    QMenu *tempmenu = (QMenu*) sender();
    QList<QAction*> menuactions = tempmenu->actions();
    QListIterator<QAction*> listiter (menuactions);
    while (listiter.hasNext())
    {
        QAction *action = listiter.next();
        action->setChecked(false);

        QHash<QString, QVariant> tempmap = action->data().toHash();
        QHashIterator<QString, QVariant> iter(tempmap);
        while (iter.hasNext())
        {
            iter.next();
            int joyindex = iter.key().toInt();
            int configindex = iter.value().toInt();
            JoyTabWidget *widget = (JoyTabWidget*)ui->tabWidget->widget(joyindex);

            if (configindex == widget->getCurrentConfigIndex())
            {
                action->setChecked(true);
            }
        }
    }
}
Example #9
0
void ExportGesamt::reload()
{
    QListIterator<AActivity*> iter = manager->getActivities();
    int i = 0;
    while(iter.hasNext()) {
        AActivity *a = iter.next();
        if (actToList.contains(a)) {
            QString farbe = MainWindow::getFarbe(a);
            actToList.value(a)->setBackgroundColor(QColor(farbe));
            actToList.value(a)->setToolTip(a->getAnlass());
            i++;
            continue;
        }
        QString farbe = MainWindow::getFarbe(a);
        QListWidgetItem *item = new QListWidgetItem(a->getListString());
        item->setBackgroundColor(QColor(farbe));
        item->setToolTip(a->getAnlass());
        ui->listAnzeige->insertItem(i, item);
        liste.insert(i, a);
        actToList.insert(a, item);
        listToAct.insert(item, a);
        i++;
    }
    show();
}
Example #10
0
void FormatterApp::fillCombos()
{

    StorageInfo storageInfo;
    const QList<FileSystem> &fs = storageInfo.fileSystems();
    QListIterator<FileSystem> it ( fs );
    QString storage;
    for( ; it.current(); ++it )
    {
        const QString name = (*it)->name();
        const QString path = (*it)->path();
        const QString disk = (*it)->disk();
        const QString options = (*it)->options();
        if( name.find( tr("Internal"),0,TRUE) == -1)
        {
            storageComboBox->insertItem(name +" -> "+disk);
        }
        //        deviceComboBox->insertItem(disk);
    }
    parsetab("/etc/mtab");
    //    parsetab("/etc/fstab");
    fileSystemsCombo->insertStringList( fsList,-1);
    deviceComboBox->insertStringList( deviceList,-1);
    storageComboSelected(0);
    deviceComboSelected(0);
}
Example #11
0
void outputStringList(QIODevice& output, const QStringList& sl){
    QListIterator<QString> itr (sl);
    while (itr.hasNext()) {
        output.write(QString(itr.next()).toUtf8());

    }
}
Example #12
0
void TreeItem::insertNode(GNode * node)
{
    nodeObj_ = node;
    node->setGuiPtr(this);
//      return;
    QListIterator < GNode > it = QListIterator < GNode > (node->children());
    while (it.current()) {
        GNode *n = it.current();
#ifdef DEBUGMSG
        qDebug("TreeItem: add %s\n", (const char *) n->name());
#endif
        TreeItem *item = new TreeItem(this, n->name());
        ASSERT(item!=0);
        if (n->isA("SNode")) {
            pixmap_.resize(20, 10);
            pixmap_.fill(((SNode *) n)->color());
            item->setPixmap(0, pixmap_);
        }
#if 0
        if (nodeObj_->isCompound())
            item->setPixmap(0, *pixmap_compound);
        else
            item->setPixmap(0, *pixmap_generalize);
#endif
#ifdef DEBUGMSG
        qDebug("TreeItem: done %s\n", (const char *) n->name());
#endif
        item->insertNode(n);
        ++it;
    }
    setOpen(TRUE);
}
void FavouriteManagerPrivate::save()
{
    QDomDocument document;
    QDomElement rootElement = document.createElement("favourites");

    QListIterator<QPair<QString, Station> > iterator
            = QListIterator<QPair<QString, Station> >(data);
    while (iterator.hasNext()) {
        QPair<QString, Station> entry = iterator.next();
        QDomElement element = XmlConversionHelper::toXml(entry.second, &document);
        element.setAttribute(BACKEND_ATTRIBUTE, entry.first);
        rootElement.appendChild(element);
    }
    document.appendChild(rootElement);

    QDir favouriteDir = QDir(QDesktopServices::storageLocation(QDesktopServices::DataLocation));
    if (!favouriteDir.exists()) {
        QDir::root().mkpath(favouriteDir.absolutePath());
    }


    QFile file (favouriteDir.absoluteFilePath(fileName));
    if (!file.open(QIODevice::WriteOnly)) {
        return;
    }

    QTextStream stream(&file);
    document.save(stream, 2);
    file.close();
}
Example #14
0
void SubassemblyView::addDependency ( const QVector<uint>& surface_id )
{
  // Basically, the idea here is to connect to each component of the
  // references path whose name change could affect the display.  So,
  // exhustively examine each element of the path and see what it
  // means to us. Note, since part faces are not real ModelItems, we
  // skip the last element of the id_path.
  QVector<uint> id_path;
  id_path.reserve( surface_id.size()-1 );

  for ( int i = 0; i < surface_id.size()-1; ++i ) {
    id_path.push_back( surface_id[i] );
    ModelItem* item = model()->lookup( id_path );
    // The first order check is that we don't already depend on this item.
    bool found = false;
    QListIterator<std::shared_ptr<ModelItem>> it (dependencies_);
    while(it.hasNext()) {
        if(it.next().get() == item) {
            found = true;
            break;
        }
    }
    if ( found ) {
      continue;
    }
    // If it's a model, part or assembly, then it can be renamed by the user.
    else if ( dynamic_cast<Model*>( item ) != 0 ||
	      dynamic_cast<Assembly*>( item ) != 0 ||
	      dynamic_cast<Part*>( item ) != 0 ) {
      dependencies_.append( std::shared_ptr<ModelItem>(item) );
      connect( item, SIGNAL( nameChanged(const QString&) ),
	       SLOT( updateConstraintName( const QString&) ) );
    }
  }
}
//---------------------------------------------------------------------------
//  getWordItems
//
//! Construct a list of word items to be inserted into a word list, based on
//! the results of a list of searches.
//
//! @param searchSpecs the list of search specifications
//! @return a list of word items
//---------------------------------------------------------------------------
QList<WordTableModel::WordItem>
WordVariationDialog::getWordItems(const QList<SearchSpec>& searchSpecs) const
{
    QList<WordTableModel::WordItem> wordItems;
    QMap<QString, QString> wordMap;
    QListIterator<SearchSpec> lit (searchSpecs);
    while (lit.hasNext()) {
        QStringList wordList = wordEngine->search(lexicon, lit.next(), false);
        QStringListIterator wit (wordList);
        while (wit.hasNext()) {
            QString str = wit.next();
            wordMap.insert(str.toUpper(), str);
        }
    }

    QMapIterator<QString, QString> mit (wordMap);
    while (mit.hasNext()) {
        mit.next();
        QString value = mit.value();
        QList<QChar> wildcardChars;
        for (int i = 0; i < value.length(); ++i) {
            QChar c = value[i];
            if (c.isLower())
                wildcardChars.append(c);
        }
        QString wildcard;
        if (!wildcardChars.isEmpty()) {
            qSort(wildcardChars.begin(), wildcardChars.end(),
                  Auxil::localeAwareLessThanQChar);
            foreach (const QChar& c, wildcardChars)
                wildcard.append(c.toUpper());
        }
        wordItems.append(WordTableModel::WordItem(
            mit.key(), WordTableModel::WordNormal, wildcard));
    }
Example #16
0
MyFileSystemNodeItem::MyFileSystemNodeItem (const QFileInfo & info, QObject * parent)
    : QObject (parent)
    , m_size  (info.size ())
    , m_info  (info)
{
    MyFileSystemNodeItem::s_instances.insert (m_info.filePath (), this);
    if (m_info.isDir ()) {
        const QFileInfoList list (QDir (m_info.filePath ()).entryInfoList (filter, sort));
#ifdef USE_ITERATOR
        QListIterator<QFileInfo> it (list);
        while (it.hasNext ()) {
            m_size += (new MyFileSystemNodeItem (it.next (), this))->getSize ();
        }
#else
#   ifdef USE_FOREACH
        foreach (QFileInfo entry, list) {
            m_size += (new MyFileSystemNodeItem (entry, this))->getSize ();
        }

#   else
        const int nb = list.count ();
        for (int idx = 0; idx < nb; idx++) {
            m_size += (new MyFileSystemNodeItem (list.at (idx), this))->getSize ();
        }
#   endif
#endif
    }
}
Example #17
0
bool Dispatcher::play(QStringList::Iterator it)
{
    if (it == m_history.end()) {
        return false;
    }

    bool playing = false;
    QUrl url(*it);
    QListIterator<MediaHandler*> mhit = m_loader->mediaHandlersIterator();
    while (mhit.hasNext()) {
        MediaHandler* handler = mhit.next();
        if (handler->handles(url)) {
            stop();
            connect(handler, SIGNAL(playbackFinished()), m_timer, SLOT(stop()));
            connect(handler, SIGNAL(playbackFinished()), this, SLOT(next()));
            m_currentHandler = handler;
            m_currentHandler->setMedia(url);
            togglePlayback();
            playing = true;
            break;
        }
    }
    if (playing) {
        m_currentHistoryPosition = it;
    } else {
        m_history.erase(it);
        m_currentHistoryPosition = m_history.begin();
    }

    return playing;
}
Example #18
0
void processFilters(QImage *& image, QListIterator<Filter *> i)
{
    while (i.hasNext())
    {
        Filter * f = i.next();

        uint w = image->width();
        uint h = image->height();

        if (f->getArea().isNull())
        {
            f->setArea(QRect(QPoint(0, 0), QSize(w, h)));
        }

        if (! f->isApplicable(w, h))
        {
            QRect area = f->getArea();

            fatal(QObject::tr("Too small image (%1x%2), pointed filter"
                " with pointed area (%3x%4+%5+%6) not applicable")
                .arg(w).arg(h).arg(area.x()).arg(area.y())
                .arg(area.width()).arg(area.height()));
        }

        QImage * newImage = f->filter(*image);

        delete image;
        image = newImage;
    }
}
Example #19
0
//====================================
// storeDataSysp...
//------------------------------------
void SaXProcess::storeDataSysp (void) {
	// .../
	//! Store data which has been written to STDOUT after
	//! a previous sysp process call
	// ----
	QList<QString> data = mProc->readStdout();
	QListIterator<QString> in (data);
	for (; in.current(); ++in) {
		int id = 0;
		QString line (*in.current());
		QStringList tokens = QStringList::split ( "=>", line );
		QString idstr = tokens.first();
		QString data  = tokens.last();
		QStringList datalist = QStringList::split ( ":", data );
		QString key = datalist.first();
		QString val = datalist.last();
		QRegExp idExp ("(\\d+)");
		int rpos = idExp.search (idstr,0);
		if (rpos >= 0) {
			id = idExp.cap().toInt();
		}
		addID (id);
		val = val.stripWhiteSpace();
		key = key.stripWhiteSpace();
		if ((! key.isEmpty()) && (! val.isEmpty())) {
			setItem (key,val);
		}
	}
}
Example #20
0
//=========================================
// clientInit
//-----------------------------------------
void ServerHandler::clientInit (void) {
	QListIterator<ServerFolder*> it (mFolderList);
	while (it.hasNext()) {
		ServerFolder* thisFolder = it.next();
		thisFolder -> updateFolder();
	}
	mServer -> writeClient ("INIT_DONE");
}
Example #21
0
//====================================
// storeData...
//------------------------------------
void SaXProcess::storeData (void) {
	// .../
	//! Store data which has been written to STDOUT after
	//! a previous isax process call
	// ----
	QList<QString> data = mProc->readStdout();
	QListIterator<QString> in (data);
	for (; in.current(); ++in) {
		QString line (*in.current());
		QString cnr;
		QString key;
		QString val;
		int index = 0;
		QStringList tokens = QStringList::split ( ":", line );
		for ( QStringList::Iterator
			in = tokens.begin(); in != tokens.end(); ++in
		) {
			QString item (*in);
			item = item.stripWhiteSpace();
			switch (index) {
			case 0:
				cnr = item;
			break;
			case 1:
				key = item;
			break;
			case 2:
				val = item;
			break;
			default:
				bool isNumber = false;
				if ((key == "Screen") || (key == "Relative")) {
					QRegExp idExp ("^(\\d+)$");
					if (idExp.search (val,0) >= 0) {
						isNumber=true;
					}
				}
				if (
					(((key == "Screen") || (key == "Relative")) &&
					 (!isNumber)) || (key == "Modes")||(key == "Virtual")
				) {
					key = key+":"+val;
					val = item;
				} else {
					val = val+":"+item;
				}
			break;
			}
			index++;
		}
		if (val.isEmpty()) {
			continue;
		}
		addID   (cnr.toInt());
		setItem (key,val);
	}
}
Example #22
0
void ItemContainerPrivate::cleanList (QStringList & list,
    QList<QSharedPointer<Item> > & find) {
    
    QListIterator <QSharedPointer<Item> > iter (find);
    
    while (iter.hasNext()) {
        list.removeAll (iter.next()->constructInfo());
    }   
}
 /*public*/ SignalMastLogic* SmlBeanTableDataModel::getLogicFromRow(int row) const
 {
     QHash<SignalMastLogic*, SignalMast*>* b = act->signalMastLogicList->at(row);
     QListIterator<SignalMastLogic*> en = b->keys();
     while (en.hasNext()) {
         return en.next();
     }
     return NULL;
 }
 /*public*/ SignalMast* SmlBeanTableDataModel::getDestMastFromRow(int row) const{
     // if object has been deleted, it's not here; ignore it
     QHash<SignalMastLogic*, SignalMast*>* b = act->signalMastLogicList->at(row);
     QListIterator<SignalMastLogic*> en = b->keys();
     while (en.hasNext()) {
         return b->value(en.next());
     }
     return NULL;
 }
Example #25
0
ThreadListModel::ThreadListModel (const QList<Message *> &data, QObject * parent)
  : QAbstractListModel (parent),
    m_data (data)
{
  QListIterator<Message *> it (m_data);
  while (it.hasNext ())
  {
    rowAdded (it.next ());
  }
}
Example #26
0
//=========================================
// slotNotify
//-----------------------------------------
void ServerHandler::slotNotify (QString* mailbox,QPoint* count) {
	QListIterator<ServerFolder*> it (mFolderList);
	while (it.hasNext()) {
		ServerFolder* thisFolder = it.next();
		if (thisFolder->getFolder() == *mailbox) {
			thisFolder->setStatus (count);
			thisFolder->updateFolder();
			break;
		}
	}
}
Example #27
0
/** for preparing the result label image every inode gets a new id */
int INode::setNewID(int id)
{
  attribute("IDStart", id);
  QListIterator < INode > it = QListIterator < INode > (children());
  for (; it.current(); ++it) {
    ++id;
    id = it.current()->setNewID(id);
  }
  attribute("IDEnd", id);
  return id;
}
Example #28
0
KbAnim::KbAnim(QObject *parent, const KeyMap& map, const QUuid id, CkbSettings& settings) :
    QObject(parent), _script(0), _map(map),
    repeatTime(0), kpRepeatTime(0), stopTime(0), kpStopTime(0), repeatMsec(0), kpRepeatMsec(0),
    _guid(id), _needsSave(false)
{
    SGroup group(settings, _guid.toString().toUpper());
    _keys = settings.value("Keys").toStringList();
    // Convert key list from storage names if needed
    if(!settings.value("UseRealNames").toBool()){
        QMutableListIterator<QString> i(_keys);
        while(i.hasNext()){
            i.next();
            QString& key = i.value();
            key = _map.fromStorage(key);
        }
    }
    _name = settings.value("Name").toString().trimmed();
    _opacity = settings.value("Opacity").toString().toDouble();
    if(_opacity < 0.)
        _opacity = 0.;
    else if(_opacity > 1.)
        _opacity = 1.;
    bool modeOk = false;
    _mode = (Mode)metaObject()->enumerator(metaObject()->indexOfEnumerator("Mode")).keysToValue(settings.value("BlendMode").toString().toLatin1(), &modeOk);
    if(!modeOk)
        _mode = Normal;
    _scriptName = settings.value("ScriptName").toString().trimmed();
    _scriptGuid = settings.value("ScriptGuid").toString();
    {
        SGroup group(settings, "Parameters");
        foreach(const QString& param, settings.childKeys())
            _parameters[param.toLower()] = settings.value(param);
    }

    if(!_scriptGuid.isNull()){
        _script = AnimScript::copy(this, _scriptGuid);
        if(_script){
            // Remove nonexistant parameters
            foreach(const QString& name, _parameters.keys()){
                AnimScript::Param param = _script->param(name);
                if(param.type == AnimScript::Param::INVALID || param.type == AnimScript::Param::LABEL)
                    _parameters.remove(name);
            }
            // Add defaults for unset parameters
            QListIterator<AnimScript::Param> i = _script->paramIterator();
            while(i.hasNext()){
                AnimScript::Param param = i.next();
                if(!_parameters.contains(param.name) && param.type != AnimScript::Param::LABEL)
                    _parameters[param.name] = param.defaultValue;
            }
            _scriptName = _script->name();
            reInit();
        }
    }
Example #29
0
void polarList::stats(void)
{
    qWarning() << "Nb polar: " << polars.count();
    QListIterator<Polar*> i (polars);
    int k=0;
    while(i.hasNext())
    {
        Polar * item = i.next();
        qWarning() << k << ": " << item->getName() << "(nb used=" << item->nbUsed << ")";
        k++;
    }
}
Example #30
0
//---------------------------------------------------------------------------
//  asString
//
//! Return a string representing the search spec.
//
//! @return the string representation
//---------------------------------------------------------------------------
QString
SearchSpec::asString() const
{
    QString str;
    QListIterator<SearchCondition> it (conditions);
    while (it.hasNext()) {
        if (!str.isEmpty())
            str += (conjunction ? QString(" AND ") : QString(" OR "));
        str += it.next().asString();
    }
    return str;
}