forked from OpenAtom-Linyaps/linyaps
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Create dedicated client for HTTP requests
使用单独的client发送http请求, 避免请求结果混淆 Log:
- Loading branch information
1 parent
76c9989
commit bf8489c
Showing
8 changed files
with
205 additions
and
177 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. | ||
* | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
*/ | ||
|
||
#include "client_factory.h" | ||
|
||
namespace linglong::repo { | ||
|
||
ClientFactory::ClientFactory(const QString &server) | ||
: m_server(server) | ||
{ | ||
} | ||
|
||
ClientFactory::ClientFactory(const std::string &server) | ||
: m_server(QString::fromStdString(server)) | ||
{ | ||
} | ||
|
||
QSharedPointer<api::client::ClientApi> ClientFactory::createClient() const | ||
{ | ||
auto api = QSharedPointer<linglong::api::client::ClientApi>::create(); | ||
api->setTimeOut(5000); | ||
api->setNewServerForAllOperations(m_server); | ||
api->setParent(QCoreApplication::instance()); | ||
return api; | ||
} | ||
|
||
void ClientFactory::setServer(QString server) | ||
{ | ||
m_server = server; | ||
} | ||
|
||
} // namespace linglong::repo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. | ||
* | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
*/ | ||
|
||
#ifndef LINGLONG_SRC_MODULE_REPO_CLIENT_FACTORY_H_ | ||
#define LINGLONG_SRC_MODULE_REPO_CLIENT_FACTORY_H_ | ||
#include "ClientApi.h" | ||
|
||
#include <QObject> | ||
#include <QPoint> | ||
|
||
namespace linglong::repo { | ||
|
||
class ClientFactory : public QObject | ||
{ | ||
Q_OBJECT | ||
public: | ||
ClientFactory(const QString &server); | ||
ClientFactory(const std::string &server); | ||
|
||
QSharedPointer<api::client::ClientApi> createClient() const; | ||
|
||
void setServer(QString server); | ||
|
||
private: | ||
QString m_server; | ||
}; | ||
} // namespace linglong::repo | ||
|
||
#endif // LINGLONG_SRC_MODULE_REPO_CLIENT_FACTORY_H_ |
Oops, something went wrong.