http模块有问题,需要修改

This commit is contained in:
2025-03-24 00:05:08 +08:00
commit 9d8c7baa36
66 changed files with 4602 additions and 0 deletions

View File

@@ -0,0 +1,129 @@
#include "frmsetting.h"
#include "ui_frmsetting.h"
#include <QDebug>
FrmSetting::FrmSetting(FileConfigDecode* fileConfig, QWidget *parent)
: QWidget(parent)
, ui(new Ui::FrmSetting)
{
ui->setupUi(this);
this->fileConfig = fileConfig;
initForm();
initWidget();
}
FrmSetting::~FrmSetting()
{
delete ui;
}
void FrmSetting::initForm()
{
ui->schRename->setBgColorOn(QColor("#409EFF"));
ui->schRename->enableText(false);
ui->schRename->setAnimation(true);
ui->schAutoSetup->setBgColorOn(QColor("#409EFF"));
ui->schAutoSetup->enableText(false);
ui->schAutoSetup->setAnimation(true);
ui->schTimeRename->setBgColorOn(QColor("#409EFF"));
ui->schTimeRename->enableText(false);
ui->schTimeRename->setAnimation(true);
ui->schEnableSsl->setBgColorOn(QColor("#409EFF"));
ui->schEnableSsl->enableText(false);
ui->schEnableSsl->setAnimation(true);
ui->btnServer->setCursor(Qt::PointingHandCursor);
ui->schRename->setCursor(Qt::PointingHandCursor);
serversetting = new ServerSetting();
serversetting->hide();
}
void FrmSetting::initWidget()
{
if (fileConfig->getRename()) {
ui->labRenameOpen->setStyleSheet(OPENQSS);
ui->labRenameClose->setStyleSheet(CLOSEQSS);
}
else {
ui->labRenameOpen->setStyleSheet(CLOSEQSS);
ui->labRenameClose->setStyleSheet(OPENQSS);
}
if (fileConfig->getAutoSetup()) {
ui->labAutoSetupOpen->setStyleSheet(OPENQSS);
ui->labAutoSetupClose->setStyleSheet(CLOSEQSS);
}
else {
ui->labAutoSetupOpen->setStyleSheet(CLOSEQSS);
ui->labAutoSetupClose->setStyleSheet(OPENQSS);
}
if (fileConfig->getTimeRename()) {
ui->labTimeRenameOpen->setStyleSheet(OPENQSS);
ui->labTimeRenameClose->setStyleSheet(CLOSEQSS);
}
else {
ui->labTimeRenameOpen->setStyleSheet(CLOSEQSS);
ui->labTimeRenameClose->setStyleSheet(OPENQSS);
}
if (fileConfig->getAutoCopy()) {
ui->labEnableSsl->setStyleSheet(OPENQSS);
ui->labEnableSsl->setStyleSheet(CLOSEQSS);
}
else {
ui->labEnableSsl->setStyleSheet(CLOSEQSS);
ui->labEnableSsl->setStyleSheet(OPENQSS);
}
ui->schRename->setChecked(fileConfig->getRename());
ui->schAutoSetup->setChecked(fileConfig->getAutoSetup());
ui->schTimeRename->setChecked(fileConfig->getTimeRename());
ui->schEnableSsl->setChecked(fileConfig->getAutoCopy());
connect(ui->schRename, &SwitchButton::checkedChanged, this, &FrmSetting::schRenameSlot);
connect(ui->schAutoSetup, &SwitchButton::checkedChanged, this, &FrmSetting::schAutoSetup);
connect(ui->schTimeRename, &SwitchButton::checkedChanged, this, &FrmSetting::schTimeRename);
connect(ui->schEnableSsl, &SwitchButton::checkedChanged, this, &FrmSetting::schEnableSsl);
connect(ui->btnServer, &QPushButton::clicked, serversetting, &ServerSetting::show);
}
void FrmSetting::schRenameSlot(bool checked)
{
fileConfig->setRename(checked);
ui->labRenameOpen->setStyleSheet(checked?OPENQSS:CLOSEQSS);
ui->labRenameClose->setStyleSheet(checked?CLOSEQSS:OPENQSS);
}
void FrmSetting::schAutoSetup(bool checked)
{
fileConfig->setAutoSetup(checked);
ui->labAutoSetupOpen->setStyleSheet(checked?OPENQSS:CLOSEQSS);
ui->labAutoSetupClose->setStyleSheet(checked?CLOSEQSS:OPENQSS);
}
void FrmSetting::schTimeRename(bool checked)
{
fileConfig->setTimeRename(checked);
ui->labTimeRenameOpen->setStyleSheet(checked?OPENQSS:CLOSEQSS);
ui->labTimeRenameClose->setStyleSheet(checked?CLOSEQSS:OPENQSS);
}
void FrmSetting::schEnableSsl(bool checked)
{
fileConfig->setAutoCopy(checked);
ui->labEnableSslOpen->setStyleSheet(checked?OPENQSS:CLOSEQSS);
ui->labEnableSslClose->setStyleSheet(checked?CLOSEQSS:OPENQSS);
TCHttpService::getInstance()->setSsl(checked);
}

