Non-ASCII path support(partial)

I didn't find other solutions on the Internet.
I found the plugins are loaded when creating MainWindow,
so this solution should be fine?
pull/33/head
wh201906 3 years ago
parent dcc17963b6
commit 36307dcda0

@ -270,6 +270,7 @@
</message>
<message>
<location filename="../ui/mf_trailerdecoderdialog.ui" line="317"/>
<location filename="../ui/mf_trailerdecoderdialog.cpp" line="113"/>
<source>KeyA</source>
<translation type="unfinished"></translation>
</message>
@ -280,6 +281,7 @@
</message>
<message>
<location filename="../ui/mf_trailerdecoderdialog.ui" line="327"/>
<location filename="../ui/mf_trailerdecoderdialog.cpp" line="117"/>
<source>KeyB</source>
<translation type="unfinished"></translation>
</message>
@ -306,6 +308,21 @@ It could make the whole sector blocked irreversibly!</source>
<source>Valid</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mf_trailerdecoderdialog.cpp" line="88"/>
<location filename="../ui/mf_trailerdecoderdialog.cpp" line="89"/>
<location filename="../ui/mf_trailerdecoderdialog.cpp" line="90"/>
<location filename="../ui/mf_trailerdecoderdialog.cpp" line="94"/>
<location filename="../ui/mf_trailerdecoderdialog.cpp" line="95"/>
<location filename="../ui/mf_trailerdecoderdialog.cpp" line="96"/>
<source>Block</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mf_trailerdecoderdialog.cpp" line="121"/>
<source>KeyA+B</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MainWindow</name>

Binary file not shown.

@ -271,6 +271,7 @@
</message>
<message>
<location filename="../ui/mf_trailerdecoderdialog.ui" line="317"/>
<location filename="../ui/mf_trailerdecoderdialog.cpp" line="113"/>
<source>KeyA</source>
<translation>A</translation>
</message>
@ -281,6 +282,7 @@
</message>
<message>
<location filename="../ui/mf_trailerdecoderdialog.ui" line="327"/>
<location filename="../ui/mf_trailerdecoderdialog.cpp" line="117"/>
<source>KeyB</source>
<translation>B</translation>
</message>
@ -310,6 +312,21 @@ It could make the whole sector blocked irreversibly!</source>
<source>Valid</source>
<translation></translation>
</message>
<message>
<location filename="../ui/mf_trailerdecoderdialog.cpp" line="88"/>
<location filename="../ui/mf_trailerdecoderdialog.cpp" line="89"/>
<location filename="../ui/mf_trailerdecoderdialog.cpp" line="90"/>
<location filename="../ui/mf_trailerdecoderdialog.cpp" line="94"/>
<location filename="../ui/mf_trailerdecoderdialog.cpp" line="95"/>
<location filename="../ui/mf_trailerdecoderdialog.cpp" line="96"/>
<source>Block</source>
<translation></translation>
</message>
<message>
<location filename="../ui/mf_trailerdecoderdialog.cpp" line="121"/>
<source>KeyA+B</source>
<translation>A+B</translation>
</message>
</context>
<context>
<name>MainWindow</name>

@ -9,6 +9,17 @@
int main(int argc, char *argv[])
{
// A trick to handle non-ascii path
// The application cannot find the plugins when the path contains non ascii characters.
// However, the plugins will be load after creating MainWindow(or QApplication?).
// QDir will handle the path correctly.
QDir* pluginDir = new QDir;
if(pluginDir->cd("plugins")) // has plugins folder
{
qputenv("QT_PLUGIN_PATH", pluginDir->absolutePath().toLocal8Bit());
}
delete pluginDir;
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
QDir *langPath = new QDir();

@ -85,15 +85,15 @@ void MF_trailerDecoderDialog::on_blockSizeChanged(int id, bool st)
{
if(id == 4)
{
ui->dataBlockWidget->verticalHeaderItem(0)->setText("Block0");
ui->dataBlockWidget->verticalHeaderItem(1)->setText("Block1");
ui->dataBlockWidget->verticalHeaderItem(2)->setText("Block2");
ui->dataBlockWidget->verticalHeaderItem(0)->setText(tr("Block") + "0");
ui->dataBlockWidget->verticalHeaderItem(1)->setText(tr("Block") + "1");
ui->dataBlockWidget->verticalHeaderItem(2)->setText(tr("Block") + "2");
}
else if(id == 16)
{
ui->dataBlockWidget->verticalHeaderItem(0)->setText("Block0~4");
ui->dataBlockWidget->verticalHeaderItem(1)->setText("Block5~9");
ui->dataBlockWidget->verticalHeaderItem(2)->setText("Block10~14");
ui->dataBlockWidget->verticalHeaderItem(0)->setText(tr("Block") + "0~4");
ui->dataBlockWidget->verticalHeaderItem(1)->setText(tr("Block") + "5~9");
ui->dataBlockWidget->verticalHeaderItem(2)->setText(tr("Block") + "10~14");
}
}
@ -110,15 +110,15 @@ void MF_trailerDecoderDialog::setTableItem(QTableWidget* widget, int row, int co
}
else if(accessType == Mifare::ACC_KEY_A)
{
text = "KeyA";
text = tr("KeyA");
}
else if(accessType == Mifare::ACC_KEY_B)
{
text = "KeyB";
text = tr("KeyB");
}
else if(accessType == Mifare::ACC_KEY_AB)
{
text = "KeyA+B";
text = tr("KeyA+B");
}
widget->item(row, column)->setText(text);
}

Loading…
Cancel
Save