21 class HgRepoConfigDataDialog(QDialog, Ui_HgRepoConfigDataDialog): |
21 class HgRepoConfigDataDialog(QDialog, Ui_HgRepoConfigDataDialog): |
22 """ |
22 """ |
23 Class implementing a dialog to enter data needed for the initial creation |
23 Class implementing a dialog to enter data needed for the initial creation |
24 of a repository configuration file (hgrc). |
24 of a repository configuration file (hgrc). |
25 """ |
25 """ |
|
26 |
26 def __init__(self, withLargefiles=False, largefilesData=None, parent=None): |
27 def __init__(self, withLargefiles=False, largefilesData=None, parent=None): |
27 """ |
28 """ |
28 Constructor |
29 Constructor |
29 |
30 |
30 @param withLargefiles flag indicating to configure the largefiles |
31 @param withLargefiles flag indicating to configure the largefiles |
31 section (boolean) |
32 section (boolean) |
32 @param largefilesData dictionary with data for the largefiles |
33 @param largefilesData dictionary with data for the largefiles |
33 section (dict) |
34 section (dict) |
34 @param parent reference to the parent widget (QWidget) |
35 @param parent reference to the parent widget (QWidget) |
35 """ |
36 """ |
36 super().__init__(parent) |
37 super().__init__(parent) |
37 self.setupUi(self) |
38 self.setupUi(self) |
38 |
39 |
39 self.defaultShowPasswordButton.setIcon( |
40 self.defaultShowPasswordButton.setIcon(UI.PixmapCache.getIcon("showPassword")) |
40 UI.PixmapCache.getIcon("showPassword")) |
|
41 self.defaultPushShowPasswordButton.setIcon( |
41 self.defaultPushShowPasswordButton.setIcon( |
42 UI.PixmapCache.getIcon("showPassword")) |
42 UI.PixmapCache.getIcon("showPassword") |
43 |
43 ) |
|
44 |
44 self.__withLargefiles = withLargefiles |
45 self.__withLargefiles = withLargefiles |
45 if withLargefiles: |
46 if withLargefiles: |
46 if largefilesData is None: |
47 if largefilesData is None: |
47 largefilesData = getLargefilesDefaults() |
48 largefilesData = getLargefilesDefaults() |
48 self.lfFileSizeSpinBox.setValue(largefilesData["minsize"]) |
49 self.lfFileSizeSpinBox.setValue(largefilesData["minsize"]) |
49 self.lfFilePatternsEdit.setText( |
50 self.lfFilePatternsEdit.setText(" ".join(largefilesData["pattern"])) |
50 " ".join(largefilesData["pattern"])) |
|
51 else: |
51 else: |
52 self.largefilesGroup.setVisible(False) |
52 self.largefilesGroup.setVisible(False) |
53 |
53 |
54 self.resize(self.width(), self.minimumSizeHint().height()) |
54 self.resize(self.width(), self.minimumSizeHint().height()) |
55 |
55 |
56 @pyqtSlot(bool) |
56 @pyqtSlot(bool) |
57 def on_defaultShowPasswordButton_clicked(self, checked): |
57 def on_defaultShowPasswordButton_clicked(self, checked): |
58 """ |
58 """ |
59 Private slot to switch the default password visibility |
59 Private slot to switch the default password visibility |
60 of the default password. |
60 of the default password. |
61 |
61 |
62 @param checked state of the push button (boolean) |
62 @param checked state of the push button (boolean) |
63 """ |
63 """ |
64 if checked: |
64 if checked: |
65 self.defaultPasswordEdit.setEchoMode(QLineEdit.EchoMode.Normal) |
65 self.defaultPasswordEdit.setEchoMode(QLineEdit.EchoMode.Normal) |
66 else: |
66 else: |
67 self.defaultPasswordEdit.setEchoMode(QLineEdit.EchoMode.Password) |
67 self.defaultPasswordEdit.setEchoMode(QLineEdit.EchoMode.Password) |
68 |
68 |
69 @pyqtSlot(bool) |
69 @pyqtSlot(bool) |
70 def on_defaultPushShowPasswordButton_clicked(self, checked): |
70 def on_defaultPushShowPasswordButton_clicked(self, checked): |
71 """ |
71 """ |
72 Private slot to switch the default password visibility |
72 Private slot to switch the default password visibility |
73 of the default push password. |
73 of the default push password. |
74 |
74 |
75 @param checked state of the push button (boolean) |
75 @param checked state of the push button (boolean) |
76 """ |
76 """ |
77 if checked: |
77 if checked: |
78 self.defaultPushPasswordEdit.setEchoMode( |
78 self.defaultPushPasswordEdit.setEchoMode(QLineEdit.EchoMode.Normal) |
79 QLineEdit.EchoMode.Normal) |
|
80 else: |
79 else: |
81 self.defaultPushPasswordEdit.setEchoMode( |
80 self.defaultPushPasswordEdit.setEchoMode(QLineEdit.EchoMode.Password) |
82 QLineEdit.EchoMode.Password) |
81 |
83 |
|
84 def getData(self): |
82 def getData(self): |
85 """ |
83 """ |
86 Public method to get the data entered into the dialog. |
84 Public method to get the data entered into the dialog. |
87 |
85 |
88 @return tuple giving the default and default push URLs (tuple of |
86 @return tuple giving the default and default push URLs (tuple of |
89 two strings) |
87 two strings) |
90 """ |
88 """ |
91 defaultUrl = QUrl.fromUserInput(self.defaultUrlEdit.text()) |
89 defaultUrl = QUrl.fromUserInput(self.defaultUrlEdit.text()) |
92 username = self.defaultUserEdit.text() |
90 username = self.defaultUserEdit.text() |
94 if username: |
92 if username: |
95 defaultUrl.setUserName(username) |
93 defaultUrl.setUserName(username) |
96 if password: |
94 if password: |
97 defaultUrl.setPassword(password) |
95 defaultUrl.setPassword(password) |
98 defaultUrl = defaultUrl.toString() if defaultUrl.isValid() else "" |
96 defaultUrl = defaultUrl.toString() if defaultUrl.isValid() else "" |
99 |
97 |
100 defaultPushUrl = QUrl.fromUserInput(self.defaultPushUrlEdit.text()) |
98 defaultPushUrl = QUrl.fromUserInput(self.defaultPushUrlEdit.text()) |
101 username = self.defaultPushUserEdit.text() |
99 username = self.defaultPushUserEdit.text() |
102 password = self.defaultPushPasswordEdit.text() |
100 password = self.defaultPushPasswordEdit.text() |
103 if username: |
101 if username: |
104 defaultPushUrl.setUserName(username) |
102 defaultPushUrl.setUserName(username) |
105 if password: |
103 if password: |
106 defaultPushUrl.setPassword(password) |
104 defaultPushUrl.setPassword(password) |
107 defaultPushUrl = ( |
105 defaultPushUrl = defaultPushUrl.toString() if defaultPushUrl.isValid() else "" |
108 defaultPushUrl.toString() |
106 |
109 if defaultPushUrl.isValid() else |
|
110 "" |
|
111 ) |
|
112 |
|
113 return defaultUrl, defaultPushUrl |
107 return defaultUrl, defaultPushUrl |
114 |
108 |
115 def getLargefilesData(self): |
109 def getLargefilesData(self): |
116 """ |
110 """ |
117 Public method to get the data for the largefiles extension. |
111 Public method to get the data for the largefiles extension. |
118 |
112 |
119 @return tuple with the minimum file size (integer) and file patterns |
113 @return tuple with the minimum file size (integer) and file patterns |
120 (list of string). None as value denote to use the default value. |
114 (list of string). None as value denote to use the default value. |
121 """ |
115 """ |
122 if self.__withLargefiles: |
116 if self.__withLargefiles: |
123 lfDefaults = getLargefilesDefaults() |
117 lfDefaults = getLargefilesDefaults() |