Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinT3Hu committed May 19, 2024
0 parents commit 82cf65f
Show file tree
Hide file tree
Showing 13 changed files with 888 additions and 0 deletions.
190 changes: 190 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
# https://clang.llvm.org/docs/ClangFormatStyleOptions.html
# for clang-format 17.0.1
Language: Cpp
BasedOnStyle: "WebKit"
# AccessModifierOffset: 2
AlignAfterOpenBracket: "AlwaysBreak"
AlignArrayOfStructures: None
AlignConsecutiveAssignments: None
AlignConsecutiveBitFields: None
AlignConsecutiveDeclarations: None
AlignConsecutiveMacros: None
# AlignConsecutiveShortCaseStatements: None
AlignEscapedNewlines: Left
AlignOperands: Align
AlignTrailingComments:
Kind: Always
OverEmptyLines: 1
AllowAllArgumentsOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
# AllowShortCompoundRequirementOnASingleLine: true
AllowShortEnumsOnASingleLine: false
AllowShortFunctionsOnASingleLine: InlineOnly
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: Inline
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: Yes
# AttributeMacros:
# - __pragma
# - _Pragma
# - __attribute__
# - __declspec
BinPackArguments: false
BinPackParameters: false
BitFieldColonSpacing: After
BraceWrapping:
AfterCaseLabel: false
AfterClass: true
AfterControlStatement: Never
AfterEnum: true
AfterFunction: true
AfterNamespace: true
# AfterObjCDeclaration: true
AfterStruct: true
AfterUnion: true
AfterExternBlock: true
BeforeCatch: true
BeforeElse: true
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
# BracedInitializerIndentWidth: 4
BreakAfterAttributes: Never
BreakAfterJavaFieldAnnotations: true
BreakArrays: true
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeBraces: Attach
BreakBeforeConceptDeclarations: Always
BreakBeforeInlineASMColon: OnlyMultiline
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeComma
BreakInheritanceList: BeforeComma
BreakStringLiterals: true
ColumnLimit: 100
# CommentPragmas: '^ MEO pragma:'
CompactNamespaces: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: false
DerivePointerAlignment: false
DisableFormat: false
EmptyLineAfterAccessModifier: Never
EmptyLineBeforeAccessModifier: LogicalBlock
# ExperimentalAutoDetectBinPacking: true
FixNamespaceComments: true
# ForEachMacros:
# - foreach
# - Q_FOREACH
# - BOOST_FOREACH
# IfMacros:
# - 'KJ_IF_MAYBE'
IncludeBlocks: Preserve
# IncludeCategories:
# IncludeIsMainRegex:
# IncludeIsMainSourceRegex:
IndentAccessModifiers: false
IndentCaseBlocks: false
IndentCaseLabels: false
IndentExternBlock: AfterExternBlock
IndentGotoLabels: false
IndentPPDirectives: None
IndentRequiresClause: false
IndentWidth: 4
IndentWrappedFunctionNames: true
InsertBraces: true
InsertNewlineAtEOF: true
InsertTrailingCommas: Wrapped
IntegerLiteralSeparator:
Binary: 4
BinaryMinDigits: 9
Decimal: 3
DecimalMinDigits: 7
Hex: -1
# JavaImportGroups:
# JavaScriptQuotes:
# JavaScriptWrapImports:
KeepEmptyLinesAtEOF: true
KeepEmptyLinesAtTheStartOfBlocks: false
LambdaBodyIndentation: Signature
# LineEnding: LF
# MacroBlockBegin: "MAA.*_NS_BEGIN$"
# MacroBlockEnd: "MAA.*_NS_END$"
# Macros:
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
# NamespaceMacros:
# ObjCBinPackProtocolList:
# ObjCBlockIndentWidth:
# ObjCBreakBeforeNestedBlockParam:
# ObjCSpaceAfterProperty:
# ObjCSpaceBeforeProtocolList:
PackConstructorInitializers: Never
# PenaltyBreakAssignment:
# PenaltyBreakBeforeFirstCallParameter:
# PenaltyBreakComment:
# PenaltyBreakFirstLessLess:
# PenaltyBreakOpenParenthesis:
# PenaltyBreakTemplateDeclaration:
# PenaltyExcessCharacter:
# PenaltyIndentedWhitespace:
# PenaltyReturnTypeOnItsOwnLine:
PointerAlignment: Left
# QualifierAlignment: Custom
# QualifierOrder:
# - inline
# - static
# - const
# - constexpr
# - type
ReferenceAlignment: Left
ReflowComments: true
RemoveBracesLLVM: false
RemoveParentheses: Leave
RemoveSemicolon: false
RequiresClausePosition: OwnLine
RequiresExpressionIndentation: OuterScope
SeparateDefinitionBlocks: Always
ShortNamespaceLines: 1000
SortIncludes: CaseSensitive
# SortJavaStaticImport:
SortUsingDeclarations: Lexicographic
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceAroundPointerQualifiers: Default
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: true
SpaceBeforeCtorInitializerColon: true
SpaceBeforeJsonColon: false
SpaceBeforeParens: ControlStatements
# SpaceBeforeParensOptions:
SpaceBeforeRangeBasedForLoopColon: true
SpaceBeforeSquareBrackets: false
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: Never
SpacesInContainerLiterals: true
SpacesInLineCommentPrefix:
Minimum: 1
Maximum: -1
SpacesInParens: Never
SpacesInSquareBrackets: false
Standard: c++20
# StatementAttributeLikeMacros:
# StatementMacros:
TabWidth: 4
# TypeNames:
# TypenameMacros:
UseTab: Never
# VerilogBreakBetweenInstancePorts:
# WhitespaceSensitiveMacros:
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
build
.vs
59 changes: 59 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
cmake_minimum_required(VERSION 3.16)
project(ImageCropper LANGUAGES CXX)

