-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add choice parameter to CServerParamsDlg (ComboBox) #366
- Loading branch information
Showing
19 changed files
with
388 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#include "AbstractParameter.h" | ||
|
||
AbstractParameter::AbstractParameter(std::string name) | ||
: name_(std::move(name)) | ||
{ | ||
} | ||
|
||
std::string AbstractParameter::getName() const | ||
{ | ||
return name_; | ||
} | ||
|
||
void AbstractParameter::setTitle(const std::string title) { | ||
title_ = title; | ||
} | ||
|
||
std::string AbstractParameter::getTitle() const { | ||
return title_; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#pragma once | ||
|
||
#include <string> | ||
#include <memory> | ||
#include <vector> | ||
|
||
class AbstractParameter { | ||
public: | ||
AbstractParameter(std::string name); | ||
virtual ~AbstractParameter() = default; | ||
|
||
std::string getName() const; | ||
void setTitle(const std::string title); | ||
std::string getTitle() const; | ||
virtual std::string getType() const = 0; | ||
|
||
virtual void setValue(const std::string& val) = 0; | ||
virtual std::string getValue() const = 0; | ||
|
||
private: | ||
std::string name_, title_; | ||
}; | ||
|
||
using ParameterList = std::vector<std::unique_ptr<AbstractParameter>>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#include "ChoiceParameter.h" | ||
|
||
ChoiceParameter::ChoiceParameter(std::string title) | ||
: AbstractParameter(std::move(title)) | ||
{ | ||
} | ||
|
||
std::string ChoiceParameter::getType() const { | ||
return "choice"; | ||
} | ||
|
||
std::string ChoiceParameter::getValue() const { | ||
return value_; | ||
} | ||
|
||
void ChoiceParameter::setValue(const std::string& val) { | ||
value_ = val; | ||
} | ||
|
||
void ChoiceParameter::addItem(const std::string& id, const std::string& value) { | ||
items_.push_back({ id, value }); | ||
} | ||
|
||
void ChoiceParameter::clearItems() { | ||
items_.clear(); | ||
} | ||
|
||
const std::vector<std::pair<std::string, std::string>>& ChoiceParameter::getItems() const{ | ||
return items_; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#pragma once | ||
|
||
#include "AbstractParameter.h" | ||
|
||
class ChoiceParameter: public AbstractParameter { | ||
public: | ||
explicit ChoiceParameter(std::string name); | ||
|
||
std::string getType() const override; | ||
std::string getValue() const override; | ||
void setValue(const std::string& val) override; | ||
void addItem(const std::string& id, const std::string& value); | ||
void clearItems(); | ||
const std::vector<std::pair<std::string, std::string>>& getItems() const; | ||
|
||
private: | ||
std::string value_; | ||
std::vector<std::pair<std::string, std::string>> items_; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#include "TextParameter.h" | ||
|
||
TextParameter::TextParameter(std::string title) | ||
: AbstractParameter(std::move(title)) | ||
{ | ||
} | ||
|
||
std::string TextParameter::getType() const { | ||
return "text"; | ||
} | ||
|
||
std::string TextParameter::getValue() const { | ||
return value_; | ||
} | ||
|
||
void TextParameter::setValue(const std::string& val) { | ||
value_ = val; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#pragma once | ||
|
||
#include "AbstractParameter.h" | ||
|
||
class TextParameter: public AbstractParameter { | ||
public: | ||
explicit TextParameter(std::string name); | ||
|
||
std::string getType() const override; | ||
std::string getValue() const override; | ||
void setValue(const std::string& val) override; | ||
|
||
private: | ||
std::string value_; | ||
}; |
Oops, something went wrong.