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 "mainwindow.h"
#include "ui_mainwindow.h" #include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) MainWindow::MainWindow(QWidget *parent)
@ -41,6 +43,9 @@ MainWindow::MainWindow(QWidget *parent)
ui->keyView->setColumnWidth(0,50); ui->keyView->setColumnWidth(0,50);
ui->keyView->setColumnWidth(1,200); ui->keyView->setColumnWidth(1,200);
ui->keyView->setColumnWidth(2,200); ui->keyView->setColumnWidth(2,200);
on_moreFuncCheckBox_stateChanged(0);
on_portButton_clicked();
} }
MainWindow::~MainWindow() MainWindow::~MainWindow()
@ -60,6 +65,8 @@ void MainWindow::on_connectButton_clicked()
void MainWindow::on_sendButton_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()); qDebug()<<(ui->commandEdit->text().toLocal8Bit());
pm3->write((ui->commandEdit->text()+"\r\n").toLocal8Bit()); pm3->write((ui->commandEdit->text()+"\r\n").toLocal8Bit());
pm3->waitForBytesWritten(3000); pm3->waitForBytesWritten(3000);
@ -102,3 +109,34 @@ void MainWindow::on_portButton_clicked()
ui->portBox->addItem(port); 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 <QDebug>
#include <QMessageBox> #include <QMessageBox>
#include <QStandardItemModel> #include <QStandardItemModel>
#include <QListWidgetItem>
#include "pm3process.h" #include "pm3process.h"
#include "mifare.h" #include "mifare.h"
@ -35,6 +36,12 @@ private slots:
void sendMSG(); void sendMSG();
void on_portButton_clicked(); void on_portButton_clicked();
void on_moreFuncCheckBox_stateChanged(int arg1);
void on_clearHistoryButton_clicked();
void on_CMDHistoryWidget_itemDoubleClicked(QListWidgetItem *item);
private: private:
Ui::MainWindow *ui; Ui::MainWindow *ui;
PM3Process* pm3; PM3Process* pm3;

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1038</width> <width>881</width>
<height>758</height> <height>656</height>
</rect> </rect>
</property> </property>
<property name="minimumSize"> <property name="minimumSize">
@ -42,7 +42,7 @@
<item> <item>
<widget class="QLineEdit" name="PM3PathEdit"> <widget class="QLineEdit" name="PM3PathEdit">
<property name="text"> <property name="text">
<string>proxmark3</string> <string>E:\Documents\source\qt\pm3\win64\proxmark3</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -81,7 +81,7 @@
</sizepolicy> </sizepolicy>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>1</number>
</property> </property>
<widget class="QWidget" name="mifareTab"> <widget class="QWidget" name="mifareTab">
<attribute name="title"> <attribute name="title">
@ -213,7 +213,15 @@
</item> </item>
</layout> </layout>
</widget> </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"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<item> <item>
<widget class="QTableView" name="dataView"> <widget class="QTableView" name="dataView">
@ -254,19 +262,93 @@
<attribute name="title"> <attribute name="title">
<string>RawCommand</string> <string>RawCommand</string>
</attribute> </attribute>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout_4">
<item> <item>
<widget class="QPlainTextEdit" name="outputEdit"> <layout class="QHBoxLayout" name="horizontalLayout_6">
<property name="verticalScrollBarPolicy"> <item>
<enum>Qt::ScrollBarAlwaysOn</enum> <widget class="QPlainTextEdit" name="outputEdit">
</property> <property name="sizePolicy">
<property name="sizeAdjustPolicy"> <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<enum>QAbstractScrollArea::AdjustIgnored</enum> <horstretch>2</horstretch>
</property> <verstretch>0</verstretch>
<property name="readOnly"> </sizepolicy>
<bool>true</bool> </property>
</property> <property name="verticalScrollBarPolicy">
</widget> <enum>Qt::ScrollBarAlwaysOn</enum>
</property>
<property name="sizeAdjustPolicy">
<enum>QAbstractScrollArea::AdjustIgnored</enum>
</property>
<property name="readOnly">
<bool>true</bool>
</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>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_3"> <layout class="QHBoxLayout" name="horizontalLayout_3">
@ -303,7 +385,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1038</width> <width>881</width>
<height>22</height> <height>22</height>
</rect> </rect>
</property> </property>

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

Loading…
Cancel
Save