add command history

pull/2/head
wh201906 5 years ago
parent 643c298662
commit e09fdf1b9b

@ -1,4 +1,6 @@
#include "mainwindow.h"
#include "mainwindow.h"
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent)
@ -41,6 +43,9 @@ MainWindow::MainWindow(QWidget *parent)
ui->keyView->setColumnWidth(0,50);
ui->keyView->setColumnWidth(1,200);
ui->keyView->setColumnWidth(2,200);
on_moreFuncCheckBox_stateChanged(0);
on_portButton_clicked();
}
MainWindow::~MainWindow()
@ -60,6 +65,8 @@ void MainWindow::on_connectButton_clicked()
void MainWindow::on_sendButton_clicked()
{
if(ui->CMDHistoryWidget->count()==0 || ui->CMDHistoryWidget->item(ui->CMDHistoryWidget->count()-1)->text()!=ui->commandEdit->text())
ui->CMDHistoryWidget->addItem(ui->commandEdit->text());
qDebug()<<(ui->commandEdit->text().toLocal8Bit());
pm3->write((ui->commandEdit->text()+"\r\n").toLocal8Bit());
pm3->waitForBytesWritten(3000);
@ -102,3 +109,34 @@ void MainWindow::on_portButton_clicked()
ui->portBox->addItem(port);
}
}
void MainWindow::on_moreFuncCheckBox_stateChanged(int arg1)
{
if(ui->moreFuncCheckBox->isChecked())
{
ui->CMDTreeView->setVisible(true);
ui->CMDTreeLabel->setVisible(true);
ui->CMDHistoryWidget->setVisible(true);
ui->CMDHistoryLabel->setVisible(true);
ui->clearHistoryButton->setVisible(true);
}
else
{
ui->CMDTreeView->setVisible(false);
ui->CMDTreeLabel->setVisible(false);
ui->CMDHistoryWidget->setVisible(false);
ui->CMDHistoryLabel->setVisible(false);
ui->clearHistoryButton->setVisible(false);
}
}
void MainWindow::on_clearHistoryButton_clicked()
{
ui->CMDHistoryWidget->clear();
}
void MainWindow::on_CMDHistoryWidget_itemDoubleClicked(QListWidgetItem *item)
{
ui->commandEdit->setText(item->text());
ui->commandEdit->setFocus();
}

@ -6,6 +6,7 @@
#include <QDebug>
#include <QMessageBox>
#include <QStandardItemModel>
#include <QListWidgetItem>
#include "pm3process.h"
#include "mifare.h"
@ -35,6 +36,12 @@ private slots:
void sendMSG();
void on_portButton_clicked();
void on_moreFuncCheckBox_stateChanged(int arg1);
void on_clearHistoryButton_clicked();
void on_CMDHistoryWidget_itemDoubleClicked(QListWidgetItem *item);
private:
Ui::MainWindow *ui;
PM3Process* pm3;

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>1038</width>
<height>758</height>
<width>881</width>
<height>656</height>
</rect>
</property>
<property name="minimumSize">
@ -42,7 +42,7 @@
<item>
<widget class="QLineEdit" name="PM3PathEdit">
<property name="text">
<string>proxmark3</string>
<string>E:\Documents\source\qt\pm3\win64\proxmark3</string>
</property>
</widget>
</item>
@ -81,7 +81,7 @@
</sizepolicy>
</property>
<property name="currentIndex">
<number>0</number>
<number>1</number>
</property>
<widget class="QWidget" name="mifareTab">
<attribute name="title">
@ -213,7 +213,15 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="">
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>520</width>
<height>194</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QTableView" name="dataView">
@ -254,9 +262,17 @@
<attribute name="title">
<string>RawCommand</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout">
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QPlainTextEdit" name="outputEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>2</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOn</enum>
</property>
@ -268,6 +284,72 @@
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QLabel" name="CMDTreeLabel">
<property name="text">
<string>Command List:</string>
</property>
</widget>
</item>
<item>
<widget class="QTreeView" name="CMDTreeView">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="CMDHistoryLabel">
<property name="text">
<string>History:</string>
</property>
</widget>
</item>
<item>
<widget class="QListWidget" name="CMDHistoryWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="clearHistoryButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>ClearHistory</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="moreFuncCheckBox">
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="sizeConstraint">
@ -303,7 +385,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>1038</width>
<width>881</width>
<height>22</height>
</rect>
</property>

@ -11,6 +11,9 @@ void Mifare::processData(const QString str)
if(isProcessingData)
{
if(inputType==FROM_RDBL)
{
}
}
}
void Mifare::processKey(const QString str)

Loading…
Cancel
Save