From e8f099cace1d77dd9ff12b4231871c6e122a739d Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 10 Oct 2013 19:14:48 +0300 Subject: fix code style. --- src/client.cpp | 1 + src/debug/debug_new.h | 1 + src/eventsmanager.cpp | 5 ++-- src/eventsmanager.h | 7 +++--- src/gui/widgets/browserbox_unittest.cc | 2 +- src/gui/widgets/listbox.cpp | 4 +-- src/gui/widgets/listbox.h | 2 +- src/input/multitouchmanager.cpp | 4 +-- src/input/multitouchmanager.h | 4 +-- src/render/graphics.cpp | 2 +- src/touchmanager.cpp | 45 ++++++++++++++++++++++------------ 11 files changed, 47 insertions(+), 30 deletions(-) diff --git a/src/client.cpp b/src/client.cpp index 39c7beb52..db0a6c2ab 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -294,6 +294,7 @@ Client::Client(const Options &options) : mDesktop(nullptr), mSetupButton(nullptr), mVideoButton(nullptr), + mHelpButton(nullptr), mThemesButton(nullptr), mPerfomanceButton(nullptr), #ifdef ANDROID diff --git a/src/debug/debug_new.h b/src/debug/debug_new.h index 67b588f32..00861f0bf 100644 --- a/src/debug/debug_new.h +++ b/src/debug/debug_new.h @@ -43,6 +43,7 @@ #define M_DEBUG_NEW_H #include +#include /** * @def HAVE_PLACEMENT_DELETE diff --git a/src/eventsmanager.cpp b/src/eventsmanager.cpp index a9e2f4169..4786e4402 100644 --- a/src/eventsmanager.cpp +++ b/src/eventsmanager.cpp @@ -232,8 +232,9 @@ void EventsManager::logEvent(const SDL_Event &event) logger->log("event: SDL_MULTIGESTURE: %u %f,%f (%f,%f) %d,%d", static_cast(gesture.touchId), gesture.dTheta, gesture.dDist, - gesture.x * w, gesture.y * h, (int)gesture.numFingers, - (int)gesture.padding); + gesture.x * w, gesture.y * h, + static_cast(gesture.numFingers), + static_cast(gesture.padding)); break; } case SDL_KEYDOWN: diff --git a/src/eventsmanager.h b/src/eventsmanager.h index 690745ad6..0cf891729 100644 --- a/src/eventsmanager.h +++ b/src/eventsmanager.h @@ -24,7 +24,6 @@ #include "configlistener.h" #include -#include #include @@ -46,14 +45,14 @@ class EventsManager final : public ConfigListener void handleGameEvents(); #ifdef USE_SDL2 - void handleSDL2WindowEvent(const SDL_Event &event); + static void handleSDL2WindowEvent(const SDL_Event &event); #else - void handleActive(const SDL_Event &event); + static void handleActive(const SDL_Event &event); #endif void optionChanged(const std::string &name); - void logEvent(const SDL_Event &event); + static void logEvent(const SDL_Event &event); protected: bool mLogInput; diff --git a/src/gui/widgets/browserbox_unittest.cc b/src/gui/widgets/browserbox_unittest.cc index 1c38d735f..2d45e507f 100644 --- a/src/gui/widgets/browserbox_unittest.cc +++ b/src/gui/widgets/browserbox_unittest.cc @@ -53,7 +53,7 @@ TEST(browserbox, test1) Theme *theme = Theme::instance(); gcn::Widget::setGlobalFont(new SDLFont("/usr/share/fonts/truetype/" "ttf-dejavu/DejaVuSans-Oblique.ttf", 18)); - BrowserBox *box = new BrowserBox(nullptr, BrowserBox::AUTO_WRAP); + BrowserBox *box = new BrowserBox(nullptr, BrowserBox::AUTO_WRAP, ""); box->setWidth(100); std::string row = "test"; box->addRow(row); diff --git a/src/gui/widgets/listbox.cpp b/src/gui/widgets/listbox.cpp index 76eadff0a..b6d31c239 100644 --- a/src/gui/widgets/listbox.cpp +++ b/src/gui/widgets/listbox.cpp @@ -68,7 +68,7 @@ ListBox::ListBox(const Widget2 *const widget, mItemPadding = mSkin->getOption("itemPadding"); } - const gcn::Font *font = getFont(); + const gcn::Font *const font = getFont(); if (font) mRowHeight = font->getHeight() + 2 * mItemPadding; else @@ -258,7 +258,7 @@ void ListBox::mouseReleased(gcn::MouseEvent &event) mPressedIndex = -2; } -void ListBox::mouseReleased1(gcn::MouseEvent &mouseEvent) +void ListBox::mouseReleased1(const gcn::MouseEvent &mouseEvent) { if (mouseEvent.getButton() == gcn::MouseEvent::LEFT) { diff --git a/src/gui/widgets/listbox.h b/src/gui/widgets/listbox.h index 865a67216..fa5906077 100644 --- a/src/gui/widgets/listbox.h +++ b/src/gui/widgets/listbox.h @@ -77,7 +77,7 @@ class ListBox : public gcn::ListBox, void mouseReleased(gcn::MouseEvent &event) override; - void mouseReleased1(gcn::MouseEvent &event); + void mouseReleased1(const gcn::MouseEvent &event); void mouseDragged(gcn::MouseEvent &event) override; diff --git a/src/input/multitouchmanager.cpp b/src/input/multitouchmanager.cpp index 82ccb0b3c..a693e1fd9 100644 --- a/src/input/multitouchmanager.cpp +++ b/src/input/multitouchmanager.cpp @@ -30,8 +30,8 @@ MultiTouchManager multiTouchManager; - -MultiTouchManager::MultiTouchManager() +MultiTouchManager::MultiTouchManager() : + mEvents() { } diff --git a/src/input/multitouchmanager.h b/src/input/multitouchmanager.h index ca4328459..34a536e50 100644 --- a/src/input/multitouchmanager.h +++ b/src/input/multitouchmanager.h @@ -21,12 +21,12 @@ #ifndef INPUT_MULTITOUCHMANAGER_H #define INPUT_MULTITOUCHMANAGER_H -#include - #include #include "localconsts.h" +union SDL_Event; + struct MultiTouchEvent { bool active; diff --git a/src/render/graphics.cpp b/src/render/graphics.cpp index 3cad42a3b..4ea219802 100644 --- a/src/render/graphics.cpp +++ b/src/render/graphics.cpp @@ -93,7 +93,7 @@ Graphics::~Graphics() if (mGLContext) { SDL_GL_DeleteContext(mGLContext); - mGLContext = 0; + mGLContext = nullptr; } #endif #endif diff --git a/src/touchmanager.cpp b/src/touchmanager.cpp index 6471fa27c..bad706867 100644 --- a/src/touchmanager.cpp +++ b/src/touchmanager.cpp @@ -410,7 +410,8 @@ void TouchManager::loadButtons() loadTouchItem(&mButtons[1], "dbutton.xml", "dbutton_image.xml", "2", x, y, sz, sz, RIGHT, "screenActionButton1", ""); loadTouchItem(&mButtons[0], "dbutton.xml", "dbutton_image.xml", - "1", skipWidth, y, sz, sz, RIGHT, "screenActionButton0", ""); + "1", skipWidth, y, sz, sz, RIGHT, + "screenActionButton0", ""); break; } // 2x2 @@ -419,9 +420,11 @@ void TouchManager::loadButtons() loadTouchItem(&mButtons[3], "dbutton.xml", "dbutton_image.xml", "4", x, y, sz, sz, RIGHT, "screenActionButton3", ""); loadTouchItem(&mButtons[2], "dbutton.xml", "dbutton_image.xml", - "3", skipWidth, y, sz, sz, RIGHT, "screenActionButton2", ""); + "3", skipWidth, y, sz, sz, RIGHT, + "screenActionButton2", ""); loadTouchItem(&mButtons[1], "dbutton.xml", "dbutton_image.xml", - "2", x, skipHeight, sz, sz, RIGHT, "screenActionButton1", ""); + "2", x, skipHeight, sz, sz, RIGHT, + "screenActionButton1", ""); loadTouchItem(&mButtons[0], "dbutton.xml", "dbutton_image.xml", "1", skipWidth, skipHeight, sz, sz, RIGHT, "screenActionButton0", ""); @@ -436,11 +439,14 @@ void TouchManager::loadButtons() loadTouchItem(&mButtons[8], "dbutton.xml", "dbutton_image.xml", "9", x, y, sz, sz, RIGHT, "screenActionButton8", ""); loadTouchItem(&mButtons[7], "dbutton.xml", "dbutton_image.xml", - "8", skipWidth, y, sz, sz, RIGHT, "screenActionButton7", ""); + "8", skipWidth, y, sz, sz, RIGHT, + "screenActionButton7", ""); loadTouchItem(&mButtons[6], "dbutton.xml", "dbutton_image.xml", - "7", skipWidth2, y, sz, sz, RIGHT, "screenActionButton6", ""); + "7", skipWidth2, y, sz, sz, RIGHT, + "screenActionButton6", ""); loadTouchItem(&mButtons[5], "dbutton.xml", "dbutton_image.xml", - "6", x, skipHeight, sz, sz, RIGHT, "screenActionButton5", ""); + "6", x, skipHeight, sz, sz, RIGHT, + "screenActionButton5", ""); loadTouchItem(&mButtons[4], "dbutton.xml", "dbutton_image.xml", "5", skipWidth, skipHeight, sz, sz, RIGHT, "screenActionButton4", ""); @@ -448,7 +454,8 @@ void TouchManager::loadButtons() "4", skipWidth2, skipHeight, sz, sz, RIGHT, "screenActionButton3", ""); loadTouchItem(&mButtons[2], "dbutton.xml", "dbutton_image.xml", - "3", x, skipHeight2, sz, sz, RIGHT, "screenActionButton2", ""); + "3", x, skipHeight2, sz, sz, RIGHT, + "screenActionButton2", ""); loadTouchItem(&mButtons[1], "dbutton.xml", "dbutton_image.xml", "2", skipWidth, skipHeight2, sz, sz, RIGHT, "screenActionButton1", ""); @@ -465,13 +472,17 @@ void TouchManager::loadButtons() loadTouchItem(&mButtons[7], "dbutton.xml", "dbutton_image.xml", "8", x, y, sz, sz, RIGHT, "screenActionButton7", ""); loadTouchItem(&mButtons[6], "dbutton.xml", "dbutton_image.xml", - "7", skipWidth, y, sz, sz, RIGHT, "screenActionButton6", ""); + "7", skipWidth, y, sz, sz, RIGHT, + "screenActionButton6", ""); loadTouchItem(&mButtons[5], "dbutton.xml", "dbutton_image.xml", - "6", skipWidth2, y, sz, sz, RIGHT, "screenActionButton5", ""); + "6", skipWidth2, y, sz, sz, RIGHT, + "screenActionButton5", ""); loadTouchItem(&mButtons[4], "dbutton.xml", "dbutton_image.xml", - "5", skipWidth3, y, sz, sz, RIGHT, "screenActionButton4", ""); + "5", skipWidth3, y, sz, sz, RIGHT, + "screenActionButton4", ""); loadTouchItem(&mButtons[3], "dbutton.xml", "dbutton_image.xml", - "4", x, skipHeight, sz, sz, RIGHT, "screenActionButton3", ""); + "4", x, skipHeight, sz, sz, RIGHT, + "screenActionButton3", ""); loadTouchItem(&mButtons[2], "dbutton.xml", "dbutton_image.xml", "3", skipWidth, skipHeight, sz, sz, RIGHT, "screenActionButton2", ""); @@ -496,11 +507,14 @@ void TouchManager::loadButtons() "dbutton_image.xml", "11", skipWidth, y, sz, sz, RIGHT, "screenActionButton10", ""); loadTouchItem(&mButtons[9], "dbutton.xml", "dbutton_image.xml", - "10", skipWidth2, y, sz, sz, RIGHT, "screenActionButton9", ""); + "10", skipWidth2, y, sz, sz, RIGHT, + "screenActionButton9", ""); loadTouchItem(&mButtons[8], "dbutton.xml", "dbutton_image.xml", - "9", skipWidth3, y, sz, sz, RIGHT, "screenActionButton8", ""); + "9", skipWidth3, y, sz, sz, RIGHT, + "screenActionButton8", ""); loadTouchItem(&mButtons[7], "dbutton.xml", "dbutton_image.xml", - "8", x, skipHeight, sz, sz, RIGHT, "screenActionButton7", ""); + "8", x, skipHeight, sz, sz, RIGHT, + "screenActionButton7", ""); loadTouchItem(&mButtons[6], "dbutton.xml", "dbutton_image.xml", "7", skipWidth, skipHeight, sz, sz, RIGHT, "screenActionButton6", ""); @@ -511,7 +525,8 @@ void TouchManager::loadButtons() "5", skipWidth3, skipHeight, sz, sz, RIGHT, "screenActionButton4", ""); loadTouchItem(&mButtons[3], "dbutton.xml", "dbutton_image.xml", - "4", x, skipHeight2, sz, sz, RIGHT, "screenActionButton3", ""); + "4", x, skipHeight2, sz, sz, RIGHT, + "screenActionButton3", ""); loadTouchItem(&mButtons[2], "dbutton.xml", "dbutton_image.xml", "3", skipWidth, skipHeight2, sz, sz, RIGHT, "screenActionButton2", ""); -- cgit v1.2.3-60-g2f50