This commit is contained in:
2023-07-06 21:48:42 +03:00
parent b763f0e5cd
commit b19d50ba62
3 changed files with 14 additions and 11 deletions

View File

@@ -19,6 +19,7 @@
#include "pikbdlistener.h" #include "pikbdlistener.h"
#include "piincludes_p.h" #include "piincludes_p.h"
#include "piliterals.h"
#ifndef WINDOWS #ifndef WINDOWS
# include <termios.h> # include <termios.h>
#else #else
@@ -147,7 +148,7 @@ PRIVATE_DEFINITION_END(PIKbdListener)
PIKbdListener::PIKbdListener(KBFunc slot, void * _d, bool startNow): PIThread() { PIKbdListener::PIKbdListener(KBFunc slot, void * _d, bool startNow): PIThread() {
setName("keyboard_listener"); setName("keyboard_listener"_a);
_object = this; _object = this;
#ifdef WINDOWS #ifdef WINDOWS
PRIVATE->hIn = GetStdHandle(STD_INPUT_HANDLE); PRIVATE->hIn = GetStdHandle(STD_INPUT_HANDLE);
@@ -526,7 +527,7 @@ void PIKbdListener::readKeyboard() {
cout << "'" << (char)(rc[i]) << "' "; cout << "'" << (char)(rc[i]) << "' ";
cout << endl;*/ cout << endl;*/
} }
if (ke.key == 0 && PRIVATE->ret > 1) ke.key = PIChar(rc).unicode16Code(); if (ke.key == 0 && PRIVATE->ret > 1) ke.key = PIChar::fromSystem(rc).unicode16Code();
#endif #endif
if ((rc[0] == '\n' || rc[0] == '\r') && PRIVATE->ret == 1) ke.key = Return; if ((rc[0] == '\n' || rc[0] == '\r') && PRIVATE->ret == 1) ke.key = Return;
if (exit_enabled && ke.key == exit_key) { if (exit_enabled && ke.key == exit_key) {

View File

@@ -1199,7 +1199,7 @@ PIVector<PISerial::DeviceInfo> PISerial::availableDevicesInfo(bool test) {
# endif # endif
PIFile file_prefixes("/proc/tty/drivers", PIIODevice::ReadOnly); PIFile file_prefixes("/proc/tty/drivers", PIIODevice::ReadOnly);
if (file_prefixes.open()) { if (file_prefixes.open()) {
PIString fc = file_prefixes.readAll(true), line, cpref; PIString fc = PIString::fromAscii(file_prefixes.readAll(true)), line, cpref;
PIStringList words; PIStringList words;
file_prefixes.close(); file_prefixes.close();
while (!fc.isEmpty()) { while (!fc.isEmpty()) {
@@ -1236,10 +1236,11 @@ PIVector<PISerial::DeviceInfo> PISerial::availableDevicesInfo(bool test) {
for (int i = 0; i < 5; ++i) { for (int i = 0; i < 5; ++i) {
fpath += "../"; fpath += "../";
// piCout << "try" << fpath; // piCout << "try" << fpath;
if (_f.open(fpath + "idVendor", PIIODevice::ReadOnly)) di.vID = PIString(_f.readAll()).trim().toInt(16); if (_f.open(fpath + "idVendor", PIIODevice::ReadOnly)) di.vID = PIString::fromAscii(_f.readAll()).trim().toInt(16);
if (_f.open(fpath + "idProduct", PIIODevice::ReadOnly)) di.pID = PIString(_f.readAll()).trim().toInt(16); if (_f.open(fpath + "idProduct", PIIODevice::ReadOnly)) di.pID = PIString::fromAscii(_f.readAll()).trim().toInt(16);
if (_f.open(fpath + "product", PIIODevice::ReadOnly)) di.description = PIString(_f.readAll()).trim(); if (_f.open(fpath + "product", PIIODevice::ReadOnly)) di.description = PIString::fromUTF8(_f.readAll()).trim();
if (_f.open(fpath + "manufacturer", PIIODevice::ReadOnly)) di.manufacturer = PIString(_f.readAll()).trim(); if (_f.open(fpath + "manufacturer", PIIODevice::ReadOnly))
di.manufacturer = PIString::fromUTF8(_f.readAll()).trim();
if (di.pID > 0) break; if (di.pID > 0) break;
} }
} }

View File

@@ -21,6 +21,7 @@
#include "pidir.h" #include "pidir.h"
#include "piincludes_p.h" #include "piincludes_p.h"
#include "piliterals.h"
#include "piprocess.h" #include "piprocess.h"
#include "pisysteminfo.h" #include "pisysteminfo.h"
#include "pitime_win.h" #include "pitime_win.h"
@@ -84,7 +85,7 @@ PISystemMonitor::PISystemMonitor(): PIThread() {
PRIVATE->mem_cnt.cb = sizeof(PRIVATE->mem_cnt); PRIVATE->mem_cnt.cb = sizeof(PRIVATE->mem_cnt);
# endif # endif
#endif #endif
setName("system_monitor"); setName("system_monitor"_a);
} }
@@ -208,7 +209,7 @@ void PISystemMonitor::run() {
// piCout << (PRIVATE->cpu_u_cur - PRIVATE->cpu_u_prev).toMilliseconds() / delay_; // piCout << (PRIVATE->cpu_u_cur - PRIVATE->cpu_u_prev).toMilliseconds() / delay_;
# else # else
PRIVATE->file.seekToBegin(); PRIVATE->file.seekToBegin();
PIString str(PRIVATE->file.readAll(true)); PIString str = PIString::fromAscii(PRIVATE->file.readAll(true));
int si = str.find('(') + 1, fi = 0, cc = 1; int si = str.find('(') + 1, fi = 0, cc = 1;
for (int i = si; i < str.size_s(); ++i) { for (int i = si; i < str.size_s(); ++i) {
if (str[i] == '(') cc++; if (str[i] == '(') cc++;
@@ -246,7 +247,7 @@ void PISystemMonitor::run() {
// piCout << sl[0] << sl[12] << sl[13]; // piCout << sl[0] << sl[12] << sl[13];
PRIVATE->filem.seekToBegin(); PRIVATE->filem.seekToBegin();
str = PRIVATE->filem.readAll(true); str = PIString::fromAscii(PRIVATE->filem.readAll(true));
sl = str.split(" "); sl = str.split(" ");
if (sl.size_s() < 6) return; if (sl.size_s() < 6) return;
tstat.virtual_memsize = sl[0].toLong() * page_size; tstat.virtual_memsize = sl[0].toLong() * page_size;
@@ -352,7 +353,7 @@ void PISystemMonitor::gatherThread(llong id) {
PIFile f(PRIVATE->proc_dir + "task/" + PIString::fromNumber(id) + "/stat"); PIFile f(PRIVATE->proc_dir + "task/" + PIString::fromNumber(id) + "/stat");
// piCout << f.path(); // piCout << f.path();
if (!f.open(PIIODevice::ReadOnly)) return; if (!f.open(PIIODevice::ReadOnly)) return;
PIString str = f.readAll(true); PIString str = PIString::fromAscii(f.readAll(true));
int si = str.find('(') + 1, fi = 0, cc = 1; int si = str.find('(') + 1, fi = 0, cc = 1;
for (int i = si; i < str.size_s(); ++i) { for (int i = si; i < str.size_s(); ++i) {
if (str[i] == '(') cc++; if (str[i] == '(') cc++;