10
from mercurial import ui, util, error, extensions
10
from mercurial import ui, util, error, extensions, scmutil
12
12
from tortoisehg.util import hglib, settings, paths, wconfig, i18n, bugtraq
13
13
from tortoisehg.hgqt.i18n import _
151
151
def isDirty(self):
152
152
return self.value() != self.curvalue
154
class PasswordEntry(QLineEdit):
154
class LineEditBox(QLineEdit):
155
155
def __init__(self, parent=None, **opts):
156
156
QLineEdit.__init__(self, parent, toolTip=opts['tooltip'])
158
158
self.curvalue = None
159
self.setEchoMode(QLineEdit.Password)
160
159
self.setMinimumWidth(ENTRY_WIDTH)
162
161
## common APIs for all edit widgets
174
173
def isDirty(self):
175
174
return self.value() != self.curvalue
176
class PasswordEntry(LineEditBox):
177
def __init__(self, parent=None, **opts):
178
QLineEdit.__init__(self, parent, toolTip=opts['tooltip'])
181
self.setEchoMode(QLineEdit.Password)
182
self.setMinimumWidth(ENTRY_WIDTH)
183
class TextEntry(QTextEdit):
184
def __init__(self, parent=None, **opts):
185
QTextEdit.__init__(self, parent, toolTip=opts['tooltip'])
188
self.setMinimumWidth(ENTRY_WIDTH)
190
## common APIs for all edit widgets
191
def setValue(self, curvalue):
192
self.curvalue = curvalue
194
self.setPlainText(hglib.tounicode(curvalue))
196
self.setPlainText('')
199
# It is not possible to set a multi-line value with an empty line
200
utext = self.removeEmptyLines(self.toPlainText())
201
return utext and hglib.fromunicode(utext) or None
204
return self.value() != self.curvalue
206
def removeEmptyLines(self, text):
209
rawlines = hglib.fromunicode(text).splitlines()
211
for line in rawlines:
215
return os.linesep.join(lines)
177
218
class FontEntry(QWidget):
178
219
def __init__(self, parent=None, **opts):
179
220
QWidget.__init__(self, parent, toolTip=opts['tooltip'])
377
418
opts['validator'] = QIntValidator()
378
419
return SettingsCombo(**opts)
421
def genLineEditBox(opts):
422
'Generate a single line text entry box'
423
return LineEditBox(**opts)
380
425
def genPasswordEntry(opts):
381
426
'Generate a password entry box'
382
427
return PasswordEntry(**opts)
428
def genTextEntry(opts):
429
'Generate a multi-line text input entry box'
430
return TextEntry(**opts)
384
432
def genDefaultCombo(opts, defaults=[]):
385
433
'user must select from a list'
464
512
_('Graphical merge program for resolving merge conflicts. If left '
465
513
'unspecified, Mercurial will use the first applicable tool it finds '
466
514
'on your system or use its internal merge tool that leaves conflict '
467
'markers in place. Chose internal:merge to force conflict markers ,'
515
'markers in place. Choose internal:merge to force conflict markers, '
468
516
'internal:prompt to always select local or other, or internal:dump '
469
517
'to leave files in the working directory for manual merging')),
470
518
_fi(_('Visual Diff Tool'), 'tortoisehg.vdiff',
525
573
({'name': 'log', 'label': _('Workbench'), 'icon': 'menulog'}, (
574
_fi(_('Single Workbench Window'), 'tortoisehg.workbench.single', genBoolRBGroup,
575
_('Select whether you want to have a single workbench window. '
576
'If you disable this setting you will get a new workbench window everytime that you use the "Hg Workbench"'
577
'command on the explorer context menu. Default: True'),
578
restartneeded=True, globalonly=True),
526
579
_fi(_('Default widget'), 'tortoisehg.defaultwidget', (genDefaultCombo,
527
580
['revdetails', 'commit', 'mq', 'sync', 'manifest', 'search']),
528
581
_('Select the initial widget that will be shown when opening a '
587
640
'<li><b>revision</b>: Push the changes in the current branch '
588
641
'<i><u>up to</u> the current revision</i>.</ul><p>'
589
642
'Default: all')),
643
_fi(_('Activate Bookmarks'), 'tortoisehg.activatebookmarks', (genDefaultCombo,
644
['auto', 'prompt', 'never']),
645
_('Select when TortoiseHg will show a prompt to activate a bookmark '
646
'when updating to a revision that has one or more bookmarks.'
647
'<ul><li><b>auto</b>: Try to automatically activate bookmarks. When '
648
'updating to a revision that has a single bookmark it will be activated '
649
'automatically. Show a prompt if there is more than one bookmark on the '
650
'revision that is being updated to.'
651
'<li><b>prompt</b>: The default. Show a prompt when updating to a '
652
'revision that has one or more bookmarks.'
653
'<li><b>never</b>: Never show any prompt to activate any bookmarks.'
591
657
({'name': 'commit', 'label': _('Commit', 'config item'), 'icon': 'menucommit'}, (
592
658
_fi(_('Username'), 'ui.username', genEditCombo,
635
701
'- <b>alwayslocal</b>: same as "<b>always</b>" but restricts forced '
636
702
'refreshes to <i>local repos</i>.<br>'
637
703
'Default: auto')),
704
_fi(_('Confirm adding unknown files'), 'tortoisehg.confirmaddfiles', genBoolRBGroup,
705
_('Determines if TortoiseHg should show a confirmation dialog '
706
'before adding new files in a commit. '
707
'If True, a confirmation dialog will be showed. '
708
'If False, selected new files will be included in the '
709
'commit with no confirmation dialog. Default: True')),
710
_fi(_('Confirm deleting files'), 'tortoisehg.confirmdeletefiles', genBoolRBGroup,
711
_('Determines if TortoiseHg should show a confirmation dialog '
712
'before removing files in a commit. '
713
'If True, a confirmation dialog will be showed. '
714
'If False, selected deleted files will be included in the '
715
'commit with no confirmation dialog. Default: True')),
640
718
({'name': 'web', 'label': _('Web Server'), 'icon': 'proxy'}, (
799
877
'while {1} refers to the first group and so on. If no {n} tokens'
800
878
'are found in issue.link, the entire matched string is appended '
880
_fi(_('Inline Tags'), 'tortoisehg.issue.inlinetags', genBoolRBGroup,
881
_('Show tags at start of commit message.')),
802
882
_fi(_('Mandatory Issue Reference'), 'tortoisehg.issue.linkmandatory', genBoolRBGroup,
803
883
_('When committing, require that a reference to an issue be specified. '
804
884
'If enabled, the regex configured in \'Issue Regex\' must find a match '
813
893
_fi(_('Issue Tracker Trigger'), 'tortoisehg.issue.bugtraqtrigger', (genDefaultCombo,
814
894
['never', 'commit']),
815
895
_('Determines when the issue tracker state will be updated by TortoiseHg. Valid settings values are:'
816
'<ul><li><b>never</b>: Do not update the Issue Tracker state automaticaly.'
817
'<li><b>commit</b>: Update the Issue Tracker state after a successful commit.</ol><p>'
896
'<ul><li><b>never</b>: Do not update the Issue Tracker state automatically.'
897
'<li><b>commit</b>: Update the Issue Tracker state after a successful commit.</ul><p>'
818
898
'Default: never'),
819
899
master='tortoisehg.issue.bugtraqplugin', visible=issuePluginVisible),
849
929
_fi(_('Patterns'), 'largefiles.patterns', genEditCombo,
850
930
_('Files with names meeting the specified patterns will be automatically '
851
931
'added as largefiles')),
852
_fi(_('Size'), 'largefiles.size', genEditCombo,
932
_fi(_('Minimum Size'), 'largefiles.minsize', genEditCombo,
853
933
_('Files of at least the specified size (in megabytes) will be added as largefiles')),
854
_fi(_('System Cache'), 'largefiles.systemcache', genPathBrowser,
855
_('Path to the directory where a system-wide cache of largefiles will be stored')),
934
_fi(_('User Cache'), 'largefiles.usercache', genPathBrowser,
935
_('Path to the directory where a user\'s cache of largefiles will be stored')),
858
938
({'name': 'projrc', 'label': _('Projrc'), 'icon': 'settings_projrc', 'extension': 'projrc'}, (
859
_fi(_('Require confirmation'), 'projrc.confirm', genBoolRBGroup,
860
_('Ask the user to confirm the update of the local "projrc" configuration file '
861
'when the remote projrc file changes. Default is "True".')),
939
_fi(_('Require confirmation'), 'projrc.confirm', (genDefaultCombo, ['always', 'first', 'never']),
940
_('When to ask the user to confirm the update of the local "projrc" configuration file '
941
'when the remote projrc file changes. Possible values are:'
942
'<ul><li><b>always</b>: [<i>default</i>] '
943
'Always show a confirmation prompt before updating the local .hg/projrc file.'
944
'<li><b>first</b>: Show a confirmation dialog when the repository is cloned '
945
'or when a remote projrc file is found for the first time.'
946
'<li><b>never</b>: Update the local .hg/projrc file automatically, '
947
'without requiring any user confirmation.</ul>')),
862
948
_fi(_('Servers'), 'projrc.servers', genEditCombo,
863
949
_('List of Servers from which "projrc" configuration files must be pulled. '
864
950
'Set it to "*" to pull from all servers. Set it to "default" to pull from the default sync path.'
868
954
_fi(_('Exclude'), 'projrc.exclude', genEditCombo,
869
955
_('List of settings that will NOT be pulled form the project configuration file. '
870
956
'Default is exclude none of the included settings.')),
957
_fi(_('Update on incoming'), 'projrc.updateonincoming', (genDefaultCombo, ['never', 'prompt', 'auto']),
958
_('Let the user update the projrc on incoming:'
959
'<ul><li><b>never</b>: [<i>default</i>] '
960
'Show whether the remote projrc file has changed, '
961
'but do not update (nor ask to update) the local projrc file.'
962
'<li><b>prompt</b>: Look for changes to the projrc file. '
963
'If there are changes _always_ show a confirmation prompt, '
964
'asking the user if it wants to update its local projrc file.'
965
'<li><b>auto</b>: Look for changes to the projrc file. '
966
'Use the value of the "projrc.confirm" configuration key to '
967
'determine whether to show a confirmation dialog or not '
968
'before updating the local projrc file.</ul><p>'
909
1008
self.conftabs = QTabWidget()
910
1009
layout.addWidget(self.conftabs)
911
utab = SettingsForm(rcpath=hglib.user_rcpath(), focus=focus)
1010
utab = SettingsForm(rcpath=scmutil.userrcpath(), focus=focus)
912
1011
self.conftabs.addTab(utab, qtlib.geticon('settings_user'),
913
1012
_("%s's global settings") % username())
914
1013
utab.restartRequested.connect(self._pushRestartRequest)