summaryrefslogtreecommitdiff
path: root/src/leap/gui
diff options
context:
space:
mode:
authorTomás Touceda <chiiph@leap.se>2013-06-12 14:22:16 -0300
committerkali <kali@leap.se>2013-06-13 23:37:31 +0900
commitb2f2831d6fc090a508437a073267d5a9e2bd5e14 (patch)
tree320aadf6956e8eaf2fd8793f9c652b219e3109b7 /src/leap/gui
parent35291c130f749850753e89d889a121ec098c0dc9 (diff)
Refactor login to its own widget and remove Utils menu
Diffstat (limited to 'src/leap/gui')
-rw-r--r--src/leap/gui/login.py213
-rw-r--r--src/leap/gui/mainwindow.py199
-rw-r--r--src/leap/gui/ui/login.ui129
-rw-r--r--src/leap/gui/ui/mainwindow.ui214
4 files changed, 519 insertions, 236 deletions
diff --git a/src/leap/gui/login.py b/src/leap/gui/login.py
new file mode 100644
index 00000000..cbd10fd0
--- /dev/null
+++ b/src/leap/gui/login.py
@@ -0,0 +1,213 @@
+# -*- coding: utf-8 -*-
+# login.py
+# Copyright (C) 2013 LEAP
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+"""
+Login widget implementation
+"""
+import logging
+import keyring
+
+from PySide import QtCore, QtGui
+from ui_login import Ui_LoginWidget
+
+logger = logging.getLogger(__name__)
+
+
+class LoginWidget(QtGui.QWidget):
+ """
+ Login widget that emits signals to display the wizard or to
+ perform login.
+ """
+
+ # Emitted when the login button is clicked
+ login = QtCore.Signal()
+ # Emitted when the user selects "Other..." in the provider
+ # combobox or click "Create Account"
+ show_wizard = QtCore.Signal()
+
+ def __init__(self, settings, parent=None):
+ """
+ Constructs the LoginWidget.
+
+ :param settings: client wide settings
+ :type settings: LeapSettings
+ :param parent: The parent widget for this widget
+ :type parent: QWidget or None
+ """
+ QtGui.QWidget.__init__(self, parent)
+
+ self._settings = settings
+ self._selected_provider_index = -1
+
+ self.ui = Ui_LoginWidget()
+ self.ui.setupUi(self)
+
+ self.ui.chkRemember.stateChanged.connect(
+ self._remember_state_changed)
+ self.ui.chkRemember.setEnabled(keyring.get_keyring() is not None)
+
+ self.ui.lnPassword.setEchoMode(QtGui.QLineEdit.Password)
+
+ self.ui.btnLogin.clicked.connect(self.login)
+ self.ui.lnPassword.returnPressed.connect(self.login)
+
+ self.ui.lnUser.returnPressed.connect(self._focus_password)
+
+ self.ui.cmbProviders.currentIndexChanged.connect(
+ self._current_provider_changed)
+ self.ui.btnCreateAccount.clicked.connect(
+ self.show_wizard)
+
+ def _remember_state_changed(self, state):
+ """
+ Saves the remember state in the LeapSettings
+
+ :param state: possible stats can be Checked, Unchecked and
+ PartiallyChecked
+ :type state: QtCore.Qt.CheckState
+ """
+ enable = True if state == QtCore.Qt.Checked else False
+ self._settings.set_remember(enable)
+
+ def set_providers(self, provider_list):
+ """
+ Set the provider list to provider_list plus an "Other..." item
+ that triggers the wizard
+
+ :param provider_list: list of providers
+ :type provider_list: list of str
+ """
+ self.ui.cmbProviders.blockSignals(True)
+ self.ui.cmbProviders.clear()
+ self.ui.cmbProviders.addItems(provider_list + ["Other..."])
+ self.ui.cmbProviders.blockSignals(False)
+
+ def select_provider_by_name(self, name):
+ """
+ Given a provider name/domain, it selects it in the combobox
+
+ :param name: name or domain for the provider
+ :type name: str
+ """
+ provider_index = self.ui.cmbProviders.findText(name)
+ self.ui.cmbProviders.setCurrentIndex(provider_index)
+
+ def get_selected_provider(self):
+ """
+ Returns the selected provider in the combobox
+ """
+ return self.ui.cmbProviders.currentText()
+
+ def set_remember(self, value):
+ """
+ Checks the remember user and password checkbox
+
+ :param value: True to mark it checked, False otherwise
+ :type value: bool
+ """
+ self.ui.chkRemember.setChecked(value)
+
+ def get_remember(self):
+ """
+ Returns the remember checkbox state
+
+ :rtype: bool
+ """
+ return self.ui.chkRemember.isChecked()
+
+ def set_user(self, user):
+ """
+ Sets the user and focuses on the next field, password.
+
+ :param user: user to set the field to
+ :type user: str
+ """
+ self.ui.lnUser.setText(user)
+ self._focus_password()
+
+ def get_user(self):
+ """
+ Returns the user that appears in the widget
+
+ :rtype: str
+ """
+ return self.ui.lnUser.text()
+
+ def set_password(self, password):
+ """
+ Sets the password for the widget
+
+ :param password: password to set
+ :type password: str
+ """
+ self.ui.lnPassword.setText(password)
+
+ def get_password(self):
+ """
+ Returns the password that appears in the widget
+
+ :rtype: str
+ """
+ return self.ui.lnPassword.text()
+
+ def set_status(self, status, error=True):
+ """
+ Sets the status label at the login stage to status
+
+ :param status: status message
+ :type status: str
+ """
+ if error:
+ status = "<font color='red'><b>%s</b></font>" % (status,)
+ self.ui.lblStatus.setText(status)
+
+ def set_enabled(self, enabled=False):
+ """
+ Enables or disables all the login widgets
+
+ :param enabled: wether they should be enabled or not
+ :type enabled: bool
+ """
+ self.ui.lnUser.setEnabled(enabled)
+ self.ui.lnPassword.setEnabled(enabled)
+ self.ui.btnLogin.setEnabled(enabled)
+ self.ui.chkRemember.setEnabled(enabled)
+ self.ui.cmbProviders.setEnabled(enabled)
+
+ def _focus_password(self):
+ """
+ Focuses in the password lineedit
+ """
+ self.ui.lnPassword.setFocus()
+
+ def _current_provider_changed(self, param):
+ """
+ SLOT
+ TRIGGERS: self.ui.cmbProviders.currentIndexChanged
+ """
+ if param == (self.ui.cmbProviders.count() - 1):
+ self.show_wizard.emit()
+ # Leave the previously selected provider in the combobox
+ prev_provider = 0
+ if self._selected_provider_index != -1:
+ prev_provider = self._selected_provider_index
+ self.ui.cmbProviders.blockSignals(True)
+ self.ui.cmbProviders.setCurrentIndex(prev_provider)
+ self.ui.cmbProviders.blockSignals(False)
+ else:
+ self._selected_provider_index = param
+
diff --git a/src/leap/gui/mainwindow.py b/src/leap/gui/mainwindow.py
index 0e388e64..61eb8ca4 100644
--- a/src/leap/gui/mainwindow.py
+++ b/src/leap/gui/mainwindow.py
@@ -37,6 +37,7 @@ from leap.config.providerconfig import ProviderConfig
from leap.crypto.srpauth import SRPAuth
from leap.gui.loggerwindow import LoggerWindow
from leap.gui.wizard import Wizard
+from leap.gui.login import LoginWidget
from leap.services.eip.eipbootstrapper import EIPBootstrapper
from leap.services.eip.eipconfig import EIPConfig
from leap.services.eip.providerbootstrapper import ProviderBootstrapper
@@ -135,11 +136,18 @@ class MainWindow(QtGui.QMainWindow):
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
- self.ui.lnPassword.setEchoMode(QtGui.QLineEdit.Password)
+ self._settings = LeapSettings(standalone)
+
+ self._login_widget = LoginWidget(
+ self._settings,
+ self.ui.stackedWidget.widget(self.LOGIN_INDEX))
+ self.ui.loginLayout.addWidget(self._login_widget)
+
+ self._login_widget.login.connect(self._login)
+ self._login_widget.show_wizard.connect(
+ self._launch_wizard)
- self.ui.btnLogin.clicked.connect(self._login)
- self.ui.lnUser.returnPressed.connect(self._focus_password)
- self.ui.lnPassword.returnPressed.connect(self._login)
+ self.ui.btnShowLog.clicked.connect(self._show_logger_window)
self.ui.stackedWidget.setCurrentIndex(self.LOGIN_INDEX)
@@ -206,10 +214,6 @@ class MainWindow(QtGui.QMainWindow):
self._vpn.qtsigs.process_finished.connect(
self._eip_finished)
- self.ui.chkRemember.stateChanged.connect(
- self._remember_state_changed)
- self.ui.chkRemember.setEnabled(keyring.get_keyring() is not None)
-
self.ui.action_sign_out.setEnabled(False)
self.ui.action_sign_out.triggered.connect(self._logout)
self.ui.action_about_leap.triggered.connect(self._about)
@@ -244,7 +248,6 @@ class MainWindow(QtGui.QMainWindow):
self._action_visible.triggered.connect(self._toggle_visible)
self._enabled_services = []
- self._settings = LeapSettings(standalone)
self._center_window()
@@ -281,6 +284,13 @@ class MainWindow(QtGui.QMainWindow):
self._finish_init()
def _rejected_wizard(self):
+ """
+ SLOT
+ TRIGGERS: self._wizard.rejected
+
+ Called if the wizard has been cancelled or closed before
+ finishing.
+ """
if self._wizard_firstrun:
self._settings.set_properprovider(False)
self.quit()
@@ -288,11 +298,24 @@ class MainWindow(QtGui.QMainWindow):
self._finish_init()
def _launch_wizard(self):
+ """
+ SLOT
+ TRIGGERS:
+ self._login_widget.show_wizard
+ self.ui.action_wizard.triggered
+
+ Also called in first run.
+
+ Launches the wizard, creating the object itself if not already
+ there.
+ """
if self._wizard is None:
self._wizard = Wizard(bypass_checks=self._bypass_checks)
self._wizard.accepted.connect(self._finish_init)
+ self.setVisible(False)
self._wizard.exec_()
self._wizard = None
+ self.setVisible(True)
def _get_leap_logging_handler(self):
"""
@@ -310,6 +333,11 @@ class MainWindow(QtGui.QMainWindow):
def _show_logger_window(self):
"""
+ SLOT
+ TRIGGERS:
+ self.ui.action_show_logs.triggered
+ self.ui.btnShowLog.clicked
+
Displays the window with the history of messages logged until now
and displays the new ones on arrival.
"""
@@ -319,14 +347,11 @@ class MainWindow(QtGui.QMainWindow):
logger.error('Leap logger handler not found')
else:
self._logger_window = LoggerWindow(handler=leap_log_handler)
- self._logger_window.show()
+ self._logger_window.setVisible(not self._logger_window.isVisible())
+ self.ui.btnShowLog.setChecked(self._logger_window.isVisible())
else:
- self._logger_window.show()
-
- def _remember_state_changed(self, state):
- enable = True if state == QtCore.Qt.Checked else False
- self.ui.chkAutoLogin.setEnabled(enable)
- self._settings.set_remember(enable)
+ self._logger_window.setVisible(not self._logger_window.isVisible())
+ self.ui.btnShowLog.setChecked(self._logger_window.isVisible())
def _new_updates_available(self, req):
"""
@@ -377,8 +402,21 @@ class MainWindow(QtGui.QMainWindow):
msg)
def _finish_init(self):
- self.ui.cmbProviders.clear()
- self.ui.cmbProviders.addItems(self._configured_providers())
+ """
+ SLOT
+ TRIGGERS:
+ self._wizard.accepted
+
+ Also called at the end of the constructor if not first run,
+ and after _rejected_wizard if not first run.
+
+ Implements the behavior after either constructing the
+ mainwindow object, loading the saved user/password, or after
+ the wizard has been executed.
+ """
+ # XXX: May be this can be divided into two methods?
+
+ self._login_widget.set_providers(self._configured_providers())
self._show_systray()
self.show()
@@ -388,20 +426,18 @@ class MainWindow(QtGui.QMainWindow):
# select the configured provider in the combo box
domain = self._wizard.get_domain()
- provider_index = self.ui.cmbProviders.findText(domain)
- self.ui.cmbProviders.setCurrentIndex(provider_index)
+ self._login_widget.select_provider_by_name(domain)
- self.ui.chkRemember.setChecked(self._wizard.get_remember())
+ self._login_widget.set_remember(self._wizard.get_remember())
self._enabled_services = list(self._wizard.get_services())
self._settings.set_enabled_services(
- self.ui.cmbProviders.currentText(),
+ self._login_widget.get_selected_provider(),
self._enabled_services)
if possible_username is not None:
- self.ui.lnUser.setText(possible_username)
- self._focus_password()
+ self._login_widget.set_user(possible_username)
if possible_password is not None:
- self.ui.lnPassword.setText(possible_password)
- self.ui.chkRemember.setChecked(True)
+ self._login_widget.set_password(possible_password)
+ self._login_widget.set_remember(True)
self._login()
self._wizard = None
self._settings.set_properprovider(True)
@@ -412,7 +448,6 @@ class MainWindow(QtGui.QMainWindow):
return
saved_user = self._settings.get_user()
- auto_login = self._settings.get_autologin()
try:
username, domain = saved_user.split('@')
@@ -423,15 +458,12 @@ class MainWindow(QtGui.QMainWindow):
if saved_user is not None:
# fill the username
- self.ui.lnUser.setText(username)
+ self._login_widget.set_user(username)
# select the configured provider in the combo box
- provider_index = self.ui.cmbProviders.findText(domain)
- self.ui.cmbProviders.setCurrentIndex(provider_index)
+ self._login_widget.select_provider_by_name(domain)
- self.ui.chkRemember.setChecked(True)
- self.ui.chkAutoLogin.setEnabled(self.ui.chkRemember
- .isEnabled())
+ self._login_widget.set_remember(True)
saved_password = None
try:
@@ -442,12 +474,7 @@ class MainWindow(QtGui.QMainWindow):
logger.debug("Incorrect Password. %r." % (e,))
if saved_password is not None:
- self.ui.lnPassword.setText(saved_password.decode("utf8"))
-
- # Only automatically login if there is a saved user
- # and the password was retrieved right
- self.ui.chkAutoLogin.setChecked(auto_login)
- if auto_login and saved_password:
+ self._login_widget.set_password(saved_password.decode("utf8"))
self._login()
def _try_autostart_eip(self):
@@ -543,6 +570,9 @@ class MainWindow(QtGui.QMainWindow):
def _about(self):
"""
+ SLOT
+ TRIGGERS: self.ui.action_about_leap.triggered
+
Display the About LEAP dialog
"""
QtGui.QMessageBox.about(
@@ -580,7 +610,6 @@ class MainWindow(QtGui.QMainWindow):
self._settings.set_geometry(self.saveGeometry())
self._settings.set_windowstate(self.saveState())
- self._settings.set_autologin(self.ui.chkAutoLogin.isChecked())
QtGui.QMainWindow.closeEvent(self, e)
@@ -615,23 +644,6 @@ class MainWindow(QtGui.QMainWindow):
is_proper_provider = self._settings.get_properprovider()
return not (has_provider_on_disk and is_proper_provider)
- def _focus_password(self):
- """
- Focuses in the password lineedit
- """
- self.ui.lnPassword.setFocus()
-
- def _set_status(self, status, error=True):
- """
- Sets the status label at the login stage to status
-
- :param status: status message
- :type status: str
- """
- if error:
- status = "<font color='red'><b>%s</b></font>" % (status,)
- self.ui.lblStatus.setText(status)
-
def _set_eip_status(self, status, error=False):
"""
Sets the status label at the VPN stage to status
@@ -644,28 +656,13 @@ class MainWindow(QtGui.QMainWindow):
status = "<font color='red'><b>%s</b></font>" % (status,)
self.ui.lblEIPStatus.setText(status)
- def _login_set_enabled(self, enabled=False):
- """
- Enables or disables all the login widgets
-
- :param enabled: wether they should be enabled or not
- :type enabled: bool
- """
- self.ui.lnUser.setEnabled(enabled)
- self.ui.lnPassword.setEnabled(enabled)
- self.ui.btnLogin.setEnabled(enabled)
- self.ui.chkRemember.setEnabled(enabled)
- if not enabled:
- self.ui.chkAutoLogin.setEnabled(False)
- self.ui.cmbProviders.setEnabled(enabled)
-
def _download_provider_config(self):
"""
Starts the bootstrapping sequence. It will download the
provider configuration if it's not present, otherwise will
emit the corresponding signals inmediately
"""
- provider = self.ui.cmbProviders.currentText()
+ provider = self._login_widget.get_selected_provider()
self._provider_bootstrapper.run_provider_select_checks(
provider,
@@ -685,7 +682,7 @@ class MainWindow(QtGui.QMainWindow):
:type data: dict
"""
if data[self._provider_bootstrapper.PASSED_KEY]:
- provider = self.ui.cmbProviders.currentText()
+ provider = self._login_widget.get_selected_provider()
if self._provider_config.loaded() or \
self._provider_config.load(os.path.join("leap",
"providers",
@@ -695,12 +692,12 @@ class MainWindow(QtGui.QMainWindow):
self._provider_config,
download_if_needed=True)
else:
- self._set_status(
+ self._login_widget.set_status(
self.tr("Could not load provider configuration"))
- self._login_set_enabled(True)
+ self._login_widget.set_enabled(True)
else:
- self._set_status(data[self._provider_bootstrapper.ERROR_KEY])
- self._login_set_enabled(True)
+ self._login_widget.set_status(data[self._provider_bootstrapper.ERROR_KEY])
+ self._login_widget.set_enabled(True)
def _login(self):
"""
@@ -716,29 +713,29 @@ class MainWindow(QtGui.QMainWindow):
"""
leap_assert(self._provider_config, "We need a provider config")
- username = self.ui.lnUser.text()
- password = self.ui.lnPassword.text()
- provider = self.ui.cmbProviders.currentText()
+ username = self._login_widget.get_user()
+ password = self._login_widget.get_password()
+ provider = self._login_widget.get_selected_provider()
self._enabled_services = self._settings.get_enabled_services(
- self.ui.cmbProviders.currentText())
+ self._login_widget.get_selected_provider())
if len(provider) == 0:
- self._set_status(self.tr("Please select a valid provider"))
+ self._login_widget.set_status(self.tr("Please select a valid provider"))
return
if len(username) == 0:
- self._set_status(self.tr("Please provide a valid username"))
+ self._login_widget.set_status(self.tr("Please provide a valid username"))
return
if len(password) == 0:
- self._set_status(self.tr("Please provide a valid Password"))
+ self._login_widget.set_status(self.tr("Please provide a valid Password"))
return
- self._set_status(self.tr("Logging in..."), error=False)
- self._login_set_enabled(False)
+ self._login_widget.set_status(self.tr("Logging in..."), error=False)
+ self._login_widget.set_enabled(False)
- if self.ui.chkRemember.isChecked():
+ if self._login_widget.get_remember():
# in the keyring and in the settings
# we store the value 'usename@provider'
username_domain = (username + '@' + provider).encode("utf8")
@@ -766,8 +763,8 @@ class MainWindow(QtGui.QMainWindow):
leap_assert(self._provider_config, "We need a provider config!")
if data[self._provider_bootstrapper.PASSED_KEY]:
- username = self.ui.lnUser.text().encode("utf8")
- password = self.ui.lnPassword.text().encode("utf8")
+ username = self._login_widget.get_user().encode("utf8")
+ password = self._login_widget.get_password().encode("utf8")
if self._srp_auth is None:
self._srp_auth = SRPAuth(self._provider_config)
@@ -779,8 +776,8 @@ class MainWindow(QtGui.QMainWindow):
# TODO: Add errback!
self._login_defer = self._srp_auth.authenticate(username, password)
else:
- self._set_status(data[self._provider_bootstrapper.ERROR_KEY])
- self._login_set_enabled(True)
+ self._login_widget.set_status(data[self._provider_bootstrapper.ERROR_KEY])
+ self._login_widget.set_enabled(True)
def _authentication_finished(self, ok, message):
"""
@@ -790,7 +787,7 @@ class MainWindow(QtGui.QMainWindow):
Once the user is properly authenticated, try starting the EIP
service
"""
- self._set_status(message, error=not ok)
+ self._login_widget.set_status(message, error=not ok)
if ok:
self.ui.action_sign_out.setEnabled(True)
# We leave a bit of room for the user to see the
@@ -799,7 +796,7 @@ class MainWindow(QtGui.QMainWindow):
QtCore.QTimer.singleShot(1000, self._switch_to_status)
self._login_defer = None
else:
- self._login_set_enabled(True)
+ self._login_widget.set_enabled(True)
def _switch_to_status(self):
"""
@@ -810,8 +807,8 @@ class MainWindow(QtGui.QMainWindow):
self._soledad_bootstrapper.run_soledad_setup_checks(
self._provider_config,
- self.ui.lnUser.text(),
- self.ui.lnPassword.text(),
+ self._login_widget.get_user(),
+ self._login_widget.get_password(),
download_if_needed=True)
self._download_eip_config()
@@ -1163,9 +1160,9 @@ class MainWindow(QtGui.QMainWindow):
"""
self.ui.action_sign_out.setEnabled(False)
self.ui.stackedWidget.setCurrentIndex(self.LOGIN_INDEX)
- self.ui.lnPassword.setText("")
- self._login_set_enabled(True)
- self._set_status("")
+ self._login_widget.set_password("")
+ self._login_widget.set_enabled(True)
+ self._login_widget.set_status("")
def _intermediate_stage(self, data):
"""
@@ -1182,8 +1179,8 @@ class MainWindow(QtGui.QMainWindow):
"""
passed = data[self._provider_bootstrapper.PASSED_KEY]
if not passed:
- self._login_set_enabled(True)
- self._set_status(data[self._provider_bootstrapper.ERROR_KEY])
+ self._login_widget.set_enabled(True)
+ self._login_widget.set_status(data[self._provider_bootstrapper.ERROR_KEY])
def _eip_finished(self, exitCode):
"""
diff --git a/src/leap/gui/ui/login.ui b/src/leap/gui/ui/login.ui
new file mode 100644
index 00000000..88c9ef44
--- /dev/null
+++ b/src/leap/gui/ui/login.ui
@@ -0,0 +1,129 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>LoginWidget</class>
+ <widget class="QWidget" name="LoginWidget">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>356</width>
+ <height>219</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="5" column="2">
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="1" column="1" colspan="2">
+ <widget class="QComboBox" name="cmbProviders"/>
+ </item>
+ <item row="5" column="0">
+ <spacer name="horizontalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="6" column="1">
+ <widget class="QPushButton" name="btnCreateAccount">
+ <property name="text">
+ <string>Create a new account</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_4">
+ <property name="text">
+ <string>&lt;b&gt;Provider:&lt;/b&gt;</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1" colspan="2">
+ <widget class="QLineEdit" name="lnPassword">
+ <property name="inputMask">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1" colspan="2">
+ <widget class="QLineEdit" name="lnUser"/>
+ </item>
+ <item row="4" column="1" colspan="2">
+ <widget class="QCheckBox" name="chkRemember">
+ <property name="text">
+ <string>Remember username and password</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>&lt;b&gt;Username:&lt;/b&gt;</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0">
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>&lt;b&gt;Password:&lt;/b&gt;</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="1">
+ <widget class="QPushButton" name="btnLogin">
+ <property name="text">
+ <string>Log In</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0" colspan="3">
+ <widget class="QLabel" name="lblStatus">
+ <property name="text">
+ <string/>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <tabstops>
+ <tabstop>cmbProviders</tabstop>
+ <tabstop>lnUser</tabstop>
+ <tabstop>lnPassword</tabstop>
+ <tabstop>chkRemember</tabstop>
+ <tabstop>btnLogin</tabstop>
+ <tabstop>btnCreateAccount</tabstop>
+ </tabstops>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/src/leap/gui/ui/mainwindow.ui b/src/leap/gui/ui/mainwindow.ui
index fdf5c167..ae895dce 100644
--- a/src/leap/gui/ui/mainwindow.ui
+++ b/src/leap/gui/ui/mainwindow.ui
@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
- <width>415</width>
+ <width>429</width>
<height>579</height>
</rect>
</property>
@@ -28,19 +28,6 @@
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QGridLayout" name="gridLayout">
- <item row="15" column="2">
- <spacer name="verticalSpacer_2">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
<item row="6" column="2">
<spacer name="verticalSpacer">
<property name="orientation">
@@ -54,18 +41,21 @@
</property>
</spacer>
</item>
- <item row="7" column="3" colspan="2">
- <spacer name="horizontalSpacer_2">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
+ <item row="7" column="2">
+ <widget class="QLabel" name="label">
+ <property name="autoFillBackground">
+ <bool>false</bool>
</property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
+ <property name="text">
+ <string/>
</property>
- </spacer>
+ <property name="pixmap">
+ <pixmap resource="../../../../data/resources/mainwindow.qrc">:/images/leap-color-big.png</pixmap>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
</item>
<item row="7" column="0" colspan="2">
<spacer name="horizontalSpacer">
@@ -80,25 +70,18 @@
</property>
</spacer>
</item>
- <item row="8" column="0" colspan="5">
+ <item row="10" column="0" colspan="5">
<widget class="QStackedWidget" name="stackedWidget">
<property name="currentIndex">
- <number>1</number>
+ <number>0</number>
</property>
- <widget class="QWidget" name="page">
+ <widget class="QWidget" name="loginPage">
<layout class="QGridLayout" name="gridLayout_2">
- <item row="4" column="2">
- <widget class="QCheckBox" name="chkRemember">
- <property name="text">
- <string>Remember</string>
- </property>
- </widget>
- </item>
- <item row="2" column="2" colspan="2">
- <widget class="QLineEdit" name="lnUser"/>
+ <item row="0" column="1">
+ <layout class="QHBoxLayout" name="loginLayout"/>
</item>
- <item row="2" column="0">
- <spacer name="horizontalSpacer_3">
+ <item row="0" column="2">
+ <spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@@ -110,15 +93,8 @@
</property>
</spacer>
</item>
- <item row="6" column="2">
- <widget class="QPushButton" name="btnLogin">
- <property name="text">
- <string>Login</string>
- </property>
- </widget>
- </item>
- <item row="2" column="4">
- <spacer name="horizontalSpacer_4">
+ <item row="0" column="0">
+ <spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@@ -130,66 +106,6 @@
</property>
</spacer>
</item>
- <item row="1" column="1">
- <widget class="QLabel" name="label_4">
- <property name="text">
- <string>&lt;b&gt;Provider:&lt;/b&gt;</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="3" column="1">
- <widget class="QLabel" name="label_3">
- <property name="text">
- <string>&lt;b&gt;Password:&lt;/b&gt;</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="1" column="2" colspan="2">
- <widget class="QComboBox" name="cmbProviders"/>
- </item>
- <item row="3" column="2" colspan="2">
- <widget class="QLineEdit" name="lnPassword">
- <property name="inputMask">
- <string/>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QLabel" name="label_2">
- <property name="text">
- <string>&lt;b&gt;User:&lt;/b&gt;</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="0" column="0" colspan="5">
- <widget class="QLabel" name="lblStatus">
- <property name="text">
- <string/>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item row="5" column="2" colspan="2">
- <widget class="QCheckBox" name="chkAutoLogin">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>Automatically login</string>
- </property>
- </widget>
- </item>
</layout>
</widget>
<widget class="QWidget" name="page_2">
@@ -303,21 +219,31 @@
</widget>
</widget>
</item>
- <item row="7" column="2">
- <widget class="QLabel" name="label">
- <property name="autoFillBackground">
- <bool>false</bool>
+ <item row="7" column="3" colspan="2">
+ <spacer name="horizontalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
</property>
- <property name="text">
- <string/>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
</property>
- <property name="pixmap">
- <pixmap resource="../../../../data/resources/mainwindow.qrc">:/images/leap-color-big.png</pixmap>
+ </spacer>
+ </item>
+ <item row="17" column="2">
+ <spacer name="verticalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
</property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
</property>
- </widget>
+ </spacer>
</item>
<item row="0" column="0" colspan="5">
<layout class="QGridLayout" name="gridLayout_4">
@@ -388,6 +314,39 @@
</item>
</layout>
</item>
+ <item row="9" column="2" colspan="3">
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <spacer name="horizontalSpacer_10">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="btnShowLog">
+ <property name="text">
+ <string>Show Log</string>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ <property name="flat">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
</layout>
</widget>
<widget class="QMenuBar" name="menubar">
@@ -395,8 +354,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>415</width>
- <height>21</height>
+ <width>429</width>
+ <height>25</height>
</rect>
</property>
<widget class="QMenu" name="menuSession">
@@ -415,15 +374,7 @@
<addaction name="separator"/>
<addaction name="action_about_leap"/>
</widget>
- <widget class="QMenu" name="menuSettings">
- <property name="title">
- <string>&amp;Utils</string>
- </property>
- <addaction name="action_wizard"/>
- <addaction name="action_show_logs"/>
- </widget>
<addaction name="menuSession"/>
- <addaction name="menuSettings"/>
<addaction name="menuHelp"/>
</widget>
<widget class="QStatusBar" name="statusbar"/>
@@ -458,13 +409,6 @@
</property>
</action>
</widget>
- <tabstops>
- <tabstop>lnUser</tabstop>
- <tabstop>lnPassword</tabstop>
- <tabstop>chkRemember</tabstop>
- <tabstop>btnLogin</tabstop>
- <tabstop>cmbProviders</tabstop>
- </tabstops>
<resources>
<include location="../../../../data/resources/mainwindow.qrc"/>
<include location="../../../../data/resources/locale.qrc"/>