Added translations functionality

(cherry picked from commit 8605a4961738afdfdd203374f87a7a78f2ef2f77)
This commit is contained in:
Eduard Kalinowski 2017-05-01 18:42:29 +02:00 committed by lancos
parent 5ceaeeadb7
commit e01e4f168b
19 changed files with 1281 additions and 1014 deletions

View File

@ -38,9 +38,6 @@
#include "e2profil.h"
using namespace Translator;
AboutModalDialog::AboutModalDialog(QWidget *bw, const QString title)
: QDialog(bw)
{
@ -57,17 +54,17 @@ AboutModalDialog::AboutModalDialog(QWidget *bw, const QString title)
setStyleSheet(cmdw->getStyleSheet());
}
lblAbout0->setText(APPNAME + " - " + APPNAME_EXT + "<br>" + STR_MSGVERSION + " " + APPVERSION + " " __DATE__);
lblAbout0->setText(APPNAME + " - " + translate(STR_APPNAME_EXT) + "<br>" + translate(STR_MSGVERSION) + " " + APPVERSION + " " __DATE__);
lblAbout1->setText("Copyright (C) " + COPYRIGHTYEAR + " by <a href=\"" + AUTHORMAIL + "\">" + AUTHORNAME + "</a><br><br>" +
"Porting to Qt4/Qt5 by <a href=\"" + PORTERMAIL + "\">" + PORTERGQT + "</a><br><br>" +
STR_APPDOWNLOAD1 + " " + APPNAME + " " + STR_APPDOWNLOAD2 + "<br>" +
translate(STR_APPDOWNLOAD1) + " " + APPNAME + " " + translate(STR_APPDOWNLOAD2) + "<br>" +
"<a href=\"" + AUTHORWEB + "\">" + AUTHORWEB + "</a>");
chkSound->setChecked(E2Profile::GetSkipStartupDialog());
chkSound->setText(STR_LBLSKIPMSG);
chkSound->setText(translate(STR_LBLSKIPMSG));
pushOk->setText(STR_BTNOK);
pushHelp->setText(STR_BTNHELP);
pushOk->setText(translate(STR_BTNOK));
pushHelp->setText(translate(STR_BTNHELP));
icoPonyProg->setPixmap(QPixmap(":/icons/ponyprog.png"));

View File

