Skip to content

Commit

Permalink
adjust whitespace (git blame -w to ignore)
Browse files Browse the repository at this point in the history
  • Loading branch information
vgmoose committed Nov 26, 2018
1 parent a2d1f99 commit dccd49a
Show file tree
Hide file tree
Showing 25 changed files with 259 additions and 261 deletions.
1 change: 1 addition & 0 deletions .clang-format
Expand Up @@ -3,5 +3,6 @@ BasedOnStyle: WebKit
BreakBeforeBraces: Allman
AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: true
AlignTrailingComments: true
TabWidth: 4
UseTab: Always
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -72,6 +72,6 @@ This software is licensed under the GPLv3.
#### Contributing
It's not required, but running a clang-format before making a PR helps to clean up styling issues:
```
find . -name "*.cpp" -not -path "./libs/*" -exec clang-format -i {} \;
find . \( -name "*.cpp" -or -name "*.hpp" \) -not -path "./libs/*" -exec clang-format -i {} \;
```

2 changes: 1 addition & 1 deletion console/Console.cpp
Expand Up @@ -254,7 +254,7 @@ char font[128][8] = {
{ 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00 }, // U+007C (|)
{ 0x07, 0x0C, 0x0C, 0x38, 0x0C, 0x0C, 0x07, 0x00 }, // U+007D (})
{ 0x6E, 0x3B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, // U+007E (~)
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } // U+007F
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } // U+007F
};

char* fontLookup(char c)
Expand Down
1 change: 0 additions & 1 deletion console/Console.hpp
Expand Up @@ -14,7 +14,6 @@ class Console
void update();

private:

// SDL graphics variables
SDL_Surface* window_surface;
SDL_Window* window;
Expand Down
47 changes: 24 additions & 23 deletions console/Input.hpp
@@ -1,31 +1,32 @@
// clang-format off
// "PAD" controls (unique to us)
#define BUTTON_LEFT 0b00000001
#define BUTTON_RIGHT 0b00000010
#define BUTTON_UP 0b00000100
#define BUTTON_DOWN 0b00001000
#define BUTTON_LEFT 0b00000001
#define BUTTON_RIGHT 0b00000010
#define BUTTON_UP 0b00000100
#define BUTTON_DOWN 0b00001000

#define BUTTON_X 0b00010000
#define BUTTON_MINUS 0b00100000
#define BUTTON_X 0b00010000
#define BUTTON_MINUS 0b00100000

#define BUTTON_A 0b01000000
#define BUTTON_B 0b10000000
#define BUTTON_A 0b01000000
#define BUTTON_B 0b10000000

// switch controls
#define JOYPAD_LEFT 0x1000
#define JOYPAD_DOWN 0x8000
#define JOYPAD_RIGHT 0x4000
#define JOYPAD_UP 0x2000
#define JOYPAD_START 0x0400
#define JOYPAD_SELECT 0x0800
#define JOYPAD_X 0x0004
#define JOYPAD_Y 0x0008
#define JOYPAD_B 0x0002
#define JOYPAD_A 0x0001
#define JOYPAD_R 0x0080
#define JOYPAD_L 0x0040
#define JOYPAD_R2 0x0200
#define JOYPAD_L2 0x0100

#define JOYPAD_LEFT 0x1000
#define JOYPAD_DOWN 0x8000
#define JOYPAD_RIGHT 0x4000
#define JOYPAD_UP 0x2000
#define JOYPAD_START 0x0400
#define JOYPAD_SELECT 0x0800
#define JOYPAD_X 0x0004
#define JOYPAD_Y 0x0008
#define JOYPAD_B 0x0002
#define JOYPAD_A 0x0001
#define JOYPAD_R 0x0080
#define JOYPAD_L 0x0040
#define JOYPAD_R2 0x0200
#define JOYPAD_L2 0x0100
// clang-format on

#include <SDL2/SDL.h>

