Esempio n. 1
0
void CounterInterface::connections()
{
    connect(DSBValueProduct, SIGNAL(valueChanged(double)), SLOT(valueChanged_DSBValueProduct(double)));

    connect(this, SIGNAL(setInput()), wPizzaMixed, SLOT(input()));

    connect(this, SIGNAL(setInput()), wPaymentView, SLOT(input()));

    connect(lPizza, SIGNAL(onClick()), SLOT(onClick_lPizza()));

    connect(wPaymentView, SIGNAL(save()), SLOT(onClick_pbSaveOrdered()));

    connect(wPaymentView, SIGNAL(clear()), SLOT(onClick_pbClearOrdered()));

    connect(wPaymentView, SIGNAL(cancel()), SLOT(onClick_pbCancelOrdered()));

    connect(wPaymentView, SIGNAL(pizza()), SLOT(onClick_lPizza()));

    connect(wPizzaMixed, SIGNAL(emitPizzaMista(QList<int>,QList<QString>,QList<QString>,QString,int,double,QString,bool,int)), this, SLOT(slotPizzaMista(QList<int>,QList<QString>,QList<QString>,QString,int,double,QString,bool,int)));

    connect(searchProduct, SIGNAL(textSearch(QString)), SLOT(getSearchProduct(QString)));

    connect(pbConfirmProduct, SIGNAL(clicked()), SLOT(onClick_pbConfirmProduct()));

    connect(pbLeaveProduct, SIGNAL(clicked()), SLOT(onClick_pbLeaveProduct()));

    connect(tableItem, SIGNAL(doubleClicked(QModelIndex)), SLOT(doubleClicked_tableItem(QModelIndex)));

    connect(this, SIGNAL(editPizzaMixed(QList<int>,QList<QString>,QList<QString>,QString,int,double,QString,int)), wPizzaMixed, SLOT(editPizzaMixed(QList<int>,QList<QString>,QList<QString>,QString,int,double,QString,int)));

    connect(sbAmount, SIGNAL(valueChanged(int)), SLOT(valueChanged_sbAmount(int)));

    connect(cbSize, SIGNAL(currentIndexChanged(int)), SLOT(currentIndexChanged_cbSize(int)));

    connect(pbRemoveItem, SIGNAL(clicked()), SLOT(onClick_pbRemoveItem()));

    connect(pbClearOrdered, SIGNAL(clicked()), SLOT(onClick_pbClearOrdered()));

    connect(pbCancelOrdered, SIGNAL(clicked()), SLOT(onClick_pbCancelOrdered()));

    connect(pbSaveOrdered, SIGNAL(clicked()), SLOT(onClick_pbSaveOrdered()));

    connect(actionName,SIGNAL(triggered()),SLOT(onTriggered_actionName()));

    connect(actionNickName,SIGNAL(triggered()),SLOT(onTriggered_actionNickName()));

    connect(wPaymentView->order, SIGNAL(loadComplete()), SLOT(loadDataOrder()));

    connect(sbAmount, SIGNAL(returnPressed()), SLOT(onClick_pbConfirmProduct()));
}
                std::auto_ptr< Pizza > createPizza(std::string item) const {
                    std::auto_ptr< Pizza > pizza(0);
                    PizzaIngredientFactory* ingredientFactory = new NYPizzaIngredientFactory();

                    if (item.compare("cheese") == 0) {
                        pizza = std::auto_ptr< Pizza >(new CheesePizza(ingredientFactory));
                        pizza->setName("New York Style Cheese Pizza");
                    } else if (item.compare("veggie") == 0) {
                        pizza = std::auto_ptr< Pizza >(new VeggiePizza(ingredientFactory));
                        pizza->setName("New York Style Veggie Pizza");
                    } else if (item.compare("clam") == 0) {
                        pizza = std::auto_ptr< Pizza >(new ClamPizza(ingredientFactory));
                        pizza->setName("New York Style Clam Pizza");
                    } else if (item.compare("pepperoni") == 0) {
                        pizza = std::auto_ptr< Pizza >(new PepperoniPizza(ingredientFactory));
                        pizza->setName("New York Style Pepperoni Pizza");
                    }

                    return pizza;
                }
