实现HTTP服务架构

This commit is contained in:
lixiaoyuan
2025-08-31 14:38:53 +08:00
parent 4af4e670d2
commit e0b64a20c4
46 changed files with 1436 additions and 545 deletions

View File

@@ -160,38 +160,38 @@ int PvApp::widget(PARAM* p, int parent, int x, int y, int w, int h)
return id;
}
int PvApp::label(PARAM* p, int parent, int x, int y, int w, int h, std::string text, std::string qss)
int PvApp::label(PARAM* p, int parent, int x, int y, int w, int h, std::string text, std::string QSS)
{
static const std::string style = "QLabel { border: none; background-color: transparent; } QLabel:disabled { color: gray;}";
int id = PvApp::pvid(p);
pvQLabel(p, id, parent);
pvSetGeometry(p, id, x, y, w, h);
if (!text.empty()) { pvSetText(p, id, text.c_str()); }
pvSetStyleSheet(p, id, qss.empty() ? style.c_str() : qss.c_str());
pvSetStyleSheet(p, id, QSS.empty() ? style.c_str() : QSS.c_str());
return id;
}
int PvApp::labelCenter(PARAM* p, int parent, int x, int y, int w, int h, std::string text, std::string qss)
int PvApp::labelCenter(PARAM* p, int parent, int x, int y, int w, int h, std::string text, std::string QSS)
{
int id = PvApp::label(p, parent, x, y, w, h, text, qss);
int id = PvApp::label(p, parent, x, y, w, h, text, QSS);
pvSetAlignment(p, id, AlignCenter);
return id;
}
int PvApp::labelAlignCenter(PARAM* p, int parent, int x, int y, int w, int h, std::string text, std::string qss)
int PvApp::labelAlignCenter(PARAM* p, int parent, int x, int y, int w, int h, std::string text, std::string QSS)
{
int id = PvApp::label(p, parent, x, y, w, h, text, qss);
int id = PvApp::label(p, parent, x, y, w, h, text, QSS);
pvSetAlignment(p, id, AlignCenter);
return id;
}
int PvApp::button(PARAM* p, int parent, int x, int y, int w, int h, std::string text, std::string qss)
int PvApp::button(PARAM* p, int parent, int x, int y, int w, int h, std::string text, std::string QSS)
{
int id = PvApp::pvid(p);
pvQPushButton(p, id, parent);
pvSetGeometry(p, id, x, y, w, h);
if (!text.empty()) { pvSetText(p, id, text.c_str()); }
pvSetStyleSheet(p, id, qss.empty() ? qss::button().c_str() : qss.c_str());
pvSetStyleSheet(p, id, QSS.empty() ? QSS::button().c_str() : QSS.c_str());
return id;
}
@@ -208,7 +208,7 @@ int PvApp::combox(PARAM* p, int parent, int x, int y, int w, int h, const std::v
int id = PvApp::pvid(p);
pvQComboBox(p, id, parent, 0, 0);
pvSetGeometry(p, id, x, y, w, h);
pvSetStyleSheet(p, id, qss::COMBOX_14.c_str());
pvSetStyleSheet(p, id, QSS::COMBOX_14.c_str());
for (int i=0; i<vecItems.size(); ++i)
{
pvInsertItem(p, id, i, NULL, vecItems[i].c_str());
@@ -218,17 +218,17 @@ int PvApp::combox(PARAM* p, int parent, int x, int y, int w, int h, const std::v
return id;
}
int PvApp::textedit(PARAM* p, int parent, int x, int y, int w, int h, std::string text, std::string qss)
int PvApp::textedit(PARAM* p, int parent, int x, int y, int w, int h, std::string text, std::string QSS)
{
int id = PvApp::pvid(p);
pvQLineEdit(p, id, parent);
pvSetGeometry(p, id, x, y, w, h);
pvSetStyleSheet(p, id, qss::LINEEDIT.c_str());
pvSetStyleSheet(p, id, QSS::LINEEDIT.c_str());
if (!text.empty()) { pvSetText(p, id, text.c_str()); }
return id;
}
int PvApp::multiTextedit(PARAM* p, int parent, int x, int y, int w, int h, std::string text, std::string qss)
int PvApp::multiTextedit(PARAM* p, int parent, int x, int y, int w, int h, std::string text, std::string QSS)
{
static std::string style =
"QTextEdit { background-color: rgb(12, 39, 58); border: 1px solid rgb(18, 251, 255); border-radius: 3px; color:white; font: bold 14px;}"
@@ -270,13 +270,13 @@ int PvApp::timeEdit(PARAM* p, int parent, int x, int y, int w, int h)
int PvApp::lineLabel(PARAM* p, int parent, PvRect& rect, int w, std::string key, std::string val)
{
int pid = PvApp::label(p, parent, rect.x, rect.y, rect.w, rect.h, key, qss::label(14));
int pid = PvApp::label(p, parent, rect.x, rect.y, rect.w, rect.h, key, QSS::label(14));
return PvApp::label(p, pid, w, 0, rect.w-w, rect.h, val);
}
int PvApp::lineTextedit(PARAM* p, int parent, PvRect& rect, int w, std::string key, std::string val)
{
int pid = PvApp::label(p, parent, rect.x, rect.y, rect.w, rect.h, key, qss::label(14));
int pid = PvApp::label(p, parent, rect.x, rect.y, rect.w, rect.h, key, QSS::label(14));
return PvApp::textedit(p, pid, w, 0, rect.w-w, rect.h, val);
}