summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-06-14 19:23:42 +0300
committerAndrei Karas <akaras@inbox.ru>2013-06-14 19:23:42 +0300
commit9b0982a39e750974852572d1a965c4a802f5f4cd (patch)
treefb8ddb5ed3f190b0d039aafd2d0f5bd59b2b404a /src
parentfb433aae06cfd9ca64f8315385534857c77bfe5b (diff)
downloadplus-9b0982a39e750974852572d1a965c4a802f5f4cd.tar.gz
plus-9b0982a39e750974852572d1a965c4a802f5f4cd.tar.bz2
plus-9b0982a39e750974852572d1a965c4a802f5f4cd.tar.xz
plus-9b0982a39e750974852572d1a965c4a802f5f4cd.zip
improve setuptouchitem.
Diffstat (limited to 'src')
-rw-r--r--src/gui/widgets/setuptouchitem.cpp29
-rw-r--r--src/gui/widgets/setuptouchitem.h20
2 files changed, 28 insertions, 21 deletions
diff --git a/src/gui/widgets/setuptouchitem.cpp b/src/gui/widgets/setuptouchitem.cpp
index aa731504f..2d0b9c1d5 100644
--- a/src/gui/widgets/setuptouchitem.cpp
+++ b/src/gui/widgets/setuptouchitem.cpp
@@ -85,13 +85,13 @@ int TouchActionsModel::getSelectionFromAction(const int action) const
}
-SetupActionDropDown::SetupActionDropDown(std::string text,
- std::string description,
- std::string keyName,
+SetupActionDropDown::SetupActionDropDown(const std::string &text,
+ const std::string &description,
+ const std::string &keyName,
SetupTabScroll *const parent,
- std::string eventName,
+ const std::string &eventName,
TouchActionsModel *const model,
- int width,
+ const int width,
const bool mainConfig) :
SetupItem(text, description, keyName, parent, eventName, mainConfig),
mHorizont(nullptr),
@@ -104,14 +104,14 @@ SetupActionDropDown::SetupActionDropDown(std::string text,
createControls();
}
-SetupActionDropDown::SetupActionDropDown(std::string text,
- std::string description,
- std::string keyName,
+SetupActionDropDown::SetupActionDropDown(const std::string &text,
+ const std::string &description,
+ const std::string &keyName,
SetupTabScroll *const parent,
- std::string eventName,
+ const std::string &eventName,
TouchActionsModel *const model,
- int width,
- std::string def,
+ const int width,
+ const std::string &def,
const bool mainConfig) :
SetupItem(text, description, keyName, parent, eventName, def, mainConfig),
mHorizont(nullptr),
@@ -135,6 +135,9 @@ SetupActionDropDown::~SetupActionDropDown()
void SetupActionDropDown::createControls()
{
+ if (!mModel)
+ return;
+
load();
mHorizont = new HorizontContainer(this, 32, 2);
@@ -159,7 +162,7 @@ void SetupActionDropDown::createControls()
void SetupActionDropDown::fromWidget()
{
- if (!mDropDown)
+ if (!mDropDown || !mModel)
return;
mValue = toString(mModel->getActionFromSelection(
@@ -168,7 +171,7 @@ void SetupActionDropDown::fromWidget()
void SetupActionDropDown::toWidget()
{
- if (!mDropDown)
+ if (!mDropDown || !mModel)
return;
mDropDown->setSelected(mModel->getSelectionFromAction(
diff --git a/src/gui/widgets/setuptouchitem.h b/src/gui/widgets/setuptouchitem.h
index ac9264467..8910f1023 100644
--- a/src/gui/widgets/setuptouchitem.h
+++ b/src/gui/widgets/setuptouchitem.h
@@ -50,17 +50,21 @@ class TouchActionsModel final : public NamesModel
class SetupActionDropDown final : public SetupItem
{
public:
- SetupActionDropDown(std::string text, std::string description,
- std::string keyName, SetupTabScroll *const parent,
- std::string eventName,
+ SetupActionDropDown(const std::string &text,
+ const std::string &description,
+ const std::string &keyName,
+ SetupTabScroll *const parent,
+ const std::string &eventName,
TouchActionsModel *const model,
- int width, const bool mainConfig = true);
+ const int width, const bool mainConfig = true);
- SetupActionDropDown(std::string text, std::string description,
- std::string keyName, SetupTabScroll *const parent,
- std::string eventName,
+ SetupActionDropDown(const std::string &text,
+ const std::string &description,
+ const std::string &keyName,
+ SetupTabScroll *const parent,
+ const std::string &eventName,
TouchActionsModel *const model,
- int width, std::string def,
+ const int width, const std::string &def,
const bool mainConfig = true);
A_DELETE_COPY(SetupActionDropDown)