virtual int compareItems(Item il, Item ir) {
		Help *lval = (Help*)il;
		Help *rval = (Help*)ir;
		if (lval->p() == rval->p()) return 0;
		if (lval->p()<rval->p()) return -1;
		return 1;
	}
示例#2
0
char* command_generator(const char* text, int state)
{
  Help commands = readline_help_function();
  Help::const_iterator it = commands.begin();
  int length,match_counter;
  
  match_counter = 0;
  if(readline_current_match >= commands.size())
    return (char*)NULL;

  length = strlen(text);
  for(;it != commands.end();it++)
    {
      if(!strncmp(it->first.c_str(),text,length) && match_counter >= readline_current_match)
	{
	  char* returnMe = (char*) calloc(it->first.size()+1,sizeof(char));
	  strcat(returnMe,it->first.c_str());
	  readline_current_match++;
	  return returnMe;
	}
      match_counter++;
    }

  return (char*) NULL;
  }
示例#3
0
void clusterMembersDialog::help()
{
    QString tab_title = m_dialog->tabWidget->tabText(
                            m_dialog->tabWidget->currentIndex());
    QString anchor = tab_title.replace('/', '-').replace(' ', '-').toLower();
    Help *h = Help::getHelpWindow(this);
    h->setName("Cluster-Member Management");
    h->setSource(QUrl("clusterMembersDialog.html#" + anchor));
    h->raise();
    h->show();
}
void ipcopAdvancedDialog::help()
{
    QString tab_title = m_dialog->tabWidget->tabText(
        m_dialog->tabWidget->currentIndex());
    QString anchor = tab_title.replace('/', '-').replace(' ', '-').toLower();
    Help *h = Help::getHelpWindow(this);
    h->setName("Firewall platform: IPCOP");
    h->setSource(QUrl("ipcopAdvancedDialog.html#" + anchor));
    h->raise();
    h->show();
}
void linux24AdvancedDialog::help()
{
    QString tab_title = m_dialog->tabWidget->tabText(
        m_dialog->tabWidget->currentIndex());
    QString anchor = tab_title.replace('/', '-').replace(' ', '-').toLower();
    Help *h = Help::getHelpWindow(this);
    h->setName("Host type Linux 2.4/2.6");
    h->setSource(QUrl("linux24AdvancedDialog.html#" + anchor));
    h->raise();
    h->show();
}
示例#6
0
void pixosIfaceOptsDialog::help()
{
    QString tab_title = m_dialog->tabWidget->tabText(
                            m_dialog->tabWidget->currentIndex());
    QString anchor = tab_title.replace('/', '-').replace(' ', '-').toLower();
    Help *h = Help::getHelpWindow(this);
    h->setName("PIX Interface");
    h->setSource(QUrl("pixosIfaceOptsDialog.html#" + anchor));
    h->raise();
    h->show();
}
示例#7
0
void VoronoiWindow::helpPushButton_clicked()
{
    Help* help = new Help(this, "help", false);
	help->init(""); // TODO: Voronoi.html and Delaunay.html
	if(help->erro_ == false)
	{
		help->show();
		help->raise();
	}
	else
		delete help;
}
示例#8
0
	bool Init() {

		Current = Structure::INTRO;

		//Inicializacion de SDL
		if (SDL_Init(SDL_INIT_EVERYTHING) < 0)
			return false;

		//Inicializacion de Display
		if ((Display = SDL_SetVideoMode(1024, 768, 32,
				SDL_HWSURFACE | SDL_DOUBLEBUF)) == NULL)
			return false;

		//Inicializacion de ventanas
		if (!intro->Init())
			return false;
		if (!menu->Init())
			return false;
		if (!help->Init())
			return false;
		if (!ingame->Init())
			return false;
		if (!story->Init())
			return false;

		return true;
	}
示例#9
0
	void Event(SDL_Event* Event) {
		if (Event->type == SDL_QUIT) {
			Running = false;
		}

		switch (Current) {
		case Structure::STORY:
			story->CheckEvent(Event);
			break;

		case Structure::INTRO:
			intro->CheckEvent(Event);
			break;

		case Structure::MENU:
			menu->CheckEvent(Event);
			break;

		case Structure::INGAME:
			ingame->CheckEvent(Event);
			break;

		case Structure::HELP:
			help->CheckEvent(Event);
			break;

		}
	}
