V1.5
This commit is contained in:
parent
de828e183e
commit
c67be395ba
@ -1,13 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="BackendCodeEditorMiscSettings">
|
||||
<option name="/Default/RiderDebugger/RiderRestoreDecompile/RestoreDecompileSetting/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/Housekeeping/GlobalSettingsUpgraded/IsUpgraded/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/Housekeeping/FeatureSuggestion/FeatureSuggestionManager/DisabledSuggesters/=SwitchToGoToActionSuggester/@EntryIndexedValue" value="true" type="bool" />
|
||||
<option name="/Default/Environment/Hierarchy/GeneratedFilesCacheKey/Timestamp/@EntryValue" value="5" type="long" />
|
||||
<option name="/Default/Housekeeping/OptionsDialog/SelectedPageId/@EntryValue" value="CppFormatterOtherPage" type="string" />
|
||||
<option name="/Default/Housekeeping/FeatureSuggestion/FeatureSuggestionManager/DisabledSuggesters/=SwitchToGoToActionSuggester/@EntryIndexRemoved" />
|
||||
</component>
|
||||
<component name="CMakePythonSetting">
|
||||
<option name="pythonIntegrationState" value="YES" />
|
||||
</component>
|
||||
|
||||
@ -5,6 +5,8 @@ project(IPBS_Station LANGUAGES CXX)
|
||||
add_subdirectory(SDK)
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++")
|
||||
#set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/Bin)
|
||||
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mwindows")
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
|
||||
@ -6,7 +6,6 @@
|
||||
#include <CCString.h>
|
||||
#include <QNetworkInterface>
|
||||
#include <CCThread.h>
|
||||
#include <QApplication>
|
||||
#include <QMessageBox>
|
||||
#include <QProcess>
|
||||
|
||||
@ -21,6 +20,10 @@
|
||||
#define Sub_ImgBuffer "ImgBuffer/"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <tchar.h>
|
||||
#include <windows.h>
|
||||
#include <tlhelp32.h>
|
||||
#include <shlobj.h> // 包含 ShellLink 和 IPersistFile 接口
|
||||
#define SubControl_Java "SubControl/WebSub/jreWin/bin/Sub_Server.exe"
|
||||
#define SubControl_Web_Exe "SubControl/Sub_Web.exe"
|
||||
#define IPBS_NSSM_Exe "IPBS_NSSM.exe"
|
||||
@ -60,6 +63,7 @@ public:
|
||||
inline static std::vector<CCString> CSIPList;
|
||||
inline static std::vector<CCString> SubIPList;
|
||||
inline static CCProcess WebRun,SubRun;
|
||||
inline static int PostMax = 5417;
|
||||
public:
|
||||
static int GetInt(char h1, char h2)
|
||||
{
|
||||
@ -84,7 +88,7 @@ public:
|
||||
CORSEn = A["CORSEn"];
|
||||
FirstRun = A["FirstRun"].to_int();
|
||||
}
|
||||
Configuration::Web_URL = "http://" + Web_IP + ":" + Web_Port + "/";
|
||||
Configuration::Web_URL = "http://" + Web_IP + ":" + Web_Port;
|
||||
}
|
||||
static void ReadCSInfo(const std::function<void()>& fun = nullptr){
|
||||
CCUniqueLock lock(_mutex);
|
||||
@ -195,12 +199,15 @@ public:
|
||||
}
|
||||
}
|
||||
}
|
||||
CCVar Ports = getAvailablePorts(3,5417);
|
||||
if(PostMax == Sub_Port.to_int()){
|
||||
PostMax = PostMax + 3;
|
||||
}
|
||||
CCVar Ports = getAvailablePorts(3,PostMax);
|
||||
Sub_Port = Ports[0].to_String();
|
||||
Sub_Audio_Port = Ports[1].to_String();
|
||||
Web_Port = Ports[2].to_String();
|
||||
Web_IP = Sub_IP;
|
||||
Sub_Org = "['http://" + Sub_IP + ":" + Sub_Port + "']";
|
||||
Sub_Org = "['http://" + Web_IP + ":" + Web_Port + "']";
|
||||
}
|
||||
static bool isPortAvailable(int port,TORU ipvx = TCP)
|
||||
{
|
||||
@ -383,13 +390,43 @@ public:
|
||||
fclose(fp);
|
||||
return true;
|
||||
}
|
||||
static bool terminateProcessByName(const char *processName) {
|
||||
#ifdef _WIN32
|
||||
CCString str = processName;
|
||||
str.append(".exe");
|
||||
HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
|
||||
if (hSnapshot == INVALID_HANDLE_VALUE) {
|
||||
return false;
|
||||
}
|
||||
PROCESSENTRY32 pe32;
|
||||
pe32.dwSize = sizeof(PROCESSENTRY32);
|
||||
if (Process32First(hSnapshot, &pe32)) {
|
||||
do {
|
||||
if (_tcscmp(pe32.szExeFile, str.c_str()) == 0) {
|
||||
HANDLE hProcess = OpenProcess(PROCESS_TERMINATE, FALSE, pe32.th32ProcessID);
|
||||
if (hProcess != NULL) {
|
||||
TerminateProcess(hProcess, 0);
|
||||
CloseHandle(hProcess);
|
||||
}
|
||||
}
|
||||
} while (Process32Next(hSnapshot, &pe32));
|
||||
}
|
||||
CloseHandle(hSnapshot);
|
||||
return true;
|
||||
#elif __linux__
|
||||
|
||||
#endif
|
||||
}
|
||||
static void IPBS_NSSMF(bool F){
|
||||
if(F){
|
||||
CCString cmd = "cd " + ExePath + " && " + IPBS_NSSMPath;
|
||||
QProcess::startDetached(cmd.c_str());
|
||||
const CCString str = CCString("./") + IPBS_NSSM_Exe;
|
||||
QProcess::startDetached(str.c_str());
|
||||
}
|
||||
else{
|
||||
QProcess::startDetached("taskkill /f /t /im IPBS_NSSM.exe");
|
||||
#ifdef _WIN32
|
||||
terminateProcessByName("IPBS_NSSM");
|
||||
#elif __linux__
|
||||
#endif
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@ -199,7 +199,7 @@ CCString HTTPResponse::sha1(const CCString &input) {
|
||||
return base64_encode(hash, SHA_DIGEST_LENGTH);
|
||||
}
|
||||
|
||||
std::streamoff HTTPResponse::getFileSize(const string &filePath) {
|
||||
std::streamoff HTTPResponse::getFileSize(const String &filePath) {
|
||||
std::ifstream file(filePath, std::ios::binary | std::ios::ate);
|
||||
if (!file.is_open()) {
|
||||
return -1; // 文件打开失败
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
#ifndef IMGUICPPDEMO_CCIOS_H
|
||||
#define IMGUICPPDEMO_CCIOS_H
|
||||
#include <filesystem>
|
||||
|
||||
#include "cstdio"
|
||||
#include "vector"
|
||||
|
||||
506
SDK/include/CCObject.h
Normal file
506
SDK/include/CCObject.h
Normal file
@ -0,0 +1,506 @@
|
||||
#ifndef CCObject_H
|
||||
#define CCObject_H
|
||||
#pragma once
|
||||
#pragma GCC system_header
|
||||
|
||||
#include <initializer_list>
|
||||
#include <typeinfo>
|
||||
#include <new>
|
||||
#include <type_traits>
|
||||
#include <bits/utility.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
class bad_CCObject_cast : public bad_cast
|
||||
{
|
||||
public:
|
||||
virtual const char* what() const noexcept { return "bad CCObject_cast"; }
|
||||
};
|
||||
|
||||
[[gnu::noreturn]] inline void __throw_bad_CCObject_cast()
|
||||
{
|
||||
#if __cpp_exceptions
|
||||
throw bad_CCObject_cast{};
|
||||
#else
|
||||
__builtin_abort();
|
||||
#endif
|
||||
}
|
||||
|
||||
#define __cpp_lib_CCObject 201606L
|
||||
|
||||
class CCObject
|
||||
{
|
||||
// Holds either pointer to a heap object or the contained object itself.
|
||||
union _Storage
|
||||
{
|
||||
constexpr _Storage() : _M_ptr{nullptr} {}
|
||||
|
||||
// Prevent trivial copies of this type, buffer might hold a non-POD.
|
||||
_Storage(const _Storage&) = delete;
|
||||
_Storage& operator=(const _Storage&) = delete;
|
||||
|
||||
void* _M_ptr;
|
||||
aligned_storage<sizeof(_M_ptr), alignof(void*)>::type _M_buffer;
|
||||
};
|
||||
|
||||
template<typename _Tp, typename _Safe = is_nothrow_move_constructible<_Tp>,
|
||||
bool _Fits = (sizeof(_Tp) <= sizeof(_Storage))
|
||||
&& (alignof(_Tp) <= alignof(_Storage))>
|
||||
using _Internal = std::integral_constant<bool, _Safe::value && _Fits>;
|
||||
|
||||
template<typename _Tp>
|
||||
struct _Manager_internal; // uses small-object optimization
|
||||
|
||||
template<typename _Tp>
|
||||
struct _Manager_external; // creates contained object on the heap
|
||||
|
||||
template<typename _Tp>
|
||||
using _Manager = __conditional_t<_Internal<_Tp>::value,
|
||||
_Manager_internal<_Tp>,
|
||||
_Manager_external<_Tp>>;
|
||||
|
||||
template<typename _Tp, typename _VTp = decay_t<_Tp>>
|
||||
using _Decay_if_not_CCObject = enable_if_t<!is_same_v<_VTp, CCObject>, _VTp>;
|
||||
|
||||
/// Emplace with an object created from @p __args as the contained object.
|
||||
template <typename _Tp, typename... _Args,
|
||||
typename _Mgr = _Manager<_Tp>>
|
||||
void __do_emplace(_Args&&... __args)
|
||||
{
|
||||
reset();
|
||||
_Mgr::_S_create(_M_storage, std::forward<_Args>(__args)...);
|
||||
_M_manager = &_Mgr::_S_manage;
|
||||
}
|
||||
template <typename _Tp, typename _Up, typename... _Args,
|
||||
typename _Mgr = _Manager<_Tp>>
|
||||
void __do_emplace(initializer_list<_Up> __il, _Args&&... __args)
|
||||
{
|
||||
reset();
|
||||
_Mgr::_S_create(_M_storage, __il, std::forward<_Args>(__args)...);
|
||||
_M_manager = &_Mgr::_S_manage;
|
||||
}
|
||||
|
||||
template <typename _Res, typename _Tp, typename... _Args>
|
||||
using __CCObject_constructible
|
||||
= enable_if<__and_<is_copy_constructible<_Tp>,
|
||||
is_constructible<_Tp, _Args...>>::value,
|
||||
_Res>;
|
||||
|
||||
template <typename _Tp, typename... _Args>
|
||||
using __CCObject_constructible_t
|
||||
= typename __CCObject_constructible<bool, _Tp, _Args...>::type;
|
||||
|
||||
template<typename _VTp, typename... _Args>
|
||||
using __emplace_t
|
||||
= typename __CCObject_constructible<_VTp&, _VTp, _Args...>::type;
|
||||
|
||||
public:
|
||||
constexpr CCObject() noexcept : _M_manager(nullptr) { }
|
||||
CCObject(const CCObject& __other)
|
||||
{
|
||||
if (!__other.has_value())
|
||||
_M_manager = nullptr;
|
||||
else
|
||||
{
|
||||
_Arg __arg;
|
||||
__arg._M_CCObject = this;
|
||||
__other._M_manager(_Op_clone, &__other, &__arg);
|
||||
}
|
||||
}
|
||||
CCObject(CCObject&& __other) noexcept
|
||||
{
|
||||
if (!__other.has_value())
|
||||
_M_manager = nullptr;
|
||||
else
|
||||
{
|
||||
_Arg __arg;
|
||||
__arg._M_CCObject = this;
|
||||
__other._M_manager(_Op_xfer, &__other, &__arg);
|
||||
}
|
||||
}
|
||||
template <typename _Tp, typename _VTp = _Decay_if_not_CCObject<_Tp>,
|
||||
typename _Mgr = _Manager<_VTp>,
|
||||
enable_if_t<is_copy_constructible_v<_VTp>
|
||||
&& !__is_in_place_type_v<_VTp>, bool> = true>
|
||||
CCObject(_Tp&& __value)
|
||||
: _M_manager(&_Mgr::_S_manage)
|
||||
{
|
||||
_Mgr::_S_create(_M_storage, std::forward<_Tp>(__value));
|
||||
}
|
||||
template <typename _Tp, typename... _Args, typename _VTp = decay_t<_Tp>,
|
||||
typename _Mgr = _Manager<_VTp>,
|
||||
__CCObject_constructible_t<_VTp, _Args&&...> = false>
|
||||
explicit
|
||||
CCObject(in_place_type_t<_Tp>, _Args&&... __args)
|
||||
: _M_manager(&_Mgr::_S_manage)
|
||||
{
|
||||
_Mgr::_S_create(_M_storage, std::forward<_Args>(__args)...);
|
||||
}
|
||||
template <typename _Tp, typename _Up, typename... _Args,
|
||||
typename _VTp = decay_t<_Tp>, typename _Mgr = _Manager<_VTp>,
|
||||
__CCObject_constructible_t<_VTp, initializer_list<_Up>&,
|
||||
_Args&&...> = false>
|
||||
explicit
|
||||
CCObject(in_place_type_t<_Tp>, initializer_list<_Up> __il, _Args&&... __args)
|
||||
: _M_manager(&_Mgr::_S_manage)
|
||||
{
|
||||
_Mgr::_S_create(_M_storage, __il, std::forward<_Args>(__args)...);
|
||||
}
|
||||
~CCObject() { reset(); }
|
||||
CCObject&
|
||||
operator=(const CCObject& __rhs)
|
||||
{
|
||||
*this = CCObject(__rhs);
|
||||
return *this;
|
||||
}
|
||||
CCObject&
|
||||
operator=(CCObject&& __rhs) noexcept
|
||||
{
|
||||
if (!__rhs.has_value())
|
||||
reset();
|
||||
else if (this != &__rhs)
|
||||
{
|
||||
reset();
|
||||
_Arg __arg;
|
||||
__arg._M_CCObject = this;
|
||||
__rhs._M_manager(_Op_xfer, &__rhs, &__arg);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
template<typename _Tp>
|
||||
enable_if_t<is_copy_constructible<_Decay_if_not_CCObject<_Tp>>::value, CCObject&>
|
||||
operator=(_Tp&& __rhs)
|
||||
{
|
||||
*this = CCObject(std::forward<_Tp>(__rhs));
|
||||
return *this;
|
||||
}
|
||||
template <typename _Tp, typename... _Args>
|
||||
__emplace_t<decay_t<_Tp>, _Args...>
|
||||
emplace(_Args&&... __args)
|
||||
{
|
||||
using _VTp = decay_t<_Tp>;
|
||||
__do_emplace<_VTp>(std::forward<_Args>(__args)...);
|
||||
return *CCObject::_Manager<_VTp>::_S_access(_M_storage);
|
||||
}
|
||||
template <typename _Tp, typename _Up, typename... _Args>
|
||||
__emplace_t<decay_t<_Tp>, initializer_list<_Up>&, _Args&&...>
|
||||
emplace(initializer_list<_Up> __il, _Args&&... __args)
|
||||
{
|
||||
using _VTp = decay_t<_Tp>;
|
||||
__do_emplace<_VTp, _Up>(__il, std::forward<_Args>(__args)...);
|
||||
return *CCObject::_Manager<_VTp>::_S_access(_M_storage);
|
||||
}
|
||||
void reset() noexcept
|
||||
{
|
||||
if (has_value())
|
||||
{
|
||||
_M_manager(_Op_destroy, this, nullptr);
|
||||
_M_manager = nullptr;
|
||||
}
|
||||
}
|
||||
void swap(CCObject& __rhs) noexcept
|
||||
{
|
||||
if (!has_value() && !__rhs.has_value())
|
||||
return;
|
||||
|
||||
if (has_value() && __rhs.has_value())
|
||||
{
|
||||
if (this == &__rhs)
|
||||
return;
|
||||
|
||||
CCObject __tmp;
|
||||
_Arg __arg;
|
||||
__arg._M_CCObject = &__tmp;
|
||||
__rhs._M_manager(_Op_xfer, &__rhs, &__arg);
|
||||
__arg._M_CCObject = &__rhs;
|
||||
_M_manager(_Op_xfer, this, &__arg);
|
||||
__arg._M_CCObject = this;
|
||||
__tmp._M_manager(_Op_xfer, &__tmp, &__arg);
|
||||
}
|
||||
else
|
||||
{
|
||||
CCObject* __empty = !has_value() ? this : &__rhs;
|
||||
CCObject* __full = !has_value() ? &__rhs : this;
|
||||
_Arg __arg;
|
||||
__arg._M_CCObject = __empty;
|
||||
__full->_M_manager(_Op_xfer, __full, &__arg);
|
||||
}
|
||||
}
|
||||
bool has_value() const noexcept { return _M_manager != nullptr; }
|
||||
CCObject Get(){return *this;}
|
||||
void * GetPointer() const;
|
||||
const char* ToString() const;
|
||||
operator int () const;
|
||||
operator double () const;
|
||||
operator float () const;
|
||||
operator const char* () const;
|
||||
|
||||
#if __cpp_rtti
|
||||
const type_info& type() const noexcept
|
||||
{
|
||||
if (!has_value())
|
||||
return typeid(void);
|
||||
_Arg __arg;
|
||||
_M_manager(_Op_get_type_info, this, &__arg);
|
||||
return *__arg._M_typeinfo;
|
||||
}
|
||||
#endif
|
||||
template<typename _Tp>
|
||||
static constexpr bool __is_valid_cast()
|
||||
{ return __or_<is_reference<_Tp>, is_copy_constructible<_Tp>>::value; }
|
||||
|
||||
private:
|
||||
enum _Op {
|
||||
_Op_access, _Op_get_type_info, _Op_clone, _Op_destroy, _Op_xfer
|
||||
};
|
||||
union _Arg
|
||||
{
|
||||
void* _M_obj;
|
||||
const std::type_info* _M_typeinfo;
|
||||
CCObject* _M_CCObject;
|
||||
};
|
||||
void (*_M_manager)(_Op, const CCObject*, _Arg*);
|
||||
_Storage _M_storage;
|
||||
template<typename _Tp>
|
||||
friend void* __CCObject_caster(const CCObject* __CCObject);
|
||||
template<typename _Tp>
|
||||
struct _Manager_internal
|
||||
{
|
||||
static void
|
||||
_S_manage(_Op __which, const CCObject* __CCObjectp, _Arg* __arg);
|
||||
|
||||
template<typename _Up>
|
||||
static void
|
||||
_S_create(_Storage& __storage, _Up&& __value)
|
||||
{
|
||||
void* __addr = &__storage._M_buffer;
|
||||
::new (__addr) _Tp(std::forward<_Up>(__value));
|
||||
}
|
||||
|
||||
template<typename... _Args>
|
||||
static void
|
||||
_S_create(_Storage& __storage, _Args&&... __args)
|
||||
{
|
||||
void* __addr = &__storage._M_buffer;
|
||||
::new (__addr) _Tp(std::forward<_Args>(__args)...);
|
||||
}
|
||||
|
||||
static _Tp*
|
||||
_S_access(const _Storage& __storage)
|
||||
{
|
||||
// The contained object is in __storage._M_buffer
|
||||
const void* __addr = &__storage._M_buffer;
|
||||
return static_cast<_Tp*>(const_cast<void*>(__addr));
|
||||
}
|
||||
};
|
||||
template<typename _Tp>
|
||||
struct _Manager_external
|
||||
{
|
||||
static void
|
||||
_S_manage(_Op __which, const CCObject* __CCObjectp, _Arg* __arg);
|
||||
|
||||
template<typename _Up>
|
||||
static void
|
||||
_S_create(_Storage& __storage, _Up&& __value)
|
||||
{
|
||||
__storage._M_ptr = new _Tp(std::forward<_Up>(__value));
|
||||
}
|
||||
template<typename... _Args>
|
||||
static void
|
||||
_S_create(_Storage& __storage, _Args&&... __args)
|
||||
{
|
||||
__storage._M_ptr = new _Tp(std::forward<_Args>(__args)...);
|
||||
}
|
||||
static _Tp*
|
||||
_S_access(const _Storage& __storage)
|
||||
{
|
||||
// The contained object is in *__storage._M_ptr
|
||||
return static_cast<_Tp*>(__storage._M_ptr);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
inline void swap(CCObject& __x, CCObject& __y) noexcept { __x.swap(__y); }
|
||||
template <typename _Tp, typename... _Args>
|
||||
inline
|
||||
enable_if_t<is_constructible_v<CCObject, in_place_type_t<_Tp>, _Args...>, CCObject>
|
||||
make_CCObject(_Args&&... __args)
|
||||
{
|
||||
return CCObject(in_place_type<_Tp>, std::forward<_Args>(__args)...);
|
||||
}
|
||||
template <typename _Tp, typename _Up, typename... _Args>
|
||||
inline
|
||||
enable_if_t<is_constructible_v<CCObject, in_place_type_t<_Tp>,
|
||||
initializer_list<_Up>&, _Args...>, CCObject>
|
||||
make_CCObject(initializer_list<_Up> __il, _Args&&... __args)
|
||||
{
|
||||
return CCObject(in_place_type<_Tp>, __il, std::forward<_Args>(__args)...);
|
||||
}
|
||||
template<typename _ValueType>
|
||||
inline _ValueType CCObject_cast(const CCObject& __CCObject)
|
||||
{
|
||||
using _Up = __remove_cvref_t<_ValueType>;
|
||||
static_assert(CCObject::__is_valid_cast<_ValueType>(),
|
||||
"模板参数必须是引用或 CopyConstructible 类型");
|
||||
static_assert(is_constructible_v<_ValueType, const _Up&>,
|
||||
"模板参数必须可以从 const 值构造。");
|
||||
auto __p = CCObject_cast<_Up>(&__CCObject);
|
||||
if (__p)
|
||||
return static_cast<_ValueType>(*__p);
|
||||
__throw_bad_CCObject_cast();
|
||||
}
|
||||
template<typename _ValueType>
|
||||
inline _ValueType CCObject_cast(CCObject& __CCObject)
|
||||
{
|
||||
using _Up = __remove_cvref_t<_ValueType>;
|
||||
static_assert(CCObject::__is_valid_cast<_ValueType>(),
|
||||
"模板参数必须是引用或 CopyConstructible 类型");
|
||||
static_assert(is_constructible_v<_ValueType, _Up&>,
|
||||
"模板参数必须可以从左值构造。");
|
||||
auto __p = CCObject_cast<_Up>(&__CCObject);
|
||||
if (__p)
|
||||
return static_cast<_ValueType>(*__p);
|
||||
__throw_bad_CCObject_cast();
|
||||
}
|
||||
template<typename _ValueType>
|
||||
inline _ValueType CCObject_cast(CCObject&& __CCObject)
|
||||
{
|
||||
using _Up = __remove_cvref_t<_ValueType>;
|
||||
static_assert(CCObject::__is_valid_cast<_ValueType>(),
|
||||
"模板参数必须是引用或 CopyConstructible 类型");
|
||||
static_assert(is_constructible_v<_ValueType, _Up>,
|
||||
"模板参数必须可以从右值构造。");
|
||||
auto __p = CCObject_cast<_Up>(&__CCObject);
|
||||
if (__p)
|
||||
return static_cast<_ValueType>(std::move(*__p));
|
||||
__throw_bad_CCObject_cast();
|
||||
}
|
||||
template<typename _Tp>
|
||||
void* __CCObject_caster(const CCObject* __CCObject)
|
||||
{
|
||||
using _Up = remove_cv_t<_Tp>;
|
||||
if constexpr (!is_same_v<decay_t<_Up>, _Up>)
|
||||
return nullptr;
|
||||
else if constexpr (!is_copy_constructible_v<_Up>)
|
||||
return nullptr;
|
||||
else if (__CCObject->_M_manager == &CCObject::_Manager<_Up>::_S_manage
|
||||
#if __cpp_rtti
|
||||
|| __CCObject->type() == typeid(_Tp)
|
||||
#endif
|
||||
)
|
||||
{
|
||||
return CCObject::_Manager<_Up>::_S_access(__CCObject->_M_storage);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
template<typename _ValueType>
|
||||
inline const _ValueType* CCObject_cast(const CCObject* __CCObject) noexcept
|
||||
{
|
||||
if constexpr (is_object_v<_ValueType>)
|
||||
if (__CCObject)
|
||||
return static_cast<_ValueType*>(__CCObject_caster<_ValueType>(__CCObject));
|
||||
return nullptr;
|
||||
}
|
||||
template<typename _ValueType>
|
||||
inline _ValueType* CCObject_cast(CCObject* __CCObject) noexcept
|
||||
{
|
||||
if constexpr (is_object_v<_ValueType>)
|
||||
if (__CCObject)
|
||||
return static_cast<_ValueType*>(__CCObject_caster<_ValueType>(__CCObject));
|
||||
return nullptr;
|
||||
}
|
||||
template<typename _Tp>
|
||||
void
|
||||
CCObject::_Manager_internal<_Tp>::
|
||||
_S_manage(_Op __which, const CCObject* __CCObject, _Arg* __arg)
|
||||
{
|
||||
|
||||
auto __ptr = reinterpret_cast<const _Tp*>(&__CCObject->_M_storage._M_buffer);
|
||||
switch (__which)
|
||||
{
|
||||
case _Op_access:
|
||||
__arg->_M_obj = const_cast<_Tp*>(__ptr);
|
||||
break;
|
||||
case _Op_get_type_info:
|
||||
#if __cpp_rtti
|
||||
__arg->_M_typeinfo = &typeid(_Tp);
|
||||
#endif
|
||||
break;
|
||||
case _Op_clone:
|
||||
::new(&__arg->_M_CCObject->_M_storage._M_buffer) _Tp(*__ptr);
|
||||
__arg->_M_CCObject->_M_manager = __CCObject->_M_manager;
|
||||
break;
|
||||
case _Op_destroy:
|
||||
__ptr->~_Tp();
|
||||
break;
|
||||
case _Op_xfer:
|
||||
::new(&__arg->_M_CCObject->_M_storage._M_buffer) _Tp
|
||||
(std::move(*const_cast<_Tp*>(__ptr)));
|
||||
__ptr->~_Tp();
|
||||
__arg->_M_CCObject->_M_manager = __CCObject->_M_manager;
|
||||
const_cast<CCObject*>(__CCObject)->_M_manager = nullptr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
template<typename _Tp>
|
||||
void
|
||||
CCObject::_Manager_external<_Tp>::
|
||||
_S_manage(_Op __which, const CCObject* __CCObject, _Arg* __arg)
|
||||
{
|
||||
auto __ptr = static_cast<const _Tp*>(__CCObject->_M_storage._M_ptr);
|
||||
switch (__which)
|
||||
{
|
||||
case _Op_access:
|
||||
__arg->_M_obj = const_cast<_Tp*>(__ptr);
|
||||
break;
|
||||
case _Op_get_type_info:
|
||||
#if __cpp_rtti
|
||||
__arg->_M_typeinfo = &typeid(_Tp);
|
||||
#endif
|
||||
break;
|
||||
case _Op_clone:
|
||||
__arg->_M_CCObject->_M_storage._M_ptr = new _Tp(*__ptr);
|
||||
__arg->_M_CCObject->_M_manager = __CCObject->_M_manager;
|
||||
break;
|
||||
case _Op_destroy:
|
||||
delete __ptr;
|
||||
break;
|
||||
case _Op_xfer:
|
||||
__arg->_M_CCObject->_M_storage._M_ptr = __CCObject->_M_storage._M_ptr;
|
||||
__arg->_M_CCObject->_M_manager = __CCObject->_M_manager;
|
||||
const_cast<CCObject*>(__CCObject)->_M_manager = nullptr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
inline CCObject::operator int() const {
|
||||
int i = CCObject_cast<int>(*this);
|
||||
return i;
|
||||
}
|
||||
inline CCObject::operator double() const {
|
||||
auto d = CCObject_cast<double>(*this);
|
||||
return d;
|
||||
}
|
||||
inline CCObject::operator float() const {
|
||||
auto f = CCObject_cast<float>(*this);
|
||||
return f;
|
||||
}
|
||||
inline const char *CCObject::ToString() const {
|
||||
return (const char*)*this;
|
||||
}
|
||||
|
||||
inline void *CCObject::GetPointer() const {
|
||||
if (auto p = CCObject_cast<void *>(*this))
|
||||
return p;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
inline CCObject::operator const char *() const {
|
||||
if (auto s = CCObject_cast<const char *>(*this))
|
||||
return s;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#endif
|
||||
201
UI/W1/widget.cpp
201
UI/W1/widget.cpp
@ -1,8 +1,6 @@
|
||||
#include <iostream>
|
||||
#include "widget.h"
|
||||
|
||||
#include <QScreen>
|
||||
|
||||
#include "./ui_widget.h"
|
||||
|
||||
Widget::Widget(QWidget *parent): QWidget(parent), ui(new Ui::Widget){
|
||||
@ -42,7 +40,13 @@ Widget::Widget(QWidget *parent): QWidget(parent), ui(new Ui::Widget){
|
||||
connect(ui->OpenPCStart, &QCheckBox::stateChanged,this, &Widget::slotCheckedChanged);
|
||||
connect(ui->RapidDeployment, &QPushButton::clicked, this, [this]()
|
||||
{
|
||||
CCThread(&Widget::Deploy,this).detach();
|
||||
CCThread([this](){
|
||||
QMetaObject::invokeMethod(this,[this]()
|
||||
{
|
||||
this->Deploy(this);
|
||||
});
|
||||
}).detach();
|
||||
// Deploy();
|
||||
});
|
||||
if(Configuration::CORSEn == "true"){
|
||||
ui->CORSEn->setChecked(true);
|
||||
@ -148,6 +152,14 @@ Widget::Widget(QWidget *parent): QWidget(parent), ui(new Ui::Widget){
|
||||
ServerThread.SetThread(&Widget::ServerListening,this);
|
||||
ServerThread.Start();
|
||||
OpenSerice(true);
|
||||
JSON Ret;std::vector<JSON> Value;
|
||||
for (int i = 0;i<1000;i++){
|
||||
JSON A;
|
||||
A["Vol"] = 8;
|
||||
A["IP"] = "127.0.0.1";
|
||||
Value.push_back(A);
|
||||
}
|
||||
Ret["State"] = Value;
|
||||
//------------------------------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
@ -170,7 +182,8 @@ void Widget::WebThreadRun() {
|
||||
while (Configuration::SubRun.IsRunning()){
|
||||
CCString Line = Configuration::SubRun.ReadLineBuffer();
|
||||
if(!Line.empty()){
|
||||
PrintMessage(Line);
|
||||
CCString A = CCEncode::Format(Line,Encode.GBK,Encode.UTF8);
|
||||
PrintMessage(A);
|
||||
}
|
||||
Threading::Sleep(1000 * 50);
|
||||
}
|
||||
@ -224,6 +237,12 @@ bool Widget::WebRunFun() {
|
||||
}
|
||||
PrintMessage("网址: " + Configuration::Web_URL);
|
||||
}).detach();
|
||||
QMetaObject::invokeMethod(this,[this]()
|
||||
{
|
||||
ui->URL_Text->setOpenExternalLinks(true);//设置为true才能打开网页
|
||||
const CCString URL1 = "<a style='color: green;' href = "+ Configuration::Web_URL +"> "+ Configuration::Web_URL +"";
|
||||
ui->URL_Text->setText(URL1.c_str());
|
||||
});
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@ -376,48 +395,20 @@ bool Widget::isJarRunning(const char *jarName) {
|
||||
#endif
|
||||
}
|
||||
|
||||
bool Widget::terminateProcessByName(const char *processName) {
|
||||
#ifdef _WIN32
|
||||
CCString str = processName;
|
||||
str.append(".exe");
|
||||
HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
|
||||
if (hSnapshot == INVALID_HANDLE_VALUE) {
|
||||
return false;
|
||||
}
|
||||
PROCESSENTRY32 pe32;
|
||||
pe32.dwSize = sizeof(PROCESSENTRY32);
|
||||
if (Process32First(hSnapshot, &pe32)) {
|
||||
do {
|
||||
if (_tcscmp(pe32.szExeFile, str.c_str()) == 0) {
|
||||
HANDLE hProcess = OpenProcess(PROCESS_TERMINATE, FALSE, pe32.th32ProcessID);
|
||||
if (hProcess != NULL) {
|
||||
TerminateProcess(hProcess, 0);
|
||||
CloseHandle(hProcess);
|
||||
}
|
||||
}
|
||||
} while (Process32Next(hSnapshot, &pe32));
|
||||
}
|
||||
CloseHandle(hSnapshot);
|
||||
return true;
|
||||
#elif __linux__
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
void Widget::ServerReRun() {
|
||||
if(ServerFlag){
|
||||
try {
|
||||
Configuration::CloseSub_Server();
|
||||
Configuration::CloseSub_Web();
|
||||
if(ServerFlag){
|
||||
WebThread.Stop();
|
||||
PrintMessage("Server Close");
|
||||
OpenFlagBtn(false);
|
||||
ServerFlag = false;
|
||||
SetState(ServerFlag);
|
||||
OpenFlagBtn(false);
|
||||
WebThread.Stop();
|
||||
PrintMessage("Server Close");
|
||||
ui->RunTime->setVisible(false);
|
||||
t = 0;h = 0;f = 0;s = 0;
|
||||
}
|
||||
Configuration::CloseSub_Server();
|
||||
Configuration::CloseSub_Web();
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
std::cerr << "Error: " << e.what() << std::endl;
|
||||
@ -520,24 +511,26 @@ void Widget::SetSaveBtn() {
|
||||
QMessageBox::StandardButton reply = QMessageBox::question(this, "提示", "保存成功是否现在启动?",
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
if (reply == QMessageBox::Yes) {
|
||||
// 用户点击了“是”按钮
|
||||
try {
|
||||
Configuration::CloseSub_Server();
|
||||
Configuration::CloseSub_Web();
|
||||
if(ServerFlag){
|
||||
WebThread.Stop();
|
||||
ui->ServerConsele->append("Server Close");
|
||||
OpenFlagBtn(false);
|
||||
ServerFlag = false;
|
||||
SetState(ServerFlag);
|
||||
ui->RunTime->setVisible(false);
|
||||
t = 0;h = 0;f = 0;s = 0;
|
||||
if(ServerFlag){
|
||||
try {
|
||||
if(ServerFlag){
|
||||
ServerFlag = false;
|
||||
SetState(ServerFlag);
|
||||
OpenFlagBtn(false);
|
||||
WebThread.Stop();
|
||||
PrintMessage("Server Close");
|
||||
ui->RunTime->setVisible(false);
|
||||
t = 0;h = 0;f = 0;s = 0;
|
||||
}
|
||||
Configuration::CloseSub_Server();
|
||||
Configuration::CloseSub_Web();
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
PrintMessage("Error: " + CCString(e.what()));
|
||||
}
|
||||
CCThread::Sleep(1000 * 100);
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
std::cerr << "Error: " << e.what() << std::endl;
|
||||
}
|
||||
OpenServerClick();
|
||||
ServerReRun();
|
||||
} else {
|
||||
// 用户点击了“否”按钮
|
||||
}
|
||||
@ -546,7 +539,14 @@ void Widget::SetSaveBtn() {
|
||||
void Widget::ServerConfigInit() {
|
||||
Configuration::CfgInit();
|
||||
SetPage(1);
|
||||
QMessageBox::information(this, "提示", "初始化已完成!");
|
||||
const QMessageBox::StandardButton reply = QMessageBox::question(this, "提示",
|
||||
"初始化已完成,是否保存?",
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
if (reply == QMessageBox::Yes) {
|
||||
SetSaveBtn();
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void Widget::Initlogo() {
|
||||
@ -696,7 +696,7 @@ void Widget::PrintMessage(CCString str)
|
||||
{
|
||||
QMetaObject::invokeMethod(this,[this,str]()
|
||||
{
|
||||
CCTimeData time;
|
||||
const CCTimeData time;
|
||||
CCString S = "[" + time.to_String() + "] -> " + str;
|
||||
ui->ServerConsele->append(S.c_str());
|
||||
});
|
||||
@ -711,7 +711,19 @@ void Widget::ReadSub_IP(){
|
||||
sub->show();
|
||||
}
|
||||
|
||||
void Widget::Deploy(){
|
||||
void Widget::Deploy(QWidget* PR){
|
||||
Configuration::CloseSub_Server();
|
||||
Configuration::CloseSub_Web();
|
||||
if(ServerFlag){
|
||||
const QMessageBox::StandardButton reply = QMessageBox::question(PR, "提示",
|
||||
"检测到服务已经启动是否先停止?",
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
if (reply == QMessageBox::Yes) {
|
||||
ServerReRun();
|
||||
} else {
|
||||
QMessageBox::information(PR, "提示", "已取消快速配置!");
|
||||
}
|
||||
}
|
||||
boolean F1 = false,F2 = false;
|
||||
PrintMessage("正在配置IP-Web分控IP地址...");
|
||||
while (true){
|
||||
@ -720,7 +732,7 @@ void Widget::Deploy(){
|
||||
if(!Configuration::SubIPList.empty()){
|
||||
if(Configuration::SubIPList.size() > 1){
|
||||
PrintMessage("检测到多个IP地址,请选择要使用的IP地址!");
|
||||
CCVar* sub = new Sub_IPUI(this);
|
||||
CCVar* sub = new Sub_IPUI(nullptr);
|
||||
int top = this->geometry().top();
|
||||
int left = this->geometry().left();
|
||||
int screenWidth = this->width();
|
||||
@ -748,20 +760,20 @@ void Widget::Deploy(){
|
||||
break;
|
||||
}
|
||||
else{
|
||||
bool A1 = false;
|
||||
QMetaObject::invokeMethod(this,[this,&F2,&A1]()
|
||||
{
|
||||
QMessageBox::StandardButton reply = QMessageBox::question(nullptr, "提示",
|
||||
"未检测到合法IPV4地址,请检查网络,是否继续检测?",
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
if (reply == QMessageBox::Yes) {
|
||||
A1 = true;
|
||||
} else {
|
||||
Configuration::Sub_IP = "";
|
||||
F2 = false;
|
||||
PrintMessage("Web分控IP地址配置跳过!");
|
||||
}
|
||||
});
|
||||
bool A1 = false,A2 = false;
|
||||
const QMessageBox::StandardButton reply = QMessageBox::question(PR, "提示",
|
||||
"未检测到合法IPV4地址,请检查网络,是否继续检测?",
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
if (reply == QMessageBox::Yes) {
|
||||
A2 = true;
|
||||
A1 = true;
|
||||
} else {
|
||||
Configuration::Sub_IP = "";
|
||||
A2 = true;
|
||||
F2 = false;
|
||||
PrintMessage("Web分控IP地址配置跳过!");
|
||||
}
|
||||
// while (A2);
|
||||
if(A1){
|
||||
continue;
|
||||
}
|
||||
@ -778,7 +790,7 @@ void Widget::Deploy(){
|
||||
if(!Configuration::CSIPList.empty()){
|
||||
if(Configuration::CSIPList.size() > 1){
|
||||
PrintMessage("在局域网检测到多个C/S服务器,请选择需要使用的C/S服务器!");
|
||||
CCVar* cs4 = new CSInfoW4(this);
|
||||
CCVar* cs4 = new CSInfoW4(nullptr);
|
||||
int top = this->geometry().top();
|
||||
int left = this->geometry().left();
|
||||
int screenWidth = this->width();
|
||||
@ -812,22 +824,19 @@ void Widget::Deploy(){
|
||||
bool A1 = false;
|
||||
Configuration::CS_IP = "";
|
||||
Configuration::CS_Port = "";
|
||||
QMetaObject::invokeMethod(this,[this,&F1,&A1]()
|
||||
{
|
||||
QMessageBox::StandardButton reply = QMessageBox::question(nullptr, "提示",
|
||||
QMessageBox::StandardButton reply = QMessageBox::question(PR, "提示",
|
||||
"在局域网未检测到可用的C/S服务器,请先启动C/S服务器,是否继续检测?",
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
if (reply == QMessageBox::Yes) {
|
||||
A1 = true;
|
||||
}
|
||||
else {
|
||||
Configuration::CS_IP = "";
|
||||
Configuration::CS_Port = "";
|
||||
F1 = false;
|
||||
PrintMessage("C/S服务器信息配置跳过!");
|
||||
A1 = false;
|
||||
}
|
||||
});
|
||||
if (reply == QMessageBox::Yes) {
|
||||
A1 = true;
|
||||
}
|
||||
else {
|
||||
Configuration::CS_IP = "";
|
||||
Configuration::CS_Port = "";
|
||||
F1 = false;
|
||||
PrintMessage("C/S服务器信息配置跳过!");
|
||||
A1 = false;
|
||||
}
|
||||
if(A1){
|
||||
continue;
|
||||
}
|
||||
@ -838,10 +847,18 @@ void Widget::Deploy(){
|
||||
}
|
||||
PrintMessage("正在分配IP-Web分控服务端口...");
|
||||
CCVar Ports = Configuration::getAvailablePorts(3,5417);
|
||||
Configuration::Sub_Port = Ports[0].to_String();
|
||||
Configuration::Sub_Audio_Port = Ports[1].to_String();
|
||||
Configuration::Web_Port = Ports[2].to_String();
|
||||
Configuration::Web_IP = Configuration::Sub_IP;
|
||||
if(Ports.size() == 3){
|
||||
Configuration::Sub_Port = Ports[0].to_String();
|
||||
Configuration::Sub_Audio_Port = Ports[1].to_String();
|
||||
Configuration::Web_Port = Ports[2].to_String();
|
||||
Configuration::Web_IP = Configuration::Sub_IP;
|
||||
}
|
||||
else{
|
||||
Configuration::Sub_Port = "";
|
||||
Configuration::Sub_Audio_Port = "";
|
||||
Configuration::Web_Port = "";
|
||||
Configuration::Web_IP = Configuration::Sub_IP = "";
|
||||
}
|
||||
PrintMessage("IP-Web分控服务端口分配完成!");
|
||||
PrintMessage("IP-Web分控服务正在设置跨域...");
|
||||
Configuration::Sub_Org = "['http://" + Configuration::Web_IP + ":" + Configuration::Web_Port + "']";
|
||||
@ -867,8 +884,8 @@ void Widget::Deploy(){
|
||||
PrintMessage("IP-Web分控服务设置保存完成");
|
||||
if(F1 && F2){
|
||||
try {
|
||||
terminateProcessByName("java");
|
||||
terminateProcessByName("nginx");
|
||||
Configuration::terminateProcessByName("java");
|
||||
Configuration::terminateProcessByName("nginx");
|
||||
if(ServerFlag){
|
||||
WebThread.Stop();
|
||||
ui->ServerConsele->append("Server Close");
|
||||
|
||||
@ -40,10 +40,7 @@
|
||||
#include "W5/sub_ipui.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <tchar.h>
|
||||
#include <windows.h>
|
||||
#include <tlhelp32.h>
|
||||
#include <shlobj.h> // 包含 ShellLink 和 IPersistFile 接口
|
||||
|
||||
#elif __linux__
|
||||
|
||||
#endif
|
||||
@ -64,9 +61,9 @@ private:
|
||||
|
||||
#endif
|
||||
QRect m_areaMovable;//可移动窗口的区域,鼠标只有在该区域按下才能移动窗口
|
||||
bool m_bPressed,closeflag = false;//鼠标按下标志(不分左右键)
|
||||
bool m_bPressed{},closeflag = false;//鼠标按下标志(不分左右键)
|
||||
QPoint m_ptPress;//鼠标按下的初始位置
|
||||
QProcess* NginxP;
|
||||
QProcess* NginxP{};
|
||||
QSystemTrayIcon *trayIcon = new QSystemTrayIcon(this);
|
||||
QMenu *trayIconMenu = new QMenu(this);
|
||||
QAction *quitAction = new QAction(tr("&退出"), this);
|
||||
@ -85,7 +82,6 @@ public:
|
||||
void ServerListening();
|
||||
void OpenServerClick();
|
||||
bool isJarRunning(const char* jarName);
|
||||
bool terminateProcessByName(const char* processName);
|
||||
void ServerReRun();
|
||||
void onCurrentIndexChanged(int index);
|
||||
void onCurrentIndexChangedCSIP(int index);
|
||||
@ -97,7 +93,7 @@ public:
|
||||
void ReadCSInfoFun();
|
||||
void PrintMessage(CCString str);
|
||||
void ReadSub_IP();
|
||||
void Deploy();
|
||||
void Deploy(QWidget* PR = nullptr);
|
||||
void InitUi();
|
||||
|
||||
private:
|
||||
|
||||
@ -455,7 +455,7 @@ QPushButton:hover{
|
||||
}</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>快速部署</string>
|
||||
<string>快速配置</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
@ -1071,7 +1071,7 @@ color: rgb(0, 0, 0);</string>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>130</x>
|
||||
<y>170</y>
|
||||
<y>220</y>
|
||||
<width>111</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
@ -1106,7 +1106,7 @@ QPushButton:hover{
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>170</y>
|
||||
<y>220</y>
|
||||
<width>111</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
@ -1137,6 +1137,37 @@ QPushButton:hover{
|
||||
<string>初始化设置</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget_9">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>160</y>
|
||||
<width>311</width>
|
||||
<height>51</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_13">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>分控前端网址:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="URL_Text">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>13</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
||||
@ -39,10 +39,15 @@ void widget3::SelectFile() {
|
||||
if(!fileNames.isEmpty()){
|
||||
CCString fileName = fileNames[0].toStdString();
|
||||
CCFile file = CCFile(fileName.c_str(), CC::ios::rb, false);
|
||||
CCString str = WebSubPaths + "html/assets/logo-CuXNbvLG.png";
|
||||
#ifdef _WIN32
|
||||
CCString Path = CCEncode::Format(WebSubPaths,Encode.UTF8,Encode.GBK);
|
||||
#elif __linux__
|
||||
CCString Path = CCEncode::Format(WebSubPaths,Encode.UTF8,Encode.UTF8);
|
||||
#endif
|
||||
CCString str = Path + "SubControl/html/assets/logo-CuXNbvLG.png";
|
||||
bool F = file.Copy(str);
|
||||
if(F){
|
||||
CCString str = WebSubPaths + "html/assets/logo-CuXNbvLG.png";
|
||||
CCString str = WebSubPaths + "SubControl/html/assets/logo-CuXNbvLG.png";
|
||||
QPixmap pixmap(str.c_str()); // 替换为你的图片路径
|
||||
if(ImGLoad != nullptr)
|
||||
{
|
||||
|
||||
@ -59,22 +59,6 @@
|
||||
<string>图片必须是100x40的大小</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="logos">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>60</x>
|
||||
<y>80</y>
|
||||
<width>341</width>
|
||||
<height>211</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgba(255, 255, 255, 0);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="LogoBtn">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
@ -110,6 +94,41 @@ QPushButton:hover{
|
||||
<string>更改logo图片</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="localUpdate">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>70</y>
|
||||
<width>121</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Bahnschrift Light</family>
|
||||
<pointsize>13</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::TabFocus</enum>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QPushButton{
|
||||
border-radius:10px;
|
||||
color: rgb(255, 255, 255);
|
||||
background-color: rgba(255,68,138,255);
|
||||
}
|
||||
|
||||
QPushButton:hover{
|
||||
border-radius:10px;
|
||||
color: rgb(255, 255, 255);
|
||||
background-color: rgba(255,100,150, 255);
|
||||
}</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>本地更新</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user