New project structure

Load translation file in the executable.
pull/33/head
wh201906 3 years ago
parent b319f9fbe1
commit f86cba8d56

73
.gitignore vendored

@ -1,72 +1 @@
# This file is used to ignore files which are generated
# ----------------------------------------------------------------------------
*~
*.autosave
*.a
*.core
*.moc
*.o
*.obj
*.orig
*.rej
*.so
*.so.*
*_pch.h.cpp
*_resource.rc
.#*
*.*#
core
!core/
tags
.DS_Store
.directory
*.debug
Makefile*
*.prl
*.app
moc_*.cpp
ui_*.h
qrc_*.cpp
Thumbs.db
*.res
*.rc
/.qmake.cache
/.qmake.stash
# qtcreator generated files
*.pro.user*
# xemacs temporary files
*.flc
# Vim temporary files
.*.swp
# Visual Studio generated files
*.ib_pdb_index
*.idb
*.ilk
*.pdb
*.sln
*.suo
*.vcproj
*vcproj.*.*.user
*.ncb
*.sdf
*.opensdf
*.vcxproj
*vcxproj.*
# MinGW generated files
*.Debug
*.Release
# Python byte code
*.pyc
# Binaries
# --------
*.dll
*.exe
/build*

@ -55,12 +55,9 @@ Great thanks to him.
sudo apt-get install qt5-default libqt5serialport5 libqt5serialport5-dev
git clone https://github.com/wh201906/Proxmark3GUI.git --depth=1
cd Proxmark3GUI
mkdir build
cd build
qmake ../
make
make clean
cp -r ../lang ./
mkdir build && cd build
qmake ../src
make -j4 && make clean
cp -r ../config ./
./Proxmark3GUI

@ -54,12 +54,9 @@ release页面中有含客户端的GUI。这个GUI也可以搭配你自己的客
sudo apt-get install qt5-default libqt5serialport5 libqt5serialport5-dev
git clone https://github.com/wh201906/Proxmark3GUI.git --depth=1
cd Proxmark3GUI
mkdir build
cd build
qmake ../
make
make clean
cp -r ../lang ./
mkdir build && cd build
qmake ../src
make -j4 && make clean
cp -r ../config ./
./Proxmark3GUI

@ -1,3 +0,0 @@
[Languages]
en_US=English
zh_CN=简体中文

72
src/.gitignore vendored

@ -0,0 +1,72 @@
# This file is used to ignore files which are generated
# ----------------------------------------------------------------------------
*~
*.autosave
*.a
*.core
*.moc
*.o
*.obj
*.orig
*.rej
*.so
*.so.*
*_pch.h.cpp
*_resource.rc
.#*
*.*#
core
!core/
tags
.DS_Store
.directory
*.debug
Makefile*
*.prl
*.app
moc_*.cpp
ui_*.h
qrc_*.cpp
Thumbs.db
*.res
*.rc
/.qmake.cache
/.qmake.stash
# qtcreator generated files
*.pro.user*
# xemacs temporary files
*.flc
# Vim temporary files
.*.swp
# Visual Studio generated files
*.ib_pdb_index
*.idb
*.ilk
*.pdb
*.sln
*.suo
*.vcproj
*vcproj.*.*.user
*.ncb
*.sdf
*.opensdf
*.vcxproj
*vcxproj.*
# MinGW generated files
*.Debug
*.Release
# Python byte code
*.pyc
# Binaries
# --------
*.dll
*.exe

