console: basic code.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
project(frelay VERSION 0.1.1 LANGUAGES CXX)
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
@@ -32,5 +32,6 @@ add_subdirectory(Server)
|
||||
add_subdirectory(ClientCore)
|
||||
add_subdirectory(Util)
|
||||
add_subdirectory(Gui)
|
||||
add_subdirectory(Console)
|
||||
add_subdirectory(Struct)
|
||||
add_subdirectory(Test)
|
||||
|
||||
@@ -27,6 +27,8 @@ void FileTrans::fbtReqSend(QSharedPointer<FrameBuffer> frame)
|
||||
{
|
||||
// judget is same client's same file.
|
||||
|
||||
// judget if file exits etc.
|
||||
|
||||
// send
|
||||
InfoMsg info = infoUnpack<InfoMsg>(frame->data);
|
||||
auto doTask = QSharedPointer<DoTransTask>::create();
|
||||
@@ -123,6 +125,8 @@ void FileTrans::fbtFileTrans(QSharedPointer<FrameBuffer> frame)
|
||||
|
||||
void FileTrans::fbtAnsSendFailed(QSharedPointer<FrameBuffer> frame)
|
||||
{
|
||||
InfoMsg info = infoUnpack<InfoMsg>(frame->data);
|
||||
qCritical() << QString(tr("request file:%1 failed. reason:%2")).arg(info.path).arg(info.msg);
|
||||
}
|
||||
|
||||
void FileTrans::fbtAnsSendSuccess(QSharedPointer<FrameBuffer> frame)
|
||||
|
||||
17
Console/CMakeLists.txt
Normal file
17
Console/CMakeLists.txt
Normal file
@@ -0,0 +1,17 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
project(frelayConsole LANGUAGES CXX)
|
||||
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core Network)
|
||||
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Network)
|
||||
|
||||
add_executable(frelayConsole Console.h Console.cpp main.cpp ../Res/ico.rc)
|
||||
target_link_libraries(frelayConsole PRIVATE Protocol Util)
|
||||
target_link_libraries(frelayConsole PRIVATE Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Network)
|
||||
1
Console/Console.cpp
Normal file
1
Console/Console.cpp
Normal file
@@ -0,0 +1 @@
|
||||
#include "Console.h"
|
||||
9
Console/Console.h
Normal file
9
Console/Console.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#ifndef FRELAY_CONSOLE_H
|
||||
#define FRELAY_CONSOLE_H
|
||||
|
||||
class RelayConsole
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
#endif // FRELAY_CONSOLE_H
|
||||
14
Console/main.cpp
Normal file
14
Console/main.cpp
Normal file
@@ -0,0 +1,14 @@
|
||||
#include <QCoreApplication>
|
||||
|
||||
#include "Console.h"
|
||||
#include <Util.h>
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
QCoreApplication app(argc, argv);
|
||||
|
||||
Util::InitLogger("frelayConsole.log", "frelayConsole");
|
||||
qInstallMessageHandler(Util::ConsoleMsgHander);
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
Reference in New Issue
Block a user