mirror of
https://github.com/wh201906/Proxmark3GUI.git
synced 2026-07-14 22:55:32 +08:00
Add new features
Support change language in Settings Support customized start arguments Strech data section in MF_dataWidget and key section in MF_keyWidget
This commit is contained in:
@@ -14,14 +14,14 @@ PM3Process::PM3Process(QThread* thread, QObject* parent): QProcess(parent)
|
||||
connect(this, &PM3Process::readyRead, this, &PM3Process::onReadyRead);
|
||||
}
|
||||
|
||||
void PM3Process::connectPM3(const QString& path, const QString& port)
|
||||
void PM3Process::connectPM3(const QString& path, const QString& port, const QStringList args)
|
||||
{
|
||||
QString result;
|
||||
Util::ClientType clientType = Util::CLIENTTYPE_OFFICIAL;
|
||||
setRequiringOutput(true);
|
||||
|
||||
// using "-f" option to make the client output flushed after every print.
|
||||
start(path, QStringList() << port << "-f", QProcess::Unbuffered | QProcess::ReadWrite);
|
||||
start(path, args, QProcess::Unbuffered | QProcess::ReadWrite);
|
||||
if(waitForStarted(10000))
|
||||
{
|
||||
waitForReadyRead(1000);
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ public:
|
||||
void testThread();
|
||||
|
||||
public slots:
|
||||
void connectPM3(const QString& path, const QString& port);
|
||||
void connectPM3(const QString& path, const QString& port, const QStringList args);
|
||||
void setSerialListener(const QString& name, bool state);
|
||||
qint64 write(QString data);
|
||||
private slots:
|
||||
|
||||
@@ -93,3 +93,27 @@ void Util::setRunningState(bool st)
|
||||
{
|
||||
this->isRunning = st;
|
||||
}
|
||||
|
||||
bool Util::chooseLanguage(QSettings* guiSettings, QMainWindow* window)
|
||||
{
|
||||
// make sure the GUISettings is not in any group
|
||||
QSettings* langSettings = new QSettings("lang/languages.ini", QSettings::IniFormat);
|
||||
QMap<QString, QString> langMap;
|
||||
langSettings->setIniCodec("UTF-8");
|
||||
langSettings->beginGroup("Languages");
|
||||
QStringList langList = langSettings->allKeys();
|
||||
for(int i = 0; i < langList.size(); i++)
|
||||
langMap.insert(langSettings->value(langList[i]).toString(), langList[i]);
|
||||
langSettings->endGroup();
|
||||
delete langSettings;
|
||||
bool isOk = false;
|
||||
QString selectedText = QInputDialog::getItem(window, "", "Choose a language:", langMap.keys(), 0, false, &isOk);
|
||||
if(isOk)
|
||||
{
|
||||
guiSettings->beginGroup("lang");
|
||||
guiSettings->setValue("language", langMap[selectedText]);
|
||||
guiSettings->endGroup();
|
||||
guiSettings->sync();
|
||||
}
|
||||
return isOk;
|
||||
}
|
||||
|
||||
@@ -10,6 +10,9 @@
|
||||
#include <QTimer>
|
||||
#include <QMetaType>
|
||||
#include <QRegularExpression>
|
||||
#include <QSettings>
|
||||
#include <QMainWindow>
|
||||
#include <QInputDialog>
|
||||
|
||||
class Util : public QObject
|
||||
{
|
||||
@@ -51,6 +54,7 @@ public:
|
||||
void delay(unsigned int msec);
|
||||
ClientType getClientType();
|
||||
static const int rawTabIndex = 1;
|
||||
static bool chooseLanguage(QSettings *guiSettings, QMainWindow *window);
|
||||
public slots:
|
||||
void processOutput(const QString& output);
|
||||
void setClientType(Util::ClientType clientType);
|
||||
|
||||
Reference in New Issue
Block a user