Expand Down
24 changes: 12 additions & 12 deletions console/Menu.hpp
Expand Up @@ -2,7 +2,7 @@
#include "Console.hpp"

#define SPLASH 1
#define CATEGORIES N/A
#define CATEGORIES N / A
#define LIST_MENU 2
#define INSTALL_SCREEN 3

Expand All @@ -19,17 +19,17 @@ class Menu
{
public:
Menu(Console* console, Get* get);
void display(); // display the menu as it's set up
void moveCursor(int diff); // move the cursor position up (-1) or down (1)
void advanceScreen(bool advance); // change the active screen to the next one
int screen; // current screen
int position; // the position of the cursor along the current menu
void display(); // display the menu as it's set up
void moveCursor(int diff); // move the cursor position up (-1) or down (1)
void advanceScreen(bool advance); // change the active screen to the next one
int screen; // current screen
int position; // the position of the cursor along the current menu

private:
int offset; // the offset of "scroll" along the current menu page
Get* get; // list of packages to draw
int offset; // the offset of "scroll" along the current menu page
Get* get; // list of packages to draw

const char* repoUrl;
Console* console; // link to the console

Console* console; // link to the console
};
20 changes: 10 additions & 10 deletions gui/AboutScreen.hpp
@@ -1,23 +1,23 @@
#ifndef ABOUTSCREEN_H_
#define ABOUTSCREEN_H_

#include "TextElement.hpp"
#include "../libs/get/src/Get.hpp"
#include "ImageElement.hpp"
#include "ListElement.hpp"
#include "../libs/get/src/Get.hpp"
#include "TextElement.hpp"

class AboutScreen : public Element
{
public:
AboutScreen(Get* get);
Get* get = NULL;
void render(Element* parent);
AboutScreen(Get* get);
Get* get = NULL;
void render(Element* parent);

// button bindings
void back();
void removeEmptyFolders();
void wipeCache();
void launchFeedback();
// button bindings
void back();
void removeEmptyFolders();
void wipeCache();
void launchFeedback();
};

#endif
8 changes: 4 additions & 4 deletions gui/AppCard.hpp
@@ -1,15 +1,15 @@
#include "TextElement.hpp"
#include "ImageElement.hpp"
#include "../libs/get/src/Package.hpp"
#include "ImageElement.hpp"
#include "TextElement.hpp"

class AppCard: public Element
class AppCard : public Element
{
public:
AppCard(Package* package);
void update();
bool process(InputEvents* event);
void render(Element* parent);
void displaySubscreen();
void displaySubscreen();

Package* package;

Expand Down
45 changes: 22 additions & 23 deletions gui/AppDetails.hpp
@@ -1,12 +1,12 @@
#ifndef APPDETAILS_H_
#define APPDETAILS_H_

#include "TextElement.hpp"
#include "../libs/get/src/Get.hpp"
#include "../libs/get/src/Package.hpp"
#include "ImageElement.hpp"
#include "ProgressBar.hpp"
#include "ListElement.hpp"
#include "../libs/get/src/Package.hpp"
#include "../libs/get/src/Get.hpp"
#include "ProgressBar.hpp"
#include "TextElement.hpp"

class AppList;

Expand All @@ -16,35 +16,34 @@ class AppDetails : public Element
AppDetails(Package* package, AppList* appList);
bool process(InputEvents* event);
void render(Element* parent);
bool launchFile(char* path, char* context);
bool launchFile(char* path, char* context);

bool operating = false;
Package* package;
Get* get;
AppList* appList;
Get* get;
AppList* appList;
ProgressBar* pbar = NULL;
int highlighted = -1;
bool canLaunch = true;
bool canLaunch = true;

// the callback method to update the currently displayed pop up (and variables it needs)
static int updateCurrentlyDisplayedPopup(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow);

void proceed();
void back();
void launch();

void moreByAuthor();
void leaveFeedback();

void preInstallHook();
void postInstallHook();
static int updateCurrentlyDisplayedPopup(void* clientp, double dltotal, double dlnow, double ultotal, double ulnow);

void proceed();
void back();
void launch();

void moreByAuthor();
void leaveFeedback();

void preInstallHook();
void postInstallHook();
};

