This commit is contained in:
Gangphon 2024-06-25 09:37:41 +08:00
parent 80ebceeeac
commit 10aa14fab4
5 changed files with 24 additions and 102 deletions

View File

@ -5,6 +5,7 @@
#include "gutil/qgui.h" #include "gutil/qgui.h"
#include "tools.h" #include "tools.h"
#include <QMessageBox> #include <QMessageBox>
#include <QTimeZone>
#include <QLineEdit> #include <QLineEdit>
#include <QButtonGroup> #include <QButtonGroup>
#include "devicepanel.h" #include "devicepanel.h"
@ -17,90 +18,8 @@ CtrlVerifyClockPanel::CtrlVerifyClockPanel() {
hBox->addWidget(label); hBox->addWidget(label);
fdTimezone = new QComboBox; fdTimezone = new QComboBox;
fdTimezone->setMinimumWidth(200); auto zoneIds = QTimeZone::availableTimeZoneIds();
fdTimezone->addItem("Africa/Brazzaville");//西部非洲标准时间 (布拉扎维)</timezone> for(auto &zoneId : zoneIds) fdTimezone->addItem(zoneId);
fdTimezone->addItem("Africa/Cairo");//东欧标准时间 (开罗)</timezone>
fdTimezone->addItem("Africa/Casablanca");//卡萨布兰卡</timezone>
fdTimezone->addItem("Africa/Harare");//中部非洲标准时间 (哈拉雷)</timezone>
fdTimezone->addItem("Africa/Nairobi");//东部非洲标准时间 (内罗毕)</timezone>
fdTimezone->addItem("Africa/Windhoek");//温得和克</timezone>
fdTimezone->addItem("America/Anchorage");//>安克雷奇</timezone>
fdTimezone->addItem("America/Argentina/Buenos_Aires");//布宜诺斯艾利斯</timezone>
fdTimezone->addItem("America/Barbados");//>大西洋时间 (巴巴多斯)</timezone>
fdTimezone->addItem("America/Bogota");//>哥伦比亚时间 (波哥大)</timezone>
fdTimezone->addItem("America/Caracas");//>委内瑞拉时间 (加拉加斯)</timezone>
fdTimezone->addItem("America/Chicago");//>美国中部时间 (芝加哥)</timezone>
fdTimezone->addItem("America/Chihuahua");//>奇瓦瓦</timezone>
fdTimezone->addItem("America/Costa_Rica");//>美国中部时间 (哥斯达黎加)</timezone>
fdTimezone->addItem("America/Denver");//>美国山区时间 (丹佛)</timezone>
fdTimezone->addItem("America/Godthab");//戈特霍布</timezone>
fdTimezone->addItem("America/Los_Angeles");//>美国太平洋时间 (洛杉矶)</timezone>
fdTimezone->addItem("America/Manaus");//亚马逊标准时间 (马瑙斯)</timezone>
fdTimezone->addItem("America/Mexico_City");//>美国中部时间 (墨西哥城)</timezone>
fdTimezone->addItem("America/Montevideo");//乌拉圭时间 (蒙得维的亚)</timezone>
fdTimezone->addItem("America/New_York");//>美国东部时间 (纽约)</timezone>
fdTimezone->addItem("America/Phoenix");//>美国山区时间 (凤凰城)</timezone>
fdTimezone->addItem("America/Regina");//>美国中部时间 (里贾纳)</timezone>
fdTimezone->addItem("America/Santiago");//圣地亚哥</timezone>
fdTimezone->addItem("America/Sao_Paulo");//圣保罗</timezone>
fdTimezone->addItem("America/St_Johns");//纽芬兰时间 (圣约翰)</timezone>
fdTimezone->addItem("America/Tijuana");//>美国太平洋时间 (提华纳)</timezone>
fdTimezone->addItem("Asia/Almaty");//阿拉木图</timezone>
fdTimezone->addItem("Asia/Amman");//东欧标准时间 (安曼)</timezone>
fdTimezone->addItem("Asia/Baghdad");//巴格达</timezone>
fdTimezone->addItem("Asia/Baku");//巴库</timezone>
fdTimezone->addItem("Asia/Bangkok");//曼谷</timezone>
fdTimezone->addItem("Asia/Beirut");//东欧标准时间 (贝鲁特)</timezone>
fdTimezone->addItem("Asia/Calcutta");//加尔各答</timezone>
fdTimezone->addItem("Asia/Colombo");//科伦坡</timezone>
fdTimezone->addItem("Asia/Dubai");//迪拜</timezone>
fdTimezone->addItem("Asia/Hong_Kong");//香港时间 (香港)</timezone>
fdTimezone->addItem("Asia/Irkutsk");//伊尔库茨克时间 (伊尔库茨克)</timezone>
fdTimezone->addItem("Asia/Jerusalem");//以色列时间 (耶路撒冷)</timezone>
fdTimezone->addItem("Asia/Kabul");//阿富汗时间 (喀布尔)</timezone>
fdTimezone->addItem("Asia/Karachi");//卡拉奇</timezone>
fdTimezone->addItem("Asia/Katmandu");//尼泊尔时间 (加德满都)</timezone>
fdTimezone->addItem("Asia/Krasnoyarsk");//克拉斯诺亚尔斯克</timezone>
fdTimezone->addItem("Asia/Kuala_Lumpur");//吉隆坡</timezone>
fdTimezone->addItem("Asia/Kuwait");//科威特</timezone>
fdTimezone->addItem("Asia/Magadan");//马加丹时间 (马加丹)</timezone>
fdTimezone->addItem("Asia/Oral");//乌拉尔</timezone>
fdTimezone->addItem("Asia/Rangoon");//缅甸时间 (仰光)</timezone>
fdTimezone->addItem("Asia/Seoul");//首尔</timezone>
fdTimezone->addItem("Asia/Shanghai");//中国标准时间 (北京)</timezone>
fdTimezone->addItem("Asia/Taipei");//台北时间 (台北)</timezone>
fdTimezone->addItem("Asia/Tbilisi");//第比利斯</timezone>
fdTimezone->addItem("Asia/Tehran");//伊朗标准时间 (德黑兰)</timezone>
fdTimezone->addItem("Asia/Tokyo");//日本时间 (东京)</timezone>
fdTimezone->addItem("Asia/Vladivostok");//海参崴时间 (符拉迪沃斯托克)</timezone>
fdTimezone->addItem("Asia/Yakutsk");//雅库茨克时间 (雅库茨克)</timezone>
fdTimezone->addItem("Asia/Yekaterinburg");//叶卡捷林堡</timezone>
fdTimezone->addItem("Asia/Yerevan");//埃里温</timezone>
fdTimezone->addItem("Atlantic/Azores");//亚述尔群岛</timezone>
fdTimezone->addItem("Atlantic/Cape_Verde");//佛得角</timezone>
fdTimezone->addItem("Atlantic/South_Georgia");//南乔治亚</timezone>
fdTimezone->addItem("Australia/Adelaide");//阿德莱德</timezone>
fdTimezone->addItem("Australia/Brisbane");//布里斯班</timezone>
fdTimezone->addItem("Australia/Darwin");//达尔文</timezone>
fdTimezone->addItem("Australia/Hobart");//霍巴特</timezone>
fdTimezone->addItem("Australia/Perth");//佩思</timezone>
fdTimezone->addItem("Australia/Sydney");//悉尼</timezone>
fdTimezone->addItem("Europe/Amsterdam");//中欧标准时间 (阿姆斯特丹)</timezone>
fdTimezone->addItem("Europe/Athens");//东欧标准时间 (雅典)</timezone>
fdTimezone->addItem("Europe/Belgrade");//中欧标准时间 (贝尔格莱德)</timezone>
fdTimezone->addItem("Europe/Brussels");//中欧标准时间 (布鲁塞尔)</timezone>
fdTimezone->addItem("Europe/Helsinki");//东欧标准时间 (赫尔辛基)</timezone>
fdTimezone->addItem("Europe/London");//格林尼治标准时间 (伦敦)</timezone>
fdTimezone->addItem("Europe/Minsk");//明斯克</timezone>
fdTimezone->addItem("Europe/Moscow");//莫斯科</timezone>
fdTimezone->addItem("Europe/Sarajevo");//中欧标准时间 (萨拉热窝)</timezone>
fdTimezone->addItem("Pacific/Auckland");//奥克兰</timezone>
fdTimezone->addItem("Pacific/Fiji");//斐济</timezone>
fdTimezone->addItem("Pacific/Guam");//关岛</timezone>
fdTimezone->addItem("Pacific/Honolulu");
fdTimezone->addItem("Pacific/Majuro");
fdTimezone->addItem("Pacific/Midway");
fdTimezone->addItem("Pacific/Tongatapu");//东加塔布</timezone>
hBox->addWidget(fdTimezone); hBox->addWidget(fdTimezone);
fdTimeZoneSet = new QPushButton; fdTimeZoneSet = new QPushButton;

View File

@ -7,7 +7,6 @@
#include <QMessageBox> #include <QMessageBox>
#include <QPainter> #include <QPainter>
#include <QInputDialog> #include <QInputDialog>
#include <QJsonObject>
DeviceItem::DeviceItem(LoQTreeWidget *parent) : TreeWidgetItem(parent) { DeviceItem::DeviceItem(LoQTreeWidget *parent) : TreeWidgetItem(parent) {
setFlags(flags() & ~Qt::ItemIsUserCheckable); setFlags(flags() & ~Qt::ItemIsUserCheckable);
@ -21,7 +20,7 @@ DeviceItem::DeviceItem(LoQTreeWidget *parent) : TreeWidgetItem(parent) {
btnGetCapture->setIcon(QIcon(":/res/deviceReadbackPic.png")); btnGetCapture->setIcon(QIcon(":/res/deviceReadbackPic.png"));
btnGetCapture->setIconSize({28, 28}); btnGetCapture->setIconSize({28, 28});
QObject::connect(btnGetCapture, &QPushButton::clicked, btnGetCapture, [=] { QObject::connect(btnGetCapture, &QPushButton::clicked, btnGetCapture, [=] {
QJsonObject json; JObj json;
json.insert("_id", "GetScreenshotFull"); json.insert("_id", "GetScreenshotFull");
json.insert("_type", "GetScreenshotFull"); json.insert("_type", "GetScreenshotFull");
auto waitingDlg = new WaitingDlg(btnGetCapture, DevicePanel::tr("Getting ")+DevicePanel::tr("Screenshot")+" ..."); auto waitingDlg = new WaitingDlg(btnGetCapture, DevicePanel::tr("Getting ")+DevicePanel::tr("Screenshot")+" ...");
@ -58,7 +57,7 @@ DeviceItem::DeviceItem(LoQTreeWidget *parent) : TreeWidgetItem(parent) {
bool ok; bool ok;
auto pwd = QInputDialog::getText(treeWidget(), DevicePanel::tr("Input password"), DevicePanel::tr("Input password"), QLineEdit::Password, QString(), &ok); auto pwd = QInputDialog::getText(treeWidget(), DevicePanel::tr("Input password"), DevicePanel::tr("Input password"), QLineEdit::Password, QString(), &ok);
if(! ok) return; if(! ok) return;
QJsonObject json; JObj json;
json.insert("_id", "VerifyPassword"); json.insert("_id", "VerifyPassword");
json.insert("_type", "VerifyPassword"); json.insert("_type", "VerifyPassword");
json.insert("pwd", pwd); json.insert("pwd", pwd);

View File

@ -205,7 +205,7 @@ QWidget* EAClock::attrWgt() {
auto hBox = new HBox(vBox); auto hBox = new HBox(vBox);
hBox->addWidget(new QLabel(tr("Basic Properties"))); hBox->addWidget(new QLabel(tr("Basic Properties")));
auto line = new QFrame(); auto line = new QFrame;
line->setFrameShape(QFrame::HLine); line->setFrameShape(QFrame::HLine);
line->setFrameShadow(QFrame::Sunken); line->setFrameShadow(QFrame::Sunken);
hBox->addWidget(line, 1); hBox->addWidget(line, 1);
@ -215,15 +215,15 @@ QWidget* EAClock::attrWgt() {
hBox->addSpacing(6); hBox->addSpacing(6);
hBox->addWidget(new QLabel(tr("Time Zone"))); hBox->addWidget(new QLabel(tr("Time Zone")));
auto wTimeZone = new QComboBox(); auto edTimeZone = new QComboBox;
QList<QByteArray> ids = QTimeZone::availableTimeZoneIds(); auto zoneIds = QTimeZone::availableTimeZoneIds();
foreach(QByteArray id, ids) wTimeZone->addItem(QString::fromUtf8(id)); for(auto &zoneId : zoneIds) edTimeZone->addItem(zoneId);
wTimeZone->setCurrentText(m_attr.timeZone.id()); edTimeZone->setCurrentText(m_attr.timeZone.id());
connect(wTimeZone, &QComboBox::currentTextChanged, this, [this](const QString &text) { connect(edTimeZone, &QComboBox::currentTextChanged, this, [this](const QString &text) {
m_attr.timeZone = QTimeZone(text.toUtf8()); m_attr.timeZone = QTimeZone(text.toUtf8());
update(); update();
}); });
hBox->addWidget(wTimeZone); hBox->addWidget(edTimeZone);
hBox->addStretch(); hBox->addStretch();

View File

@ -153,15 +153,15 @@ QWidget* EDClock::attrWgt() {
hBox->addSpacing(6); hBox->addSpacing(6);
hBox->addWidget(new QLabel(tr("Time Zone"))); hBox->addWidget(new QLabel(tr("Time Zone")));
auto wTimeZone = new QComboBox(); auto edTimeZone = new QComboBox;
auto zoneIds = QTimeZone::availableTimeZoneIds(); auto zoneIds = QTimeZone::availableTimeZoneIds();
foreach(QByteArray zoneId, zoneIds) wTimeZone->addItem(QString::fromUtf8(zoneId)); for(auto &zoneId : zoneIds) edTimeZone->addItem(zoneId);
wTimeZone->setCurrentText(QString::fromUtf8(m_attr.timeZoneId)); edTimeZone->setCurrentText(m_attr.timeZoneId);
connect(wTimeZone, &QComboBox::currentTextChanged, this, [this](const QString &text) { connect(edTimeZone, &QComboBox::currentTextChanged, this, [this](const QString &text) {
m_attr.timeZoneId = text.toUtf8(); m_attr.timeZoneId = text.toUtf8();
update(); update();
}); });
hBox->addWidget(wTimeZone); hBox->addWidget(edTimeZone);
hBox->addStretch(); hBox->addStretch();
vBox->addLayout(hBox); vBox->addLayout(hBox);

View File

@ -12,7 +12,8 @@
EPhoto *EPhoto::create(const QString &file, PageListItem *pageItem, EBase *multiWin) { EPhoto *EPhoto::create(const QString &file, PageListItem *pageItem, EBase *multiWin) {
QImageReader reader(file); QImageReader reader(file);
QImage img = reader.read(); reader.setAutoTransform(true);
auto img = reader.read();
if(img.isNull()) { if(img.isNull()) {
QMessageBox::critical(pageItem->listWidget(), "Image Error", Tools::readErrStr(reader.error())+": "+reader.errorString()+"\n"+file); QMessageBox::critical(pageItem->listWidget(), "Image Error", Tools::readErrStr(reader.error())+": "+reader.errorString()+"\n"+file);
return 0; return 0;
@ -34,7 +35,9 @@ EPhoto *EPhoto::create(const JObj &json, PageListItem *pageItem, EBase *multiWin
else if(QFileInfo(file2 = dir + "/card_"+name).isFile()) QFile::rename(file2, file); else if(QFileInfo(file2 = dir + "/card_"+name).isFile()) QFile::rename(file2, file);
else return nullptr; else return nullptr;
} }
auto img = QImage(file); QImageReader reader(file);
reader.setAutoTransform(true);
auto img = reader.read();
if(img.isNull()) return 0; if(img.isNull()) return 0;
auto ins = new EPhoto(img, dir, name, pageItem, multiWin); auto ins = new EPhoto(img, dir, name, pageItem, multiWin);
ins->setBaseAttr(json); ins->setBaseAttr(json);
@ -114,7 +117,8 @@ QWidget* EPhoto::attrWgt() {
QString file = QFileDialog::getOpenFileName(wgtAttr, tr("Select File"), home, EPhoto::filters()); QString file = QFileDialog::getOpenFileName(wgtAttr, tr("Select File"), home, EPhoto::filters());
if(file.isEmpty()) return; if(file.isEmpty()) return;
QImageReader reader(file); QImageReader reader(file);
QImage aimg = reader.read(); reader.setAutoTransform(true);
auto aimg = reader.read();
if(aimg.isNull()) { if(aimg.isNull()) {
QMessageBox::critical(wgtAttr, tr("Image Read Error"), Tools::readErrStr(reader.error())+": "+reader.errorString()+"\n"+file); QMessageBox::critical(wgtAttr, tr("Image Read Error"), Tools::readErrStr(reader.error())+": "+reader.errorString()+"\n"+file);
return; return;