Skip to content

Commit

Permalink
Use Mozilla style break brace
Browse files Browse the repository at this point in the history
  • Loading branch information
bitigchi authored and humdingerb committed Apr 1, 2024
1 parent cf71b3c commit 6c14d41
Show file tree
Hide file tree
Showing 21 changed files with 52 additions and 38 deletions.
2 changes: 1 addition & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ BreakAfterJavaFieldAnnotations: false
BreakArrays: true
BreakBeforeBinaryOperators: None
BreakBeforeConceptDeclarations: Always
BreakBeforeBraces: Stroustrup
BreakBeforeBraces: Mozilla
BreakBeforeInlineASMColon: OnlyMultiline
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeColon
Expand Down
6 changes: 4 additions & 2 deletions src/Hashtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
#include <SupportKit.h>

// Hashtable that can has only one instance of a key
struct _hash_node {
struct _hash_node
{
int32 key;
void* item;
struct _hash_node* next;
Expand All @@ -37,7 +38,8 @@ struct _hash_node {
}
};

class Hashtable {
class Hashtable
{
protected:
int32 array_size;
int32 items;
Expand Down
12 changes: 4 additions & 8 deletions src/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,7 @@ MainWindow::Minimize(bool minimize)
// Gotta get rid of the refresh thread
delete fRefreshRunner;
fRefreshRunner = NULL;
}
else if ((!minimized) && (fRefreshRunner == NULL)) {
} else if ((!minimized) && (fRefreshRunner == NULL)) {
BMessage refreshMessage(REFRESH_TEAMS);
fRefreshRunner = new BMessageRunner(BMessenger(this), &refreshMessage, fRefreshRate);
}
Expand Down Expand Up @@ -340,8 +339,7 @@ MainWindow::UpdateTeams()
teamView->AddRow(thread_item, team_item);
if (teinf.team != 1 || strncmp(thinf.name, "idle thread ", 12) != 0) {
team_item->CPU_diff += thread_item->CPU_diff;
}
else
} else
idle_CPU_diff += thread_item->CPU_diff;
}
}
Expand All @@ -366,8 +364,7 @@ MainWindow::UpdateTeams()
}
if (teinf.team != 1 || strncmp(thinf.name, "idle thread ", 12) != 0) {
team_item->CPU_diff += thread_item->CPU_diff;
}
else
} else
idle_CPU_diff += thread_item->CPU_diff;
}
}
Expand Down Expand Up @@ -441,8 +438,7 @@ postlistproc(BRow* item, void* _wnd)
wnd->teamView->UpdateRow(item);
}
((TeamItem*)item)->changed = 0;
}
else {
} else {
float CPU = ((float)((ThreadItem*)item)->CPU_diff) / wnd->total_CPU_diff;
if ((CPU != ((ThreadItem*)item)->CPU)) {
CPU = (CPU > 1.0 ? 1.0 : CPU < 0.0 ? 0.0 : CPU);
Expand Down
3 changes: 2 additions & 1 deletion src/MainWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ postlistproc(BRow*, void*);
static const BString ProjectWebsite =
"https://github.com/HaikuArchives/Slayer/blob/master/DOCS.txt";

class MainWindow : public BWindow {
class MainWindow : public BWindow
{
public:
// true if window minimized
bool minimized;
Expand Down
3 changes: 2 additions & 1 deletion src/MainWindowDefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ Views in MainWindow:


// Message constants:
enum {
enum
{
IE_MAINWINDOW_MAINMENU_FILE_QUIT = 0x6L,
IE_MAINWINDOW_MAINMENU_FILE_DOCS__ = 0x7L,
IE_MAINWINDOW_MAINMENU_ACTION_KILL = 0x149L,
Expand Down
3 changes: 1 addition & 2 deletions src/MiniSlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@ MiniSlayer::MouseDown(BPoint point)
if (slayer->mainWindow->minimized)
slayer->mainWindow->Minimize(false);
slayer->mainWindow->Unlock();
}
else {
} else {
if (slayer->mainWindow->Lock()) {
uint32 saved_flags = slayer->mainWindow->Flags();

Expand Down
3 changes: 2 additions & 1 deletion src/MiniSlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@

class _EXPORT MiniSlayer;

class MiniSlayer : public BView {
class MiniSlayer : public BView
{
BBitmap* miniIcon;
const char* signature; // the loaded apps signature (should be equal to
// slayer_signature usually)
Expand Down
13 changes: 10 additions & 3 deletions src/Options.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,23 @@
#include <InterfaceKit.h>
#include <SupportKit.h>

struct Options {
struct Options
{
int32 refresh;

enum workspace_type { current_workspace, all_workspaces, saved_workspace } workspace_activation;
enum workspace_type
{
current_workspace,
all_workspaces,
saved_workspace
} workspace_activation;

int32 workspaces;
bool wind_minimized;
BRect wind_rect;

enum {
enum
{
id_col = 0x1,
priority_col = 0x2,
state_col = 0x4,
Expand Down
3 changes: 2 additions & 1 deletion src/PositiveIntegerColumn.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

#include <ColumnTypes.h>

class PositiveIntegerColumn : public BIntegerColumn {
class PositiveIntegerColumn : public BIntegerColumn
{
public:
PositiveIntegerColumn(
const char* title, float width, float minWidth, float maxWidth,
Expand Down
3 changes: 2 additions & 1 deletion src/PriorityMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ PriorityMenu::Update()
}
}

typedef struct {
typedef struct
{
const char* name;
long priority;
} PriorityRec;
Expand Down
3 changes: 2 additions & 1 deletion src/PriorityMenu.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@

#include "TeamListView.h"

class PriorityMenu : public BMenu {
class PriorityMenu : public BMenu
{
public:
PriorityMenu(TeamListView* teamListView);

Expand Down
3 changes: 2 additions & 1 deletion src/SettingsWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
#include <DecimalSpinner.h>
#include <InterfaceKit.h>

class SettingsWindow : public BWindow {
class SettingsWindow : public BWindow
{
BDecimalSpinner* refresh;

BRadioButton *current_workspace, *all_workspaces, *saved_workspace;
Expand Down
3 changes: 2 additions & 1 deletion src/SettingsWindowDefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ Views in SettingsWindow:


// Message constants:
enum {
enum
{
IE_SETTINGSWINDOW_SETTINGSSAVEWORKSPACE = 0x5L,
IE_SETTINGSWINDOW_SETTINGSREFRESH = 0xAL,
IE_SETTINGSWINDOW_SETTINGSREVERT = 0x63L,
Expand Down
3 changes: 2 additions & 1 deletion src/SizeColumn.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

#include <ColumnTypes.h>

class SizeColumn : public BSizeColumn {
class SizeColumn : public BSizeColumn
{
public:
SizeColumn(
const char* title, float width, float minWidth, float maxWidth,
Expand Down
3 changes: 1 addition & 2 deletions src/SlayerApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ SlayerApp::SlayerApp(bool dock) : BApplication(slayer_signature)
if (!dock) {
options.Load();
new MainWindow;
}
else {
} else {
MiniSlayer* replicant = new MiniSlayer();
BMessage archiveMsg(B_ARCHIVED_OBJECT);
replicant->Archive(&archiveMsg);
Expand Down
6 changes: 4 additions & 2 deletions src/SlayerApp.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@

#define SLAYER_VERSION "v1.0"

class SlayerOpt {
class SlayerOpt
{
public:
Options options;
BWindow* FindWindow(const char* name);
Expand All @@ -33,7 +34,8 @@ class SlayerOpt {
bool docked;
};

class SlayerApp : public BApplication, public SlayerOpt {
class SlayerApp : public BApplication, public SlayerOpt
{
public:
SlayerApp(bool dock = false);
virtual ~SlayerApp();
Expand Down
3 changes: 1 addition & 2 deletions src/TeamItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ TeamItem::TeamItem(team_info* info) : BRow()
for (name = tmp = args; *tmp != 0; tmp++)
if (*tmp == '/')
name = tmp + 1;
}
else
} else
args[0] = 0;

int32 i = 0;
Expand Down
3 changes: 2 additions & 1 deletion src/TeamItem.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
#include "miscSlayer.h"
#include <stdio.h>

class TeamItem : public BRow {
class TeamItem : public BRow
{
public:
int32 refreshed;
int32 changed;
Expand Down
3 changes: 2 additions & 1 deletion src/TeamListView.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
#define SET_PRIORITY 'pset'
#define REFRESH_TEAMS 'rfsh'

class TeamListView : public BColumnListView {
class TeamListView : public BColumnListView
{
public:
static const int expander_ndx = 0, icon_ndx = 1, name_ndx = 2, id_ndx = 3, priority_ndx = 4,
state_ndx = 5, areas_ndx = 6, CPU_ndx = 7;
Expand Down
3 changes: 2 additions & 1 deletion src/ThreadItem.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
#include <stdio.h>
#include <string.h>

class ThreadItem : public BRow {
class ThreadItem : public BRow
{
public:
int32 refreshed;
int32 changed;
Expand Down
6 changes: 2 additions & 4 deletions src/miscSlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ get_app_info(team_id team, BBitmap** a_icon, char** name, char** fullName)
kernelPath.Append(systemInfo.kernel_name);

get_ref_for_path(kernelPath.Path(), &appInfo.ref);
}
else
} else
BPrivate::get_app_ref(team, &appInfo.ref);
}

Expand All @@ -58,8 +57,7 @@ get_app_info(team_id team, BBitmap** a_icon, char** name, char** fullName)
if (status != B_OK) {
delete icon;
icon = NULL;
}
else {
} else {
*name = strdup(appInfo.ref.name);
BPath appFullName(&appInfo.ref);
if (appFullName.InitCheck() == B_OK) {
Expand Down

0 comments on commit 6c14d41

Please sign in to comment.