Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Generated from CLion C/C++ Code Style settings
Language: Cpp
BasedOnStyle: Google
ColumnLimit: 100
SortIncludes: true
AccessModifierOffset: -1
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignOperands: Align
AllowAllArgumentsOnNextLine: false
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: Always
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterReturnType: None
AlwaysBreakTemplateDeclarations: Yes
BreakBeforeBraces: Custom
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: true
BreakBeforeBinaryOperators: None
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeColon
BreakInheritanceList: BeforeColon
CompactNamespaces: false
ContinuationIndentWidth: 4
IndentCaseLabels: true
IndentPPDirectives: None
IndentWidth: 2
KeepEmptyLinesAtTheStartOfBlocks: true
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: false
DerivePointerAlignment: false
PointerAlignment: Left
ReflowComments: false
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
IncludeBlocks: Merge
TabWidth: 2
UseTab: Never

---
Language: ObjC
BasedOnStyle: Google
ColumnLimit: 100

# Only sort headers in each include block
SortIncludes: true
IncludeBlocks: Preserve
DerivePointerAlignment: false
PointerAlignment: Left
AllowShortFunctionsOnASingleLine: None
BraceWrapping:
SplitEmptyFunction: true
94 changes: 94 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
cmake_minimum_required(VERSION 3.13)
project(inspectorTool)

include(./third_party/vendor_tools/vendor.cmake)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
cmake_policy(SET CMP0063 NEW)
set(CMAKE_CXX_VISIBILITY_PRESET hidden)

set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(TGFX_DIR ${CMAKE_CURRENT_SOURCE_DIR}/tgfx)
set(INSPECTOR_COMMON_DIR ${TGFX_DIR}/src/debug)

if (NOT CMAKE_PREFIX_PATH)
if (NOT EXISTS ${PROJECT_SOURCE_DIR}/QTCMAKE.cfg)
file(WRITE ${PROJECT_SOURCE_DIR}/QTCMAKE.cfg
"set(CMAKE_PREFIX_PATH /Users/[username]/Qt/6.6.1/macos/lib/cmake) #put your own QT path here")
endif ()
include("QTCMAKE.cfg")
endif ()

string(REGEX MATCH "([0-9]+)\\.[0-9]+\\.[0-9]+" QT_VERSION ${CMAKE_PREFIX_PATH})
if (QT_VERSION)
string(REGEX MATCH "^[0-9]+" QT_VERSION_MAJOR ${QT_VERSION})
if (QT_VERSION_MAJOR GREATER_EQUAL 6 AND CMAKE_SIZEOF_VOID_P EQUAL 4)
message(FATAL_ERROR "QT has dropped support for 32-bit builds since version 6.0.0")
endif ()
endif ()

set(TGFX_USE_QT ON)
set(TGFX_BUILD_INSPECTOR OFF)
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
add_subdirectory(${TGFX_DIR} tgfx EXCLUDE_FROM_ALL)

find_package(Qt6 REQUIRED COMPONENTS Core Widgets OpenGL qml Quick WebSockets Network QuickControls2 Core5Compat)
list(APPEND TGFX_INSPECTOR_LIBS Qt6::Core Qt6::Widgets Qt6::WebSockets Qt6::OpenGL Qt6::Qml Qt6::Quick Qt6::Network
Qt6::QuickControls2 Qt6::Core5Compat)
qt6_add_resources(QT_RESOURCES res.qrc)

if (APPLE)
find_library(APPLICATION_SERVICES_FRAMEWORK ApplicationServices REQUIRED)
list(APPEND TGFX_INSPECTOR_LIBS ${APPLICATION_SERVICES_FRAMEWORK})
find_library(QUARTZ_CORE QuartzCore REQUIRED)
list(APPEND TGFX_INSPECTOR_LIBS ${QUARTZ_CORE})
find_library(COCOA Cocoa REQUIRED)
list(APPEND TGFX_INSPECTOR_LIBS ${COCOA})
find_library(FOUNDATION Foundation REQUIRED)
list(APPEND TGFX_INSPECTOR_LIBS ${FOUNDATION})
find_library(ICONV_LIBRARIES NAMES iconv libiconv libiconv-2 c)
list(APPEND TGFX_INSPECTOR_LIBS ${ICONV_LIBRARIES})
find_library(VIDEOTOOLBOX VideoToolbox)
list(APPEND TGFX_INSPECTOR_LIBS ${VIDEOTOOLBOX})
find_library(CORE_MEDIA CoreMedia)
list(APPEND TGFX_INSPECTOR_LIBS ${CORE_MEDIA})
find_library(COMPRESSION_LIBRARIES NAMES compression)
list(APPEND TGFX_INSPECTOR_LIBS ${COMPRESSION_LIBRARIES})
elseif (WIN32)
set(BUILD_USE_64BITS ON)
add_definitions(-DNOMINMAX -D_USE_MATH_DEFINES)
find_library(Bcrypt_LIB Bcrypt)
list(APPEND TGFX_INSPECTOR_LIBS ${Bcrypt_LIB})
find_library(ws2_32_LIB ws2_32)
list(APPEND TGFX_INSPECTOR_LIBS ${ws2_32_LIB})
endif ()

