mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 04:03:59 +02:00
Fix Windows warning
This commit is contained in:
parent
a8de6f0a57
commit
fcf44911a3
3 changed files with 19 additions and 9 deletions
|
@ -337,14 +337,13 @@ void setupPreferences() {
|
|||
|
||||
auto nodelist = DependencyManager::get<NodeList>();
|
||||
{
|
||||
const int MIN_PORT_NUMBER { 0 };
|
||||
const int MAX_PORT_NUMBER { 65535 };
|
||||
auto getter = [nodelist] { return nodelist->getSocketLocalPort(); };
|
||||
auto setter = [nodelist](quint16 preset) { nodelist->setSocketLocalPort(preset); };
|
||||
auto preference = new SpinnerPreference(RENDER, "Listening Port", getter, setter);
|
||||
static const int MIN_PORT_NUMBER { 0 };
|
||||
static const int MAX_PORT_NUMBER { 65535 };
|
||||
auto getter = [nodelist] { return static_cast<int>(nodelist->getSocketLocalPort()); };
|
||||
auto setter = [nodelist](int preset) { nodelist->setSocketLocalPort(static_cast<quint16>(preset)); };
|
||||
auto preference = new IntSpinnerPreference(RENDER, "Listening Port", getter, setter);
|
||||
preference->setMin(MIN_PORT_NUMBER);
|
||||
preference->setMax(MAX_PORT_NUMBER);
|
||||
preference->setStep(1);
|
||||
preferences->addPreference(preference);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -252,9 +252,11 @@ void NodeList::setSocketLocalPort(quint16 socketLocalPort) {
|
|||
Q_ARG(quint16, socketLocalPort));
|
||||
return;
|
||||
}
|
||||
_nodeSocket.rebind(socketLocalPort);
|
||||
reset();
|
||||
NODELIST_LOCAL_PORT.set(socketLocalPort);
|
||||
if (_nodeSocket.localPort() != socketLocalPort) {
|
||||
reset();
|
||||
_nodeSocket.rebind(socketLocalPort);
|
||||
NODELIST_LOCAL_PORT.set(socketLocalPort);
|
||||
}
|
||||
}
|
||||
|
||||
void NodeList::addNodeTypeToInterestSet(NodeType_t nodeTypeToAdd) {
|
||||
|
|
|
@ -254,6 +254,15 @@ public:
|
|||
Type getType() override { return Spinner; }
|
||||
};
|
||||
|
||||
class IntSpinnerPreference : public IntPreference {
|
||||
Q_OBJECT
|
||||
public:
|
||||
IntSpinnerPreference(const QString& category, const QString& name, Getter getter, Setter setter)
|
||||
: IntPreference(category, name, getter, setter) { }
|
||||
|
||||
Type getType() override { return Spinner; }
|
||||
};
|
||||
|
||||
class EditPreference : public StringPreference {
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QString placeholderText READ getPlaceholderText CONSTANT)
|
||||
|
|
Loading…
Reference in a new issue