void testRun(void) {
	Reception firstReception(1, 1, 1);

	firstReception.run();
	if (UnitTests::isNotEqual((int)firstReception.getOrders().size(), 0)) {
		printError("Run method have not right number of orders at start");
	}

	if (UnitTests::isNotEqual((int)firstReception.getKitchens()->size(), 0)) {
		printError("Run method have not right number of kitchens at start");
	}

	Reception secondReception(1, 1, 1);
	Pizza pizza(Regina, XL);

	secondReception.push(pizza);
	secondReception.run();

	if (UnitTests::isNotEqual((int)secondReception.getOrders().size(), 0)) {
		printError("Run method is not popping an order");
	}

	if (UnitTests::isNotEqual((int)secondReception.getKitchens()->size(), 1)) {
		printError("Run method is not creating a Kitchen like expected");
	}

	secondReception.push(pizza);
	secondReception.run();

	if (UnitTests::isNotEqual((int)secondReception.getOrders().size(), 0)) {
		printError("Run method is not popping an order");
	}

	if (UnitTests::isNotEqual((int)secondReception.getKitchens()->size(), 1)) {
		printError("Run method is creating an new kitchen even if she can takes the order");
	}	
}
Esempio n. 4
0
int main(int argc, char *argv[]) {
	 		 if(argc == 2) {//Testando se os parâmetros de entradas são do tipo .json
	 		  char kind[8];
	 		  char  s2[] = {".json"};

	 		  type(argv[1],kind);

	 		  int result = compare(kind, s2);

	 		 if(result != 0) {
	 		  printf("Argumento passado não é do tipo .json!\n");	

	 		  return 0;
	  }
}
	 		 else if(argc > 2) {
	 		  printf("Mais argumentos do que o necessário!\nPor favor, insira somente um argumento do tipo .json!\n");

	 		  return 0;
}	
	 		 else if(argc < 2) {
	 		  printf("Menos argumentos do que o necessário!\nPor favor, insira um argumento do tipo .json!\n");

			  return 0;
}
			  Chart * chart = ChartCreate(argv[1]);
			  Drawer * cairo = DrawerInit(800, 600, chart->fileType, chart->filePath);
	
			  int num_elementos = chart->DatumSize;//Declarando o número de elementos do Datum
	
				 float aux[num_elementos];
				 int cont3;
 
				for(cont3 = 0; cont3 < num_elementos; cont3++) {
					aux[cont3] = chart->content[cont3]->percentage;
				}  			  


		Title title = {
		    
		    30.0,//Fonte do Título
		    chart->chartName,//String que provém o título
		    {0.0,0.0,0.0,1.0}//Cor do Título
};
		Rectangle base = {
		    
		    0, //x
		    0, //y
		    800, //width
		    600, //height
		    0.0, // borderWidth
		   {1.0, 1.0, 1.0, 1.0},// Color Bg
		   {0.0, 0.0, 0.0, 0.0}// Color border (borderless)
};
		
		DrawerDrawRectangle(cairo, base);
		Rectangle baseBg = {
		    
		    10, //x
		    10, //y
		    780, //width
		    580, //height
		    1.0, // borderWidth
		   {0.9,0.9, 0.9, 1.0},// Color Bg
		   {0.3, 0.3, 0.3, 1.0}// Color border (borderless)
};
		DrawerDrawRectangle(cairo, baseBg);
		DrawerDrawTextTitle(cairo, title, base);

		    if(strcmp(chart->chartType,"pizza") == 0) {//Se for Pizza
		     
		     pizza(cairo, chart, base);
	
		   }else if(strcmp(chart->chartType,"bars") == 0){//Se for Barras
		    
			  barra(cairo,chart, base, aux);
}
			  DrawerSave(cairo, chart->fileType, chart->filePath);
			  DrawerDestroy(cairo);

		return 0;
}