提交测试,基本完成
This commit is contained in:
@ -12,6 +12,7 @@
|
||||
#include <QPixmap>
|
||||
#include "mainwindowlayout.h"
|
||||
#include "globalvariables.h"
|
||||
#include "MyButton.h"
|
||||
#include "sqlitehelper.h"
|
||||
#ifdef _DEBUG
|
||||
#pragma comment(lib, "Qt5Svgd.lib")
|
||||
@ -54,20 +55,28 @@ NavBar::NavBar(ConfigResponse *configResponse, MainScreen *mainScreen,QWidget *p
|
||||
config_request.sendRequest(&config_response);
|
||||
SQLiteHelper sqlite_helper;
|
||||
sqlite_helper.get_software(&buttonStructs, &config_response);
|
||||
if(config_response.succeed==true)
|
||||
if(!config_response.succeed)
|
||||
{
|
||||
getLogoFromInternet(&config_response);
|
||||
qColor.setNamedColor(DEFAULT_BACKGROUND_COLOR);
|
||||
|
||||
}else
|
||||
{
|
||||
getLogoFromLocal();
|
||||
qColor.setNamedColor(config_response.basic.backgroud_color);
|
||||
}
|
||||
layout2 = new QHBoxLayout;
|
||||
layout_right = new QHBoxLayout;
|
||||
layout_left = new QHBoxLayout;
|
||||
logo_label = new QLabel(this);
|
||||
logo_label->setAttribute(Qt::WA_TranslucentBackground);
|
||||
//*logo = logo->scaled(this->width() / (5 / scale), this->height());
|
||||
logo_label->setScaledContents(true);
|
||||
logo_label->setPixmap(QPixmap::fromImage(*logo));
|
||||
QPixmap pixmap(QApplication::applicationDirPath() + DEFAULT_LOGO);
|
||||
pixmap.setMask(pixmap.createMaskFromColor(QColor(Qt::transparent)));
|
||||
logo_label->setAutoFillBackground(true);
|
||||
QPalette palette = logo_label->palette();
|
||||
palette.setColor(QPalette::Window, Qt::transparent);
|
||||
logo_label->setPalette(palette);
|
||||
logo_label->setPixmap(pixmap);
|
||||
logo_label->setMaximumHeight(parent->height() / 8);
|
||||
layout_left->addWidget(logo_label);
|
||||
layout_left->setAlignment(Qt::AlignCenter);
|
||||
@ -104,7 +113,6 @@ NavBar::~NavBar() {
|
||||
}
|
||||
layout2->removeWidget(logo_label);
|
||||
delete logo_label;
|
||||
delete logo;
|
||||
//delete layout_left;
|
||||
delete layout_right;
|
||||
delete layout2;
|
||||
@ -129,7 +137,7 @@ void NavBar::resizeEvent(QResizeEvent *event) {
|
||||
}
|
||||
logo_label->setMaximumSize(event->size().width() / 5, event->size().height());
|
||||
}
|
||||
void NavBar::getLogoFromInternet(ConfigResponse *configResponse) {
|
||||
/*void NavBar::getLogoFromInternet(ConfigResponse *configResponse) {
|
||||
qColor.setNamedColor(configResponse->basic.backgroud_color);
|
||||
|
||||
QUrl url_logo(configResponse->basic.logo_url);
|
||||
@ -147,7 +155,7 @@ void NavBar::getLogoFromInternet(ConfigResponse *configResponse) {
|
||||
reply->close();
|
||||
if (downloadSuccess == true) {
|
||||
*buffer = reply->readAll();
|
||||
logo = new QImage();
|
||||
logo = new ;
|
||||
logo->loadFromData(*buffer);
|
||||
buffer->clear();
|
||||
}else
|
||||
@ -157,7 +165,7 @@ void NavBar::getLogoFromInternet(ConfigResponse *configResponse) {
|
||||
delete manager;
|
||||
manager = nullptr;
|
||||
|
||||
}
|
||||
}*/
|
||||
void NavBar::storeToBuffer() {
|
||||
buffer = new QByteArray;
|
||||
|
||||
@ -169,7 +177,7 @@ void NavBar::cancelDownload() {
|
||||
downloadSuccess = false;
|
||||
}
|
||||
|
||||
void NavBar::getLogoFromLocal() {
|
||||
/*void NavBar::getLogoFromLocal() {
|
||||
QString dir = QApplication::applicationDirPath();
|
||||
QFile file(dir + DEFAULT_FILE);
|
||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
@ -186,9 +194,7 @@ void NavBar::getLogoFromLocal() {
|
||||
*obj_root = qJsonDocument->object();
|
||||
delete qJsonDocument;
|
||||
QString logo_path = obj_root->value("basic").toObject().value("logo").toString();
|
||||
logo = new QImage(logo_path);
|
||||
QString color= obj_root->value("basic").toObject().value("backgroud_color").toString();
|
||||
qColor.setNamedColor(color);
|
||||
logo = new QPixmap(logo_path);
|
||||
QJsonArray *array = new QJsonArray;
|
||||
}
|
||||
else {
|
||||
@ -198,4 +204,4 @@ void NavBar::getLogoFromLocal() {
|
||||
}
|
||||
delete obj_root;
|
||||
|
||||
}
|
||||
}*/
|
Reference in New Issue
Block a user