pull/2/head
wh201906 5 years ago
parent e09fdf1b9b
commit d2689c333c

@ -12,40 +12,7 @@ MainWindow::MainWindow(QWidget *parent)
mifare=new Mifare; mifare=new Mifare;
connect(pm3,&PM3Process::readyRead,this,&MainWindow::refresh); connect(pm3,&PM3Process::readyRead,this,&MainWindow::refresh);
connect(ui->commandEdit,&QLineEdit::editingFinished,this,&MainWindow::sendMSG); connect(ui->commandEdit,&QLineEdit::editingFinished,this,&MainWindow::sendMSG);
uiInit();
dataModel=new QStandardItemModel;
dataModel->setColumnCount(3);
dataModel->setRowCount(64);
dataModel->setHorizontalHeaderItem(0,new QStandardItem("Sector"));
dataModel->setHorizontalHeaderItem(1,new QStandardItem("Block"));
dataModel->setHorizontalHeaderItem(2,new QStandardItem("Data"));
for(int i=0;i<64;i++)
dataModel->setItem(i,1,new QStandardItem(QString::number(i)));
for(int i=0;i<16;i++)
dataModel->setItem(i*4,0,new QStandardItem(QString::number(i)));
ui->dataView->setModel(dataModel);
ui->dataView->verticalHeader()->setVisible(false);
ui->dataView->setColumnWidth(0,50);
ui->dataView->setColumnWidth(1,40);
ui->dataView->setColumnWidth(2,400);
keyModel=new QStandardItemModel;
keyModel->setColumnCount(3);
keyModel->setRowCount(16);
keyModel->setHorizontalHeaderItem(0,new QStandardItem("Sector"));
keyModel->setHorizontalHeaderItem(1,new QStandardItem("KeyA"));
keyModel->setHorizontalHeaderItem(2,new QStandardItem("KeyB"));
for(int i=0;i<16;i++)
keyModel->setItem(i,0,new QStandardItem(QString::number(i)));
ui->keyView->setModel(keyModel);
ui->keyView->verticalHeader()->setVisible(false);
ui->keyView->setColumnWidth(0,50);
ui->keyView->setColumnWidth(1,200);
ui->keyView->setColumnWidth(2,200);
on_moreFuncCheckBox_stateChanged(0);
on_portButton_clicked();
} }
MainWindow::~MainWindow() MainWindow::~MainWindow()
@ -114,7 +81,7 @@ void MainWindow::on_moreFuncCheckBox_stateChanged(int arg1)
{ {
if(ui->moreFuncCheckBox->isChecked()) if(ui->moreFuncCheckBox->isChecked())
{ {
ui->CMDTreeView->setVisible(true); ui->CMDTreeWidget->setVisible(true);
ui->CMDTreeLabel->setVisible(true); ui->CMDTreeLabel->setVisible(true);
ui->CMDHistoryWidget->setVisible(true); ui->CMDHistoryWidget->setVisible(true);
ui->CMDHistoryLabel->setVisible(true); ui->CMDHistoryLabel->setVisible(true);
@ -122,7 +89,7 @@ void MainWindow::on_moreFuncCheckBox_stateChanged(int arg1)
} }
else else
{ {
ui->CMDTreeView->setVisible(false); ui->CMDTreeWidget->setVisible(false);
ui->CMDTreeLabel->setVisible(false); ui->CMDTreeLabel->setVisible(false);
ui->CMDHistoryWidget->setVisible(false); ui->CMDHistoryWidget->setVisible(false);
ui->CMDHistoryLabel->setVisible(false); ui->CMDHistoryLabel->setVisible(false);
@ -140,3 +107,35 @@ void MainWindow::on_CMDHistoryWidget_itemDoubleClicked(QListWidgetItem *item)
ui->commandEdit->setText(item->text()); ui->commandEdit->setText(item->text());
ui->commandEdit->setFocus(); ui->commandEdit->setFocus();
} }
void MainWindow::uiInit()
{
ui->MFDataWidget->setColumnCount(3);
ui->MFDataWidget->setRowCount(64);
ui->MFDataWidget->setHorizontalHeaderItem(0,new QTableWidgetItem("Sector"));
ui->MFDataWidget->setHorizontalHeaderItem(1,new QTableWidgetItem("Block"));
ui->MFDataWidget->setHorizontalHeaderItem(2,new QTableWidgetItem("Data"));
for(int i=0;i<64;i++)
ui->MFDataWidget->setItem(i,1,new QTableWidgetItem(QString::number(i)));
for(int i=0;i<16;i++)
ui->MFDataWidget->setItem(i*4,0,new QTableWidgetItem(QString::number(i)));
ui->MFDataWidget->verticalHeader()->setVisible(false);
ui->MFDataWidget->setColumnWidth(0,50);
ui->MFDataWidget->setColumnWidth(1,40);
ui->MFDataWidget->setColumnWidth(2,400);
ui->MFKeyWidget->setColumnCount(3);
ui->MFKeyWidget->setRowCount(16);
ui->MFKeyWidget->setHorizontalHeaderItem(0,new QTableWidgetItem("Sector"));
ui->MFKeyWidget->setHorizontalHeaderItem(1,new QTableWidgetItem("KeyA"));
ui->MFKeyWidget->setHorizontalHeaderItem(2,new QTableWidgetItem("KeyB"));
for(int i=0;i<16;i++)
ui->MFKeyWidget->setItem(i,0,new QTableWidgetItem(QString::number(i)));
ui->MFKeyWidget->verticalHeader()->setVisible(false);
ui->MFKeyWidget->setColumnWidth(0,50);
ui->MFKeyWidget->setColumnWidth(1,200);
ui->MFKeyWidget->setColumnWidth(2,200);
on_moreFuncCheckBox_stateChanged(0);
on_portButton_clicked();
}

@ -5,7 +5,6 @@
#include <QProcess> #include <QProcess>
#include <QDebug> #include <QDebug>
#include <QMessageBox> #include <QMessageBox>
#include <QStandardItemModel>
#include <QListWidgetItem> #include <QListWidgetItem>
#include "pm3process.h" #include "pm3process.h"
#include "mifare.h" #include "mifare.h"
@ -46,7 +45,6 @@ private:
Ui::MainWindow *ui; Ui::MainWindow *ui;
PM3Process* pm3; PM3Process* pm3;
Mifare* mifare; Mifare* mifare;
QStandardItemModel* dataModel; void uiInit();
QStandardItemModel* keyModel;
}; };
#endif // MAINWINDOW_H #endif // MAINWINDOW_H

@ -218,13 +218,13 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>520</width> <width>651</width>
<height>194</height> <height>271</height>
</rect> </rect>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<item> <item>
<widget class="QTableView" name="dataView"> <widget class="QTableWidget" name="MFDataWidget">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding"> <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>2</horstretch> <horstretch>2</horstretch>
@ -240,7 +240,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QTableView" name="keyView"> <widget class="QTableWidget" name="MFKeyWidget">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding"> <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>1</horstretch> <horstretch>1</horstretch>
@ -294,13 +294,21 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QTreeView" name="CMDTreeView"> <widget class="QTreeWidget" name="CMDTreeWidget">
<property name="sizePolicy"> <property name="minimumSize">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding"> <size>
<horstretch>1</horstretch> <width>1</width>
<verstretch>0</verstretch> <height>0</height>
</sizepolicy> </size>
</property>
<property name="columnCount">
<number>1</number>
</property> </property>
<column>
<property name="text">
<string>1</string>
</property>
</column>
</widget> </widget>
</item> </item>
<item> <item>

Loading…
Cancel
Save