示例#10
0
	void Render(SDL_Surface* display, float camera = 0) {
		switch (Current) {

		case Structure::STORY:
			story->Render(display);
			break;

		case Structure::INTRO:
			intro->Render(display);
			break;

		case Structure::MENU:
			menu->Render(display);
			break;

		case Structure::INGAME:
			ingame->Render(display);
			break;

		case Structure::HELP:
			help->Render(display);
			break;
		}

		SDL_Flip(display);
	}
示例#11
0
	int Loop() {

		switch (Current) {
		case Structure::STORY:
			Current = story->Loop();
			break;

		case Structure::INTRO:
			Current = intro->Loop();
			break;

		case Structure::MENU:
			Current = menu->Loop();
			break;

		case Structure::INGAME:
			Current = ingame->Loop();
			break;

		case Structure::HELP:
			Current = help->Loop();
			break;
		}
		return Current;
	}
示例#12
0
int main()
{
	Help* help = new Help();
	
	switch(help->menu())
	{
		case 2:
			double divisor, dividendo;
			cout << "Digite o Divisor e posteriormente o dividendo" << endl;
			cin >> divisor >> dividendo;
			Divisao* div = new Divisao(divisor, dividendo);
			cout << "Resultado: " << div->getResult() << endl;
		break;
	}	
	return 0;

}
示例#13
0
	void Cleanup() const {
		story->Cleanup();
		intro->Cleanup();
		menu->Cleanup();
		help->Cleanup();
		ingame->Cleanup();
		SDL_Quit();
	}
