diff --git a/core_form/frmsetting/frmsetting.cpp b/core_form/frmsetting/frmsetting.cpp index 2e8f2a7..0316f5e 100644 --- a/core_form/frmsetting/frmsetting.cpp +++ b/core_form/frmsetting/frmsetting.cpp @@ -123,6 +123,7 @@ void FrmSetting::schEnableSsl(bool checked) ui->labEnableSslClose->setStyleSheet(checked?CLOSEQSS:OPENQSS); TCHttpService::getInstance()->setSsl(checked); + } diff --git a/core_form/frmupload/frmupload.cpp b/core_form/frmupload/frmupload.cpp index a42ffcd..9f33d6c 100644 --- a/core_form/frmupload/frmupload.cpp +++ b/core_form/frmupload/frmupload.cpp @@ -10,6 +10,7 @@ FrmUpload::FrmUpload(QWidget *parent) ui->setupUi(this); initFrom(); initWidget(); + connect(TCHttpService::getInstance(), &TCHttpService::signal_uploadFileSec, this, &FrmUpload::slot_uploadFileSec); } FrmUpload::~FrmUpload() @@ -17,6 +18,18 @@ FrmUpload::~FrmUpload() delete ui; } +void FrmUpload::slot_uploadFileSec(QString url) +{ + QClipboard* clipboard = QApplication::clipboard(); + + if (copyState == 0) { + clipboard->setText(QString("![](%1)").arg(url)); + } + else { + clipboard->setText(url); + } +} + bool FrmUpload::eventFilter(QObject *watched, QEvent *event) { static bool mousePressed = false; @@ -64,7 +77,7 @@ void FrmUpload::dropEvent(QDropEvent *event) QList urlList = mimeData->urls(); -#if DEBUG +#if !DEBUG foreach (QUrl url, urlList) { qDebug() << url.toLocalFile(); } @@ -88,6 +101,11 @@ void FrmUpload::dropEvent(QDropEvent *event) void FrmUpload::initFrom() { ui->frmUpload->setMinimumSize(QSize(400, 200)); + ui->btnHTML->setText("HTML"); + ui->btnFastUpload->setText("剪贴板上传"); + ui->btnMarkdown->setText("Markdown"); + ui->btnUrl->setText("URL"); + ui->btnUBB->setText("UBB"); } void FrmUpload::initWidget() @@ -99,5 +117,13 @@ void FrmUpload::initWidget() void FrmUpload::uploadFiles(QStringList fileList) { + if (!TCHttpService::getInstance()->getOnlineState()) + return; + foreach (QString p, fileList) { + qDebug() << "upload:" << p; + TCHttpService::getInstance()->apiUpload(p); + } + // TCHttpService::getInstance()->apiMyfileCount(); + // TCHttpService::getInstance()->apiMyfileNormal(); } diff --git a/core_form/frmupload/frmupload.h b/core_form/frmupload/frmupload.h index ddf4aee..c283e7e 100644 --- a/core_form/frmupload/frmupload.h +++ b/core_form/frmupload/frmupload.h @@ -10,6 +10,9 @@ #include #include #include +#include +#include +#include "tchttpservice.h" #define DEBUG 1 @@ -25,6 +28,9 @@ public: explicit FrmUpload(QWidget *parent = nullptr); ~FrmUpload(); +public slots: + void slot_uploadFileSec(QString url); + protected: virtual bool eventFilter(QObject* watched, QEvent* event); virtual void dragEnterEvent(QDragEnterEvent *event) override; @@ -34,6 +40,8 @@ private: void initFrom(); void initWidget(); void uploadFiles(QStringList fileList); + // 0 md 1 url + int copyState = 0; private: Ui::FrmUpload *ui; diff --git a/core_form/frmupload/frmupload.ui b/core_form/frmupload/frmupload.ui index 248f060..7c24e30 100644 --- a/core_form/frmupload/frmupload.ui +++ b/core_form/frmupload/frmupload.ui @@ -13,43 +13,50 @@ Form - - - 0 - + + + + + LennDFS 快捷助手 + + + Qt::AlignmentFlag::AlignCenter + + + - + 0 0 - 800 - 450 + 650 + 350 - 800 - 450 + 650 + 350 - QFrame::NoFrame + QFrame::Shape::NoFrame - Qt::Vertical + Qt::Orientation::Vertical @@ -64,7 +71,7 @@ - Qt::Horizontal + Qt::Orientation::Horizontal @@ -76,6 +83,12 @@ + + + 100 + 100 + + @@ -83,14 +96,14 @@ :/qrc/image/upload_white.png - Qt::AlignCenter + Qt::AlignmentFlag::AlignCenter - Qt::Horizontal + Qt::Orientation::Horizontal @@ -107,7 +120,7 @@ Microsoft YaHei UI - 26 + 16 @@ -118,7 +131,7 @@ - Qt::Vertical + Qt::Orientation::Vertical @@ -134,10 +147,186 @@ - Qt::Horizontal + Qt::Orientation::Horizontal - QSizePolicy::Fixed + QSizePolicy::Policy::Fixed + + + + 40 + 20 + + + + + + + + + + + + Qt::Orientation::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + 链接格式 + + + Qt::AlignmentFlag::AlignCenter + + + + + + + 0 + + + + + + 100 + 0 + + + + + 100 + 20 + + + + PushButton + + + + + + + + 0 + 0 + + + + + 75 + 20 + + + + PushButton + + + + + + + + 0 + 0 + + + + + 75 + 20 + + + + PushButton + + + + + + + + 0 + 0 + + + + + 100 + 20 + + + + PushButton + + + + + + + + + + + Qt::Orientation::Horizontal + + + + 40 + 20 + + + + + + + + + + 快捷上传 + + + Qt::AlignmentFlag::AlignCenter + + + + + + + + 120 + 30 + + + + + 100 + 20 + + + + PushButton + + + + + + + + + Qt::Orientation::Horizontal diff --git a/core_support/tchttpservice/tchttpservice.cpp b/core_support/tchttpservice/tchttpservice.cpp index f6cb466..d78199e 100644 --- a/core_support/tchttpservice/tchttpservice.cpp +++ b/core_support/tchttpservice/tchttpservice.cpp @@ -46,6 +46,7 @@ void TCHttpService::apiLogin() void TCHttpService::apiMyfileCount() { + QString urlStr; if (m_enableSsl) urlStr = "https://" + m_domain + "/api/myfiles"; @@ -77,7 +78,7 @@ void TCHttpService::apiMyfileCount() }); } -void TCHttpService::apiMyfileNormal() +void TCHttpService::apiMyfileNormal(int start, int count) { QString urlStr; if (m_enableSsl) @@ -100,16 +101,15 @@ void TCHttpService::apiMyfileNormal() QJsonObject jsonObj; jsonObj["token"] = m_token; jsonObj["user"] = m_userName; - jsonObj["count"] = m_total; - jsonObj["start"] = 0; + jsonObj["count"] = count; + jsonObj["start"] = start; QJsonDocument jsonDoc(jsonObj); QByteArray jsonData = jsonDoc.toJson(); QNetworkReply* reply = nullptr; reply = m_manager.post(request, jsonData); - QObject::connect(reply, &QNetworkReply::finished, [this, reply](){ - + connect(reply, &QNetworkReply::finished, [this, reply](){ emit requestFinished(reply, "myfilenormal"); }); } @@ -137,73 +137,112 @@ void TCHttpService::apiMd5(const QString& filePath) QMap headers; headers.insert("Content-Type", "application/json"); QString md5Str = QString::fromUtf8(fileMd5); - QString bodyStr = QString("\"%1\":\"%2\",\"%3\":\"%4\",\"%5\":\"%6\",\"%7\":\"%8\"").arg("token").arg(m_token). - arg("md5").arg(md5Str).arg("filename").arg(QFileInfo(file).fileName()).arg("user").arg(m_userName); + QJsonObject jsonObj; + jsonObj["token"] = m_token; + jsonObj["md5"] = md5Str; + jsonObj["filename"] = QFileInfo(file).fileName(); + jsonObj["user"] = m_userName; file.close(); + QJsonDocument jsonDoc(jsonObj); + QByteArray jsonData = jsonDoc.toJson(); + QNetworkReply* reply = nullptr; + + QNetworkRequest request(urlStr); + reply = m_manager.post(request, jsonData); + + QObject::connect(reply, &QNetworkReply::finished, [this, reply](){ + emit requestFinished(reply, "md5"); + }); } -void TCHttpService::apiUpload(const QString &filePath, const QString &md5Str) +void TCHttpService::apiUpload(const QString &filePath) { + QString urlStr; if (m_enableSsl) urlStr = "https://" + m_domain + "/api/upload"; else urlStr = "http://" + m_domain + "/api/upload"; - QFile file(filePath); - QFileInfo info(file); - QHttpMultiPart* multiPart = new QHttpMultiPart(QHttpMultiPart::FormDataType); - QHttpPart filePart; - QString contentTypeStrFile = QString("form-data; name=\"file\"; filename=\"%1\"").arg(info.fileName()); - filePart.setHeader(QNetworkRequest::ContentDispositionHeader, - QVariant(contentTypeStrFile)); - filePart.setHeader(QNetworkRequest::ContentTypeHeader, QVariant("application/octet-stream")); - if (!file.open(QIODevice::ReadOnly)) { + + QFile *file = new QFile(filePath); + if (!file->open(QIODevice::ReadOnly)) { + qDebug() << "无法打开文件:" << filePath; + delete file; return; } - filePart.setBodyDevice(&file); - file.setParent(multiPart); + // 计算文件 MD5 + QCryptographicHash hash(QCryptographicHash::Md5); + hash.addData(file); + QString md5 = hash.result().toHex(); + + // 重置文件指针 + file->seek(0); + + // 获取文件大小 + qint64 fileSize = file->size(); + + // 创建 multipart 请求 +#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) + QHttpMultiPart *multiPart = new QHttpMultiPart(QHttpMultiPart::FormDataType); +#else + QHttpMultiPart *multiPart = new QHttpMultiPart(QHttpMultiPart::FormData); +#endif + // 添加文件部分 + QHttpPart filePart; + filePart.setHeader(QNetworkRequest::ContentTypeHeader, QVariant("application/octet-stream")); + filePart.setHeader(QNetworkRequest::ContentDispositionHeader, + QVariant("form-data; name=\"file\"; filename=\"" + QFileInfo(filePath).fileName() + "\"")); + filePart.setBodyDevice(file); multiPart->append(filePart); - + // 添加用户信息部分 QHttpPart userPart; - QString contentTypeStrUser = QString("form-data; name=\"user\""); - userPart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant(contentTypeStrUser)); + userPart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"user\"")); userPart.setBody(m_userName.toUtf8()); multiPart->append(userPart); + // 添加 MD5 部分 QHttpPart md5Part; - QString contentTypeStrMd5 = QString("form-data; name=\"md5\""); - md5Part.setHeader(QNetworkRequest::ContentTypeHeader, QVariant(contentTypeStrMd5)); - md5Part.setBody(md5Str.toUtf8()); + md5Part.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"md5\"")); + md5Part.setBody(md5.toUtf8()); multiPart->append(md5Part); + // 添加文件大小部分 QHttpPart sizePart; - QString contentTypeStrSize = QString("form-data; name=\"size\""); - sizePart.setHeader(QNetworkRequest::ContentTypeHeader, QVariant(contentTypeStrSize)); - sizePart.setBody(QString::number(info.size()).toUtf8()); + sizePart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"size\"")); + sizePart.setBody(QString::number(fileSize).toUtf8()); multiPart->append(sizePart); - QUrl url(urlStr); - QNetworkRequest request(url); + // 创建网络请求 + QNetworkRequest request(urlStr); // 替换为实际的服务器地址 + request.setHeader(QNetworkRequest::ContentTypeHeader, "multipart/form-data; boundary=" + multiPart->boundary()); - QNetworkReply* reply = m_manager.post(request, multiPart); - multiPart->setParent(reply); + // 发送请求 + // QNetworkAccessManager *manager = new QNetworkAccessManager(this); + QNetworkReply *reply = m_manager.post(request, multiPart); - QObject::connect(reply, &QNetworkReply::finished, [this, reply]{ - QJsonDocument jsonDoc = QJsonDocument::fromJson(reply->readAll()); - QJsonObject jsonObj = jsonDoc.object(); - - int code = jsonObj["code"].toInt(); - if (code == 0) { - emit signal_uploadSuc(); + // 连接信号槽 + connect(reply, &QNetworkReply::finished, this, [=]() { + if (reply->error() == QNetworkReply::NoError) { + qDebug() << "上传成功:"; + apiMyfileCount(); + } else { + qDebug() << "上传失败:" << reply->errorString(); } reply->deleteLater(); + multiPart->deleteLater(); }); + connect(reply, &QNetworkReply::uploadProgress, this, [](qint64 bytesSent, qint64 bytesTotal) { + if (bytesTotal > 0) { + int progress = (bytesSent * 100) / bytesTotal; + qDebug() << "上传进度:" << progress << "%"; + } + }); } void TCHttpService::apiSharePicShare(const QString &fileName, const QString &md5) @@ -230,7 +269,6 @@ void TCHttpService::apiSharePicShare(const QString &fileName, const QString &md5 void TCHttpService::setConfiguration(QString userName, QString firstPwd, QString domain) { - qDebug() << "setConfiguration"; this->m_domain = domain; this->m_userName = userName; this->m_firstPwd = firstPwd; @@ -246,6 +284,9 @@ void TCHttpService::setConfiguration(QString userName, QString firstPwd, QString if (code == 0) { this->m_token = jsonObj["token"].toString(); qDebug() << this->m_token; + this->m_isOnline = true; + apiMyfileCount(); + } } if (api == "myfilecount") { @@ -258,11 +299,65 @@ void TCHttpService::setConfiguration(QString userName, QString firstPwd, QString if (code == 0) { int total = jsonObj["total"].toInt(); this->m_total = total; + int n = total / 10 + 1; + for (int i = 0; i < n; i++) { + //0 10 20 + int count = (total - i * 10 >= 10) ? 10 : (total - i * 10); + apiMyfileNormal(i*10, count); + } + } } if (api == "myfilenormal") { + QJsonDocument jsonDoc = QJsonDocument::fromJson(rawData); + if (jsonDoc.isEmpty()) + return; + QJsonObject jsonObj = jsonDoc.object(); + + int code = jsonObj["code"].toInt(); + if (code != 0) + return; + QJsonArray jsonArray = jsonObj["files"].toArray(); + for (const QJsonValue& value : jsonArray) { + QJsonObject jsonObj = value.toObject(); + + QString file_name = jsonObj["file_name"].toString(); + int share_status = jsonObj["share_status"].toInt(); + QString url = jsonObj["url"].toString(); + qint64 size = jsonObj["size"].toInt(); + QString md5 = jsonObj["md5"].toString(); + + QMap::iterator ite; + ite = m_fileMap.find(file_name); + if (ite == m_fileMap.end()) { + file_info_t info; + info.share_status = share_status; + info.size = size; + info.url = url; + info.file_name = file_name; + emit signal_uploadFileSec(url); + m_fileMap.insert(md5, info); + } +#if !DEBUG + // for(auto ite = m_fileMap.constBegin(); ite != m_fileMap.constEnd(); ite++) { + // qDebug() << "fileMap debug:" << ite.value().file_name; + // } + qDebug() << "fileMap size:" << m_fileMap.size(); +#endif + } + } + // if (api == "upload") { + // qDebug() <<"upload"; + // QJsonDocument jsondoc = QJsonDocument::fromJson(rawData); + // QJsonObject jsonObj = jsondoc.object(); + + // int code = jsonObj["code"].toInt(); + + // if (code == 0) + // this->apiMyfileCount(); + // } reply->deleteLater(); }); apiLogin(); @@ -270,10 +365,19 @@ void TCHttpService::setConfiguration(QString userName, QString firstPwd, QString void TCHttpService::setSsl(bool enable) { - qDebug() << "setSsl:" <m_enableSsl = enable; } +bool TCHttpService::getOnlineState() +{ + return m_isOnline; +} + +void TCHttpService::setUploadNum(int nb) +{ + this->m_uploadNum = nb; +} + QUrl TCHttpService::encodeUrl(QString urlStr, QMap params) { QUrlQuery query; @@ -290,14 +394,14 @@ QUrl TCHttpService::encodeUrl(QString urlStr, QMap params) void TCHttpService::updateFileMap(QJsonObject jsonObj) { - QString fileMD5 = jsonObj["md5"].toString(); - QString fileUrl = jsonObj["http"].toString(); + // QString fileMD5 = jsonObj["md5"].toString(); + // QString fileUrl = jsonObj["http"].toString(); - QMap::iterator ite = m_fileMap.begin(); - if (ite != m_fileMap.end()) - return; + // QMap::iterator ite = m_fileMap.begin(); + // if (ite != m_fileMap.end()) + // return; - m_fileMap.insert(fileMD5, fileUrl); + // m_fileMap.insert(fileMD5, fileUrl); } TCHttpService::TCHttpService(QObject *parent) : QObject(parent) diff --git a/core_support/tchttpservice/tchttpservice.h b/core_support/tchttpservice/tchttpservice.h index 2bb42a4..0e66f0f 100644 --- a/core_support/tchttpservice/tchttpservice.h +++ b/core_support/tchttpservice/tchttpservice.h @@ -1,6 +1,8 @@ #ifndef TCHTTPSERVICE_H #define TCHTTPSERVICE_H +#define DEBUG 1 + #include #include #include @@ -14,21 +16,33 @@ #include #include #include +#include class TCHttpService : public QObject { Q_OBJECT +private: + typedef struct { + QString file_name; + int share_status; + QString url; + qint64 size; + } file_info_t; + + QMap m_fileMap; public: static TCHttpService* getInstance(); void apiLogin(); void apiMyfileCount(); - void apiMyfileNormal(); + void apiMyfileNormal(int start, int count); void apiMd5(const QString& filePath); - void apiUpload(const QString& filePath, const QString& md5); + void apiUpload(const QString& filePath); void apiSharePicShare(const QString& fileName, const QString& md5); void setConfiguration(QString userName, QString firstPwd, QString domain); void setSsl(bool enable); + bool getOnlineState(); + void setUploadNum(int nb); private: @@ -38,7 +52,7 @@ signals: void signal_loginSuc(); void signal_uploadSuc(); void signal_shareSuc(); - + void signal_uploadFileSec(QString url); void requestFinished(QNetworkReply* reply, QString api); private: explicit TCHttpService(QObject *parent = nullptr); @@ -51,10 +65,13 @@ private: QString m_domain; QString m_firstPwd; QString m_userName; - QMap m_fileMap; int m_total; bool m_enableSsl = true; + bool m_isOnline = false; + + bool m_uploadNum = 0; + signals: }; diff --git a/picpanel.pro.user b/picpanel.pro.user index 3c1d0cb..c75f21e 100644 --- a/picpanel.pro.user +++ b/picpanel.pro.user @@ -1,10 +1,10 @@ - + EnvironmentId - {eff88622-f1f6-485c-90af-dd46e6d2c022} + {631b5895-04c2-4f08-83d2-9e1277f189a1} ProjectExplorer.Project.ActiveTarget @@ -33,7 +33,6 @@ false 4 false - 0 80 true true @@ -79,7 +78,7 @@ true true Builtin.DefaultTidyAndClazy - 8 + 12 true @@ -92,16 +91,16 @@ ProjectExplorer.Project.Target.0 Desktop - Qt 6.7.3 for macOS - Qt 6.7.3 for macOS - qt.qt6.673.clang_64_kit + Desktop Qt 6.7.3 MinGW 64-bit + Desktop Qt 6.7.3 MinGW 64-bit + qt.qt6.673.win64_mingw_kit 0 0 0 0 - /Users/lenn/Workspace/picpanel/build/Qt_6_7_3_for_macOS-Debug - /Users/lenn/Workspace/picpanel/build/Qt_6_7_3_for_macOS-Debug + E:\picpanel\build\Desktop_Qt_6_7_3_MinGW_64_bit-Debug + E:/picpanel/build/Desktop_Qt_6_7_3_MinGW_64_bit-Debug true @@ -139,8 +138,8 @@ 2 - /Users/lenn/Workspace/picpanel/build/Qt_6_7_3_for_macOS-Release - /Users/lenn/Workspace/picpanel/build/Qt_6_7_3_for_macOS-Release + E:\picpanel\build\Desktop_Qt_6_7_3_MinGW_64_bit-Release + E:/picpanel/build/Desktop_Qt_6_7_3_MinGW_64_bit-Release true @@ -180,8 +179,8 @@ 0 - /Users/lenn/Workspace/picpanel/build/Qt_6_7_3_for_macOS-Profile - /Users/lenn/Workspace/picpanel/build/Qt_6_7_3_for_macOS-Profile + E:\picpanel\build\Desktop_Qt_6_7_3_MinGW_64_bit-Profile + E:/picpanel/build/Desktop_Qt_6_7_3_MinGW_64_bit-Profile true @@ -239,19 +238,20 @@ true 0 true + 2 false - -e cpu-cycles --call-graph dwarf,4096 -F 250 + -e cpu-cycles --call-graph "dwarf,4096" -F 250 - Qt4ProjectManager.Qt4RunConfiguration: - /Users/lenn/Workspace/picpanel/picpanel.pro + Qt4ProjectManager.Qt4RunConfiguration:E:/picpanel/picpanel.pro + E:/picpanel/picpanel.pro false true true true - /Users/lenn/Workspace/picpanel/build/Qt_6_7_3_for_macOS-Debug/picpanel.app/Contents/MacOS + E:/picpanel/build/Desktop_Qt_6_7_3_MinGW_64_bit-Debug 1 diff --git a/picpanel.pro.user.eff8862 b/picpanel.pro.user.eff8862 new file mode 100644 index 0000000..3c1d0cb --- /dev/null +++ b/picpanel.pro.user.eff8862 @@ -0,0 +1,271 @@ + + + + + + EnvironmentId + {eff88622-f1f6-485c-90af-dd46e6d2c022} + + + ProjectExplorer.Project.ActiveTarget + 0 + + + ProjectExplorer.Project.EditorSettings + + true + false + true + + Cpp + + CppGlobal + + + + QmlJS + + QmlJSGlobal + + + 2 + UTF-8 + false + 4 + false + 0 + 80 + true + true + 1 + 0 + false + true + false + 2 + true + true + 0 + 8 + true + false + 1 + true + true + true + *.md, *.MD, Makefile + false + true + true + + + + ProjectExplorer.Project.PluginSettings + + + true + false + true + true + true + true + + false + + + 0 + true + + true + true + Builtin.DefaultTidyAndClazy + 8 + true + + + + true + + + + + ProjectExplorer.Project.Target.0 + + Desktop + Qt 6.7.3 for macOS + Qt 6.7.3 for macOS + qt.qt6.673.clang_64_kit + 0 + 0 + 0 + + 0 + /Users/lenn/Workspace/picpanel/build/Qt_6_7_3_for_macOS-Debug + /Users/lenn/Workspace/picpanel/build/Qt_6_7_3_for_macOS-Debug + + + true + QtProjectManager.QMakeBuildStep + false + + + + true + Qt4ProjectManager.MakeStep + + 2 + 构建 + 构建 + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + clean + + 1 + 清除 + 清除 + ProjectExplorer.BuildSteps.Clean + + 2 + false + + false + + Debug + Qt4ProjectManager.Qt4BuildConfiguration + 2 + + + /Users/lenn/Workspace/picpanel/build/Qt_6_7_3_for_macOS-Release + /Users/lenn/Workspace/picpanel/build/Qt_6_7_3_for_macOS-Release + + + true + QtProjectManager.QMakeBuildStep + false + + + + true + Qt4ProjectManager.MakeStep + + 2 + 构建 + 构建 + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + clean + + 1 + 清除 + 清除 + ProjectExplorer.BuildSteps.Clean + + 2 + false + + false + + Release + Qt4ProjectManager.Qt4BuildConfiguration + 0 + 0 + + + 0 + /Users/lenn/Workspace/picpanel/build/Qt_6_7_3_for_macOS-Profile + /Users/lenn/Workspace/picpanel/build/Qt_6_7_3_for_macOS-Profile + + + true + QtProjectManager.QMakeBuildStep + false + + + + true + Qt4ProjectManager.MakeStep + + 2 + 构建 + 构建 + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + clean + + 1 + 清除 + 清除 + ProjectExplorer.BuildSteps.Clean + + 2 + false + + false + + Profile + Qt4ProjectManager.Qt4BuildConfiguration + 0 + 0 + 0 + + 3 + + + 0 + 部署 + 部署 + ProjectExplorer.BuildSteps.Deploy + + 1 + + false + ProjectExplorer.DefaultDeployConfiguration + + 1 + + true + true + 0 + true + + 2 + + false + -e cpu-cycles --call-graph dwarf,4096 -F 250 + + Qt4ProjectManager.Qt4RunConfiguration: + /Users/lenn/Workspace/picpanel/picpanel.pro + false + true + true + true + /Users/lenn/Workspace/picpanel/build/Qt_6_7_3_for_macOS-Debug/picpanel.app/Contents/MacOS + + 1 + + + + ProjectExplorer.Project.TargetCount + 1 + + + ProjectExplorer.Project.Updater.FileVersion + 22 + + + Version + 22 + + diff --git a/qrc/image/upload_white.png b/qrc/image/upload_white.png index 9f84849..d059438 100644 Binary files a/qrc/image/upload_white.png and b/qrc/image/upload_white.png differ diff --git a/qrc/image/upload_white_bak.png b/qrc/image/upload_white_bak.png new file mode 100644 index 0000000..9f84849 Binary files /dev/null and b/qrc/image/upload_white_bak.png differ diff --git a/qrc/qss/blacksoft.qss b/qrc/qss/blacksoft.qss index 0316a5d..2ea878c 100644 --- a/qrc/qss/blacksoft.qss +++ b/qrc/qss/blacksoft.qss @@ -36,7 +36,7 @@ QPushButton#btnMin:pressed { QFrame#frame > QPushButton { font-family: 'Microsoft YaHei UI'; - font-size: 20px; + font-size: 15px; color: white; } @@ -189,4 +189,55 @@ QWidget#ServerSetting > QLineEdit { border: 2px solid #DCDFE6; background-color: white; color: black; -} \ No newline at end of file +} + +QWidget#FrmUpload > QPushButton { + font-family: 'Microsoft YaHei UI'; + border: 1px solid 5E6B71; + color: #5E6B71; + background-color: white; +} + +QWidget#FrmUpload > QLabel#labFastUpload { + color: white; + font-size: 15px; +} + +QWidget#FrmUpload > QLabel#labLinkType { + color: white; + font-size: 15px; +} + +QWidget#FrmUpload > QPushButton#btnMarkdown { + border-top-left-radius: 10px; + border-bottom-left-radius: 10px; +} + +QWidget#FrmUpload > QPushButton#btnUBB { + border-top-right-radius: 10px; + border-bottom-right-radius: 10px; +} + + +QWidget#FrmUpload > QPushButton#btnFastUpload { + border-radius: 10px; + border: 1px solid #409EFF; + background-color: #409EFF; + font-family: 'Microsoft YaHei UI'; + font-size: 15px; + color: white; +} + +QWidget#FrmUpload > QPushButton#btnFastUpload:hover { + background-color: #79BBFF; +} + +QWidget#FrmUpload > QPushButton#btnFastUpload:pressed { + border: none; + background-color: #337ECC; +} + +QWidget#FrmUpload > QLabel#labTitle { + color: white; + font-size: 30px; +} diff --git a/widget.cpp b/widget.cpp index 809f7dd..2caf1ca 100644 --- a/widget.cpp +++ b/widget.cpp @@ -10,7 +10,8 @@ Widget::Widget(QWidget *parent) initWidgetForm(); initWidget(); initSignalSlot(); - + // this->btnPageUpload->setChecked(true); + // this->btnPageUpload->setStyleSheet("{border: none;border-right: 4px solid #409EFF;color: #409EFF;}"); } Widget::~Widget() @@ -144,7 +145,8 @@ void Widget::paintEvent(QPaintEvent *event) void Widget::initWidgetForm() { - this->setFixedSize(QSize(1000, 550)); + // this->setFixedSize(QSize(1000, 550)); + this->setFixedSize(800, 450); this->setWindowFlag(Qt::FramelessWindowHint); this->setWindowFlags(this->windowFlags() | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint); this->setWindowIcon(QIcon(QPixmap(":/qrc/image/icon.png"))); @@ -162,6 +164,7 @@ void Widget::initWidgetForm() IconHelper::setIcon(ui->btnClose, QString("F00D").toInt(nullptr, 16), 16); ui->labTitle->setText("PicPanel"); + } void Widget::initWidget() @@ -187,6 +190,8 @@ void Widget::initWidget() btnPageUpload->setChecked(true); ui->stackedWidget->setCurrentIndex(0); + + ui->horizontalLayout_2->setSizeConstraint(QLayout::SetFixedSize); } void Widget::initSignalSlot() @@ -217,9 +222,10 @@ void Widget::initLeftMenu() btnPageUpload->setMinimumWidth(160); btnPageUpload->setMinimumHeight(30); btnPageUpload->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum); - QIcon iconUpload(QPixmap(":/qrc/image/upload_white.png")); + QIcon iconUpload(QPixmap(":/qrc/image/upload_blue.png")); btnPageUpload->setIconSize(QSize(24, 24)); btnPageUpload->setIcon(iconUpload); + btnPageUpload->setCheckable(true); btnPageAlbum = new QPushButton(ui->frame); btnPageAlbum->setObjectName("btnPageAlbum"); @@ -232,6 +238,7 @@ void Widget::initLeftMenu() QIcon iconAlbum(QPixmap(":/qrc/image/album_white.png")); btnPageAlbum->setIconSize(QSize(24, 24)); btnPageAlbum->setIcon(iconAlbum); + btnPageAlbum->setCheckable(true); btnPageSetting = new QPushButton(ui->frame); btnPageSetting->setObjectName("btnPageSetting"); @@ -244,6 +251,7 @@ void Widget::initLeftMenu() QIcon iconSetting(QPixmap(":/qrc/image/setting_white.png")); btnPageSetting->setIconSize(QSize(24, 24)); btnPageSetting->setIcon(iconSetting); + btnPageSetting->setCheckable(true); ui->stackedWidget->addWidget(frmupload); ui->stackedWidget->addWidget(frmalbum); diff --git a/widget.ui b/widget.ui index 804d706..fe8ec59 100644 --- a/widget.ui +++ b/widget.ui @@ -6,10 +6,28 @@ 0 0 - 800 - 600 + 999 + 564 + + + 0 + 0 + + + + + 999 + 564 + + + + + 999 + 564 + + Widget @@ -38,7 +56,7 @@ - QFrame::NoFrame + QFrame::Shape::NoFrame @@ -59,7 +77,7 @@ - Qt::Horizontal + Qt::Orientation::Horizontal @@ -79,7 +97,7 @@ - Qt::Horizontal + Qt::Orientation::Horizontal @@ -153,18 +171,24 @@ - QFrame::NoFrame + QFrame::Shape::NoFrame - + 0 0 + + + 999 + 564 + +