summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.clang-format201
-rw-r--r--.clang-tidy33
-rw-r--r--.gitignore2
-rw-r--r--CMakeLists.txt25
-rw-r--r--src/main.cpp8
-rw-r--r--src/main_window.cpp66
-rw-r--r--src/main_window.hpp42
7 files changed, 377 insertions, 0 deletions
diff --git a/.clang-format b/.clang-format
new file mode 100644
index 0000000..689c8e6
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,201 @@
+---
+Language: Cpp
+# BasedOnStyle: LLVM
+AccessModifierOffset: -2
+AlignAfterOpenBracket: AlwaysBreak
+AlignArrayOfStructures: None
+AlignConsecutiveAssignments:
+ Enabled: false
+ AcrossEmptyLines: false
+ AcrossComments: false
+ AlignCompound: false
+ PadOperators: true
+AlignConsecutiveBitFields:
+ Enabled: false
+ AcrossEmptyLines: false
+ AcrossComments: false
+ AlignCompound: false
+ PadOperators: false
+AlignConsecutiveDeclarations:
+ Enabled: false
+ AcrossEmptyLines: false
+ AcrossComments: false
+ AlignCompound: false
+ PadOperators: false
+AlignConsecutiveMacros:
+ Enabled: false
+ AcrossEmptyLines: false
+ AcrossComments: false
+ AlignCompound: false
+ PadOperators: false
+AlignEscapedNewlines: Left
+AlignOperands: false
+AllowAllArgumentsOnNextLine: false
+AllowAllParametersOfDeclarationOnNextLine: false
+AllowShortBlocksOnASingleLine: Never
+AllowShortCaseLabelsOnASingleLine: false
+AllowShortEnumsOnASingleLine: false
+AllowShortFunctionsOnASingleLine: None
+AllowShortIfStatementsOnASingleLine: Never
+AllowShortLambdasOnASingleLine: All
+AllowShortLoopsOnASingleLine: false
+AlwaysBreakAfterDefinitionReturnType: None
+AlwaysBreakAfterReturnType: None
+AlwaysBreakBeforeMultilineStrings: true
+AlwaysBreakTemplateDeclarations: Yes
+AttributeMacros:
+ - __capability
+BinPackArguments: false
+BinPackParameters: false
+BitFieldColonSpacing: Both
+BraceWrapping:
+ AfterCaseLabel: false
+ AfterClass: false
+ AfterControlStatement: Never
+ AfterEnum: true
+ AfterExternBlock: false
+ AfterFunction: true
+ AfterNamespace: false
+ AfterObjCDeclaration: false
+ AfterStruct: false
+ AfterUnion: false
+ BeforeCatch: false
+ BeforeElse: false
+ BeforeLambdaBody: false
+ BeforeWhile: false
+ IndentBraces: false
+ SplitEmptyFunction: true
+ SplitEmptyRecord: true
+ SplitEmptyNamespace: true
+BreakAfterJavaFieldAnnotations: false
+BreakBeforeBinaryOperators: None
+BreakBeforeConceptDeclarations: Always
+BreakBeforeBraces: Custom
+BreakBeforeTernaryOperators: true
+BreakConstructorInitializers: AfterColon
+BreakInheritanceList: BeforeColon
+BreakStringLiterals: true
+ColumnLimit: 120
+CommentPragmas: '^ IWYU pragma:'
+CompactNamespaces: false
+ConstructorInitializerIndentWidth: 4
+ContinuationIndentWidth: 4
+Cpp11BracedListStyle: true
+DerivePointerAlignment: false
+DisableFormat: false
+EmptyLineAfterAccessModifier: Never
+EmptyLineBeforeAccessModifier: LogicalBlock
+ExperimentalAutoDetectBinPacking: false
+FixNamespaceComments: true
+ForEachMacros:
+ - foreach
+ - Q_FOREACH
+ - BOOST_FOREACH
+IfMacros:
+ - KJ_IF_MAYBE
+IncludeBlocks: Regroup
+IncludeCategories:
+ - Regex: '^"(llvm|llvm-c|clang|clang-c)/'
+ Priority: 2
+ SortPriority: 0
+ CaseSensitive: false
+ - Regex: '^(<|"(gtest|gmock|isl|json)/)'
+ Priority: 3
+ SortPriority: 0
+ CaseSensitive: false
+ - Regex: '.*'
+ Priority: 1
+ SortPriority: 0
+ CaseSensitive: false
+IncludeIsMainRegex: '(Test)?$'
+IncludeIsMainSourceRegex: ''
+IndentAccessModifiers: false
+IndentCaseBlocks: false
+IndentCaseLabels: false
+IndentExternBlock: AfterExternBlock
+IndentGotoLabels: true
+IndentPPDirectives: None
+IndentRequiresClause: true
+IndentWidth: 4
+IndentWrappedFunctionNames: false
+InsertBraces: false
+InsertTrailingCommas: None
+JavaScriptQuotes: Leave
+JavaScriptWrapImports: true
+KeepEmptyLinesAtTheStartOfBlocks: true
+LambdaBodyIndentation: Signature
+MacroBlockBegin: ''
+MacroBlockEnd: ''
+MaxEmptyLinesToKeep: 1
+NamespaceIndentation: None
+ObjCBinPackProtocolList: Auto
+ObjCBlockIndentWidth: 2
+ObjCBreakBeforeNestedBlockParam: true
+ObjCSpaceAfterProperty: false
+ObjCSpaceBeforeProtocolList: true
+PackConstructorInitializers: BinPack
+PenaltyBreakAssignment: 1000000
+PenaltyBreakBeforeFirstCallParameter: 19
+PenaltyBreakComment: 300
+PenaltyBreakFirstLessLess: 120
+PenaltyBreakOpenParenthesis: 0
+PenaltyBreakString: 1000
+PenaltyBreakTemplateDeclaration: 10
+PenaltyExcessCharacter: 1000000
+PenaltyIndentedWhitespace: 1
+PenaltyReturnTypeOnItsOwnLine: 1000000
+PointerAlignment: Left
+ReferenceAlignment: Left
+PPIndentWidth: -1
+QualifierAlignment: Leave
+ReflowComments: true
+RemoveBracesLLVM: false
+RequiresClausePosition: OwnLine
+SeparateDefinitionBlocks: Leave
+ShortNamespaceLines: 1
+SortIncludes: CaseSensitive
+SpaceAfterCStyleCast: false
+SpaceAfterLogicalNot: false
+SpaceAfterTemplateKeyword: true
+SpaceAroundPointerQualifiers: Default
+SpaceBeforeAssignmentOperators: true
+SpaceBeforeCaseColon: false
+SpaceBeforeCpp11BracedList: false
+SpaceBeforeCtorInitializerColon: true
+SpaceBeforeInheritanceColon: true
+SpaceBeforeParens: ControlStatements
+SpaceBeforeParensOptions:
+ AfterControlStatements: true
+ AfterForeachMacros: true
+ AfterFunctionDefinitionName: false
+ AfterFunctionDeclarationName: false
+ AfterIfMacros: true
+ AfterOverloadedOperator: false
+ AfterRequiresInClause: false
+ AfterRequiresInExpression: false
+ BeforeNonEmptyParentheses: false
+SpaceBeforeRangeBasedForLoopColon: true
+SpaceBeforeSquareBrackets: false
+SpaceInEmptyBlock: false
+SpacesBeforeTrailingComments: 1
+SpacesInAngles: Never
+SpacesInContainerLiterals: true
+SpacesInLineCommentPrefix:
+ Minimum: 1
+ Maximum: -1
+SpacesInSquareBrackets: false
+Standard: Latest
+StatementAttributeLikeMacros:
+ - Q_EMIT
+StatementMacros:
+ - Q_UNUSED
+ - QT_REQUIRE_VERSION
+TabWidth: 4
+UseTab: Never
+WhitespaceSensitiveMacros:
+ - BOOST_PP_STRINGIZE
+ - CF_SWIFT_NAME
+ - NS_SWIFT_NAME
+ - PP_STRINGIZE
+ - STRINGIZE
+...
diff --git a/.clang-tidy b/.clang-tidy
new file mode 100644
index 0000000..2a7bc1b
--- /dev/null
+++ b/.clang-tidy
@@ -0,0 +1,33 @@
+---
+Checks: 'clang-diagnostic-*,clang-analyzer-*,readability*,-readability-use-anyofallof,bugprone*,-bugprone-easily-swappable-parameters,deadcode,cppcoreguidelines*,-cppcoreguidelines-avoid-magic-numbers,-cppcoreguidelines-avoid-do-while,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-owning-memory,-cppcoreguidelines-non-private-member-variables-in-classes,modernize-*,-modernize-pass-by-value,-modernize-use-trailing-return-type,-modernize-avoid-c-arrays,performance*,-cppcoreguidelines-pro-bounds-constant-array-index,-cppcoreguidelines-pro-type-union-access,-clang-diagnostic-unknown-warning-option,-clang-analyzer-valist*'
+WarningsAsErrors: ''
+HeaderFileExtensions:
+ - ''
+ - h
+ - hh
+ - hpp
+ - hxx
+ImplementationFileExtensions:
+ - c
+ - cc
+ - cpp
+ - cxx
+HeaderFilterRegex: ''
+FormatStyle: none
+User: djallen9
+CheckOptions:
+ cert-dcl16-c.NewSuffixes: 'L;LL;LU;LLU'
+ google-readability-namespace-comments.ShortNamespaceLines: '10'
+ cert-err33-c.CheckedFunctions: '::aligned_alloc;::asctime_s;::at_quick_exit;::atexit;::bsearch;::bsearch_s;::btowc;::c16rtomb;::c32rtomb;::calloc;::clock;::cnd_broadcast;::cnd_init;::cnd_signal;::cnd_timedwait;::cnd_wait;::ctime_s;::fclose;::fflush;::fgetc;::fgetpos;::fgets;::fgetwc;::fopen;::fopen_s;::fprintf;::fprintf_s;::fputc;::fputs;::fputwc;::fputws;::fread;::freopen;::freopen_s;::fscanf;::fscanf_s;::fseek;::fsetpos;::ftell;::fwprintf;::fwprintf_s;::fwrite;::fwscanf;::fwscanf_s;::getc;::getchar;::getenv;::getenv_s;::gets_s;::getwc;::getwchar;::gmtime;::gmtime_s;::localtime;::localtime_s;::malloc;::mbrtoc16;::mbrtoc32;::mbsrtowcs;::mbsrtowcs_s;::mbstowcs;::mbstowcs_s;::memchr;::mktime;::mtx_init;::mtx_lock;::mtx_timedlock;::mtx_trylock;::mtx_unlock;::printf_s;::putc;::putwc;::raise;::realloc;::remove;::rename;::scanf;::scanf_s;::setlocale;::setvbuf;::signal;::snprintf;::snprintf_s;::sprintf;::sprintf_s;::sscanf;::sscanf_s;::strchr;::strerror_s;::strftime;::strpbrk;::strrchr;::strstr;::strtod;::strtof;::strtoimax;::strtok;::strtok_s;::strtol;::strtold;::strtoll;::strtoul;::strtoull;::strtoumax;::strxfrm;::swprintf;::swprintf_s;::swscanf;::swscanf_s;::thrd_create;::thrd_detach;::thrd_join;::thrd_sleep;::time;::timespec_get;::tmpfile;::tmpfile_s;::tmpnam;::tmpnam_s;::tss_create;::tss_get;::tss_set;::ungetc;::ungetwc;::vfprintf;::vfprintf_s;::vfscanf;::vfscanf_s;::vfwprintf;::vfwprintf_s;::vfwscanf;::vfwscanf_s;::vprintf_s;::vscanf;::vscanf_s;::vsnprintf;::vsnprintf_s;::vsprintf;::vsprintf_s;::vsscanf;::vsscanf_s;::vswprintf;::vswprintf_s;::vswscanf;::vswscanf_s;::vwprintf_s;::vwscanf;::vwscanf_s;::wcrtomb;::wcschr;::wcsftime;::wcspbrk;::wcsrchr;::wcsrtombs;::wcsrtombs_s;::wcsstr;::wcstod;::wcstof;::wcstoimax;::wcstok;::wcstok_s;::wcstol;::wcstold;::wcstoll;::wcstombs;::wcstombs_s;::wcstoul;::wcstoull;::wcstoumax;::wcsxfrm;::wctob;::wctrans;::wctype;::wmemchr;::wprintf_s;::wscanf;::wscanf_s;'
+ llvm-else-after-return.WarnOnUnfixable: 'false'
+ cert-str34-c.DiagnoseSignedUnsignedCharComparisons: 'false'
+ google-readability-namespace-comments.SpacesBeforeComments: '2'
+ cppcoreguidelines-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic: 'true'
+ google-readability-braces-around-statements.ShortStatementLines: '1'
+ google-readability-function-size.StatementThreshold: '800'
+ llvm-qualified-auto.AddConstToQualified: 'false'
+ llvm-else-after-return.WarnOnConditionVariables: 'false'
+ cert-oop54-cpp.WarnOnlyIfThisHasSuspiciousField: 'false'
+SystemHeaders: false
+...
+
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..4e7bf47
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+build/
+.cache
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..3908a43
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,25 @@
+cmake_minimum_required(VERSION 3.16)
+
+project(getsuyomi VERSION 1.0.0 LANGUAGES CXX)
+
+set(CMAKE_CXX_STANDARD 20)
+set(CMAKE_CXX_STANDARD_REQUIRED ON)
+
+find_package(Qt6 REQUIRED COMPONENTS Widgets)
+qt_standard_project_setup()
+
+set(CXX_CPPCHECK "project=build/compile_commands.json;enable=information;force")
+set(CMAKE_EXPORT_COMPILE_COMMANDS true)
+
+qt_add_executable(getsuyomi
+ # main_window.ui
+ src/main_window.cpp
+ src/main.cpp
+)
+
+target_link_libraries(getsuyomi PRIVATE Qt6::Widgets)
+
+# set_target_properties(getsuyomi PROPERTIES
+# WIN32_EXECUTABLE ON
+# MACOSX_BUNDLE ON
+#)
diff --git a/src/main.cpp b/src/main.cpp
new file mode 100644
index 0000000..bb08972
--- /dev/null
+++ b/src/main.cpp
@@ -0,0 +1,8 @@
+#include "main_window.hpp"
+
+int main(int argc, char* argv[]) {
+ QApplication app{argc, argv};
+ getsuyobi::GetsuyobiApp getsuyobi{};
+
+ return app.exec();
+}
diff --git a/src/main_window.cpp b/src/main_window.cpp
new file mode 100644
index 0000000..796b4fc
--- /dev/null
+++ b/src/main_window.cpp
@@ -0,0 +1,66 @@
+#include "main_window.hpp"
+
+#include <QString>
+
+namespace getsuyobi {
+
+GetsuyobiApp::GetsuyobiApp() : m_getsuyobi{new Getsuyobi()}
+{
+ setCentralWidget(m_getsuyobi);
+ setup();
+}
+
+void GetsuyobiApp::setup()
+{
+ createActions();
+ createMenus();
+
+ QCoreApplication::setApplicationName(AppName);
+ QCoreApplication::setApplicationVersion(AppVersionString);
+ setWindowTitle(AppName);
+
+ show();
+}
+
+void GetsuyobiApp::createActions()
+{
+ m_openAction = new QAction(QIcon::fromTheme(QIcon::ThemeIcon::DocumentOpen), tr("&Open"), this);
+ m_openAction->setShortcuts(QKeySequence::Open);
+ m_openAction->setStatusTip(tr("Open a file"));
+ connect(m_openAction, &QAction::triggered, this, &GetsuyobiApp::openFile);
+
+ m_quitAction = new QAction(QIcon::fromTheme(QIcon::ThemeIcon::ApplicationExit), tr("&Quit"), this);
+ m_quitAction->setShortcuts(QKeySequence::Quit);
+ m_quitAction->setStatusTip(tr("Quit"));
+ connect(m_quitAction, &QAction::triggered, this, &GetsuyobiApp::quit);
+}
+
+void GetsuyobiApp::createMenus()
+{
+ m_fileMenu = menuBar()->addMenu(tr("&File"));
+ m_fileMenu->addAction(m_openAction);
+ m_fileMenu->addAction(m_quitAction);
+}
+
+void GetsuyobiApp::openFile()
+{
+ printf("Open file!\n");
+}
+
+void GetsuyobiApp::quit()
+{
+ printf("Quit!\n");
+ QCoreApplication::quit();
+}
+
+Getsuyobi::Getsuyobi()
+{
+ m_layout = new QVBoxLayout();
+
+ auto* label = new QLabel(AppName);
+ m_layout->addWidget(label);
+
+ setLayout(m_layout);
+}
+
+} // namespace getsuyobi
diff --git a/src/main_window.hpp b/src/main_window.hpp
new file mode 100644
index 0000000..0bd074a
--- /dev/null
+++ b/src/main_window.hpp
@@ -0,0 +1,42 @@
+#include <QtWidgets>
+
+namespace getsuyobi {
+
+constexpr const char* AppName = "GetsuYobi";
+constexpr const char* AppVersionString = "1.0.0";
+
+class Getsuyobi;
+
+class GetsuyobiApp : public QMainWindow {
+ Q_OBJECT
+
+ public:
+ GetsuyobiApp();
+
+ private:
+ void setup();
+ void createActions();
+ void createMenus();
+
+ Getsuyobi* m_getsuyobi;
+
+ QAction* m_openAction;
+ QAction* m_quitAction;
+
+ QMenu* m_fileMenu;
+
+ private slots:
+ void openFile();
+ void quit();
+};
+
+class Getsuyobi : public QWidget {
+ Q_OBJECT
+ public:
+ Getsuyobi();
+
+ private:
+ QLayout* m_layout{nullptr};
+};
+
+} // namespace getsuyobi