示例#14
0
void Node::mousePressEvent(QMouseEvent *) {

    Help *help = new Help(this, (Qt::Popup | Qt::Dialog));
    help->resize(610, 458);
    help->show();
}
示例#15
0
void dohelp (int command)
{	help.general();
}
int main(int argc, char *argv[])
{
  QString classes = "ALL";
  unsigned int minsize = 0;
  int minth = 0;
  if(argc == 8) {
    classes = argv[7];
    argc = 7;
  }
  if(argc == 7) {
    minth = atoi(argv[6]);
    argc = 6;
  }
  if(argc == 6) {
    minsize = atoi(argv[5]);
    argc = 5;
  }
  if (argc != 5 )
    usage(argv[0]);

//cout <<argv[0]<<" "<<argv[1]<<" "<<argv[2]<<" "<<argv[3]<<" "<<argv[4]<<" "<<argv[5]<<endl;

  float gN=0.0, gS=0.0, gW=0.0, gE=0.0, xRes=0.0, yRes=0.0;
  int newX=0, newY=0;
  BottomUp bu(argv[1]); // read infile 'XML' description file
  //NodeList *nl = bu.selectClass(classes); //select given classes
	NodeList *nl_i = bu.selectClass(classes); //select given classes
	//NodeList *nl_i = bu.selectClass("Gebaeude"); //select given classes
	//NodeList *nl_s = bu.selectClass("settlement"); //select given classes
	//NodeList *nl_g = bu.selectClass("greenland"); //select given classes
	
	//nl_i->info(); //INFO
		
	RegionSensor *rs = new RegionSensor();
  //nl_i->calcForSelect ("M11", rs);
	nl_i->calcForSelect ("Gebaeude","orthogonallity", rs);	
	nl_i->calcForSelect ("Haus","orthogonallity", rs);	
	nl_i->calcForSelect ("Gebaeude","thickness", rs);	
	nl_i->calcForSelect ("Gebaeude","compactness", rs);	
	nl_i->calcForSelect ("Gebaeude","squareness", rs);	
	nl_i->calcForSelect ("Haus","squareness", rs);	
	nl_i->calcForSelect ("size", rs);
	QDictIterator<Node> it( *nl_i ); //iterator for nodelist
	
	Node* n;
	for (it.toFirst();it.current();++it) { //Gebaeude bewerten
  	n = nl_i->find(it.currentKey());
		if ((n->classname()).compare("Gebaeude") == 0){
			QString *val = new QString("0.0");
			float tmp=0.0;
			float orthogonallity=((*n)["orthogonallity"])->toFloat();
			float compactness=((*n)["compactness"])->toFloat();
			float squareness=((*n)["squareness"])->toFloat();
			int thickness=((*n)["thickness"])->toInt();
			unsigned int size=((*n)["size"])->toUInt();
			if(thickness>=minth && size>=minsize){
			  if(compactness>squareness) tmp=compactness;
			  else tmp=squareness;
			  if(orthogonallity>tmp) tmp=orthogonallity;
			  tmp+=0.25; if(tmp>1.0)tmp=1.0;
			  val->setNum(tmp);
			}
			//if (size>=minsize) val->setNum(0,87654);
		  //cout << "##### " <<": "<< n->name() << " - " << n->classname()<< " - "<<(n->getValue("p"))->toFloat()<<endl;
			n->replace("p", val);
		}
	}

	for (it.toFirst();it.current();++it) { //Haeuser
  	n = nl_i->find(it.currentKey());
		if ((n->classname()).compare("Haus") == 0){
			QString *val = new QString("0.0");
			float tmp=0.0;
// WIN32: warning C4553: '==' : Operator hat keine Auswirkungen; ist '=' beabsichtigt?
//			tmp==((*n)["orthogonallity"])->toFloat();
			tmp=((*n)["orthogonallity"])->toFloat();
			float squareness=((*n)["squareness"])->toFloat();
			if (squareness>tmp) tmp=squareness;
			tmp+=0.25; if(tmp>1.0)tmp=1.0;
		  val->setNum(tmp);
			n->replace("p", val);
		}
	}
		

	for (it.toFirst();it.current();++it) { //Parkplaetze bewerten
  	n = nl_i->find(it.currentKey());
		if ((n->classname()).compare("agriculture") == 0){
			QString *val = new QString("0.0");
			unsigned int size=((*n)["size"])->toUInt();
			if(size>4700){
			  n->replace("p", val);
			}
		}
	}

	nl_i->calcNewGEOValues(gN,gS,gW,gE,newX,newY,xRes,yRes);
	MyList hl;
	it.toFirst();
	while(it.current()) {
		float p;
//<<<<<<< ga_bu_industrie.cpp
// 	  if (!(*it)["p"]) p=0.5;
// 	  else p=(*it)["p"]->toFloat();
//		if(p>0.0000001) {
//		  Help* h = new Help(p,it.currentKey());
//		  hl.append(h);
//		}
//=======
 	  if (!(**it)["p"]) p=(float)0.987;
 	  else p=(**it)["p"]->toFloat();
		Help* h = new Help(p,it.currentKey());
		hl.append(h);
//>>>>>>> 1.6
		++it;
	}
	
	hl.sort();
	newX = int((gE-gW) / xRes);//calculate new image size
	newY = int((gN-gS) / yRes);//calculate new image size
	qDebug("$$$newX: %d, newY: %d, xRes: %f, yRes: %f, gN: %f, gS: %f, gE: %f, gW: %f",
	  newX, newY, xRes, yRes, gN, gS, gE, gW);
	
	QFile fp(argv[2]); // 'XML' - description
  if (!fp.open(IO_WriteOnly)) qDebug("write: file not accesable to %s\n",argv[2]);
  QTextStream str(&fp);
	
	QDict<int> dict( 17, FALSE ); //dictionary for the class nr.
	QArray<NodeInfo*> infolist(nl_i->size()+1); // array of pointers to NodeInfo
	Help *pl;
	int i = 1;
	int helplabel = 0;//, label = 0;
	Image out_img(typeid(signed int),newX,newY,1); //generate out image
#ifdef WIN32
	QArray <int> vec(nl_i->size()+1); 
#else
	int vec[nl_i->size()+1]; 
#endif
	for (int ix=0; ix<nl_i->size()+1; ix++) vec[ix]=0; //info for labeling
	out_img.setGeoCoordinates(gW,gN,gE,gS);
  for ( pl=hl.first(); pl != 0; pl=hl.next() ) {
		Node *node=nl_i->find(pl->cl_name());
		//label = node->id();
		NodeInfo* ni = new NodeInfo(newX, newY);
		ni->id(i);
		ni->cl_name(node->classname());
		ni->name(node->name());
		//cout << "##### " << i <<": "<< node->name() << " - " << node->classname()<<endl;//<<"; p:"<< (node->getValue("p"))->toFloat()<<endl;
	  ni->p((node->getValue("p"))->toFloat());
//	    qDebug("$$§§§§ node->p: %f",node->getValue("p"))->toFloat());
		ni->addr(node->addr());
		
		if(dict.find(node->classname())) //class with nr.
		  ni->classNr(*(dict.find(node->classname())));
		else {
		  int *l = new int(helplabel);
		  dict.insert(node->classname(),l);
		  ni->classNr(helplabel);
		  helplabel++;
		}	
		infolist[i] = ni;
		vec[i]=helplabel;
  	//cout <<"$$$ label:"<<i<<") oldlabel:"<<node->id()<<", helplabel: "<<ni->classNr()<<" - "<<node->filename()<<endl;
		
		Image img(typeid(int));
		img.read(node->filename().latin1());
    img.setGeoCoordinates(node->geoWest(), node->geoNorth(), node->geoEast(), node->geoSouth());
	
	  float np=((*n)["p"])->toFloat();
		if (np>0.00001) out_img.geoMerge(img, node->id(), i);//XX
		i++;
  }
  out_img.write(argv[3]);	


  int x, y, val; //calculate the new position of the label
  ConstIterator pix = out_img.constBegin();
  //for (ConstIterator pix = out_img.constBegin(); pix != out_img.end(); out_img.nextCol(pix)) {
  for (y=0;y<newY;y++)//calculate the new values of the label
    for (x=0;x<newX;x++) {
    val = out_img.getInt(pix);
    if(val>0) {
      (infolist[val])->add(x,y);
    }
    out_img.nextCol(pix);
  }


  float p = 0.0;
  float industrie = 0.0;
  float rest = 0.0;
  int ii = 0;
  for (int j=1; j<i; j++) {
    qDebug("$$$%s %d industrie p:%f",((infolist[j])->name()).latin1(),(infolist[j])->classNr(),(infolist[j])->p());
    p += (infolist[j])->p();
    n = nl_i->find(infolist[j]->addr());
    if ((n->classname()).compare("Gebaeude") == 0 && (infolist[j])->p()>0.0){
      industrie+=float(((*n)["size"])->toInt());
      ii++;
    }
    else rest+=float(((*n)["size"])->toInt());
  }
  if(industrie==0.0) p=0.0; //no house|| all house => shit
  else {
    float faktor=10*industrie/(industrie+rest); if (faktor>1.0)faktor=1.0;
    p=p/(ii);
    //qDebug("$$$ p:%f, faktor:%f =>  p:%f",p,faktor,p*faktor);
    //p*=faktor;
    qDebug("$$$industrie:%f; rest:%f; 3*industrie/(industrie+rest):%f",industrie,rest,industrie/(industrie+rest));
  }
  if (p>1.0) p=1.0;

//cout <<", i:"<< i<<", helplabel:"<<helplabel <<", nl_i->size():"<<nl_i->size() <<endl;
  str << "<group id=\""<<1<<"\" file=\"" << argv[4]
      << "\" p=\"" << QString().sprintf("%f",p) << "\" "
      << "file_geoWest=\"" << QString().sprintf("%f",gW) << "\" "
      << "file_geoNorth=\"" << QString().sprintf("%f",gN) << "\" "
      << "file_geoEast=\"" << QString().sprintf("%f",gE) << "\" "
      << "file_geoSouth=\"" << QString().sprintf("%f",gS) << "\" "
      << ">\n";
 //str << "<group id=\""<<1<<"\" file=\"" << argv[4]<<"\" p=\"" << QString().sprintf("%f",p) << "\">\n";
  if (p>0.0)
    for (int k=0; k<helplabel; k++) {
      for (int j=1; j<i; j++) {
        NodeInfo* ni = infolist[j];
        cout <<j<<" j - i "<<i<<"; nl_i-size "<<nl_i->size()<<endl;
        //if ((ni) && (k==ni->classNr()) && (ni->llx()<=ni->urx()))
         cout <<j<<" j - i "<<i<<", k:"<<k<<" ?==? classNr:"<<ni->classNr()<<"..."
          << ", size:"<<minsize<<" < ni->area:"<<ni->area()<<" "<<ni->cl_name()<<" "<<ni->name()<<endl;
        if ((ni) && (k==ni->classNr()) && (ni->p()>0.0000001))// node exist && correct group && label not overwritten
          if(ni->area()>minsize || (ni->cl_name()=="Haus" && ni->area()>25)){
          Node *node=nl_i->find(ni->addr());
          node->replace("file", new QString(argv[3]));
#ifdef WIN32
//error C2664: 'replace' : Konvertierung des Parameters 2 von 'class QString' in 'const class QString *' nicht moeglich
//Kein benutzerdefinierter Konvertierungsoperator verfuegbar, der diese Konvertierung durchfuehren kann, oder der Operator kann nicht aufgerufen werden
          node->replace("llx", &(new QString)->setNum(ni->llx()));
          node->replace("lly", &(new QString)->setNum(ni->lly()));
          node->replace("urx", &(new QString)->setNum(ni->urx()));
          node->replace("ury", &(new QString)->setNum(ni->ury()));
          node->replace("file_geoNorth",&(new QString)->sprintf("%f",gN));
          node->replace("file_geoSouth",&(new QString)->sprintf("%f",gS));
          node->replace("file_geoEast", &(new QString)->sprintf("%f",gE));
          node->replace("file_geoWest", &(new QString)->sprintf("%f",gW));
          //node->replace("p", &(new QString)->setNum(ni->p()));
          node->replace("id", &(new QString)->setNum(ni->id()));
#else
          node->replace("llx", (new QString)->setNum(ni->llx()));
          node->replace("lly", (new QString)->setNum(ni->lly()));
          node->replace("urx", (new QString)->setNum(ni->urx()));
          node->replace("ury", (new QString)->setNum(ni->ury()));
          node->replace("file_geoNorth",(new QString)->sprintf("%f",gN));
          node->replace("file_geoSouth",(new QString)->sprintf("%f",gS));
          node->replace("file_geoEast", (new QString)->sprintf("%f",gE));
          node->replace("file_geoWest", (new QString)->sprintf("%f",gW));
          //node->replace("p", (new QString)->setNum(ni->p()));
          node->replace("id", (new QString)->setNum(ni->id()));
#endif
          node->write(str);
      }
    }
   }
  str<<"</group>\n";
	fp.close();

  {
    for (Iterator pix = out_img.begin(); pix != out_img.end(); out_img.nextCol(pix)) {
      if (out_img.getInt(pix))
      out_img.set(pix,vec[1]);
      //out_img.set(pix,vec[out_img.getInt(pix)]);
    }
    out_img.write(argv[4]);
  }
	cout << "FIN ... "<<endl;
#ifdef WIN32
	vec.~QArray();
	return (0);
#endif

}
 Help(Help& rval){p_=rval.p(); cl_name_=rval.cl_name();}
