actions: change naming convention to camelCase

This commit is contained in:
Andrzej Rybczak
2012-10-06 18:02:31 +02:00
parent ca24c5be5b
commit 6709219aac
10 changed files with 361 additions and 355 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -98,7 +98,7 @@ Action *parseActionLine(const std::string &line, F error)
size_t i = 0; size_t i = 0;
for (; i < line.size() && !isspace(line[i]); ++i) { } for (; i < line.size() && !isspace(line[i]); ++i) { }
if (i == line.size()) // only action name if (i == line.size()) // only action name
result = Action::Get(line); result = Action::get(line);
else // there is something else else // there is something else
{ {
std::string action_name = line.substr(0, i); std::string action_name = line.substr(0, i);
@@ -141,7 +141,7 @@ Action *parseActionLine(const std::string &line, F error)
{ {
// require that given action is runnable // require that given action is runnable
std::string arg = getEnclosedString(line, '"', '"', 0); std::string arg = getEnclosedString(line, '"', '"', 0);
Action *action = Action::Get(arg); Action *action = Action::get(arg);
if (action) if (action)
result = new RequireRunnable(action); result = new RequireRunnable(action);
else else

View File

@@ -74,7 +74,7 @@ struct Binding
{ {
typedef std::vector<Action *> ActionChain; typedef std::vector<Action *> ActionChain;
Binding(ActionType at) : m_is_single(true), m_action(Action::Get(at)) { } Binding(ActionType at) : m_is_single(true), m_action(Action::get(at)) { }
Binding(const ActionChain &actions) { Binding(const ActionChain &actions) {
assert(actions.size() > 0); assert(actions.size() > 0);
if (actions.size() == 1) { if (actions.size() == 1) {
@@ -90,10 +90,10 @@ struct Binding
bool result = false; bool result = false;
if (m_is_single) { if (m_is_single) {
assert(m_action); assert(m_action);
result = m_action->Execute(); result = m_action->execute();
} else { } else {
for (auto it = m_chain->begin(); it != m_chain->end(); ++it) for (auto it = m_chain->begin(); it != m_chain->end(); ++it)
if (!(*it)->Execute()) if (!(*it)->execute())
break; break;
result = true; result = true;
} }

View File

@@ -121,7 +121,7 @@ void ParseArgv(int argc, char **argv)
exit(0); exit(0);
} }
if (!Action::ConnectToMPD()) if (!Action::connectToMPD())
exit(1); exit(1);
if (!strcmp(argv[i], "-s") || !strcmp(argv[i], "--screen")) if (!strcmp(argv[i], "-s") || !strcmp(argv[i], "--screen"))

View File

@@ -131,7 +131,7 @@ std::string Help::DisplayKeys(const ActionType at)
{ {
for (auto j = it->second.begin(); j != it->second.end(); ++j) for (auto j = it->second.begin(); j != it->second.end(); ++j)
{ {
if (j->isSingle() && j->action()->Type() == at) if (j->isSingle() && j->action()->type() == at)
{ {
result += keyToString(it->first, &print_backspace); result += keyToString(it->first, &print_backspace);
result += " "; result += " ";

View File

@@ -21,7 +21,7 @@
#include "global.h" #include "global.h"
#include "macro_utilities.h" #include "macro_utilities.h"
void PushCharacters::Run() void PushCharacters::run()
{ {
for (auto it = m_queue.begin(); it != m_queue.end(); ++it) for (auto it = m_queue.begin(); it != m_queue.end(); ++it)
(*m_window)->pushChar(*it); (*m_window)->pushChar(*it);
@@ -37,7 +37,7 @@ bool RequireScreen::canBeRun() const
return Global::myScreen->type() == m_screen_type; return Global::myScreen->type() == m_screen_type;
} }
void RunExternalCommand::Run() void RunExternalCommand::run()
{ {
GNUC_UNUSED int res; GNUC_UNUSED int res;
res = std::system(m_command.c_str()); res = std::system(m_command.c_str());

View File

@@ -31,7 +31,7 @@ struct PushCharacters : public Action
: Action(aMacroUtility, ""), m_window(w), m_queue(queue) { } : Action(aMacroUtility, ""), m_window(w), m_queue(queue) { }
protected: protected:
virtual void Run(); virtual void run();
private: private:
NC::Window **m_window; NC::Window **m_window;
@@ -45,7 +45,7 @@ struct RequireRunnable : public Action
protected: protected:
virtual bool canBeRun() const; virtual bool canBeRun() const;
virtual void Run() { } virtual void run() { }
private: private:
Action *m_action; Action *m_action;
@@ -58,7 +58,7 @@ struct RequireScreen : public Action
protected: protected:
virtual bool canBeRun() const; virtual bool canBeRun() const;
virtual void Run() { } virtual void run() { }
private: private:
ScreenType m_screen_type; ScreenType m_screen_type;
@@ -70,7 +70,7 @@ struct RunExternalCommand : public Action
: Action(aMacroUtility, ""), m_command(command) { } : Action(aMacroUtility, ""), m_command(command) { }
protected: protected:
virtual void Run(); virtual void run();
private: private:
std::string m_command; std::string m_command;

View File

@@ -60,7 +60,7 @@ namespace
} }
else if (signal == SIGWINCH) else if (signal == SIGWINCH)
{ {
Action::ResizeScreen(true); Action::resizeScreen(true);
} }
} }
# endif // !WIN32 # endif // !WIN32
@@ -121,7 +121,7 @@ int main(int argc, char **argv)
if (argc > 1) if (argc > 1)
ParseArgv(argc, argv); ParseArgv(argc, argv);
if (!Action::ConnectToMPD()) if (!Action::connectToMPD())
exit(1); exit(1);
if (Mpd.Version() < 16) if (Mpd.Version() < 16)
@@ -150,9 +150,9 @@ int main(int argc, char **argv)
if (Config.new_design) if (Config.new_design)
Config.statusbar_visibility = 0; Config.statusbar_visibility = 0;
Action::SetWindowsDimensions(); Action::setWindowsDimensions();
Action::ValidateScreenSize(); Action::validateScreenSize();
Action::InitializeScreens(); Action::initializeScreens();
wHeader = new NC::Window(0, 0, COLS, Action::HeaderHeight, "", Config.header_color, NC::brNone); wHeader = new NC::Window(0, 0, COLS, Action::HeaderHeight, "", Config.header_color, NC::brNone);
if (Config.header_visibility || Config.new_design) if (Config.header_visibility || Config.new_design)

View File

@@ -468,7 +468,7 @@ void TagEditor::enterPressed()
if (w == TagTypes && id == 5) if (w == TagTypes && id == 5)
{ {
bool yes = Action::AskYesNoQuestion("Number tracks?", Status::trace); bool yes = Action::askYesNoQuestion("Number tracks?", Status::trace);
if (yes) if (yes)
{ {
auto it = EditedSongs.begin(); auto it = EditedSongs.begin();
@@ -929,7 +929,7 @@ bool TagEditor::ifAnyModifiedAskForDiscarding()
{ {
bool result = true; bool result = true;
if (isAnyModified(*Tags)) if (isAnyModified(*Tags))
result = Action::AskYesNoQuestion("There are pending changes, are you sure?", Status::trace); result = Action::askYesNoQuestion("There are pending changes, are you sure?", Status::trace);
return result; return result;
} }