20
20
NONE = QVariant() #: Null value to return from the data function of item models
22
ALL_COLUMNS = ['title', 'authors', 'size', 'timestamp', 'rating', 'publisher', 'tags', 'series']
22
ALL_COLUMNS = ['title', 'authors', 'size', 'timestamp', 'rating', 'publisher',
23
'tags', 'series', 'pubdate']
25
26
c = Config('gui', 'preferences for the calibre GUI')
27
28
help=_('Frequently used directories'))
28
29
c.add_opt('send_to_storage_card_by_default', default=False,
29
30
help=_('Send file to storage card instead of main memory by default'))
30
c.add_opt('save_to_disk_single_format', default='lrf',
31
help=_('The format to use when saving single files to disk'))
32
31
c.add_opt('confirm_delete', default=False,
33
32
help=_('Confirm before deleting'))
34
33
c.add_opt('toolbar_icon_size', default=QSize(48, 48),
49
48
help=_('Defaults for conversion to LRF'))
50
49
c.add_opt('LRF_ebook_viewer_options', default=None,
51
50
help=_('Options for the LRF ebook viewer'))
52
c.add_opt('internally_viewed_formats', default=['LRF', 'EPUB', 'LIT', 'MOBI', 'PRC', 'HTML', 'FB2'],
51
c.add_opt('internally_viewed_formats', default=['LRF', 'EPUB', 'LIT',
52
'MOBI', 'PRC', 'HTML', 'FB2', 'PDB', 'RB'],
53
53
help=_('Formats that are viewed using the internal viewer'))
54
54
c.add_opt('column_map', default=ALL_COLUMNS,
55
55
help=_('Columns to be displayed in the book list'))
71
71
help='Show donation button')
72
72
c.add_opt('asked_library_thing_password', default=False,
73
73
help='Asked library thing password at least once.')
74
c.add_opt('search_as_you_type', default=True,
75
help='Start searching as you type. If this is disabled then search will '
76
'only take place when the Enter or Return key is pressed.')
74
77
return ConfigProxy(c)
100
103
def extension(path):
101
104
return os.path.splitext(path)[1][1:].lower()
103
def warning_dialog(parent, title, msg):
106
def warning_dialog(parent, title, msg, det_msg='', show=False):
104
107
d = QMessageBox(QMessageBox.Warning, 'WARNING: '+title, msg, QMessageBox.Ok,
109
d.setDetailedText(det_msg)
106
110
d.setIconPixmap(QPixmap(':/images/dialog_warning.svg'))
109
def error_dialog(parent, title, msg):
116
def error_dialog(parent, title, msg, det_msg='', show=False):
110
117
d = QMessageBox(QMessageBox.Critical, 'ERROR: '+title, msg, QMessageBox.Ok,
119
d.setDetailedText(det_msg)
112
120
d.setIconPixmap(QPixmap(':/images/dialog_error.svg'))
115
def question_dialog(parent, title, msg):
125
def question_dialog(parent, title, msg, det_msg=''):
116
126
d = QMessageBox(QMessageBox.Question, title, msg, QMessageBox.Yes|QMessageBox.No,
128
d.setDetailedText(det_msg)
118
129
d.setIconPixmap(QPixmap(':/images/dialog_information.svg'))
130
return d.exec_() == QMessageBox.Yes
121
def info_dialog(parent, title, msg):
132
def info_dialog(parent, title, msg, det_msg='', show=False):
122
133
d = QMessageBox(QMessageBox.Information, title, msg, QMessageBox.NoButton,
135
d.setDetailedText(det_msg)
124
136
d.setIconPixmap(QPixmap(':/images/dialog_information.svg'))
127
142
def qstring_to_unicode(q):
128
143
return unicode(q)