示例#18
0
/**
 * Opens the help dialog with a video
 */
void MainWindow::on_actionScribo_Help_triggered()
{
    Help help;
    help.setModal(true);
    help.exec();
}
	bool operator == (Help& lval){return (p_==lval.p());}
	bool operator < (Help& lval){return (p_<lval.p());}
示例#21
0
StartTipDialog::StartTipDialog(QWidget *parent): QDialog(parent)
{
    setAttribute(Qt::WA_DeleteOnClose);
    setModal(false);

    http_getter = new HttpGet();
    connect(http_getter, SIGNAL(done(const QString&)),
            this, SLOT(downloadComplete(const QString&)));

    m_dialog = new Ui::StartTipDialog_q;
    m_dialog->setupUi(this);

    QString pgm = m_dialog->program_name->text();
    m_dialog->program_name->setText(pgm.arg(GENERATION));
    m_dialog->program_version->setText(VERSION);

    QString locale = QLocale::system().name(); //"en_US";
    QStringList paths;
    paths.append(QString(Constants::getResourcesDirectory().c_str()) +
                 "/help/" + locale);
    paths.append(QString(Constants::getResourcesDirectory().c_str()) +
                 "/help/" + "en_US");

    m_dialog->textview->setSearchPaths(paths);
    m_dialog->textview->setOpenLinks(true);
    m_dialog->textview->setOpenExternalLinks(true);

    current_tip = -1;

    // preload tips that come with the package
    
    // we use separate Help() object for the tip of the day becayse it should
    // have different size and should not be persistent
    Help *h = new Help(NULL, "");
    int tip_no = 1;
    while (true)
    {
        QString tip_file;
        tip_file.sprintf("tip%02d.html", tip_no);
        QString contents;
        if (fwbdebug)
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
            qDebug("Trying tip file %s", tip_file.toAscii().constData());
#else
            qDebug("Trying tip file %s", tip_file.toLatin1().constData());
#endif

        QString help_file = h->findHelpFile(tip_file);
        if (!help_file.isEmpty())
        {
            tips.append("file:" + tip_file);
            tip_no++;
        } else
            break;
    }
    delete h;
    current_tip = tips.size() - 1;

    if (fwbdebug) qDebug("Have %d tips", tips.size());

    first_run = st->getBool("UI/FirstRun");
}