1 |
2 |
peteralieb |
package edu.byu.cc.plieber.fpgaenet.modmod;
|
2 |
|
|
import com.trolltech.qt.core.Qt;
|
3 |
|
|
import com.trolltech.qt.gui.*;
|
4 |
|
|
|
5 |
|
|
import edu.byu.cc.plieber.fpgaenet.fcp.FCPProtocol;
|
6 |
|
|
|
7 |
|
|
public class StaticModulesWidget extends QWidget{
|
8 |
|
|
|
9 |
|
|
public static void main(String[] args) {
|
10 |
|
|
QApplication.initialize(args);
|
11 |
|
|
|
12 |
|
|
StaticModulesWidget testStaticModulesWidget = new StaticModulesWidget(null, null);
|
13 |
|
|
testStaticModulesWidget.show();
|
14 |
|
|
|
15 |
|
|
QApplication.exec();
|
16 |
|
|
}
|
17 |
|
|
|
18 |
|
|
private FCPProtocol fcpprotocol;
|
19 |
|
|
|
20 |
|
|
public StaticModulesWidget(QWidget parent, FCPProtocol protocol){
|
21 |
|
|
super(parent);
|
22 |
|
|
fcpprotocol = protocol;
|
23 |
|
|
createWidgets();
|
24 |
|
|
createLayout();
|
25 |
|
|
connectSignalsAndSlots();
|
26 |
|
|
}
|
27 |
|
|
|
28 |
|
|
private QLabel labelStaticModules = new QLabel("Static Module Control");
|
29 |
|
|
private QLabel labelLEDValue = new QLabel("LED Value:");
|
30 |
|
|
private QLabel labelDIPValue = new QLabel("DIP Value:");
|
31 |
|
|
private QLabel labelClockControl = new QLabel("Clock Control");
|
32 |
|
|
private QLabel labelStepClock = new QLabel("Step Clock:");
|
33 |
|
|
|
34 |
|
|
private QPushButton btnSetLED = new QPushButton("Set LED");
|
35 |
|
|
private QPushButton btnGetDIP = new QPushButton("Get DIP");
|
36 |
|
|
private QPushButton btnStep = new QPushButton("Step");
|
37 |
|
|
private QPushButton btnSingleStep = new QPushButton("Single Step");
|
38 |
|
|
private QPushButton btnCCReset = new QPushButton("Reset");
|
39 |
|
|
|
40 |
|
|
private QLineEdit txtLEDValue = new QLineEdit();
|
41 |
|
|
private QLineEdit txtDIPValue = new QLineEdit();
|
42 |
|
|
private QLineEdit txtNumCycles = new QLineEdit();
|
43 |
|
|
|
44 |
|
|
private void createWidgets() {
|
45 |
|
|
labelStaticModules.font().setPointSize(labelStaticModules.font().pointSize()+2);
|
46 |
|
|
labelLEDValue.setAlignment(Qt.AlignmentFlag.AlignRight);
|
47 |
|
|
labelDIPValue.setAlignment(Qt.AlignmentFlag.AlignRight);
|
48 |
|
|
labelStepClock.setAlignment(Qt.AlignmentFlag.AlignRight);
|
49 |
|
|
labelClockControl.font().setPointSize(labelClockControl.font().pointSize()+2);
|
50 |
|
|
}
|
51 |
|
|
|
52 |
|
|
private void createLayout() {
|
53 |
|
|
QVBoxLayout mainLayout = new QVBoxLayout(this);
|
54 |
|
|
QGridLayout leddipLayout = new QGridLayout();
|
55 |
|
|
QGridLayout clockControlLayout = new QGridLayout();
|
56 |
|
|
|
57 |
|
|
leddipLayout.setColumnMinimumWidth(0, 20);
|
58 |
|
|
//leddipLayout.setColumnMinimumWidth(3, 20);
|
59 |
|
|
leddipLayout.setColumnStretch(2, 1);
|
60 |
|
|
leddipLayout.addWidget(labelLEDValue, 0, 1);
|
61 |
|
|
leddipLayout.addWidget(txtLEDValue, 0, 2);
|
62 |
|
|
leddipLayout.addWidget(btnSetLED, 0, 3);
|
63 |
|
|
leddipLayout.addWidget(labelDIPValue, 1, 1);
|
64 |
|
|
leddipLayout.addWidget(btnGetDIP, 1, 3);
|
65 |
|
|
leddipLayout.addWidget(txtDIPValue, 1, 2);
|
66 |
|
|
|
67 |
|
|
clockControlLayout.setColumnMinimumWidth(0, 20);
|
68 |
|
|
//clockControlLayout.setColumnMinimumWidth(3, 20);
|
69 |
|
|
clockControlLayout.setColumnStretch(2, 1);
|
70 |
|
|
clockControlLayout.addWidget(labelStepClock, 0, 1);
|
71 |
|
|
clockControlLayout.addWidget(txtNumCycles, 0, 2);
|
72 |
|
|
clockControlLayout.addWidget(btnStep, 0, 3);
|
73 |
|
|
clockControlLayout.addWidget(btnSingleStep, 1, 1);
|
74 |
|
|
clockControlLayout.addWidget(btnCCReset, 1, 3);
|
75 |
|
|
|
76 |
|
|
mainLayout.addWidget(labelStaticModules);
|
77 |
|
|
mainLayout.addLayout(leddipLayout);
|
78 |
|
|
mainLayout.addWidget(labelClockControl);
|
79 |
|
|
mainLayout.addLayout(clockControlLayout);
|
80 |
|
|
mainLayout.addStretch();
|
81 |
|
|
}
|
82 |
|
|
|
83 |
|
|
private void connectSignalsAndSlots() {
|
84 |
|
|
|
85 |
|
|
}
|
86 |
|
|
}
|