Skip to content

Commit

Permalink
GUI: Use delegating constructors for duplicate constructors
Browse files Browse the repository at this point in the history
  • Loading branch information
aryanrawlani28 committed Sep 30, 2020
1 parent 75b3d8f commit 2d3038e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 22 deletions.
11 changes: 0 additions & 11 deletions backends/keymapper/keymap.cpp
Expand Up @@ -44,17 +44,6 @@ Keymap::Keymap(KeymapType type, const String &id, const U32String &description)

}

Keymap::Keymap(KeymapType type, const String &id, const String &description) :
_type(type),
_id(id),
_description(U32String(description)),
_enabled(true),
_configDomain(nullptr),
_hardwareInputSet(nullptr),
_backendDefaultBindings(nullptr) {

}

Keymap::~Keymap() {
for (ActionArray::iterator it = _actions.begin(); it != _actions.end(); ++it)
delete *it;
Expand Down
2 changes: 1 addition & 1 deletion backends/keymapper/keymap.h
Expand Up @@ -81,7 +81,7 @@ class Keymap {
typedef Array<Action *> ActionArray;

Keymap(KeymapType type, const String &id, const U32String &description);
Keymap(KeymapType type, const String &id, const String &description);
Keymap(KeymapType type, const String &id, const String &description) : Keymap(type, id, U32String(description)) {}
~Keymap();
void setConfigDomain(ConfigManager::Domain *configDomain);
void setHardwareInputs(HardwareInputSet *hardwareInputSet);
Expand Down
13 changes: 3 additions & 10 deletions gui/message.cpp
Expand Up @@ -38,8 +38,9 @@ enum {


// TODO: The default button should be visibly distinct from the alternate button
MessageDialog::MessageDialog(const Common::U32String &message, const Common::U32String &defaultButton, const Common::U32String &altButton, Graphics::TextAlign alignment, const char *url)
: Dialog(30, 20, 260, 124) {

void MessageDialog::init(const Common::U32String &message, const Common::U32String &defaultButton, const Common::U32String &altButton, Graphics::TextAlign alignment, const char *url) {
_url = url;

const int screenW = g_system->getOverlayWidth();
Expand Down Expand Up @@ -101,16 +102,8 @@ void MessageDialog::init(const Common::U32String &message, const Common::U32Stri
}
}

MessageDialog::MessageDialog(const Common::U32String &message, const Common::U32String &defaultButton, const Common::U32String &altButton, Graphics::TextAlign alignment, const char *url)
: Dialog(30, 20, 260, 124) {

init(message, defaultButton, altButton, alignment, url);
}

MessageDialog::MessageDialog(const Common::String &message, const Common::String &defaultButton, const Common::String &altButton, Graphics::TextAlign alignment, const char *url)
: Dialog(30, 20, 260, 124) {

init(Common::U32String(message), Common::U32String(defaultButton), Common::U32String(altButton), alignment, url);
: MessageDialog(Common::U32String(message), Common::U32String(defaultButton), Common::U32String(altButton), alignment, url) {
}

void MessageDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
Expand Down

0 comments on commit 2d3038e

Please sign in to comment.