@ -40,7 +40,7 @@
class e2CmdWindow;
class AboutModalDialog : public QDialog, public Ui::AboutDialog
class AboutModalDialog : public QDialog, public cTranslator, public Ui::AboutDialog
{
Q_OBJECT
public: //---------------------------------------- public

View File

@ -29,13 +29,6 @@
#include "e2awinfo.h"
#include "e2app.h" // Header file
#include "string_table.h"
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <locale.h>
#include <QCoreApplication>
#include <QString>
#include <QMessageBox>
@ -185,7 +178,7 @@ void e2App::initSettings()
}
else if (str == "locale")
{
sp2 = STR_LANGUAGE_CODE;
sp2 = translate(STR_LANGUAGE_CODE);
}
else
{
@ -199,51 +192,49 @@ void e2App::initSettings()
// Make sure all parameters (even default values) are written
// to the INI file.
// EK 2017
// TODO to remove the read/write because of QSettings?
SetInterfaceType((HInterfaceType) E2Profile::GetParInterfType());
SetPort(E2Profile::GetParPortNo());
E2Profile::GetPowerUpDelay() ; // E2Profile::SetPowerUpDelay( E2Profile::GetPowerUpDelay() );
E2Profile::GetPowerUpDelay();
SetPolarity(E2Profile::GetPolarityControl());
E2Profile::GetSPIResetPulse();// E2Profile::SetSPIResetPulse( E2Profile::GetSPIResetPulse() );
E2Profile::GetSPIDelayAfterReset();// E2Profile::SetSPIDelayAfterReset( E2Profile::GetSPIDelayAfterReset() );
E2Profile::GetSPIPageWrite();// E2Profile::SetSPIPageWrite( E2Profile::GetSPIPageWrite() );
E2Profile::GetMegaPageDelay();// E2Profile::SetMegaPageDelay( E2Profile::GetMegaPageDelay() );
E2Profile::GetAVRProgDelay();// E2Profile::SetAVRProgDelay( E2Profile::GetAVRProgDelay() );
E2Profile::GetAVREraseDelay();// E2Profile::SetAVREraseDelay( E2Profile::GetAVREraseDelay() );
E2Profile::GetAT89DelayAfterReset(); // E2Profile::SetAT89DelayAfterReset( E2Profile::GetAT89DelayAfterReset() );
E2Profile::GetAVRDelayAfterReset();// E2Profile::SetAVRDelayAfterReset( E2Profile::GetAVRDelayAfterReset() );
E2Profile::GetSPIResetPulse();
E2Profile::GetSPIDelayAfterReset();
E2Profile::GetSPIPageWrite();
E2Profile::GetMegaPageDelay();
E2Profile::GetAVRProgDelay();
E2Profile::GetAVREraseDelay();
E2Profile::GetAT89DelayAfterReset();
E2Profile::GetAVRDelayAfterReset();
//
E2Profile::GetI2CSpeed();// E2Profile::SetI2CSpeed( E2Profile::GetI2CSpeed() );
E2Profile::GetSPISpeed();// E2Profile::SetSPISpeed( E2Profile::GetSPISpeed() );
E2Profile::GetMicroWireSpeed();// E2Profile::SetMicroWireSpeed( E2Profile::GetMicroWireSpeed() );
E2Profile::GetPICSpeed();// E2Profile::SetPICSpeed( E2Profile::GetPICSpeed() );
E2Profile::GetSDESpeed();// E2Profile::SetSDESpeed( E2Profile::GetSDESpeed() );
E2Profile::GetI2CSpeed();
E2Profile::GetSPISpeed();
E2Profile::GetMicroWireSpeed();
E2Profile::GetPICSpeed();
E2Profile::GetSDESpeed();
//
E2Profile::GetLogEnabled();// E2Profile::SetLogEnabled( E2Profile::GetLogEnabled() );
E2Profile::GetSoundEnabled();// E2Profile::SetSoundEnabled( E2Profile::GetSoundEnabled() );
E2Profile::GetSkipStartupDialog();// E2Profile::SetSkipStartupDialog( E2Profile::GetSkipStartupDialog() );
E2Profile::GetVerifyAfterWrite();// E2Profile::SetVerifyAfterWrite( E2Profile::GetVerifyAfterWrite() );
E2Profile::GetClearBufBeforeLoad();// E2Profile::SetClearBufBeforeLoad( E2Profile::GetClearBufBeforeLoad() );
E2Profile::GetClearBufBeforeRead();// E2Profile::SetClearBufBeforeRead( E2Profile::GetClearBufBeforeRead() );
E2Profile::GetAutoDetectPorts();// E2Profile::SetAutoDetectPorts( E2Profile::GetAutoDetectPorts() );
E2Profile::GetAt89PageOp();// E2Profile::SetAt89PageOp( E2Profile::GetAt89PageOp() );
E2Profile::Get8253FallEdge();// E2Profile::Set8253FallEdge( E2Profile::Get8253FallEdge() );
E2Profile::GetLogEnabled();
E2Profile::GetSoundEnabled();
E2Profile::GetSkipStartupDialog();
E2Profile::GetVerifyAfterWrite();
E2Profile::GetClearBufBeforeLoad();
E2Profile::GetClearBufBeforeRead();
E2Profile::GetAutoDetectPorts();
E2Profile::GetAt89PageOp();
E2Profile::Get8253FallEdge();
#ifdef __unix__
E2Profile::GetHtmlBrowseApp();// E2Profile::SetHtmlBrowseApp( E2Profile::GetHtmlBrowseApp() );
E2Profile::GetLockDir();// E2Profile::SetLockDir( E2Profile::GetLockDir() );
E2Profile::GetDevDir();// E2Profile::SetDevDir( E2Profile::GetDevDir() );
E2Profile::GetHtmlBrowseApp();
E2Profile::GetLockDir();
E2Profile::GetDevDir();
#endif
#ifdef __linux__
E2Profile::GetGpioPinClock();// E2Profile::SetGpioPinClock( E2Profile::GetGpioPinClock() );
E2Profile::GetGpioPinCtrl();// E2Profile::SetGpioPinCtrl( E2Profile::GetGpioPinCtrl() );
E2Profile::GetGpioPinDataIn();// E2Profile::SetGpioPinDataIn( E2Profile::GetGpioPinDataIn() );
E2Profile::GetGpioPinDataOut();// E2Profile::SetGpioPinDataOut( E2Profile::GetGpioPinDataOut() );
E2Profile::GetGpioPinClock();
E2Profile::GetGpioPinCtrl();
E2Profile::GetGpioPinDataIn();
E2Profile::GetGpioPinDataOut();
#endif
E2Profile::GetDevName(); // E2Profile::SetDevName( E2Profile::GetDevName() );
E2Profile::GetDevName();
scriptMode = false;
returnValue = 0;
@ -574,22 +565,23 @@ void e2App::LookForBogoMips()
DWORD count;
DWORD multiplier = 1;
static char strbuf[MAX_PATH];
strncpy(strbuf, helpfile, MAX_PATH);
char *sp = strrchr(strbuf, '\\');
QString strbuf;
strbuf = helpfile;
if (sp == NULL)
int sp = strbuf.lastIndexOf("\\");
if (sp < 0)
{
sp = strrchr(strbuf, '/');
sp = strbuf.lastIndexOf("/");
}
if (sp == NULL)
if (sp < 0)
{
strcpy(strbuf, "bogomips.out");
strbuf = "bogomips.out";
}
else
{
strcpy(sp + 1, "bogomips.out");
strbuf += "bogomips.out";
}
QFile fh(strbuf);

View File

@ -34,7 +34,7 @@
#include <QApplication>
#include <QCoreApplication>
#include "Translator.h"
// #include "busio.h"
//Include Bus Classes
@ -74,7 +74,7 @@ enum AppStatus
AppBusy
};
class e2App
class e2App : public cTranslator
{
public: //---------------------------------------- public

File diff suppressed because it is too large Load Diff

View File

@ -48,7 +48,7 @@
#include "device.h"
#include "Translator.h"
#include "e2app.h"
#include "e2awinfo.h"
@ -233,6 +233,7 @@ class e2CmdWindow : public QMainWindow, public e2App, public Ui::MainWindow
void selectFontSize(QAction *mnu);
void setLang(QAction *mnu);
// void setOverwriteMode(bool);
// void dataChanged();
@ -244,8 +245,8 @@ class e2CmdWindow : public QMainWindow, public e2App, public Ui::MainWindow
private:
//All commands
int CmdOpen(int type = ALL_TYPE, char *file = 0, long relocation = 0, int clear_buffer = -1);
int CmdSave(int type = ALL_TYPE, char *file = 0, long relocation = 0);
int CmdOpen(int type = ALL_TYPE, const char *file = 0, long relocation = 0, int clear_buffer = -1);
int CmdSave(int type = ALL_TYPE, const char *file = 0, long relocation = 0);
int CmdSaveAs(int type = ALL_TYPE, long relocation = 0);
int CmdLastFile1();
int CmdLastFile2();
@ -258,7 +259,7 @@ class e2CmdWindow : public QMainWindow, public e2App, public Ui::MainWindow
int CmdGetInfo();
int CmdReset();
int CmdReadLock();
// int CmdWrite(int type);
// int CmdWrite(int type);
// int CmdRunScript();
int CmdLoadScript();
int CmdWriteLock();
@ -292,6 +293,11 @@ class e2CmdWindow : public QMainWindow, public e2App, public Ui::MainWindow
int findItemInMenuVector(const QString &n);
bool readLangDir();
bool getLangTable();
void setLangGUI();
void translateGUI();
private: //--------------------------------------- private
void createSignalSlotConnections();
@ -347,7 +353,7 @@ class e2CmdWindow : public QMainWindow, public e2App, public Ui::MainWindow
// void IndexToCoord(int index, int &row, int &col);
void setMenuIndexes();
void selectTypeSubtype(const QString &t, const QString &st);
int ScriptError(int line_number, int arg_index, char *arg, const QString msg = "");
int ScriptError(int line_number, int arg_index, const QString &s, const QString msg = "");
private:
@ -365,6 +371,10 @@ class e2CmdWindow : public QMainWindow, public e2App, public Ui::MainWindow
int idxSDE2506;
int idxX244;
QString selectedLang;
QStringList lastScripts;
QStringList lastFiles;
QFont sysFont;
short fontSize;
@ -387,6 +397,9 @@ class e2CmdWindow : public QMainWindow, public e2App, public Ui::MainWindow
QVector<QAction *> actFSizeSelect;
QActionGroup *fsizeGroup;
QActionGroup *langGroup;
QStringList langFiles;
// Standard elements
QHexEdit *e2HexEdit; // For the canvas

View File

@ -41,7 +41,6 @@
class e2CmdWindow;
using namespace Translator;
//=========================>>> e2Dialog::e2Dialog <<<====================
@ -290,25 +289,59 @@ void e2Dialog::setWidgetsText()
"EasyI2C API" <<
"EasyI2C I/O" <<
"SysFs GPIO ";
cbxInterfLPT->addItems(interfListL);
rdbComPort->setText(STR_LBLSERIAL);
rdbLptPort->setText(STR_LBLPARALLEL);
rdbComPort->setText(translate(STR_LBLSERIAL));
rdbLptPort->setText(translate(STR_LBLPARALLEL));
lptList << STR_LBLLPT1 << STR_LBLLPT2 << STR_LBLLPT3;
comList << STR_LBLCOM1 << STR_LBLCOM2 << STR_LBLCOM3 << STR_LBLCOM4;
usbList << STR_LBLUSB1 << STR_LBLUSB2 << STR_LBLUSB3 << STR_LBLUSB4 << STR_LBLUSB5 << STR_LBLUSB6 << STR_LBLUSB7 << STR_LBLUSB8;
lblPol1->setText(STR_LBLSELPOLARITY);
#ifndef __linux__
chkPol1->setText(STR_LBLINVRESET);
chkPol2->setText(STR_LBLINVSCK);
chkPol3->setText(STR_LBLINVDATAIN);
chkPol4->setText(STR_LBLINVDATAOUT);
for (int i = 1; i < 4; i++)
{
lptList << translate(STR_LBLLPT1) + QString::number(i);
}
pushOk->setText(STR_BTNOK);
pushTest->setText(STR_BTNPROBE);
pushCancel->setText(STR_BTNCANC);
for (int i = 1; i < 5; i++)
{
comList << translate(STR_LBLCOM1) + QString::number(i);
}
for (int i = 1; i < 9; i++)
{
usbList << translate(STR_LBLUSB1) + QString::number(i);
}
#else
for (int i = 0; i < 3; i++)
{
lptList << translate(STR_LBLLPT1) + QString::number(i);
}
for (int i = 0; i < 4; i++)
{
comList << translate(STR_LBLCOM1) + QString::number(i);
}
for (int i = 0; i < 8; i++)
{
usbList << translate(STR_LBLUSB1) + QString::number(i);
}
#endif
lblPol1->setText(translate(STR_LBLSELPOLARITY));
chkPol1->setText(translate(STR_LBLINVRESET));
chkPol2->setText(translate(STR_LBLINVSCK));
chkPol3->setText(translate(STR_LBLINVDATAIN));
chkPol4->setText(translate(STR_LBLINVDATAOUT));
pushOk->setText(translate(STR_BTNOK));
pushTest->setText(translate(STR_BTNPROBE));
pushCancel->setText(translate(STR_BTNCANC));
}
@ -325,11 +358,11 @@ void e2Dialog::onTest()
if (test)
{
QMessageBox::critical(this, "Failed", STR_MSGTEST + " " + STR_MSGFAILED);
QMessageBox::critical(this, "Failed", translate(STR_MSGTEST) + " " + translate(STR_MSGFAILED));
}
else
{
QMessageBox::information(this, "Info", STR_MSGTEST + " " + STR_MSGOK);
QMessageBox::information(this, "Info", translate(STR_MSGTEST) + " " + translate(STR_MSGOK));
}
}

