修复导航栏问题
parent
6fa68053bb
commit
4220083ac3
Binary file not shown.
|
@ -11,6 +11,7 @@ MyButton::MyButton(ButtonStruct &buttonStruct,int width,int height,QList<MyButto
|
||||||
this->url = buttonStruct.url;
|
this->url = buttonStruct.url;
|
||||||
this->logo=buttonStruct.image;
|
this->logo=buttonStruct.image;
|
||||||
this->logo_cover = buttonStruct.image_cover;
|
this->logo_cover = buttonStruct.image_cover;
|
||||||
|
this->background_color = buttonStruct.background_color;
|
||||||
QString style = "background-color:";
|
QString style = "background-color:";
|
||||||
style += buttonStruct.background_color;
|
style += buttonStruct.background_color;
|
||||||
style += ";border:none;";
|
style += ";border:none;";
|
||||||
|
|
|
@ -51,6 +51,7 @@ protected:
|
||||||
private:
|
private:
|
||||||
QColor text_color;
|
QColor text_color;
|
||||||
QColor text_cover_color;
|
QColor text_cover_color;
|
||||||
|
QString background_color;
|
||||||
QList<MyButton *> *buttons;
|
QList<MyButton *> *buttons;
|
||||||
QImage *logo;
|
QImage *logo;
|
||||||
QImage *logo_cover;
|
QImage *logo_cover;
|
||||||
|
|
|
@ -9,15 +9,15 @@
|
||||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter Include="Resource Files">
|
|
||||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
|
||||||
<Extensions>qrc;rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="Form Files">
|
<Filter Include="Form Files">
|
||||||
<UniqueIdentifier>{99349809-55BA-4b9d-BF79-8FDBB0286EB3}</UniqueIdentifier>
|
<UniqueIdentifier>{99349809-55BA-4b9d-BF79-8FDBB0286EB3}</UniqueIdentifier>
|
||||||
<Extensions>ui</Extensions>
|
<Extensions>ui</Extensions>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter Include="Source Files\Translation Files">
|
<Filter Include="Resource Files">
|
||||||
|
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||||
|
<Extensions>qrc;rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Translation Files">
|
||||||
<UniqueIdentifier>{639EADAA-A684-42e4-A9AD-28FC9BCB8F7C}</UniqueIdentifier>
|
<UniqueIdentifier>{639EADAA-A684-42e4-A9AD-28FC9BCB8F7C}</UniqueIdentifier>
|
||||||
<Extensions>ts</Extensions>
|
<Extensions>ts</Extensions>
|
||||||
</Filter>
|
</Filter>
|
||||||
|
|
|
@ -5,9 +5,9 @@
|
||||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<QtLastBackgroundBuild>2023-08-01T03:05:45.8140795Z</QtLastBackgroundBuild>
|
<QtLastBackgroundBuild>2023-08-03T08:03:42.8435391Z</QtLastBackgroundBuild>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<QtLastBackgroundBuild>2023-08-01T03:05:46.4588999Z</QtLastBackgroundBuild>
|
<QtLastBackgroundBuild>2023-08-03T08:03:43.2818738Z</QtLastBackgroundBuild>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -18,6 +18,23 @@
|
||||||
#pragma comment(lib, "Qt5Svg.lib")
|
#pragma comment(lib, "Qt5Svg.lib")
|
||||||
#endif
|
#endif
|
||||||
QString url_param;
|
QString url_param;
|
||||||
|
void ConvertImageToTransparent(QImage &img)
|
||||||
|
{
|
||||||
|
img = img.convertToFormat(QImage::Format_ARGB32);
|
||||||
|
union myrgb
|
||||||
|
{
|
||||||
|
uint rgba;
|
||||||
|
uchar rgba_bits[4];
|
||||||
|
};
|
||||||
|
myrgb* mybits = (myrgb*)img.bits();
|
||||||
|
int len = img.width()*img.height();
|
||||||
|
while (len--> 0)
|
||||||
|
{
|
||||||
|
mybits->rgba_bits[3] = (mybits->rgba == 0xFFFFFFFF) ? 0 : 255;
|
||||||
|
mybits++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
NavBar::NavBar(ConfigResponse *configResponse, MainScreen *mainScreen,QWidget *parent) :
|
NavBar::NavBar(ConfigResponse *configResponse, MainScreen *mainScreen,QWidget *parent) :
|
||||||
QWidget(parent), ui(new Ui::NavBar) {
|
QWidget(parent), ui(new Ui::NavBar) {
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
@ -118,6 +135,7 @@ void NavBar::getLogoFromInternet(ConfigResponse *configResponse) {
|
||||||
timer.stop();
|
timer.stop();
|
||||||
buffer = new QByteArray;
|
buffer = new QByteArray;
|
||||||
delete request_logo;
|
delete request_logo;
|
||||||
|
reply->close();
|
||||||
if (downloadSuccess == true) {
|
if (downloadSuccess == true) {
|
||||||
*buffer = reply->readAll();
|
*buffer = reply->readAll();
|
||||||
logo = new QImage();
|
logo = new QImage();
|
||||||
|
@ -137,10 +155,17 @@ void NavBar::getLogoFromInternet(ConfigResponse *configResponse) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
*buffer = reply->readAll();
|
*buffer = reply->readAll();
|
||||||
|
|
||||||
QSvgRenderer *render_image = new QSvgRenderer(*buffer);
|
QSvgRenderer *render_image = new QSvgRenderer(*buffer);
|
||||||
|
|
||||||
QImage *image = new QImage(200, 200, QImage::Format_ARGB32);
|
QImage *image = new QImage(200, 200, QImage::Format_ARGB32);
|
||||||
QPainter painter_image(image);
|
QPainter painter_image(image);
|
||||||
|
painter_image.setCompositionMode(QPainter::CompositionMode_Clear); // 清除画布
|
||||||
|
painter_image.fillRect(rect(), Qt::transparent); // 填充透明色
|
||||||
|
painter_image.setCompositionMode(QPainter::CompositionMode_SourceOver); // 恢复默认值
|
||||||
render_image->render(&painter_image);
|
render_image->render(&painter_image);
|
||||||
|
buffer->clear();
|
||||||
|
reply->close();
|
||||||
|
|
||||||
QUrl url_image_cover(button.img_cover);
|
QUrl url_image_cover(button.img_cover);
|
||||||
QNetworkRequest *request_image_cover = new QNetworkRequest(url_image_cover);
|
QNetworkRequest *request_image_cover = new QNetworkRequest(url_image_cover);
|
||||||
|
@ -151,11 +176,19 @@ void NavBar::getLogoFromInternet(ConfigResponse *configResponse) {
|
||||||
if (!downloadSuccess) {
|
if (!downloadSuccess) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
eventLoop.exec();
|
||||||
*buffer = reply->readAll();
|
*buffer = reply->readAll();
|
||||||
|
qDebug() << *buffer;
|
||||||
QSvgRenderer *render_image_cover = new QSvgRenderer(*buffer);
|
QSvgRenderer *render_image_cover = new QSvgRenderer(*buffer);
|
||||||
QImage *image_cover = new QImage(200, 200, QImage::Format_ARGB32);
|
QImage *image_cover = new QImage(200, 200, QImage::Format_ARGB32);
|
||||||
QPainter painter_image_cover(image_cover);
|
QPainter painter_image_cover(image_cover);
|
||||||
|
painter_image_cover.setCompositionMode(QPainter::CompositionMode_Clear); // 清除画布
|
||||||
|
painter_image_cover.fillRect(rect(), Qt::transparent); // 填充透明色
|
||||||
|
painter_image_cover.setCompositionMode(QPainter::CompositionMode_SourceOver); // 恢复默认值
|
||||||
render_image_cover->render(&painter_image_cover);
|
render_image_cover->render(&painter_image_cover);
|
||||||
|
buffer->clear();
|
||||||
|
reply->close();
|
||||||
|
|
||||||
ButtonStruct buttonStruct;
|
ButtonStruct buttonStruct;
|
||||||
buttonStruct.image = image;
|
buttonStruct.image = image;
|
||||||
buttonStruct.image_cover = image_cover;
|
buttonStruct.image_cover = image_cover;
|
||||||
|
|
|
@ -31,8 +31,24 @@
|
||||||
#endif
|
#endif
|
||||||
#pragma comment(lib,"comsuppw.lib")
|
#pragma comment(lib,"comsuppw.lib")
|
||||||
//读取注册表获取MachineUUID
|
//读取注册表获取MachineUUID
|
||||||
|
bool IsWin11AndLater()
|
||||||
|
{
|
||||||
|
|
||||||
|
//Windows 10 从内部版本 10240 开始,以内部版本 19044 结束。Windows 11 从内部版本 22000 开始,那么:
|
||||||
|
//Environment.OSVersion.Version.Build >= 22000;
|
||||||
|
NTSTATUS(WINAPI * RtlGetVersion)(LPOSVERSIONINFOEXW);
|
||||||
|
OSVERSIONINFOEXW osInfo;
|
||||||
|
*(FARPROC*)&RtlGetVersion = GetProcAddress(GetModuleHandleA("ntdll"), "RtlGetVersion");
|
||||||
|
if (NULL != RtlGetVersion)
|
||||||
|
{
|
||||||
|
osInfo.dwOSVersionInfoSize = sizeof(osInfo);
|
||||||
|
RtlGetVersion(&osInfo);
|
||||||
|
|
||||||
|
return (osInfo.dwMajorVersion >= 10 && osInfo.dwBuildNumber >= 22000);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
RequestBodyBase::RequestBodyBase(){
|
RequestBodyBase::RequestBodyBase(){
|
||||||
wchar_t unix_time[65]={0};
|
wchar_t unix_time[65]={0};
|
||||||
wsprintf(unix_time,L"%ld",std::time(0));
|
wsprintf(unix_time,L"%ld",std::time(0));
|
||||||
|
@ -72,36 +88,50 @@ RequestBodyBase::RequestBodyBase(){
|
||||||
}
|
}
|
||||||
//获取操作系统版本
|
//获取操作系统版本
|
||||||
this->os="Windows";
|
this->os="Windows";
|
||||||
OSVERSIONINFOEX os;
|
OSVERSIONINFOEXW os;
|
||||||
os.dwOSVersionInfoSize=sizeof(os);
|
os.dwOSVersionInfoSize=sizeof(os);
|
||||||
GetVersionEx((OSVERSIONINFO *)&os);
|
GetVersionEx((OSVERSIONINFO *)&os);
|
||||||
switch(os.dwMajorVersion){//主版本号
|
NTSTATUS(WINAPI * RtlGetVersion)(LPOSVERSIONINFOEXW);
|
||||||
case 5: //不兼容Windows 2000,因此5.x一定是Windows XP
|
*(FARPROC*)&RtlGetVersion = GetProcAddress(GetModuleHandleA("ntdll"), "RtlGetVersion");
|
||||||
os_version="Windows XP";
|
if (RtlGetVersion != nullptr) {
|
||||||
break;
|
RtlGetVersion(&os);
|
||||||
case 6:
|
switch (os.dwMajorVersion) {//主版本号
|
||||||
switch(os.dwMinorVersion){ //次版本号
|
case 5: //不兼容Windows 2000,因此5.x一定是Windows XP
|
||||||
case 0:
|
os_version = "Windows XP";
|
||||||
os_version="Windows Vista or Windows Server 2008";
|
break;
|
||||||
break;
|
case 6:
|
||||||
case 1:
|
switch (os.dwMinorVersion) { //次版本号
|
||||||
os_version="Windows 7 or Windows Server 2008 R2";
|
case 0:
|
||||||
break;
|
os_version = "Windows Vista or Windows Server 2008";
|
||||||
case 2:
|
break;
|
||||||
os_version="Windows 8 or Windows Server 2012";
|
case 1:
|
||||||
break;
|
os_version = "Windows 7 or Windows Server 2008 R2";
|
||||||
case 3:
|
break;
|
||||||
os_version="Windows 8.1 or Windows Server 2012 R2";
|
case 2:
|
||||||
break;
|
os_version = "Windows 8 or Windows Server 2012";
|
||||||
default:
|
break;
|
||||||
os_version="Unknown";
|
case 3:
|
||||||
}
|
os_version = "Windows 8.1 or Windows Server 2012 R2";
|
||||||
case 10: //这几个系统都是10.0
|
break;
|
||||||
os_version="Windows 10, Windows 11, Windows Server 2016 or Windows Server 2019";
|
default:
|
||||||
break;
|
os_version = "Unknown";
|
||||||
default:
|
}
|
||||||
os_version="Unknown";
|
case 10: //这几个系统都是10.0
|
||||||
}
|
if (IsWin11AndLater()) {
|
||||||
|
os_version = "Windows 11 or Windows Server 2022";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
os_version = "Windows 10, Windows Server 2016 or Windows Server 2019";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
os_version = "Unknown";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
os_version = "Unknown";
|
||||||
|
}
|
||||||
|
|
||||||
this->release = RELEASE;
|
this->release = RELEASE;
|
||||||
this->version = VERSION;
|
this->version = VERSION;
|
||||||
//读取MachineGUID并取MD5作为device_id
|
//读取MachineGUID并取MD5作为device_id
|
||||||
|
|
|
@ -110,4 +110,7 @@ inline QString getMachineGUID() {
|
||||||
return guid;
|
return guid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class SoftwareRequest :public RequestBodyBase {
|
||||||
|
|
||||||
|
};
|
||||||
#endif //OFFICEASSISTANT_NETIO_H
|
#endif //OFFICEASSISTANT_NETIO_H
|
||||||
|
|
Loading…
Reference in New Issue