control:基本架子控件。

This commit is contained in:
taynpg 2025-05-08 21:13:36 +08:00
parent 4442ecd7e5
commit f33eed6ddb
23 changed files with 250 additions and 14 deletions

View File

@ -4,6 +4,8 @@ project(RelayFile VERSION 0.1.0 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_PREFIX_PATH "D:/Program/Dev/wxWidgets")
if (MSVC)
add_compile_options(/utf-8)
endif()

View File

@ -26,6 +26,16 @@ void ClientCore::Disconnect()
{
}
bool ClientCore::GetOnlineList(InfoClientVec& infoClientVec)
{
return false;
}
bool ClientCore::AskDirectory(const wxString& id, const wxString& path, DirFileInfoVec& dirInfoVec)
{
return false;
}
void ClientCore::OnSocketEvent(wxSocketEvent& event)
{
switch (event.GetSocketEvent()) {

View File

@ -1,6 +1,8 @@
#ifndef CLIENTCORE_H
#define CLIENTCORE_H
#include <InfoClient.hpp>
#include <InfoDirFile.hpp>
#include <cstdint>
#include <memory>
#include <vector>
@ -16,8 +18,8 @@ public:
void Disconnect();
public:
bool GetOnlineList(std::vector<wxString>& list);
bool AskDirectory(const wxString& id, const wxString& path);
bool GetOnlineList(InfoClientVec& infoClientVec);
bool AskDirectory(const wxString& id, const wxString& path, DirFileInfoVec& dirInfoVec);
private:
void OnSocketEvent(wxSocketEvent& event);

View File

@ -0,0 +1,28 @@
#ifndef _InfoClient_hpp_
#define _InfoClient_hpp_
#include <cereal/archives/binary.hpp>
#include <cereal/types/memory.hpp>
#include <cereal/types/vector.hpp>
#include <string>
struct InfoClient {
std::string id;
std::string name;
template <class Archive> void serialize(Archive& archive)
{
archive(CEREAL_NVP(id), CEREAL_NVP(name));
}
};
struct InfoClientVec {
std::vector<InfoClient> vec;
template <class Archive> void serialize(Archive& archive)
{
archive(CEREAL_NVP(vec));
}
};
#endif // _InfoClient_hpp_

View File

@ -3,7 +3,6 @@
#include <cereal/archives/binary.hpp>
#include <cereal/types/memory.hpp>
#include <cereal/types/unordered_map.hpp>
#include <cereal/types/vector.hpp>
#include <cstdint>
#include <string>

View File

@ -1,13 +1,31 @@
cmake_minimum_required(VERSION 3.16)
project(RemoteTran LANGUAGES CXX)
project(RelayFile LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(wxWidgets CONFIG REQUIRED)
set(MSOURCES
UserInterface.h
UserInterface.cxx
main.cxx
HeaderControl.h
HeaderControl.cxx
LocalControl.h
LocalControl.cxx
RemoteControl.h
RemoteControl.cxx
LogControl.h
LogControl.cxx
OnLineControl.h
OnLineControl.cxx
TaskControl.h
TaskControl.cxx
MineControl.h
MineControl.cxx
)
add_executable(UserInterface ${MSOURCES})
add_executable(RelayFile ${MSOURCES})
target_link_libraries(RelayFile PRIVATE wx::base wx::core)
set_target_properties(RelayFile PROPERTIES WIN32_EXECUTABLE TRUE)

View File

View File

@ -0,0 +1,13 @@
#ifndef HEADERCONTORL_H
#define HEADERCONTORL_H
#include <wx/wx.h>
class HeaderContorl : public wxPanel
{
public:
HeaderContorl(wxWindow* parent);
~HeaderContorl() override;
};
#endif // HEADERCONTORL_H

View File

@ -0,0 +1,9 @@
#include "LocalControl.h"
LocalControl::LocalControl(wxWindow* parent)
{
}
LocalControl::~LocalControl()
{
}

View File

@ -0,0 +1,13 @@
#ifndef LOCALCONTROL_H
#define LOCALCONTROL_H
#include <wx/wx.h>
class LocalControl : public wxPanel
{
public:
LocalControl(wxWindow* parent);
~LocalControl() override;
};
#endif // LOCALCONTROL_H

View File

@ -0,0 +1,9 @@
#include "LogControl.h"
LogControl::LogControl(wxWindow* parent)
{
}
LogControl::~LogControl()
{
}

View File

@ -0,0 +1,13 @@
#ifndef LOGCONTROL_H
#define LOGCONTROL_H
#include <wx/wx.h>
class LogControl : public wxPanel
{
public:
LogControl(wxWindow* parent);
~LogControl() override;
};
#endif // LOGCONTROL_H

View File

@ -0,0 +1,9 @@
#include "MineControl.h"
MineControl::MineControl(wxWindow* parent)
{
}
MineControl::~MineControl()
{
}

View File

@ -0,0 +1,13 @@
#ifndef MINECONTROL_H
#define MINECONTROL_H
#include <wx/wx.h>
class MineControl : public wxPanel
{
public:
MineControl(wxWindow* parent);
~MineControl() override;
};
#endif // MINECONTROL_H

View File

@ -0,0 +1,9 @@
#include "OnLineControl.h"
OnlineControl::OnlineControl(wxWindow* parent)
{
}
OnlineControl::~OnlineControl()
{
}

View File

@ -0,0 +1,13 @@
#ifndef ONLINECONTROL_H
#define ONLINECONTROL_H
#include <wx/wx.h>
class OnlineControl : public wxPanel
{
public:
OnlineControl(wxWindow* parent);
~OnlineControl() override;
};
#endif // ONLINECONTROL_H

View File

@ -0,0 +1,9 @@
#include "RemoteControl.h"
RemoteControl::RemoteControl(wxWindow* parent)
{
}
RemoteControl::~RemoteControl()
{
}

View File

@ -0,0 +1,13 @@
#ifndef REMOTECONTROL_H
#define REMOTECONTROL_H
#include <wx/wx.h>
class RemoteControl : public wxPanel
{
public:
RemoteControl(wxWindow* parent);
~RemoteControl() override;
};
#endif // REMOTECONTROL_H

View File

@ -0,0 +1,9 @@
#include "TaskControl.h"
TaskControl::TaskControl(wxWindow* parent)
{
}
TaskControl::~TaskControl()
{
}

View File

@ -0,0 +1,13 @@
#ifndef TASKCONTROL_H
#define TASKCONTROL_H
#include <wx/wx.h>
class TaskControl : public wxPanel
{
public:
TaskControl(wxWindow* parent);
~TaskControl() override;
};
#endif // TASKCONTROL_H

View File

@ -1,5 +1,21 @@
#include "UserInterface.h"
UserInterface::UserInterface(const wxString& title) : wxFrame(nullptr, wxID_ANY, title, wxDefaultPosition, wxSize(800, 600))
{
}
UserInterface::~UserInterface()
{
}
void UserInterface::InitUI()
{
}
void UserInterface::InitData()
{
}

View File

@ -1,10 +1,17 @@
#ifndef _IUSERINTERFACE_H
#define _IUSERINTERFACE_H
#ifndef IUSERINTERFACE_H
#define IUSERINTERFACE_H
class UserInterface
#include <wx/wx.h>
class UserInterface final : public wxFrame
{
public:
~UserInterface();
explicit UserInterface(const wxString& title);
~UserInterface() override;
private:
void InitUI();
void InitData();
};
#endif // _IUSERINTERFACE_H
#endif // IUSERINTERFACE_H

View File

@ -1,6 +1,15 @@
#include "UserInterface.h"
int main()
class RelayFileApp : public wxApp
{
return 0;
public:
bool OnInit() override
{
auto* f = new UserInterface(wxT("RelayFile"));
f->Show();
return true;
}
};
IMPLEMENT_APP(RelayFileApp);
DECLARE_APP(RelayFileApp);