View File

@ -40,18 +40,15 @@
#include "ui_e2dlg.h"
#include "string_table.h"
using namespace Translator;
class e2CmdWindow;
class e2Dialog : public QDialog, public Ui::E2Dialog
class e2Dialog : public QDialog, public cTranslator, public Ui::E2Dialog
{
Q_OBJECT
public: //---------------------------------------- public
e2Dialog(QWidget *bw, const QString title = STR_MSGINTSETUP);
e2Dialog(QWidget *bw, const QString title = translate(STR_MSGINTSETUP));
virtual ~e2Dialog(); // Destructor
protected: //--------------------------------------- protected
@ -74,7 +71,7 @@ class e2Dialog : public QDialog, public Ui::E2Dialog
QStringList comList;
QStringList usbList;
// e2CmdWindow* cmdWin;
// e2CmdWindow* cmdWin;
int port_no; // Numero della porta utilizzata
int lpt_no, com_no;
HInterfaceType interf_type;

View File

@ -34,10 +34,6 @@
#include "e2cmdw.h"
#include "types.h"
#include "filldlg.h"
#include "string_table.h"
using namespace Translator;
class e2CmdWindow;
@ -67,12 +63,12 @@ FillDialog::FillDialog(QWidget *bw, long &cfrom, long &cto, int &cval, long max_
mTo = (cto < 0) ? mMax : cto;
mVal = (cval < 0) ? 0xFF : cval;
lblFrom->setText(STR_LBLFROM);
lblTo->setText(STR_LBLTO);
lblVal->setText(STR_LBLVALUE);
lblFrom->setText(translate(STR_LBLFROM));
lblTo->setText(translate(STR_LBLTO));
lblVal->setText(translate(STR_LBLVALUE));
pushOk->setText(STR_BTNOK);
pushCancel->setText(STR_BTNCANC);
pushOk->setText(translate(STR_BTNOK));
pushCancel->setText(translate(STR_BTNCANC));
//TODO: should get strings from E2Profile settings, not local variables
QString str;

View File

@ -34,18 +34,17 @@
#include <QDialog>
#include <QObject>
#include "Translator.h"
#include "ui_blockdlg.h"
#include "string_table.h"
using namespace Translator;
class FillDialog : public QDialog, public Ui::BlockDialog
class FillDialog : public QDialog, public cTranslator, public Ui::BlockDialog
{
Q_OBJECT
public: //---------------------------------------- public
FillDialog(QWidget *bw, long &cfrom, long &cto, int &cval, long max_addr, const QString title = STR_LBLFILLBUF);
FillDialog(QWidget *bw, long &cfrom, long &cto, int &cval, long max_addr, const QString title = translate(STR_LBLFILLBUF));
virtual ~FillDialog(); // Destructor

View File

@ -33,17 +33,13 @@
#include <QDebug>
using namespace Translator;
//======================>>> fuseModalDialog::fuseModalDialog <<<==================
fuseModalDialog::fuseModalDialog(e2CmdWindow *bw, e2AppWinInfo *p, bool readonly, const QString &msg) :
QDialog(bw)
{
setupUi(this);
setWindowTitle(STR_MSGFUSEDLG);
setWindowTitle(translate(STR_MSGFUSEDLG));
awip = p;
@ -121,10 +117,10 @@ void fuseModalDialog::setTextWidgets()
}
}
pushRead->setText(STR_BTNREAD);
pushWrite->setText(STR_BTNWRITE);
pushOk->setText(STR_BTNOK);
pushCancel->setText(STR_BTNCANC);
pushRead->setText(translate(STR_BTNREAD));
pushWrite->setText(translate(STR_BTNWRITE));
pushOk->setText(translate(STR_BTNOK));
pushCancel->setText(translate(STR_BTNCANC));
}
@ -381,9 +377,9 @@ void fuseModalDialog::initWidgets(const QString &msg, long int type, bool readon
chkFuse.at(3 * 8 + k)->setChecked(((fuse) & (0x80 >> k)) ? true : false); // F3
}
chkHlp1->setText(STR_FUSEDLGNOTESET + " (bit = 0)");
chkHlp1->setText(translate(STR_FUSEDLGNOTESET) + " (bit = 0)");
chkHlp1->setEnabled(false);
chkHlp0->setText(STR_FUSEDLGNOTECLR + " (bit = 1)");
chkHlp0->setText(translate(STR_FUSEDLGNOTECLR) + " (bit = 1)");
chkHlp0->setEnabled(false);
if (readonly)
@ -405,7 +401,7 @@ blockDialog::blockDialog(e2CmdWindow *bw, e2AppWinInfo *p, bool readonly, const
{
setupUi(this);
setWindowTitle(STR_MSGFUSEDLG);
setWindowTitle(translate(STR_MSGFUSEDLG));
awip = p;
@ -422,9 +418,9 @@ blockDialog::blockDialog(e2CmdWindow *bw, e2AppWinInfo *p, bool readonly, const
qDebug() << "blockDialog::blockDialog()";
lblFrom->setText(STR_MSGFIRSTBLK);
lblTo->setText(STR_MSGNUMBLOCK);
lblVal->setText(STR_MSGHIGHENDBLK);
lblFrom->setText(translate(STR_MSGFIRSTBLK));
lblTo->setText(translate(STR_MSGNUMBLOCK));
lblVal->setText(translate(STR_MSGHIGHENDBLK));
QString str1 = QString().sprintf("%d", (int)((lock >> 4) & 0x0F));
QString str2 = QString().sprintf("%d", (int)(lock & 0x0F));
@ -434,8 +430,8 @@ blockDialog::blockDialog(e2CmdWindow *bw, e2AppWinInfo *p, bool readonly, const
txiTo->setText(str2);
txiVal->setText(str3);
pushOk->setText(STR_BTNOK);
pushCancel->setText(STR_BTNCANC);
pushOk->setText(translate(STR_BTNOK));
pushCancel->setText(translate(STR_BTNCANC));
if (readonly)
{

View File

@ -70,7 +70,7 @@ typedef struct
class fuseModalDialog : public QDialog, public Ui::FuseDialog
class fuseModalDialog : public QDialog, public cTranslator, public Ui::FuseDialog
{
Q_OBJECT
public: //---------------------------------------- public
@ -1117,7 +1117,7 @@ const QVector<FuseBit> eep_fusebits =
};
class blockDialog : public QDialog, public Ui::BlockDialog
class blockDialog : public QDialog, public cTranslator, public Ui::BlockDialog
{
Q_OBJECT
public: //---------------------------------------- public

View File

@ -34,9 +34,6 @@
#include <QString>
#include "string_table.h"
using namespace Translator;
#define AUTOSIZE_ID 64768
@ -52,7 +49,7 @@ static QString AUTHORNAME = "Claudio Lanconelli";
static QString AUTHORMAIL = "PonyProg2000@gmail.com";
static QString AUTHORWEB = "http://www.LancOS.com";
static QString COPYRIGHTYEAR = "1997-2017";
static QString APPNAME_EXT = STR_APPNAME_EXT;
// static QString APPNAME_EXT = STR_APPNAME_EXT;
static QString PORTERGQT = "Eduard Kalinowski";
static QString PORTERMAIL = "eduard_kalinowski@yahoo.de";

View File

@ -27,20 +27,14 @@
//-------------------------------------------------------------------------//
//=========================================================================//
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <QDebug>
#include <QString>
#include "e2cmdw.h"
#include "string_table.h"
#include "globals.h"
#include "infomdlg.h"
using namespace Translator;
class e2CmdWindow;
@ -61,20 +55,20 @@ e24xx_infoModalDialog::e24xx_infoModalDialog(QWidget *bw, int rlv, uint16_t crc,
if (rlv == 1)
{
txiFrom->setText(STR_MSGYES);// SetCommandLabel(txtRllBnk, STR_MSGYES, e24xxCmds);
txiFrom->setText(translate(STR_MSGYES));// SetCommandLabel(txtRllBnk, STR_MSGYES, e24xxCmds);
}
else if (rlv == 2)
{
txiFrom->setText(STR_MSGNO);//SetCommandLabel(txtRllBnk, STR_MSGNO, e24xxCmds);
txiFrom->setText(translate(STR_MSGNO));//SetCommandLabel(txtRllBnk, STR_MSGNO, e24xxCmds);
}
else
{
txiFrom->setText(STR_MSGUNKNOWN);//SetCommandLabel(txtRllBnk, STR_MSGUNKNOWN, e24xxCmds);
txiFrom->setText(translate(STR_MSGUNKNOWN));//SetCommandLabel(txtRllBnk, STR_MSGUNKNOWN, e24xxCmds);
}
lblFrom->setText(STR_MSGCRC); // crc label
lblTo->setText(STR_MSGEEPSIZE); // size label
lblVal->setText(STR_MSGFLASHSIZE); // flash size label
lblFrom->setText(translate(STR_MSGCRC)); // crc label
lblTo->setText(translate(STR_MSGEEPSIZE)); // size label
lblVal->setText(translate(STR_MSGFLASHSIZE)); // flash size label
QString str;
str = QString().sprintf("%04Xh", crc);
@ -88,7 +82,7 @@ e24xx_infoModalDialog::e24xx_infoModalDialog(QWidget *bw, int rlv, uint16_t crc,
lblVal->setHidden(true);
txiVal->setHidden(true);
pushOk->setText(STR_BTNCLOSE);
pushOk->setText(translate(STR_BTNCLOSE));
pushCancel->setHidden(true);
connect(pushOk, SIGNAL(clicked()), this, SLOT(onOk()));
@ -126,9 +120,9 @@ other_infoModalDialog::other_infoModalDialog(QWidget *bw, long fsize, long esize
QString str;
lblFrom->setText(STR_MSGCRC); // crc label
lblTo->setText(STR_MSGEEPSIZE); // size label
lblVal->setText(STR_MSGFLASHSIZE); // flash size label
lblFrom->setText(translate(STR_MSGCRC)); // crc label
lblTo->setText(translate(STR_MSGEEPSIZE)); // size label
lblVal->setText(translate(STR_MSGFLASHSIZE)); // flash size label
str = QString().sprintf("%04Xh", crc);
txiFrom->setText(str);
@ -142,7 +136,7 @@ other_infoModalDialog::other_infoModalDialog(QWidget *bw, long fsize, long esize
txiVal->setText(str);
txiVal->setReadOnly(true);
pushOk->setText(STR_BTNCLOSE);
pushOk->setText(translate(STR_BTNCLOSE));
pushCancel->setHidden(true);
connect(pushOk, SIGNAL(clicked()), this, SLOT(onOk()));
@ -182,8 +176,8 @@ notesModalDialog::notesModalDialog(QWidget *bw, QString &id, QString &cm, const
id_ptr = &id;
cm_ptr = &cm;
lblStrID->setText(STR_MSGCHIPID);
lblCommnt->setText(STR_MSGNOTE);
lblStrID->setText(translate(STR_MSGCHIPID));
lblCommnt->setText(translate(STR_MSGNOTE));
if (id.length() && cm.length())
{
@ -193,8 +187,8 @@ notesModalDialog::notesModalDialog(QWidget *bw, QString &id, QString &cm, const
txiCommnt->setText(cmt_txt);
}
pushOk->setText(STR_BTNOK);
pushCancel->setText(STR_BTNCANC);
pushOk->setText(translate(STR_BTNOK));
pushCancel->setText(translate(STR_BTNCANC));
connect(pushOk, SIGNAL(clicked()), this, SLOT(onOk()));
connect(pushCancel, SIGNAL(clicked()), this, SLOT(reject()));
@ -240,9 +234,9 @@ editModalDialog::editModalDialog(QWidget *bw, int curval, const QString title) :
curval = 0;
}
lblFrom->setText(STR_MSGHEX);
lblTo->setText(STR_MSGDECIMAL);
lblVal->setText(STR_MSGCHAR);
lblFrom->setText(translate(STR_MSGHEX));
lblTo->setText(translate(STR_MSGDECIMAL));
lblVal->setText(translate(STR_MSGCHAR));
oldval = curval;
@ -260,8 +254,8 @@ editModalDialog::editModalDialog(QWidget *bw, int curval, const QString title) :
txiVal->setText(str);
connect(txiVal, SIGNAL(changed()), this, SLOT(onEdit()));
pushOk->setText(STR_BTNOK);
pushCancel->setText(STR_BTNCANC);
pushOk->setText(translate(STR_BTNOK));
pushCancel->setText(translate(STR_BTNCANC));
connect(pushOk, SIGNAL(clicked()), this, SLOT(onOk()));
connect(pushCancel, SIGNAL(clicked()), this, SLOT(reject()));
@ -393,7 +387,7 @@ editModalDialog2::editModalDialog2(QWidget *bw, const QString curval, const QStr
lblTo->setHidden(true);
txiTo->setHidden(true);
lblVal->setText(STR_MSGCHAR);
lblVal->setText(translate(STR_MSGCHAR));
qDebug() << "editModalDialog::editModalDialog()";
@ -406,8 +400,8 @@ editModalDialog2::editModalDialog2(QWidget *bw, const QString curval, const QStr
txiVal->setText(val);
pushOk->setText(STR_BTNOK);
pushCancel->setText(STR_BTNCANC);
pushOk->setText(translate(STR_BTNOK));
pushCancel->setText(translate(STR_BTNCANC));
connect(pushOk, SIGNAL(clicked()), this, SLOT(onOk()));
connect(pushCancel, SIGNAL(clicked()), this, SLOT(reject()));

View File

@ -34,22 +34,20 @@
#include <QObject>
#include <QDialog>
#include "Translator.h"
#include "types.h"
#include "ui_notesdlg.h"
#include "ui_editdlg.h"
#include "ui_blockdlg.h"
#include "string_table.h"
using namespace Translator;
class e24xx_infoModalDialog : public QDialog, public Ui::EditDialog
class e24xx_infoModalDialog : public QDialog, public cTranslator, public Ui::EditDialog
{
Q_OBJECT
public: //---------------------------------------- public
e24xx_infoModalDialog(QWidget *bw, int rlv, uint16_t crc, long size, const QString title = STR_MSGDEVINFO);
e24xx_infoModalDialog(QWidget *bw, int rlv, uint16_t crc, long size, const QString title = translate(STR_MSGDEVINFO));
virtual ~e24xx_infoModalDialog(); // Destructor
// virtual int infoAction(char* msg = "Device Info");
@ -64,11 +62,11 @@ class e24xx_infoModalDialog : public QDialog, public Ui::EditDialog
class other_infoModalDialog : public QDialog, public Ui::EditDialog
class other_infoModalDialog : public QDialog, public cTranslator, public Ui::EditDialog
{
Q_OBJECT
public: //---------------------------------------- public
other_infoModalDialog(QWidget *bw, long fsize, long esize, uint16_t crc, const QString title = STR_MSGDEVINFO);
other_infoModalDialog(QWidget *bw, long fsize, long esize, uint16_t crc, const QString title = translate(STR_MSGDEVINFO));
virtual ~other_infoModalDialog(); // Destructor
// virtual int infoAction(char* msg = "Device Info");
@ -82,11 +80,11 @@ class other_infoModalDialog : public QDialog, public Ui::EditDialog
};
class notesModalDialog : public QDialog, public Ui::NotesDialog
class notesModalDialog : public QDialog, public cTranslator, public Ui::NotesDialog
{
Q_OBJECT
public: //---------------------------------------- public
notesModalDialog(QWidget *bw, QString &id, QString &cm, const QString title = STR_MSGDEVNOTE);
notesModalDialog(QWidget *bw, QString &id, QString &cm, const QString title = translate(STR_MSGDEVNOTE));
virtual ~notesModalDialog(); // Destructor
// QString GetId();
// QString GetComment();
@ -107,11 +105,11 @@ class notesModalDialog : public QDialog, public Ui::NotesDialog
};
class editModalDialog : public QDialog, public Ui::EditDialog
class editModalDialog : public QDialog, public cTranslator, public Ui::EditDialog
{
Q_OBJECT
public: //---------------------------------------- public
editModalDialog(QWidget *bw, int curval = 0, const QString title = STR_MSGEDITBUG);
editModalDialog(QWidget *bw, int curval = 0, const QString title = translate(STR_MSGEDITBUG));
virtual ~editModalDialog(); // Destructor
// virtual int editAction(char* msg, int &retval);
int GetVal();
@ -127,11 +125,11 @@ class editModalDialog : public QDialog, public Ui::EditDialog
};
class editModalDialog2 : public QDialog, public Ui::EditDialog
class editModalDialog2 : public QDialog, public cTranslator, public Ui::EditDialog
{
Q_OBJECT
public: //---------------------------------------- public
editModalDialog2(QWidget *bw, const QString curval = "", const QString title = STR_MSGEDITBUG);
editModalDialog2(QWidget *bw, const QString curval = "", const QString title = translate(STR_MSGEDITBUG));
virtual ~editModalDialog2(); // Destructor
// virtual int editAction(char* msg, char *text, int len);
QString GetVal();

View File

@ -36,9 +36,6 @@
#include "eeptypes.h"
#include "globals.h"
#include "string_table.h"
using namespace Translator;
//======================>>> progOptionDialog::progOptionDialog <<<==================
@ -79,16 +76,16 @@ progOptionDialog::~progOptionDialog()
void progOptionDialog::setTextWidgets()
{
QStringList txList = (QStringList() << STR_MSGRELOAD << STR_MSGREADPROG << STR_MSGREADDATA << STR_MSGBYTESWAP <<
STR_MSGSERNUM << STR_READOSCCALIB << STR_MSGERASE << STR_MSGWRITEPROG << STR_MSGWRITEDATA << STR_MSGWRITESEC);
QStringList txList = (QStringList() << translate(STR_MSGRELOAD) << translate(STR_MSGREADPROG) << translate(STR_MSGREADDATA) << translate(STR_MSGBYTESWAP) <<
translate(STR_MSGSERNUM) << translate(STR_READOSCCALIB) << translate(STR_MSGERASE) << translate(STR_MSGWRITEPROG) << translate(STR_MSGWRITEDATA) << translate(STR_MSGWRITESEC));
for (int i = 0; i < chk.size(); i++)
{
chk[i]->setText(txList.at(i));
}
pushOk->setText(STR_BTNOK);
pushCancel->setText(STR_BTNCANC);
pushOk->setText(translate(STR_BTNOK));
pushCancel->setText(translate(STR_BTNCANC));
}
void progOptionDialog::onOk()

View File

@ -39,16 +39,14 @@
#include "ui_progoption.h"
#include "e2cmdw.h"
#include "string_table.h"
using namespace Translator;
// TODO to check modal
class progOptionDialog : public QDialog, public Ui::ProgOptDialog
class progOptionDialog : public QDialog, public cTranslator, public Ui::ProgOptDialog
{
Q_OBJECT
public: //---------------------------------------- public
progOptionDialog(QWidget *bw, long type, int &reload, int &reep, int &erase, int &flash, int &eeprom, int &lock, const QString title = STR_MSGPROGOPT);
progOptionDialog(QWidget *bw, long type, int &reload, int &reep, int &erase, int &flash, int &eeprom, int &lock, const QString title = translate(STR_MSGPROGOPT));
virtual ~progOptionDialog(); // Destructor
private slots:

View File

@ -27,16 +27,12 @@
//-------------------------------------------------------------------------//
//=========================================================================//
#include <stdio.h>
#include <stdlib.h>
#include <QDebug>
#include "types.h"
#include "sernumdlg.h"
using namespace Translator;
//=========================>>> SerNumDialog::SerNumDialog <<<====================
SerNumDialog::SerNumDialog(QWidget *bw, const QString title) :
@ -65,9 +61,9 @@ SerNumDialog::SerNumDialog(QWidget *bw, const QString title) :
size = (size < 0 || size > 4) ? 4 : size;
memtype = (memtype == 0 || memtype == 1) ? memtype : 0;
lblLoc->setText(STR_MSGADDRESS);
lblLen->setText(STR_MSGSIZE2);
lblVal->setText(STR_MSGVALUE);
lblLoc->setText(translate(STR_MSGADDRESS));
lblLen->setText(translate(STR_MSGSIZE2));
lblVal->setText(translate(STR_MSGVALUE));
QString str;
str = QString().sprintf("0x%04lX", loc);
@ -108,20 +104,20 @@ SerNumDialog::~SerNumDialog()
void SerNumDialog::setTextWidgets()
{
pushOk->setText(STR_BTNOK);
pushCancel->setText(STR_BTNCANC);
pushOk->setText(translate(STR_BTNOK));
pushCancel->setText(translate(STR_BTNCANC));
lblLoc->setText(STR_MSGADDRESS);
lblLen->setText(STR_MSGSIZE2);
lblVal->setText(STR_MSGVALUE);
lblLoc->setText(translate(STR_MSGADDRESS));
lblLen->setText(translate(STR_MSGSIZE2));
lblVal->setText(translate(STR_MSGVALUE));
chkMemOffset->setText(STR_MSGOFFSET);
chkAutoInc->setText(STR_MSGSNAUTOINC);
chkMemOffset->setText(translate(STR_MSGOFFSET));
chkAutoInc->setText(translate(STR_MSGSNAUTOINC));
frmFormat->setTitle(STR_MSGFORMAT);
frmFormat->setTitle(translate(STR_MSGFORMAT));
rdbLittleEnd->setText(STR_MSGLITTLEEND);
rdbBigEnd->setText(STR_MSGBIGENDIAN);
rdbLittleEnd->setText(translate(STR_MSGLITTLEEND));
rdbBigEnd->setText(translate(STR_MSGBIGENDIAN));
}
@ -212,10 +208,10 @@ OscCalibDialog::OscCalibDialog(QWidget *bw, e2AppWinInfo *aw, const QString titl
E2Profile::GetCalibrationAddress(loc, size, memtype);
lblLoc->setText(STR_MSGADDRESS);
lblVal->setText(STR_MSGVALUE);
lblLoc->setText(translate(STR_MSGADDRESS));
lblVal->setText(translate(STR_MSGVALUE));
chkMemOffset->setText(STR_MSGOFFSET);
chkMemOffset->setText(translate(STR_MSGOFFSET));
QString str1;
QString str3;
@ -231,9 +227,9 @@ OscCalibDialog::OscCalibDialog(QWidget *bw, e2AppWinInfo *aw, const QString titl
chkMemOffset->setChecked(memtype);
pushOk->setText(STR_BTNOK);
pushCancel->setText(STR_BTNCANC);
pushRead->setText(STR_BTNREAD);
pushOk->setText(translate(STR_BTNOK));
pushCancel->setText(translate(STR_BTNCANC));
pushRead->setText(translate(STR_BTNREAD));
connect(pushOk, SIGNAL(clicked()), this, SLOT(onOk()));
connect(pushCancel, SIGNAL(clicked()), this, SLOT(reject()));

View File

@ -36,20 +36,18 @@
#include <QString>
#include <QDialog>
#include "Translator.h"
#include "types.h"
#include "e2profil.h"
#include "e2awinfo.h"
#include "string_table.h"
using namespace Translator;
class SerNumDialog : public QDialog, public Ui::SNCfgDialog
class SerNumDialog : public QDialog, public cTranslator, public Ui::SNCfgDialog
{
Q_OBJECT
public: //---------------------------------------- public
SerNumDialog(QWidget *bw, const QString title = STR_MSGSERNUMCFG);
SerNumDialog(QWidget *bw, const QString title = translate(STR_MSGSERNUMCFG));
virtual ~SerNumDialog(); // Destructor
private slots:
@ -69,11 +67,11 @@ class SerNumDialog : public QDialog, public Ui::SNCfgDialog
};
class OscCalibDialog : public QDialog, public Ui::OscCalibrDialog
class OscCalibDialog : public QDialog, public cTranslator, public Ui::OscCalibrDialog
{
Q_OBJECT
public: //---------------------------------------- public
OscCalibDialog(QWidget *bw, e2AppWinInfo *aw, const QString title = STR_MSGOSCCALIBCFG);
OscCalibDialog(QWidget *bw, e2AppWinInfo *aw, const QString title = translate(STR_MSGOSCCALIBCFG));
virtual ~OscCalibDialog(); // Destructor
private slots: