예제 #1
0
파일: main.C 프로젝트: xwizard/kde1
void TEDemo::addSession(TESession* s)
{
  session_no += 1;
  no2session.insert(session_no,s);
  session2no.insert(s,(void*)session_no);
  m_sessions->insertItem(s->Title(), session_no);
}
예제 #2
0
void GadWorkspace::load(const ClassDict & classDict, const QString & filename)
{
  qDebug("GadWorkspace::load\n");
  classDict_ = &classDict;
  genMenu();
  QFile fp(filename);
  if (!fp.open(IO_ReadOnly))
    return;
  MLParser parser(&fp);
  QString keywords[] = { "OBJECT", "" };
  MLTagTable tagtable(keywords);

  int tag;
  QIntDict < GadObject > dict;

  while ((tag = parser.tag(tagtable)) != MLParser::END_OF_FILE) {
    GadObject *obj;
    qDebug("tag=%d\n", tag);
    switch (tag) {
    case 1:
      obj = new GadObject(classDict, parser.args(), this);
      dict.insert(obj->id(), obj);
      break;
    default:
      delete parser.args();
    }
  }
  qDebug("GadWorkspace::load: connecting\n");
  QIntDictIterator < GadObject > it(dict);
  for (; it.current(); ++it) {
    it.current()->connectObject(dict);
  }
  resize();
  qDebug("GadWorkspace::load: connecting done\n");
}
예제 #3
0
QIntDict<QString> EventItem::actions()
{
    QIntDict<QString> result;
    result.insert( 0, new QString( QObject::tr("show") ) );
    result.insert( 1, new QString( QObject::tr("edit") ) );
    return result;
}
QIntDict<QString>* ConfigHelper::stringList2intDict(QStringList stringList)
{
    QIntDict<QString>* filterDict = new QIntDict<QString>;

    // loop over all entries in the stringlist
    for (QStringList::Iterator it = stringList.begin(); it != stringList.end(); ++it) {

        tracer->sdebug(__func__) << "Handling entry: '" << *it << "'" << endl;

        // split the current entry into key and value and put them into the intdict
        int delimitorPos = (*it).find(':');
        if (delimitorPos > 0) {
            QString keyStr = (*it).mid(0, delimitorPos);
            QString value = (*it).mid(delimitorPos + 1);

            tracer->sdebug(__func__) << "key-->value: '" << keyStr << "-->" << value << "'" << endl;

            bool ok;
            int key = keyStr.toInt(&ok);

            if (ok) {
                filterDict->insert(key, new QString(value));
            } else {
                tracer->swarning(__func__) << "Key '" << *it << "' is invalid! It is not a number. (Valid format: 'key:value')" << endl;
            }

        } else {
            tracer->swarning(__func__) << "KeyValue pair '" << *it << "' is invalid! (Valid format: 'key:value')" << endl;
        }
    }

    return filterDict;
}
예제 #5
0
파일: main.C 프로젝트: xwizard/kde1
void TEDemo::addSessionCommand(const char* path)
{
  KSimpleConfig* co = new KSimpleConfig(path,TRUE);
  co->setGroup("KDE Desktop Entry");
  QString typ = co->readEntry("Type");
  QString txt = co->readEntry("Comment");
  QString cmd = co->readEntry("Exec");
  QString nam = co->readEntry("Name");
  if (typ.isEmpty() || txt.isEmpty() || cmd.isEmpty() || nam.isEmpty() ||
      strcmp(typ.data(),"KonsoleApplication"))
  {
    delete co; return; // ignore
  }
  m_file->insertItem(txt, ++cmd_serial);
  no2command.insert(cmd_serial,co);
}
예제 #6
0
파일: server.cpp 프로젝트: opieproject/opie
bool Server::setKeyboardLayout( const QString &kb )
{
    //quick demo version that can be extended

    QIntDict<QWSServer::KeyMap> *om = 0;
    if ( kb == "us101" ) { // No tr
        om = 0;
    }
    else if ( kb == "jp109" ) {
        om = new QIntDict<QWSServer::KeyMap>(37);
        const KeyOverride *k = jp109keys;
        while ( k->scan_code ) {
            om->insert( k->scan_code, &k->map );
            k++;
        }
    }
    QWSServer::setOverrideKeys( om );

    return TRUE;
}
예제 #7
0
void Scribble::slotSave()
{
    QPopupMenu *menu = new QPopupMenu( 0 );
    QIntDict<QString> formats;
    formats.setAutoDelete( TRUE );

    for ( unsigned int i = 0; i < QImageIO::outputFormats().count(); i++ ) {
	QString str = QString( QImageIO::outputFormats().at( i ) );
	formats.insert( menu->insertItem( QString( "%1..." ).arg( str ) ), new QString( str ) );
    }

    menu->setMouseTracking( TRUE );
    int id = menu->exec( bSave->mapToGlobal( QPoint( 0, bSave->height() + 1 ) ) );

    if ( id != -1 ) {
	QString format = *formats[ id ];

	QString filename = QFileDialog::getSaveFileName( QString::null, QString( "*.%1" ).arg( format.lower() ), this );
	if ( !filename.isEmpty() )
	    canvas->save( filename, format );
    }

    delete menu;
}
예제 #8
0
static void read_bodies(const char * path, QIntDict<char> & bodies)
{
  char * s = read_file(path);
  
  if (s != 0) {
    char * p1 = s;
    char * p2;
    
    while ((p2 = strstr(p1, BodyPrefix)) != 0) {
      p2 += BodyPrefixLength;
      
      char * body;
      long id = strtol(p2, &body, 16);
      
      if (body != (p2 + 8)) {
	UmlCom::trace(QCString("<font color =\"red\"> Error in ") + path +
		      " : invalid preserve body identifier</font><br>");
	UmlCom::bye(n_errors() + 1);
	UmlCom::fatal_error("read_bodies 1");
      }
      
      if (bodies.find(id) != 0) {
	UmlCom::trace(QCString("<font  color =\"red\"> Error in ") + path + 
	  " : preserve body identifier used twice</font><br>");
	UmlCom::bye(n_errors() + 1);
	UmlCom::fatal_error("read_bodies 2");
      }
      
      if (*body == '\r')
	body += 1;
      if (*body == '\n')
	body += 1;
      else {
	UmlCom::trace(QCString("<font  color =\"red\"> Error in ") + path + 
		      " : invalid preserve body block, end of line expected</font><br>");
	UmlCom::bye(n_errors() + 1);
	UmlCom::fatal_error("read_bodies 3");
      }
      
      if (((p1 = strstr(body, BodyPostfix)) == 0) ||
	  (strncmp(p1 + BodyPostfixLength, p2, 8) != 0)) {
	UmlCom::trace(QCString("<font  color =\"red\"> Error in ") + path + 
		      " : invalid preserve body block, wrong balanced</font><br>");
	UmlCom::bye(n_errors() + 1);
	UmlCom::fatal_error("read_bodies 4");
      }

      p2 = p1;
      while ((p2 != body) && (p2[-1] != '\n'))
	p2 -= 1;
      *p2 = 0;
      
      int len = p2 - body + 1;
      char * b = new char[len];
      
      memcpy(b, body, len);
      bodies.insert(id, b);
      
      p1 += BodyPostfixLength + 8;
    }
    
    delete [] s;
  }
}
예제 #9
0
bool KeyMappings::apply(int unicode, int keycode, int modifiers,
	int keymask, bool isPress)
{
	CodeMaps* map;
	m_isMapped = false;

	if(m_keymaps.contains(keycode)){
		map = m_keymaps[keycode];
		if(map->contains(keymask)){
			m_isMapped = true;
			m_keyinfo = (*map)[keymask];
		} else {
			int mask = -1;
			for(CodeMaps::Iterator it=map->begin();
					it!=map->end(); ++it){
				if((keymask & it.key()) == it.key()
					&& it.key() > mask){
					mask = it.key();
				}
			}
			if(mask != -1){
				m_isMapped = true;
				m_keyinfo = (*map)[mask];
			}
		}
	}

	if(m_isMapped == false){
		QWSServer::KeyMap* cache = g_mapCache[keycode];
		if(cache == NULL){
			cache = new QWSServer::KeyMap();
			g_mapCache.insert(keycode, cache);
			cache->unicode = cache->shift_unicode = cache->ctrl_unicode = 0;
		}
		if(cache->unicode == 0 || cache->shift_unicode == 0 || cache->ctrl_unicode == 0){
			QChar ch(unicode);
			if(modifiers & Qt::ControlButton){
				cache->ctrl_unicode = unicode;
			} else if(modifiers & Qt::ShiftButton){
				cache->shift_unicode = ch.upper().unicode();
			} else {
				cache->unicode = ch.lower().unicode();
			}
		}
		m_keyinfo = MapInfo(keycode, 0,
			cache->unicode, cache->shift_unicode, cache->ctrl_unicode);
		if(m_keyinfo.isDefined){
			setOriginal(unicode, modifiers);
		} else {
			setUnicode(unicode);
		}
	}

#if 1
	if(isPress){
		if(m_keyinfo.keycode == Qt::Key_CapsLock){
			m_capslock = !m_capslock;
		}
	}
#endif
	return(m_isMapped);
}
예제 #10
0
void ColorSchema::addSchema()
{
  numb2schema.insert(numb,this);
  path2schema.insert(path.data(),this);
}