Skip to content

Commit

Permalink
0.2.rev.A. UI improvements in software
Browse files Browse the repository at this point in the history
  • Loading branch information
robsonsmartins committed Jan 14, 2024
1 parent 51e0053 commit 38959e8
Show file tree
Hide file tree
Showing 7 changed files with 140 additions and 155 deletions.
24 changes: 12 additions & 12 deletions software/usbflashprog/i18n/ufprog_en_US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -433,18 +433,6 @@
<source>Calibrate</source>
<translation>Calibrate</translation>
</message>
<message>
<source>Set Address</source>
<translation>Set Address</translation>
</message>
<message>
<source>Set Data</source>
<translation>Set Data</translation>
</message>
<message>
<source>Get Data</source>
<translation>Get Data</translation>
</message>
<message>
<source>File</source>
<translation>File</translation>
Expand Down Expand Up @@ -550,6 +538,14 @@
<source>%1 second(s)</source>
<translation>%1 second(s)</translation>
</message>
<message>
<source>Get Word</source>
<translation>Get Word</translation>
</message>
<message>
<source>Get Byte</source>
<translation>Get Byte</translation>
</message>
</context>
<context>
<name>SettingsDialog</name>
Expand Down Expand Up @@ -601,5 +597,9 @@
<source>Note: The log file can be found at %1</source>
<translation>Note: The log file can be found at %1</translation>
</message>
<message>
<source>Settings</source>
<translation>Settings</translation>
</message>
</context>
</TS>
24 changes: 12 additions & 12 deletions software/usbflashprog/i18n/ufprog_pt_BR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -433,18 +433,6 @@
<source>Calibrate</source>
<translation>Calibrar</translation>
</message>
<message>
<source>Set Address</source>
<translation>Gravar Endereço</translation>
</message>
<message>
<source>Set Data</source>
<translation>Gravar Dados</translation>
</message>
<message>
<source>Get Data</source>
<translation>Ler Dados</translation>
</message>
<message>
<source>File</source>
<translation>Arquivo</translation>
Expand Down Expand Up @@ -549,6 +537,14 @@
<source>%1 second(s)</source>
<translation>%1 segundo(s)</translation>
</message>
<message>
<source>Get Word</source>
<translation>Ler 16 Bits</translation>
</message>
<message>
<source>Get Byte</source>
<translation>Ler 8 Bits</translation>
</message>
</context>
<context>
<name>SettingsDialog</name>
Expand Down Expand Up @@ -600,5 +596,9 @@
<source>Note: The log file can be found at %1</source>
<translation>Nota: O arquivo de log pode ser encontrado em %1</translation>
</message>
<message>
<source>Settings</source>
<translation>Configurações</translation>
</message>
</context>
</TS>
46 changes: 30 additions & 16 deletions software/usbflashprog/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@
#include "main.hpp"
#include "ui/mainwindow.hpp"

#ifdef Q_OS_WINDOWS
#include <windows.h>
#else
#include <sys/time.h>
#include <sys/resource.h>
#endif

// ---------------------------------------------------------------------------
/**
* @brief Main routine.
Expand Down Expand Up @@ -82,26 +89,26 @@ void initLogging(int level) {
QString strType;
switch (level) {
case 1: // Fatal
rules = "*.fatal=true";
rules = "*.critical=false";
strType = "FATAL";
break;
case 2: // Critical
rules = "*.critical=true";
rules = "*.warning=false";
strType = "CRITICAL";
break;
case 3: // Warning
rules = "*.warning=true";
rules = "*.info=false";
strType = "WARNING";
break;
case 4: // Info
rules = "*.warning=true\nbackend.*.info=true\ndevice.*.info=true";
rules = "*.debug=false";
strType = "INFO";
break;
case 5: // Debug
default:
if (level >= 5) {
rules =
"*.info=true\nbackend.*.debug=true\ndevice.*.debug=true";
"*.debug=false\nbackend.*.debug=true\ndevice.*.debug=true";
strType = "DEBUG";
}
break;
Expand Down Expand Up @@ -134,19 +141,19 @@ void initLogging(int level) {
strType = "DEBUG";
break;
}
QString timeStamp =
QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss.zzz");
QString txt = QString("%1 %2 %3 - %4")
.arg(timeStamp)
.arg("[" + QString(context.category) + "]", -25)
.arg(strType, -8)
.arg(localMsg);
QFile logFile(QDir::homePath() + "/" + QString(kLogFileName));
logFile.open(QIODevice::WriteOnly | QIODevice::Append);
QTextStream ts(&logFile);
ts << txt << endl;
QString timeStamp =
QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss.zzz");
ts << QString("%1 %2 %3 - %4")
.arg(timeStamp)
.arg("[" + QString(context.category) + "]", -25)
.arg(strType, -8)
.arg(localMsg)
<< endl;
});
qInfo() << "Setting Log Level: " << strType;
qInfo() << "Setting Log Level:" << strType;
}

void loadLanguage(const QString &language, QApplication *app) {
Expand Down Expand Up @@ -203,17 +210,24 @@ void loadLanguage(const QString &language, QApplication *app) {
}
if (baseOk) {
app->installTranslator(baseTranslator);
qInfo() << "Installed Qt Base translator for language: " << localeName;
qInfo() << "Installed Qt Base translator for language:" << localeName;
}
if (customOk) {
app->installTranslator(customTranslator);
qInfo() << "Installed Custom translator for language: " << localeName;
qInfo() << "Installed Custom translator for language:" << localeName;
}
}

int main(int argc, char *argv[]) {
#ifdef Q_OS_LINUX
setenv("XDG_SESSION_TYPE", "x11", 1);
#endif
// elevates priority of process
#ifdef Q_OS_WINDOWS
SetPriorityClass(GetCurrentProcess(), REALTIME_PRIORITY_CLASS);
#else
// only if running as superuser
setpriority(PRIO_PROCESS, 0, -20);
#endif
// create app
QApplication app(argc, argv);
Expand Down
Loading

0 comments on commit 38959e8

Please sign in to comment.