← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~thelinuxguy/openlp/editable-remote-port into lp:openlp

 

Simon Hanna has proposed merging lp:~thelinuxguy/openlp/editable-remote-port into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)

For more details, see:
https://code.launchpad.net/~thelinuxguy/openlp/editable-remote-port/+merge/353586

Somehow the port was changed to be static, this reintroduces customizable ports
-- 
Your team OpenLP Core is requested to review the proposed merge of lp:~thelinuxguy/openlp/editable-remote-port into lp:openlp.
=== modified file 'openlp/core/api/tab.py'
--- openlp/core/api/tab.py	2018-08-04 20:58:13 +0000
+++ openlp/core/api/tab.py	2018-08-22 16:43:25 +0000
@@ -71,7 +71,9 @@
         self.http_setting_layout.setObjectName('http_setting_layout')
         self.port_label = QtWidgets.QLabel(self.http_settings_group_box)
         self.port_label.setObjectName('port_label')
-        self.port_spin_box = QtWidgets.QLabel(self.http_settings_group_box)
+        self.port_spin_box = QtWidgets.QSpinBox(self.http_settings_group_box)
+        self.port_spin_box.setMinimum(1024)
+        self.port_spin_box.setMaximum(65535)
         self.port_spin_box.setObjectName('port_spin_box')
         self.http_setting_layout.addRow(self.port_label, self.port_spin_box)
         self.remote_url_label = QtWidgets.QLabel(self.http_settings_group_box)
@@ -213,7 +215,7 @@
         """
         Load the configuration and update the server configuration if necessary
         """
-        self.port_spin_box.setText(str(Settings().value(self.settings_section + '/port')))
+        self.port_spin_box.setValue(Settings().value(self.settings_section + '/port'))
         self.address_edit.setText(Settings().value(self.settings_section + '/ip address'))
         self.twelve_hour = Settings().value(self.settings_section + '/twelve hour')
         self.twelve_hour_check_box.setChecked(self.twelve_hour)
@@ -232,8 +234,10 @@
         """
         Save the configuration and update the server configuration if necessary
         """
-        if Settings().value(self.settings_section + '/ip address') != self.address_edit.text():
+        if Settings().value(self.settings_section + '/ip address') != self.address_edit.text() or \
+           Settings().value(self.settings_section + '/port') != self.port_spin_box.value():
             self.settings_form.register_post_process('remotes_config_updated')
+        Settings().setValue(self.settings_section + '/port', self.port_spin_box.value())
         Settings().setValue(self.settings_section + '/ip address', self.address_edit.text())
         Settings().setValue(self.settings_section + '/twelve hour', self.twelve_hour)
         Settings().setValue(self.settings_section + '/thumbnails', self.thumbnails)

=== modified file 'tests/functional/openlp_core/api/test_tab.py'
--- tests/functional/openlp_core/api/test_tab.py	2018-08-04 20:58:13 +0000
+++ tests/functional/openlp_core/api/test_tab.py	2018-08-22 16:43:25 +0000
@@ -119,3 +119,27 @@
         assert self.form.live_url.text() == \
             "<a href=\"http://192.168.1.1:4316/main\";>http://192.168.1.1:4316/main</a>", \
             'The return value should be a fully formed main link'
+
+    def test_port_spin_box_is_available(self):
+        """
+        Test that the port can be set using a SpinBox
+        """
+        # GIVEN: The Remote Settings tab
+        # THEN: The port input is a spin box
+        assert isinstance(self.form.port_spin_box, QtWidgets.QSpinBox)
+
+    def test_port_spin_box_maximum_value(self):
+        """
+        Test that the maximum allowed value is 65535
+        """
+        # GIVEN: The Remote Settings tab
+        # THEN: The maximum allowed value is 65535
+        assert self.form.port_spin_box.maximum() == 65535
+
+    def test_port_spin_box_minimum_value(self):
+        """
+        Test that the minimum allowed value is 1024
+        """
+        # GIVEN: The Remote Settings tab
+        # THEN: The minimum allowed value is 1024
+        assert self.form.port_spin_box.minimum() == 1024


Follow ups