准备整理代码

This commit is contained in:
Mike Solar
2023-08-17 01:10:27 +08:00
parent 94017995bc
commit bc3b3f69a7
17 changed files with 182 additions and 256 deletions

View File

@ -1,4 +1,4 @@
//
//
// Created by HW on 2023/07/26.
//
@ -67,6 +67,7 @@ NavBar::NavBar(MainScreen *mainScreen,QWidget *parent) :
layout2 = new QHBoxLayout;
layout_right = new QHBoxLayout;
layout_left = new QHBoxLayout;
getLogoFromInternet(&config_response);
logo_label = new QLabel(this);
logo_label->setAttribute(Qt::WA_TranslucentBackground);
//*logo = logo->scaled(this->width() / (5 / scale), this->height());
@ -138,9 +139,7 @@ void NavBar::resizeEvent(QResizeEvent *event) {
}
logo_label->setMaximumSize(event->size().width() / 5, event->size().height());
}
/*void NavBar::getLogoFromInternet(ConfigResponse *configResponse) {
qColor.setNamedColor(configResponse->basic.backgroud_color);
void NavBar::getLogoFromInternet(ConfigResponse *configResponse) {
QUrl url_logo(configResponse->basic.logo_url);
QNetworkRequest *request_logo = new QNetworkRequest(url_logo);
manager = new QNetworkAccessManager;
@ -156,17 +155,17 @@ void NavBar::resizeEvent(QResizeEvent *event) {
reply->close();
if (downloadSuccess == true) {
*buffer = reply->readAll();
logo = new ;
logo->loadFromData(*buffer);
QFile logo(QApplication::applicationDirPath() + DEFAULT_LOGO);
if (logo.open(QIODevice::WriteOnly)) {
logo.write(*buffer);
logo.close();
}
buffer->clear();
}else
{
getLogoFromLocal();
}
delete manager;
manager = nullptr;
}*/
}
void NavBar::storeToBuffer() {
buffer = new QByteArray;
@ -182,7 +181,7 @@ void NavBar::cancelDownload() {
QString dir = QApplication::applicationDirPath();
QFile file(dir + DEFAULT_FILE);
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
QMessageBox::warning(nullptr, QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), QString::fromLocal8Bit("<EFBFBD>޷<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>"));
QMessageBox::warning(nullptr, QString::fromLocal8Bit("错误"), QString::fromLocal8Bit("无法打开配置文件"));
exit(1);
}
buffer->clear();
@ -199,7 +198,7 @@ void NavBar::cancelDownload() {
QJsonArray *array = new QJsonArray;
}
else {
QMessageBox::warning(nullptr, QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
QMessageBox::warning(nullptr, QString::fromLocal8Bit("错误"), QString::fromLocal8Bit("配置文件损坏"));
delete obj_root;
exit(1);
}