@ -22,6 +22,7 @@ SOURCES += \
common/util.cpp \
module/lf.cpp \
module/mifare.cpp \
module/t55xxtab.cpp \
ui/mf_trailerdecoderdialog.cpp \
ui/mf_sim_simdialog.cpp \
ui/mf_uid_parameterdialog.cpp \
@ -34,6 +35,7 @@ HEADERS += \
common/util.h \
module/lf.h \
module/mifare.h \
module/t55xxtab.h \
ui/mf_trailerdecoderdialog.h \
ui/mf_sim_simdialog.h \
ui/mf_uid_parameterdialog.h \
@ -41,6 +43,7 @@ HEADERS += \
ui/mf_attack_hardnesteddialog.h \
FORMS += \
ui/t55xxtab.ui \
ui/mf_trailerdecoderdialog.ui \
ui/mf_sim_simdialog.ui \
ui/mf_uid_parameterdialog.ui \
@ -48,8 +51,8 @@ FORMS += \
ui/mf_attack_hardnesteddialog.ui
TRANSLATIONS += \
lang/zh_CN.ts \
lang/en_US.ts
i18n/zh_CN.ts \
i18n/en_US.ts
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
@ -60,3 +63,6 @@ VERSION = 0.2.3
QMAKE_TARGET_PRODUCT = "Proxmark3GUI"
QMAKE_TARGET_DESCRIPTION = "Proxmark3GUI"
QMAKE_TARGET_COMPANY = "wh201906"
RESOURCES += \
i18n/language.qrc

@ -106,7 +106,7 @@ void Util::setRunningState(bool 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);
QSettings* langSettings = new QSettings(":/i18n/languages.ini", QSettings::IniFormat);
QMap<QString, QString> langMap;
langSettings->setIniCodec("UTF-8");
langSettings->beginGroup("Languages");

@ -0,0 +1,7 @@
<RCC>
<qresource prefix="/i18n">
<file>en_US.qm</file>
<file>languages.ini</file>
<file>zh_CN.qm</file>
</qresource>
</RCC>

@ -0,0 +1,4 @@
[Languages]
en_US=English
zh_CN=简体中文
ext=Load from external file

@ -694,7 +694,7 @@ Use this to get raw data from a tag.</source>
If the antenna voltage has a obvious drop after putting card on the antenna, it is likely that the tag is a LF tag.
On Iceman/RRG repo, press the button on PM3 to stop measuring</source>
<translation>线
线
线
PM3</translation>
</message>
<message>

@ -22,7 +22,6 @@ int main(int argc, char *argv[])
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
QDir *langPath = new QDir();
QApplication a(argc, argv);
MainWindow w;
@ -42,10 +41,12 @@ int main(int argc, char *argv[])
else
currLang = "en_US";
}
currLang += ".qm";
langPath->cd("lang");
if(currLang == "ext")
currLang = QFileDialog::getOpenFileName(nullptr, "Select the translation file:");
else
currLang = ":/i18n/" + currLang + ".qm";
QTranslator* translator = new QTranslator(&w);
if(translator->load(currLang, langPath->absolutePath()))
if(translator->load(currLang))
{
a.installTranslator(translator);
}
@ -54,7 +55,6 @@ int main(int argc, char *argv[])
QMessageBox::information(&w, "Error", "Can't load " + currLang + " as translation file.");
}
delete settings;
delete langPath;
w.initUI();
w.show();
return a.exec();

@ -0,0 +1,14 @@
#include "t55xxtab.h"
#include "ui_t55xxtab.h"
T55xxTab::T55xxTab(QWidget *parent) :
QWidget(parent),
ui(new Ui::T55xxTab)
{
ui->setupUi(this);
}
T55xxTab::~T55xxTab()
{
delete ui;
}

@ -0,0 +1,22 @@
#ifndef T55XXTAB_H
#define T55XXTAB_H
#include <QWidget>
namespace Ui {
class T55xxTab;
}
class T55xxTab : public QWidget
{
Q_OBJECT
public:
explicit T55xxTab(QWidget *parent = nullptr);
~T55xxTab();
private:
Ui::T55xxTab *ui;
};
#endif // T55XXTAB_H

@ -136,7 +136,7 @@
</sizepolicy>
</property>
<property name="currentIndex">
<number>0</number>
<number>2</number>
</property>
<widget class="QWidget" name="mifareTab">
<attribute name="title">

@ -0,0 +1,21 @@
<ui version="4.0">
<author/>
<comment/>
<exportmacro/>
<class>T55xxTab</class>
<widget class="QWidget" name="T55xxTab">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
</widget>
<pixmapfunction/>
<connections/>
</ui>
Loading…
Cancel
Save