class AppDetailsContent : public ListElement
{
bool process(InputEvents* event);
void render(Element* parent);
bool process(InputEvents* event);
void render(Element* parent);
};

#endif
4 changes: 2 additions & 2 deletions gui/AppList.cpp
Expand Up @@ -6,7 +6,7 @@
#include <SDL2/SDL2_gfxPrimitives.h>
#include <algorithm>
#include <cstdlib> // std::rand, std::srand
#include <ctime> // std::time
#include <ctime> // std::time

AppList::AppList(Get* get, Sidebar* sidebar)
{
Expand Down Expand Up @@ -89,7 +89,7 @@ bool AppList::process(InputEvents* event)
{
this->touchMode = false;
this->highlighted = 0;
this->y = 0; // reset scroll TODO: maintain scroll when switching back from touch mode
this->y = 0; // reset scroll TODO: maintain scroll when switching back from touch mode
event->keyCode = -1; // we already have the cursor where we want it, no further updates
ret |= true;
}
Expand Down
34 changes: 16 additions & 18 deletions gui/AppList.hpp
@@ -1,19 +1,18 @@
#include "TextElement.hpp"
#include "ImageElement.hpp"
#include "../libs/get/src/Get.hpp"
#include "AppDetails.hpp"
#include "Sidebar.hpp"
#include "ListElement.hpp"
#include "ImageElement.hpp"
#include "Keyboard.hpp"
#include "../libs/get/src/Get.hpp"
#include "ListElement.hpp"
#include "Sidebar.hpp"
#include "TextElement.hpp"

#define TOTAL_SORTS 5 // alphabetical (with updates at top), downloads, last updated, size, shuffled
#define TOTAL_SORTS 5 // alphabetical (with updates at top), downloads, last updated, size, shuffled
#define RECENT 0
#define POPULARITY 1
#define ALPHABETICAL 2
#define SIZE 3
#define RANDOM 4


class AppList : public ListElement
{
public:
Expand All @@ -24,25 +23,24 @@ class AppList : public ListElement

Get* get = NULL;
Sidebar* sidebar = NULL;
Keyboard* keyboard = NULL;
Keyboard* keyboard = NULL;

void toggleKeyboard();
void cycleSort();
void reorient();
void toggleAudio();
void toggleKeyboard();
void cycleSort();
void reorient();
void toggleAudio();

const char* applySortOrder(std::vector<Package*>* packages);
const char* applySortOrder(std::vector<Package*>* packages);

bool touchMode = true;

// the total number of apps displayed in this list
int totalCount = 0;

// default number of items per row TODO: save this value as config
int R = 3;

int sortMode = RECENT;
// default number of items per row TODO: save this value as config
int R = 3;

void launchSettings();
int sortMode = RECENT;

void launchSettings();
};
23 changes: 11 additions & 12 deletions gui/Button.hpp
@@ -1,22 +1,21 @@
#include "TextElement.hpp"
#include "ImageElement.hpp"
#include "TextElement.hpp"

class Button : public Element
{
public:
Button(const char* text, int button, bool dark = false, int size = 20, int width = 0);
bool process(InputEvents* event);
void render(Element* parent);
void position(int x, int y);

// original x and y coordinates of this button before add in the parent
int ox = 0, oy = 0;
Button(const char* text, int button, bool dark = false, int size = 20, int width = 0);
bool process(InputEvents* event);
void render(Element* parent);
void position(int x, int y);

// the physical button to activate this button
int physical = -1;
// original x and y coordinates of this button before add in the parent
int ox = 0, oy = 0;

bool dark = false;
// the physical button to activate this button
int physical = -1;

bool dark = false;

// TOOD: callback -> part of Element?
// TOOD: callback -> part of Element?
};

0 comments on commit dccd49a

Please sign in to comment.