include(qt.cmake)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core)
find_package(Qt${QT_VERSION_MAJOR}
COMPONENTS
Core
Gui
Widgets
)
qt_standard_project_setup()

set(SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/source)

file(GLOB PROJECT_SOURCES ${SOURCE_DIR}/*)

set(GLOB FORMS ${SOURCE_DIR}/*.ui)

source_group(FORMS FILES ${FORMS})

qt_add_executable(ImageCropper ${PROJECT_SOURCES})

### OpenCV

find_package(OpenCV REQUIRED)
target_include_directories(ImageCropper
PRIVATE
${OpenCV_INCLUDE_DIRS}
)
target_link_directories(ImageCropper
PRIVATE
${OpenCV_LIB_DIR}
)
target_link_libraries(ImageCropper
PRIVATE
${OpenCV_LIBS}
)

target_include_directories(ImageCropper
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/include
)

set_target_properties(ImageCropper
PROPERTIES
WIN32_EXECUTABLE TRUE
)

target_link_libraries(ImageCropper
PUBLIC
Qt::Core
Qt::Gui
Qt::Widgets
)
42 changes: 42 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"version": 3,
"configurePresets": [
{
"hidden": true,
"name": "Qt",
"cacheVariables": {
"CMAKE_PREFIX_PATH": "$env{QTDIR}"
}
},
{
"hidden": true,
"name": "MSVC",
"inherits": "Qt",
"binaryDir": "build",
"cacheVariables": {
"CMAKE_GENERATOR": "Visual Studio 17 2022"
}
},
{
"name": "MSVC-Release",
"inherits": "MSVC",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
}
},
{
"name": "MSVC-Debug",
"inherits": "MSVC",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
}
},
{
"name": "MSVC-RelWithDebInfo",
"inherits": "MSVC",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "RelWithDebInfo"
}
}
]
}
7 changes: 7 additions & 0 deletions include/adb.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include <QProcess>
#include <opencv2/opencv.hpp>

namespace adb {
bool is_connected();
cv::Mat screenshot();
}
17 changes: 17 additions & 0 deletions qt.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
if(QT_VERSION VERSION_LESS 6.3)
macro(qt_standard_project_setup)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
endmacro()
endif()

if(QT_VERSION VERSION_LESS 6.0)
macro(qt_add_executable name)
if(ANDROID)
add_library(name SHARED ${ARGN})
else()
add_executable(${ARGV})
endif()
endmacro()
endif()
Loading

0 comments on commit 82cf65f

Please sign in to comment.