Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

bugs fixed

  • Loading branch information...
commit ee5711ea2969b7a4ec65f7d2d0842daaf86283d6 1 parent a17d379
@ranxian authored
View
2  Headers/qt/emulator.h
@@ -9,6 +9,7 @@
#include "floor.h"
#include "elevator.h"
#include <QLabel>
+#include <QLineEdit>
class Emulator : public QWidget
{
@@ -74,6 +75,7 @@ private slots:
QPushButton *scan;
QPushButton *costflow;
QPushButton *pickup;
+ QPushButton *reload;
protected: /* Below is QWidget API */
void timerEvent(QTimerEvent*);
View
2  Sources/elevator.cpp
@@ -163,7 +163,7 @@ void Elevator::Letin(int dirCode) {
int Elevator::AverThrput() {
if (Emulator::dual == 0) return -1;
- return (throughput * 3600) / (Emulator::dual * Emulator::UNIT_TIME);
+ return (throughput * 3600) / Emulator::dual;
}
int Elevator::Get_capacity() {
View
2  Sources/main.cpp
@@ -45,7 +45,7 @@ int main(int argc, char *argv[])
/* Set runtime parameters */
Emulator::nFloor = 10;
- Emulator::lambda = 0.0005;
+ Emulator::lambda = 0.003;
Emulator::nElevator = 10;
Emulator::elevatorType = "fcfs";
View
27 Sources/qt/emulator.cpp
@@ -8,6 +8,7 @@
#include <QGridLayout>
#include <QPainter>
#include <QKeyEvent>
+#include <QSound>
/* 构造函数:构造 Qt 界面 */
Emulator::Emulator(QWidget* parent) : QWidget(parent) {
@@ -78,9 +79,13 @@ Emulator::Emulator(QWidget* parent) : QWidget(parent) {
connect(scan, SIGNAL(clicked()), this, SLOT(useScan()));
connect(costflow, SIGNAL(clicked()), this, SLOT(useCostflow()));
connect(pickup, SIGNAL(clicked()), this, SLOT(usePickup()));
-
timer = 0;
-
+
+// QSound *sound = new QSound("../../Muisc/style.mp3", this);
+// sound->play();
+
+ QSound *style = new QSound("style.mp3", this);
+ style->play();
startTimer(10);
}
@@ -195,12 +200,12 @@ void Emulator::paintEvent(QPaintEvent *event)
/* 打印统计数据 */
nEle->setText (QString::number(nElevator));
nPas->setText (QString::number(Passenger::Total()));
- avWt->setText (QString::number(Passenger::AverWaitTime()));
- avDur->setText(QString::number(Passenger::AverDuration()));
- mxWt->setText (QString::number(Passenger::MaxWaitTime()));
- mxDur->setText(QString::number(Passenger::MaxDuration()));
- mnDur->setText(QString::number(Passenger::MinDuration()));
- avThr->setText(QString::number(Elevator::AverThrput()));
+ avWt->setText (QString::number(Passenger::AverWaitTime()) + "s");
+ avDur->setText(QString::number(Passenger::AverDuration()) + "s");
+ mxWt->setText (QString::number(Passenger::MaxWaitTime()) + "s");
+ mxDur->setText(QString::number(Passenger::MaxDuration()) + "s");
+ mnDur->setText(QString::number(Passenger::MinDuration()) + "s");
+ avThr->setText(QString::number(Elevator::AverThrput()) + "/h");
}
/* Qt::键盘响应事件映射 */
@@ -311,7 +316,8 @@ void Emulator::Reset() {
floors[i].upOrder = floors[i].downOrder = NULL;
}
- Passenger::maxDuration = Passenger::maxWaitTime = Passenger::nCompleteDuration = 0;
+ Passenger::maxDuration = Passenger::maxWaitTime = Passenger::nCompleteDuration = Passenger::total = Passenger::totalWaitTime =
+ Passenger::totalDuration = 0;
Passenger::minDuration = INT_MAX;
Passenger::minWaitTime = INT_MAX;
@@ -335,5 +341,4 @@ void Emulator::useCostflow() {
void Emulator::usePickup() {
Reset();
elevatorType = "pickup";
-}
-
+}
Please sign in to comment.
Something went wrong with that request. Please try again.