Skip to content

Commit f9ee794

Browse files
committed
Apply clang-format using llvm style to all source files
- Format all C/C++ source files using clang-format with llvm style - Exclude app/assets/images/ and platforms/tab5/components/ directories - Ensure code formatting matches CI check configuration
1 parent 10993f0 commit f9ee794

180 files changed

Lines changed: 19086 additions & 18229 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@
33
build
44
dependencies
55
.DS_Store
6+
vcpkg/
7+
scripts/

app/app.cpp

Lines changed: 31 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
* SPDX-License-Identifier: MIT
55
*/
66
#include "app.h"
7-
#include "hal/hal.h"
87
#include "apps/app_installer.h"
8+
#include "hal/hal.h"
99
#include <mooncake.h>
1010
#include <mooncake_log.h>
1111
#include <string>
@@ -19,57 +19,51 @@ using namespace mooncake;
1919

2020
static const std::string _tag = "app";
2121

22-
void app::Init(InitCallback_t callback)
23-
{
24-
mclog::tagInfo(_tag, "init");
22+
void app::Init(InitCallback_t callback) {
23+
mclog::tagInfo(_tag, "init");
2524

26-
mclog::tagInfo(_tag, "hal injection");
27-
if (callback.onHalInjection) {
28-
callback.onHalInjection();
29-
}
25+
mclog::tagInfo(_tag, "hal injection");
26+
if (callback.onHalInjection) {
27+
callback.onHalInjection();
28+
}
3029

31-
GetMooncake();
30+
GetMooncake();
3231

33-
on_startup_anim();
34-
on_install_apps();
32+
on_startup_anim();
33+
on_install_apps();
3534
}
3635

37-
void app::Update()
38-
{
39-
GetMooncake().update();
36+
void app::Update() {
37+
GetMooncake().update();
4038

4139
#if defined(PLATFORM_BUILD_DESKTOP)
42-
// Handle SDL events on desktop platform
43-
SDL_Event event;
44-
while (SDL_PollEvent(&event)) {
45-
// SDL events are handled by LVGL SDL driver automatically
46-
// We just need to poll them
47-
if (event.type == SDL_QUIT) {
48-
// Handle window close event if needed
49-
}
40+
// Handle SDL events on desktop platform
41+
SDL_Event event;
42+
while (SDL_PollEvent(&event)) {
43+
// SDL events are handled by LVGL SDL driver automatically
44+
// We just need to poll them
45+
if (event.type == SDL_QUIT) {
46+
// Handle window close event if needed
5047
}
51-
48+
}
49+
5250
#if defined(_WIN32) || defined(WIN32)
53-
// Windows-specific: Add small delay to prevent high CPU usage
54-
// LVGL timer handler runs in separate thread on Windows
55-
SDL_Delay(5);
51+
// Windows-specific: Add small delay to prevent high CPU usage
52+
// LVGL timer handler runs in separate thread on Windows
53+
SDL_Delay(5);
5654
#endif
5755
#endif
5856

5957
#if defined(__APPLE__) && defined(__MACH__)
60-
// 'nextEventMatchingMask should only be called from the Main Thread!'
61-
auto time_till_next = lv_timer_handler();
62-
std::this_thread::sleep_for(std::chrono::milliseconds(time_till_next));
58+
// 'nextEventMatchingMask should only be called from the Main Thread!'
59+
auto time_till_next = lv_timer_handler();
60+
std::this_thread::sleep_for(std::chrono::milliseconds(time_till_next));
6361
#endif
6462
}
6563

66-
bool app::IsDone()
67-
{
68-
return false;
69-
}
64+
bool app::IsDone() { return false; }
7065

71-
void app::Destroy()
72-
{
73-
DestroyMooncake();
74-
hal::Destroy();
66+
void app::Destroy() {
67+
DestroyMooncake();
68+
hal::Destroy();
7569
}

app/app.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
* SPDX-License-Identifier: MIT
55
*/
66
#pragma once
7-
#include <mooncake.h>
87
#include <functional>
8+
#include <mooncake.h>
99

1010
/**
1111
* @brief Application layer
@@ -14,7 +14,7 @@
1414
namespace app {
1515

1616
struct InitCallback_t {
17-
std::function<void()> onHalInjection = nullptr;
17+
std::function<void()> onHalInjection = nullptr;
1818
};
1919

2020
/**
@@ -44,4 +44,4 @@ bool IsDone();
4444
*/
4545
void Destroy();
4646

47-
} // namespace app
47+
} // namespace app

app/apps/app_installer.h

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,38 +4,38 @@
44
* SPDX-License-Identifier: MIT
55
*/
66
#pragma once
7-
#include <mooncake.h>
8-
#include <memory>
9-
#include <hal/hal.h>
10-
#include "app_template/app_template.h"
117
#include "app_launcher/app_launcher.h"
128
#include "app_startup_anim/app_startup_anim.h"
9+
#include "app_template/app_template.h"
10+
#include <hal/hal.h>
11+
#include <memory>
12+
#include <mooncake.h>
1313
/* Header files locator (Don't remove) */
1414

1515
// Start boot anim app and wait for it to finish
16-
inline void on_startup_anim()
17-
{
18-
auto app_id = mooncake::GetMooncake().installApp(std::make_unique<AppStartupAnim>());
19-
mooncake::GetMooncake().openApp(app_id);
20-
while (1) {
21-
mooncake::GetMooncake().update();
22-
if (mooncake::GetMooncake().getAppCurrentState(app_id) == mooncake::AppAbility::StateSleeping) {
23-
break;
24-
}
25-
GetHAL()->delay(1);
16+
inline void on_startup_anim() {
17+
auto app_id =
18+
mooncake::GetMooncake().installApp(std::make_unique<AppStartupAnim>());
19+
mooncake::GetMooncake().openApp(app_id);
20+
while (1) {
21+
mooncake::GetMooncake().update();
22+
if (mooncake::GetMooncake().getAppCurrentState(app_id) ==
23+
mooncake::AppAbility::StateSleeping) {
24+
break;
2625
}
27-
mooncake::GetMooncake().uninstallApp(app_id);
26+
GetHAL()->delay(1);
27+
}
28+
mooncake::GetMooncake().uninstallApp(app_id);
2829
}
2930

3031
/**
3132
* @brief App 安装回调
3233
*
3334
* @param mooncake
3435
*/
35-
inline void on_install_apps()
36-
{
37-
// 安装 App
38-
// mooncake::GetMooncake().installApp(std::make_unique<AppTemplate>());
39-
mooncake::GetMooncake().installApp(std::make_unique<AppLauncher>());
40-
/* Install app locator (Don't remove) */
36+
inline void on_install_apps() {
37+
// 安装 App
38+
// mooncake::GetMooncake().installApp(std::make_unique<AppTemplate>());
39+
mooncake::GetMooncake().installApp(std::make_unique<AppLauncher>());
40+
/* Install app locator (Don't remove) */
4141
}

app/apps/app_launcher/app_launcher.cpp

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,42 +4,33 @@
44
* SPDX-License-Identifier: MIT
55
*/
66
#include "app_launcher.h"
7+
#include <assets/assets.h>
78
#include <hal/hal.h>
89
#include <mooncake.h>
910
#include <mooncake_log.h>
1011
#include <smooth_lvgl.h>
11-
#include <assets/assets.h>
1212

1313
using namespace mooncake;
1414

15-
AppLauncher::AppLauncher()
16-
{
17-
setAppInfo().name = "AppLauncher";
18-
}
15+
AppLauncher::AppLauncher() { setAppInfo().name = "AppLauncher"; }
1916

20-
void AppLauncher::onCreate()
21-
{
22-
mclog::tagInfo(getAppInfo().name, "on create");
17+
void AppLauncher::onCreate() {
18+
mclog::tagInfo(getAppInfo().name, "on create");
2319

24-
open();
20+
open();
2521
}
2622

27-
void AppLauncher::onOpen()
28-
{
29-
mclog::tagInfo(getAppInfo().name, "on open");
23+
void AppLauncher::onOpen() {
24+
mclog::tagInfo(getAppInfo().name, "on open");
3025

31-
_view = std::make_unique<launcher_view::LauncherView>();
32-
_view->init();
26+
_view = std::make_unique<launcher_view::LauncherView>();
27+
_view->init();
3328
}
3429

35-
void AppLauncher::onRunning()
36-
{
37-
_view->update();
38-
}
30+
void AppLauncher::onRunning() { _view->update(); }
3931

40-
void AppLauncher::onClose()
41-
{
42-
mclog::tagInfo(getAppInfo().name, "on close");
32+
void AppLauncher::onClose() {
33+
mclog::tagInfo(getAppInfo().name, "on close");
4334

44-
_view.reset();
35+
_view.reset();
4536
}

app/apps/app_launcher/app_launcher.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,23 @@
55
*/
66
#pragma once
77
#include "view/view.h"
8-
#include <mooncake.h>
98
#include <memory>
9+
#include <mooncake.h>
1010

1111
/**
1212
* @brief 派生 App
1313
*
1414
*/
1515
class AppLauncher : public mooncake::AppAbility {
1616
public:
17-
AppLauncher();
17+
AppLauncher();
1818

19-
// 重写生命周期回调
20-
void onCreate() override;
21-
void onOpen() override;
22-
void onRunning() override;
23-
void onClose() override;
19+
// 重写生命周期回调
20+
void onCreate() override;
21+
void onOpen() override;
22+
void onRunning() override;
23+
void onClose() override;
2424

2525
private:
26-
std::unique_ptr<launcher_view::LauncherView> _view;
26+
std::unique_ptr<launcher_view::LauncherView> _view;
2727
};

0 commit comments

Comments
 (0)