View File

@@ -0,0 +1,47 @@
#ifndef FRMSETTING_H
#define FRMSETTING_H
#include <QWidget>
#include "fileconfigdecode.h"
#include "serversetting.h"
#include "tchttpservice.h"
// 开机自启动
// 域名/地址
// 端口
// 上传前重命名
// 时间戳重命名
// 上传后复制URL
#define OPENQSS "QLabel{color:#409EFF;}"
#define CLOSEQSS "QLabel{color:#FFFFFF;}"
namespace Ui {
class FrmSetting;
}
class FrmSetting : public QWidget
{
Q_OBJECT
public:
explicit FrmSetting(FileConfigDecode* fileConfig, QWidget *parent = nullptr);
~FrmSetting();
private:
void initForm();
void initWidget();
private slots:
void schRenameSlot(bool checked);
void schAutoSetup(bool checked);
void schTimeRename(bool checked);
void schEnableSsl(bool checked);
private:
Ui::FrmSetting *ui;
FileConfigDecode* fileConfig = nullptr;
ServerSetting* serversetting;
};
#endif // FRMSETTING_H

View File

@@ -0,0 +1,8 @@
FORMS += \
$$PWD/frmsetting.ui
HEADERS += \
$$PWD/frmsetting.h
SOURCES += \
$$PWD/frmsetting.cpp

View File

@@ -0,0 +1,364 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>FrmSetting</class>
<widget class="QWidget" name="FrmSetting">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>731</width>
<height>439</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="labServer">
<property name="text">
<string>设置Server</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="btnServer">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>35</height>
</size>
</property>
<property name="text">
<string>点击设置</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="labAutoSetup">
<property name="text">
<string>开机自启</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="labAutoSetupClose">
<property name="text">
<string>关</string>
</property>
</widget>
</item>
<item>
<widget class="SwitchButton" name="schAutoSetup" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>200</width>
<height>30</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labAutoSetupOpen">
<property name="text">
<string>开</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line1">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="labRename">
<property name="text">
<string>上传重命名</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="labRenameClose">
<property name="text">
<string>关</string>
</property>
</widget>
</item>
<item>
<widget class="SwitchButton" name="schRename" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>200</width>
<height>30</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labRenameOpen">
<property name="text">
<string>开</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line2">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="labTimeRename">
<property name="text">
<string>时间戳重命名</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="labTimeRenameClose">
<property name="text">
<string>关</string>
</property>
</widget>
</item>
<item>
<widget class="SwitchButton" name="schTimeRename" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>200</width>
<height>30</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labTimeRenameOpen">
<property name="text">
<string>开</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line3">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QLabel" name="labEnableSsl">
<property name="text">
<string>开启SSL</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="labEnableSslClose">
<property name="text">
<string>关</string>
</property>
</widget>
</item>
<item>
<widget class="SwitchButton" name="schEnableSsl" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>200</width>
<height>30</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labEnableSslOpen">
<property name="text">
<string>开</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>SwitchButton</class>
<extends>QWidget</extends>
<header location="global">switchbutton.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>