list(APPEND TGFX_INSPECTOR_SRC src src/tags src/socket/*.* src/layerInspector/*.*)
file(GLOB TGFX_INSPECTOR_FILES src/*.* src/tags/*.* src/socket/*.* src/layerInspector/*.*)
set(LZ4_DIR ${TGFX_DIR}/third_party/lz4/lib)

list(APPEND LZ4_FILE ${LZ4_DIR}/lz4.c)
list(APPEND TGFX_INSPECTOR_COMMON_INCLUDE ${LZ4_DIR} ${INSPECTOR_COMMON_DIR})

file(GLOB TGFX_INSPECTOR_COMMON_FILES
${LZ4_FILE}
${INSPECTOR_COMMON_DIR}/Socket.cpp)

list(APPEND INSPECTOR_STATIC_VENDORS KDDockWidgets)
add_vendor_target(inspector-vendor STATIC_VENDORS ${INSPECTOR_STATIC_VENDORS})
find_vendor_libraries(inspector-vendor STATIC INSPECTOR_VENDOR_STATIC_LIBRARIES)
list(APPEND TGFX_INSPECTOR_LIBS ${INSPECTOR_VENDOR_STATIC_LIBRARIES})
list(APPEND TGFX_INSPECTOR_DEFINE KDDW_FRONTEND_QTQUICK KDDW_FRONTEND_QT KDDW_QTGUI_TYPES)

list(APPEND TGFX_INSPECTOR_INCLUDE ./third_party/KDDockWidgets/src/fwd_headers)

list(APPEND TGFX_INSPECTOR_OPTIONS -fno-rtti)

add_executable(inspectorTool ${RC_FILES} ${TGFX_INSPECTOR_FILES} ${TGFX_INSPECTOR_COMMON_FILES} ${QT_RESOURCES})
target_include_directories(inspectorTool PUBLIC ${TGFX_INSPECTOR_SRC} ${TGFX_INSPECTOR_COMMON_INCLUDE})
target_include_directories(inspectorTool SYSTEM PRIVATE ${TGFX_INSPECTOR_INCLUDE})
target_compile_definitions(inspectorTool PUBLIC ${TGFX_INSPECTOR_DEFINE})
target_compile_options(inspectorTool PUBLIC ${TGFX_INSPECTOR_OPTIONS})
target_link_libraries(inspectorTool tgfx ${TGFX_INSPECTOR_LIBS})
33 changes: 33 additions & 0 deletions DEPS
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"version": "1.3.12",
"vars": {
"PAG_GROUP": "https://github.com/libpag"
},
"repos": {
"common": [
{
"url": "${PAG_GROUP}/vendor_tools.git",
"commit": "76b266c30e3314678a0d8daeb5b40a9389ea5544",
"dir": "third_party/vendor_tools"
},
{
"url": "https://github.com/KDAB/KDDockWidgets.git",
"commit": "bdf4e7bd4ee49c961cac8a0caff44c25ca2a06b4",
"dir": "third_party/KDDockWidgets"
},
{
"url": "https://github.com/Tencent/tgfx.git",
"commit": "ff01c45b1b00b5c732e388358cb3065188b23763",
"dir": "tgfx"
}
]
},
"actions": {
"common": [
{
"command": "depsync --clean",
"dir": "third_party"
}
]
}
}
41 changes: 41 additions & 0 deletions codeformat.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/usr/bin/env bash
cd $(dirname $0)

if [[ $(uname) == 'Darwin' ]]; then
MAC_REQUIRED_TOOLS="python3"
for TOOL in ${MAC_REQUIRED_TOOLS[@]}; do
if [ ! $(which $TOOL) ]; then
if [ ! $(which brew) ]; then
echo "Homebrew not found. Trying to install..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" ||
exit 1
fi
echo "$TOOL not found. Trying to install..."
brew install $TOOL || exit 1
fi
done
clangformat=`clang-format --version`
if [[ $clangformat =~ "14." ]]
then
echo "----$clangformat----"
else
echo "----install clang-format----"
pip3 install clang-format==14
fi
fi

echo "----begin to scan code format----"
find src -name "*.cpp" -print -o -name "*.c" -print -o -name "*.h" -print -o -name "*.mm" -print -o -name "*.m" -print | xargs clang-format -i

git diff
result=`git diff`
if [[ $result =~ "diff" ]]
then
echo "----Failed to pass the code format check----"
exit 1
else
echo "----Complete the code format check-----"
fi



Binary file added icons/InspectorIcon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/LayerTreeIcon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/arrow_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/capture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/chooseOpenFile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/close.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/disconnected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/openfile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/savefile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions install_tools.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash -e
cd $(dirname $0)
# install all the tools required for the autotest.

if [[ `uname` == 'Darwin' ]]; then
MAC_REQUIRED_TOOLS="cmake ninja git-lfs"
for TOOL in ${MAC_REQUIRED_TOOLS[@]}; do
if [ ! $(which $TOOL) ]; then
if [ ! $(which brew) ]; then
echo "Homebrew not found. Trying to install..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
echo "$TOOL not found. Trying to install..."
brew install $TOOL
fi
done
fi

Loading