Commit 7e5a2d33 authored by mbriand's avatar mbriand

Possibilité de spécifier le nombre de tickets par carnet en paramètre

parent 9aad3e66
Simon Lopez <simon DOT lopez AT ayolo DOT org>
Mathieu Briand <briandmathieu AT hyprua DOT org>
......@@ -6,6 +6,10 @@ int main(int argc, char ** argv)
{
QApplication app( argc, argv );
VenteTickets win;
if (argc > 1)
win.setUniteCarnet(atoi(argv[1]));
win.show();
app.connect( &app, SIGNAL( lastWindowClosed() ), &app, SLOT( quit() ) );
return app.exec();
......
......@@ -33,6 +33,8 @@ VenteTickets::VenteTickets( QWidget * parent, Qt::WFlags f)
ticketImg=ticketImg.scaledToWidth(Printer.pageRect().width()/2,
Qt::SmoothTransformation);
this->setUniteCarnet(10);
/* Connect signals */
SigConnect();
}
......@@ -46,8 +48,8 @@ void VenteTickets::SigConnect()
connect(actionEventName,SIGNAL(activated()),this,SLOT(SetEventName()));
connect(actionA_propos,SIGNAL(activated()),this,SLOT(About()));
connect(actionImprimante,SIGNAL(activated()),this,SLOT(SelectPrinter()));
connect(vente10, SIGNAL( released() ), this, SLOT(Print10()));
connect(vente20, SIGNAL( released() ), this, SLOT(Print20()));
connect(vente1, SIGNAL( released() ), this, SLOT(Print1()));
connect(vente2, SIGNAL( released() ), this, SLOT(Print2()));
}
/**
......@@ -140,6 +142,7 @@ void VenteTickets::About()
about += QString::fromUtf8("<h4>Développeur(s) :</h4>");
about += "<ul>";
about += "<li> Simon Lopez";
about += "<li> Mathieu Briand";
about += "</ul>";
about += QString::fromUtf8("<h4>Basé sur </h4>");
about += "Qt ";
......@@ -185,19 +188,19 @@ bool VenteTickets::SetPrinterInfo(QString name)
/**
* Print 10 tickets
*/
void VenteTickets::Print10()
void VenteTickets::Print1()
{
lcd10tik->display(lcd10tik->intValue()+1);
Print(10);
lcd1tik->display(lcd1tik->intValue()+1);
Print(uniteCarnet);
}
/**
* Print 20 tickets
*/
void VenteTickets::Print20()
void VenteTickets::Print2()
{
lcd20tik->display(lcd20tik->intValue()+1);
Print(20);
lcd2tik->display(lcd2tik->intValue()+1);
Print(2*uniteCarnet);
}
/**
......@@ -253,3 +256,20 @@ void VenteTickets::Print(int nb)
Painter.end();
}
void VenteTickets::setUniteCarnet(int unite)
{
QString str;
uniteCarnet = unite;
str = QString("Carnet de ").append(QString::number(uniteCarnet)).append(" tickets :");
tik1label->setText(str);
str = QString("Carnet de ").append(QString::number(2 * uniteCarnet)).append(" tickets :");
tik2label->setText(str);
str = QString::number(uniteCarnet).append(" tickets");
vente1->setText(str);
str = QString::number(2 * uniteCarnet).append(" tickets");
vente2->setText(str);
}
......@@ -11,11 +11,13 @@ class VenteTickets : public QMainWindow, public Ui::MainWindow
{
Q_OBJECT
public:
VenteTickets( QWidget * parent = 0, Qt::WFlags f = 0 );
VenteTickets( QWidget * parent = 0, Qt::WFlags f = 0);
void setUniteCarnet(int unite);
private:
QString EventName;
QPrinter Printer;
QImage ticketImg;
int uniteCarnet;
void SigConnect();
bool SetPrinterInfo(QString name);
void Print(int nb);
......@@ -26,8 +28,8 @@ private slots:
void About();
void Load_image();
void SelectPrinter();
void Print10();
void Print20();
void Print1();
void Print2();
};
#endif
......
......@@ -35,7 +35,7 @@
<height>331</height>
</rect>
</property>
<widget class="QPushButton" name="vente10" >
<widget class="QPushButton" name="vente1" >
<property name="geometry" >
<rect>
<x>50</x>
......@@ -50,10 +50,10 @@
</font>
</property>
<property name="text" >
<string>10 tickets</string>
<string>tickets 1</string>
</property>
</widget>
<widget class="QPushButton" name="vente20" >
<widget class="QPushButton" name="vente2" >
<property name="geometry" >
<rect>
<x>370</x>
......@@ -68,7 +68,7 @@
</font>
</property>
<property name="text" >
<string>20 tickets</string>
<string>tickets 2</string>
</property>
</widget>
<widget class="QGroupBox" name="Stats" >
......@@ -83,7 +83,7 @@
<property name="title" >
<string>Statistiques</string>
</property>
<widget class="QLabel" name="tik10label" >
<widget class="QLabel" name="tik1label" >
<property name="geometry" >
<rect>
<x>10</x>
......@@ -98,10 +98,10 @@
</font>
</property>
<property name="text" >
<string>Carnets de 10 tickets :</string>
<string>Carnets de tickets 1 :</string>
</property>
</widget>
<widget class="QLCDNumber" name="lcd10tik" >
<widget class="QLCDNumber" name="lcd1tik" >
<property name="geometry" >
<rect>
<x>220</x>
......@@ -537,7 +537,7 @@
<bool>false</bool>
</property>
</widget>
<widget class="QLCDNumber" name="lcd20tik" >
<widget class="QLCDNumber" name="lcd2tik" >
<property name="geometry" >
<rect>
<x>220</x>
......@@ -970,7 +970,7 @@
</font>
</property>
</widget>
<widget class="QLabel" name="tik20label" >
<widget class="QLabel" name="tik2label" >
<property name="geometry" >
<rect>
<x>10</x>
......@@ -985,7 +985,7 @@
</font>
</property>
<property name="text" >
<string>Carnets de 20 tickets :</string>
<string>Carnets de tickets 2 :</string>
</property>
</widget>
</widget>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment