Skip to content

Commit

Permalink
Cleanup|libshell: Cleanup with clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Jan 20, 2018
1 parent 7e7c580 commit 372c587
Show file tree
Hide file tree
Showing 51 changed files with 328 additions and 490 deletions.
40 changes: 13 additions & 27 deletions doomsday/sdk/libshell/include/de/shell/abstractlineeditor.h
Expand Up @@ -25,8 +25,7 @@
#include <de/String>
#include <de/Vector>

namespace de {
namespace shell {
namespace de { namespace shell {

class Lexicon;

Expand Down Expand Up @@ -54,14 +53,14 @@ class LIBSHELL_PUBLIC AbstractLineEditor : public ITextEditor
*
* @param promptText Text for the prompt.
*/
void setPrompt(String const &promptText);
void setPrompt(String const &promptText);
String prompt() const;

void setText(String const &lineText);
void setText(String const &lineText);
String text() const;

void setCursor(int index);
int cursor() const;
int cursor() const;

/**
* Determines the position of a specific character on the wrapped lines.
Expand All @@ -72,10 +71,10 @@ class LIBSHELL_PUBLIC AbstractLineEditor : public ITextEditor

Vector2i lineCursorPos() const { return linePos(cursor()); }

bool isSuggestingCompletion() const;
Rangei completionRange() const;
bool isSuggestingCompletion() const;
Rangei completionRange() const;
QStringList suggestedCompletions() const;
void acceptCompletion();
void acceptCompletion();

/**
* Defines the terms and rules for auto-completion.
Expand All @@ -86,10 +85,7 @@ class LIBSHELL_PUBLIC AbstractLineEditor : public ITextEditor

Lexicon const &lexicon() const;

enum EchoMode {
NormalEchoMode,
PasswordEchoMode
};
enum EchoMode { NormalEchoMode, PasswordEchoMode };

/**
* Determines how the entered text should be shown to the user.
Expand All @@ -100,13 +96,7 @@ class LIBSHELL_PUBLIC AbstractLineEditor : public ITextEditor

EchoMode echoMode() const;

enum KeyModifier {
Unmodified = 0,
Shift = 0x1,
Control = 0x2,
Alt = 0x4,
Meta = 0x8
};
enum KeyModifier { Unmodified = 0, Shift = 0x1, Control = 0x2, Alt = 0x4, Meta = 0x8 };
Q_DECLARE_FLAGS(KeyModifiers, KeyModifier)

virtual bool handleControlKey(int qtKey, KeyModifiers const &mods = Unmodified);
Expand All @@ -127,15 +117,12 @@ class LIBSHELL_PUBLIC AbstractLineEditor : public ITextEditor

// Notifications:
virtual void numberOfLinesChanged(int lineCount) = 0;
virtual void cursorMoved() = 0;
virtual void contentChanged() = 0;
virtual void cursorMoved() = 0;
virtual void contentChanged() = 0;
virtual void autoCompletionBegan(String const &wordBase);
virtual void autoCompletionEnded(bool accepted);

enum LineWrapUpdateBehavior {
RewrapNow,
WrapUnlessWrappedAlready
};
enum LineWrapUpdateBehavior { RewrapNow, WrapUnlessWrappedAlready };

/// Request rewrapping the text.
void updateLineWraps(LineWrapUpdateBehavior behavior);
Expand All @@ -146,7 +133,6 @@ class LIBSHELL_PUBLIC AbstractLineEditor : public ITextEditor

Q_DECLARE_OPERATORS_FOR_FLAGS(AbstractLineEditor::KeyModifiers)

} // namespace shell
} // namespace de
}} // namespace de::shell

#endif // LIBSHELL_ABSTRACTLINEEDITOR_H
17 changes: 6 additions & 11 deletions doomsday/sdk/libshell/include/de/shell/abstractlink.h
Expand Up @@ -26,8 +26,7 @@
#include <de/Transmitter>
#include <QObject>

namespace de {
namespace shell {
namespace de { namespace shell {

/**
* Abstract network connection to a server.
Expand All @@ -36,17 +35,14 @@ namespace shell {
*
* @ingroup shell
*/
class LIBSHELL_PUBLIC AbstractLink : public QObject, public Transmitter
class LIBSHELL_PUBLIC AbstractLink
: public QObject
, public Transmitter
{
Q_OBJECT

public:
enum Status
{
Disconnected,
Connecting,
Connected
};
enum Status { Disconnected, Connecting, Connected };

public:
AbstractLink();
Expand Down Expand Up @@ -128,7 +124,6 @@ protected slots:
DENG2_PRIVATE(d)
};

} // namespace shell
} // namespace de
}} // namespace de::shell

#endif // LIBSHELL_ABSTRACTLINK_H
16 changes: 8 additions & 8 deletions doomsday/sdk/libshell/include/de/shell/action.h
Expand Up @@ -23,15 +23,16 @@
#include <de/Action>
#include <QObject>

namespace de {
namespace shell {
namespace de { namespace shell {

/**
* Maps a key event to a signal.
*
* @ingroup textUi
*/
class Action : public QObject, public de::Action
class Action
: public QObject
, public de::Action
{
Q_OBJECT

Expand Down Expand Up @@ -66,13 +67,12 @@ class Action : public QObject, public de::Action
~Action();

private:
KeyEvent _event;
String _label;
QObject *_target;
KeyEvent _event;
String _label;
QObject * _target;
char const *_slot;
};

} // namespace shell
} // namespace de
}} // namespace de::shell

#endif // LIBSHELL_ACTION_H
6 changes: 2 additions & 4 deletions doomsday/sdk/libshell/include/de/shell/choicewidget.h
Expand Up @@ -22,8 +22,7 @@
#include "LabelWidget"
#include <QList>

namespace de {
namespace shell {
namespace de { namespace shell {

/**
* Widget for selecting an item from multiple choices.
Expand Down Expand Up @@ -73,7 +72,6 @@ protected slots:
DENG2_PRIVATE(d)
};

} // namespace shell
} // namespace de
}} // namespace de::shell

#endif // LIBSHELL_CHOICEWIDGET_H
6 changes: 2 additions & 4 deletions doomsday/sdk/libshell/include/de/shell/commandlinewidget.h
Expand Up @@ -21,8 +21,7 @@

#include "LineEditWidget"

namespace de {
namespace shell {
namespace de { namespace shell {

/**
* Text editor with a history.
Expand All @@ -47,7 +46,6 @@ class LIBSHELL_PUBLIC CommandLineWidget : public LineEditWidget
DENG2_PRIVATE(d)
};

} // namespace shell
} // namespace de
}} // namespace de::shell

#endif // LIBSHELL_COMMANDLINEWIDGET_H
6 changes: 2 additions & 4 deletions doomsday/sdk/libshell/include/de/shell/dialogwidget.h
Expand Up @@ -21,8 +21,7 @@

#include "TextWidget"

namespace de {
namespace shell {
namespace de { namespace shell {

/**
* Base class for modal dialogs.
Expand Down Expand Up @@ -79,7 +78,6 @@ public slots:
DENG2_PRIVATE(d)
};

} // namespace shell
} // namespace shell
}} // namespace de::shell

#endif // LIBSHELL_DIALOGWIDGET_H
40 changes: 15 additions & 25 deletions doomsday/sdk/libshell/include/de/shell/doomsdayinfo.h
Expand Up @@ -24,8 +24,7 @@
#include <de/NativePath>
#include <QList>

namespace de {
namespace shell {
namespace de { namespace shell {

/**
* Information about Doomsday Engine and its plugins.
Expand All @@ -35,42 +34,34 @@ namespace shell {
class LIBSHELL_PUBLIC DoomsdayInfo
{
public:
struct Game
{
struct Game {
String title;
String option; ///< Mode identifier.
};

enum OptionType
{
Toggle,
Choice,
Text
};
enum OptionType { Toggle, Choice, Text };

struct LIBSHELL_PUBLIC GameOption
{
struct LIBSHELL_PUBLIC Value
{
struct LIBSHELL_PUBLIC GameOption {
struct LIBSHELL_PUBLIC Value {
String value;
String label;
String ruleSemantic; // for determining if the option is set

Value(String const &value = String(), String const &label = String(),
String const &ruleSemantic = String())
: value(value), label(label), ruleSemantic(ruleSemantic) {}
: value(value)
, label(label)
, ruleSemantic(ruleSemantic)
{}
};

OptionType type;
String title;
String command; // e.g., "setmap %1"
Value defaultValue;
OptionType type;
String title;
String command; // e.g., "setmap %1"
Value defaultValue;
QList<Value> allowedValues;

GameOption(OptionType type,
String title,
String command,
Value defaultValue = Value(),
GameOption(OptionType type, String title, String command, Value defaultValue = Value(),
QList<Value> allowedValues = QList<Value>());
};

Expand All @@ -88,7 +79,6 @@ class LIBSHELL_PUBLIC DoomsdayInfo
static NativePath defaultServerRuntimeFolder();
};

} // namespace shell
} // namespace de
}} // namespace de::shell

#endif // LIBSHELL_DOOMSDAYINFO_H
8 changes: 3 additions & 5 deletions doomsday/sdk/libshell/include/de/shell/editorhistory.h
Expand Up @@ -21,8 +21,7 @@

#include "ITextEditor"

namespace de {
namespace shell {
namespace de { namespace shell {

/**
* History buffer for a text editor. Remembers past entries entered into the
Expand All @@ -35,7 +34,7 @@ class LIBSHELL_PUBLIC EditorHistory
public:
EditorHistory(ITextEditor *editor = 0);

void setEditor(ITextEditor &editor);
void setEditor(ITextEditor &editor);
ITextEditor &editor();

/**
Expand Down Expand Up @@ -79,7 +78,6 @@ class LIBSHELL_PUBLIC EditorHistory
DENG2_PRIVATE(d)
};

} // namespace shell
} // namespace de
}} // namespace de::shell

#endif // LIBSHELL_ABSTRACTCOMMANDLINEEDITOR_H
10 changes: 4 additions & 6 deletions doomsday/sdk/libshell/include/de/shell/inputdialog.h
Expand Up @@ -21,8 +21,7 @@

#include "DialogWidget"

namespace de {
namespace shell {
namespace de { namespace shell {

class LabelWidget;
class LineEditWidget;
Expand All @@ -38,9 +37,9 @@ class InputDialog : public de::shell::DialogWidget
public:
InputDialog(de::String const &name = de::String());

LabelWidget &label();
LabelWidget & label();
LineEditWidget &lineEdit();
MenuWidget &menu();
MenuWidget & menu();

/**
* Sets the width of the dialog. The default width is 50.
Expand Down Expand Up @@ -73,7 +72,6 @@ class InputDialog : public de::shell::DialogWidget
DENG2_PRIVATE(d)
};

} // namespace shell
} // namespace de
}} // namespace de::shell

#endif // LIBSHELL_INPUTDIALOG_H
12 changes: 5 additions & 7 deletions doomsday/sdk/libshell/include/de/shell/itexteditor.h
Expand Up @@ -21,8 +21,7 @@

#include "libshell.h"

namespace de {
namespace shell {
namespace de { namespace shell {

/**
* Interface for a text editor: text content and a cursor position.
Expand All @@ -35,13 +34,12 @@ class ITextEditor
virtual ~ITextEditor() {}

virtual void setText(String const &text) = 0;
virtual void setCursor(int pos) = 0;
virtual void setCursor(int pos) = 0;

virtual String text() const = 0;
virtual int cursor() const = 0;
virtual String text() const = 0;
virtual int cursor() const = 0;
};

} // namespace shell
} // namespace de
}} // namespace de::shell

#endif // LIBSHELL_ITEXTEDITOR_H

0 comments on commit 372c587

Please sign in to comment.