Fix #2720 ('Proper Case' Function)

This commit is contained in:
Kovid Goyal 2009-06-26 18:49:51 -07:00
commit 6c207d4a95
7 changed files with 507 additions and 405 deletions

View File

@ -20,36 +20,6 @@
<string>Book Cover</string>
</property>
<layout class="QGridLayout" name="_2">
<item row="0" column="0">
<layout class="QHBoxLayout" name="_3">
<item>
<widget class="ImageView" name="cover">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../../../../../../calibre/gui2/images.qrc">:/images/book.svg</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="opt_prefer_metadata_cover">
<property name="text">
<string>Use cover from &amp;source file</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<layout class="QVBoxLayout" name="_4">
<property name="spacing">
@ -92,7 +62,7 @@
<string>...</string>
</property>
<property name="icon">
<iconset resource="../../../../../../calibre/gui2/images.qrc">
<iconset resource="../images.qrc">
<normaloff>:/images/document_open.svg</normaloff>:/images/document_open.svg</iconset>
</property>
</widget>
@ -101,6 +71,36 @@
</item>
</layout>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="opt_prefer_metadata_cover">
<property name="text">
<string>Use cover from &amp;source file</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<layout class="QHBoxLayout" name="_3">
<item>
<widget class="ImageView" name="cover">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../images.qrc">:/images/book.svg</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
<zorder>opt_prefer_metadata_cover</zorder>
<zorder></zorder>
@ -124,7 +124,7 @@
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="title">
<widget class="EnLineEdit" name="title">
<property name="toolTip">
<string>Change the title of this book</string>
</property>
@ -144,7 +144,7 @@
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="author">
<widget class="EnLineEdit" name="author">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>1</horstretch>
@ -170,7 +170,7 @@
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="author_sort">
<widget class="EnLineEdit" name="author_sort">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
@ -196,7 +196,7 @@
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="publisher">
<widget class="EnLineEdit" name="publisher">
<property name="toolTip">
<string>Change the publisher of this book</string>
</property>
@ -216,7 +216,7 @@
</widget>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="tags">
<widget class="EnLineEdit" name="tags">
<property name="toolTip">
<string>Tags categorize the book. This is particularly useful while searching. &lt;br&gt;&lt;br&gt;They can be any words or phrases, separated by commas.</string>
</property>
@ -239,7 +239,7 @@
</widget>
</item>
<item row="5" column="1">
<widget class="QComboBox" name="series">
<widget class="EnComboBox" name="series">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>10</horstretch>
@ -319,10 +319,21 @@
<extends>QLabel</extends>
<header>widgets.h</header>
</customwidget>
<customwidget>
<class>EnLineEdit</class>
<extends>QLineEdit</extends>
<header>widgets.h</header>
</customwidget>
<customwidget>
<class>EnComboBox</class>
<extends>QComboBox</extends>
<header>widgets.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="../../../../../../calibre/gui2/images.qrc"/>
<include location="../images.qrc"/>
<include location="../images.qrc"/>
<include location="../../../../../gui2/images.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -29,7 +29,7 @@
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="opt_title"/>
<widget class="EnLineEdit" name="opt_title"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="author_label">
@ -42,7 +42,7 @@
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="opt_author"/>
<widget class="EnLineEdit" name="opt_author"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
@ -155,6 +155,13 @@
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>EnLineEdit</class>
<extends>QLineEdit</extends>
<header>widgets.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="../images.qrc"/>
</resources>

View File

@ -1,235 +1,236 @@
<ui version="4.0" >
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MetadataBulkDialog</class>
<widget class="QDialog" name="MetadataBulkDialog" >
<property name="geometry" >
<widget class="QDialog" name="MetadataBulkDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>461</width>
<width>495</width>
<height>387</height>
</rect>
</property>
<property name="windowTitle" >
<property name="windowTitle">
<string>Edit Meta information</string>
</property>
<property name="windowIcon" >
<iconset resource="../images.qrc" >
<property name="windowIcon">
<iconset resource="../images.qrc">
<normaloff>:/images/edit_input.svg</normaloff>:/images/edit_input.svg</iconset>
</property>
<layout class="QGridLayout" name="gridLayout_2" >
<item row="0" column="0" >
<widget class="QSplitter" name="splitter" >
<property name="orientation" >
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QSplitter" name="splitter">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<widget class="QWidget" name="layoutWidget" >
<layout class="QVBoxLayout" >
<property name="spacing" >
<widget class="QWidget" name="layoutWidget">
<layout class="QVBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin" >
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QGroupBox" name="groupBox" >
<property name="title" >
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Meta information</string>
</property>
<layout class="QGridLayout" name="gridLayout" >
<item row="0" column="0" >
<widget class="QLabel" name="label_2" >
<property name="text" >
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>&amp;Author(s): </string>
</property>
<property name="alignment" >
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy" >
<property name="buddy">
<cstring>authors</cstring>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2" >
<widget class="QLineEdit" name="authors" >
<property name="toolTip" >
<item row="0" column="1" colspan="2">
<widget class="EnLineEdit" name="authors">
<property name="toolTip">
<string>Change the author(s) of this book. Multiple authors should be separated by an &amp;. If the author name contains an &amp;, use &amp;&amp; to represent it.</string>
</property>
</widget>
</item>
<item row="2" column="0" >
<widget class="QLabel" name="label_8" >
<property name="text" >
<item row="2" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Author S&amp;ort: </string>
</property>
<property name="alignment" >
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy" >
<property name="buddy">
<cstring>authors</cstring>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2" >
<widget class="QLineEdit" name="author_sort" >
<property name="toolTip" >
<item row="2" column="1" colspan="2">
<widget class="EnLineEdit" name="author_sort">
<property name="toolTip">
<string>Specify how the author(s) of this book should be sorted. For example Charles Dickens should be sorted as Dickens, Charles.</string>
</property>
</widget>
</item>
<item row="3" column="0" >
<widget class="QLabel" name="label_6" >
<property name="text" >
<item row="3" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>&amp;Rating:</string>
</property>
<property name="alignment" >
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy" >
<property name="buddy">
<cstring>rating</cstring>
</property>
</widget>
</item>
<item row="3" column="1" colspan="2" >
<widget class="QSpinBox" name="rating" >
<property name="toolTip" >
<item row="3" column="1" colspan="2">
<widget class="QSpinBox" name="rating">
<property name="toolTip">
<string>Rating of this book. 0-5 stars</string>
</property>
<property name="whatsThis" >
<property name="whatsThis">
<string>Rating of this book. 0-5 stars</string>
</property>
<property name="buttonSymbols" >
<property name="buttonSymbols">
<enum>QAbstractSpinBox::PlusMinus</enum>
</property>
<property name="suffix" >
<property name="suffix">
<string> stars</string>
</property>
<property name="maximum" >
<property name="maximum">
<number>5</number>
</property>
</widget>
</item>
<item row="4" column="0" >
<widget class="QLabel" name="label_3" >
<property name="text" >
<item row="4" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>&amp;Publisher: </string>
</property>
<property name="alignment" >
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy" >
<property name="buddy">
<cstring>publisher</cstring>
</property>
</widget>
</item>
<item row="4" column="1" colspan="2" >
<widget class="QLineEdit" name="publisher" >
<property name="toolTip" >
<item row="4" column="1" colspan="2">
<widget class="EnLineEdit" name="publisher">
<property name="toolTip">
<string>Change the publisher of this book</string>
</property>
</widget>
</item>
<item row="5" column="0" >
<widget class="QLabel" name="label_4" >
<property name="text" >
<item row="5" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Add Ta&amp;gs: </string>
</property>
<property name="alignment" >
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy" >
<property name="buddy">
<cstring>tags</cstring>
</property>
</widget>
</item>
<item row="5" column="1" >
<widget class="QLineEdit" name="tags" >
<property name="toolTip" >
<string>Tags categorize the book. This is particularly useful while searching. &lt;br>&lt;br>They can be any words or phrases, separated by commas.</string>
<item row="5" column="1">
<widget class="EnLineEdit" name="tags">
<property name="toolTip">
<string>Tags categorize the book. This is particularly useful while searching. &lt;br&gt;&lt;br&gt;They can be any words or phrases, separated by commas.</string>
</property>
</widget>
</item>
<item row="5" column="2" >
<widget class="QToolButton" name="tag_editor_button" >
<property name="toolTip" >
<item row="5" column="2">
<widget class="QToolButton" name="tag_editor_button">
<property name="toolTip">
<string>Open Tag Editor</string>
</property>
<property name="text" >
<property name="text">
<string>Open Tag Editor</string>
</property>
<property name="icon" >
<iconset resource="../images.qrc" >
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/chapters.svg</normaloff>:/images/chapters.svg</iconset>
</property>
</widget>
</item>
<item row="6" column="0" >
<widget class="QLabel" name="label" >
<property name="text" >
<item row="6" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>&amp;Remove tags:</string>
</property>
<property name="buddy" >
<property name="buddy">
<cstring>remove_tags</cstring>
</property>
</widget>
</item>
<item row="6" column="1" colspan="2" >
<widget class="QLineEdit" name="remove_tags" >
<property name="toolTip" >
<item row="6" column="1" colspan="2">
<widget class="EnLineEdit" name="remove_tags">
<property name="toolTip">
<string>Comma separated list of tags to remove from the books. </string>
</property>
</widget>
</item>
<item row="7" column="0" >
<widget class="QLabel" name="label_7" >
<property name="text" >
<item row="7" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>&amp;Series:</string>
</property>
<property name="textFormat" >
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="alignment" >
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy" >
<property name="buddy">
<cstring>series</cstring>
</property>
</widget>
</item>
<item row="7" column="1" >
<widget class="QComboBox" name="series" >
<property name="toolTip" >
<item row="7" column="1">
<widget class="EnComboBox" name="series">
<property name="toolTip">
<string>List of known series. You can add new series.</string>
</property>
<property name="whatsThis" >
<property name="whatsThis">
<string>List of known series. You can add new series.</string>
</property>
<property name="editable" >
<property name="editable">
<bool>true</bool>
</property>
<property name="insertPolicy" >
<property name="insertPolicy">
<enum>QComboBox::InsertAlphabetically</enum>
</property>
<property name="sizeAdjustPolicy" >
<property name="sizeAdjustPolicy">
<enum>QComboBox::AdjustToContents</enum>
</property>
</widget>
</item>
<item row="8" column="1" >
<widget class="QComboBox" name="remove_format" />
<item row="8" column="1">
<widget class="QComboBox" name="remove_format"/>
</item>
<item row="8" column="0" >
<widget class="QLabel" name="label_5" >
<property name="text" >
<item row="8" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Remove &amp;format:</string>
</property>
<property name="buddy" >
<property name="buddy">
<cstring>remove_format</cstring>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QCheckBox" name="auto_author_sort" >
<property name="text" >
<item row="1" column="1">
<widget class="QCheckBox" name="auto_author_sort">
<property name="text">
<string>A&amp;utomatically set author sort</string>
</property>
</widget>
@ -241,20 +242,32 @@
</widget>
</widget>
</item>
<item row="1" column="0" >
<widget class="QDialogButtonBox" name="button_box" >
<property name="orientation" >
<item row="1" column="0">
<widget class="QDialogButtonBox" name="button_box">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons" >
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>EnLineEdit</class>
<extends>QLineEdit</extends>
<header>widgets.h</header>
</customwidget>
<customwidget>
<class>EnComboBox</class>
<extends>QComboBox</extends>
<header>widgets.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="../images.qrc" />
<include location="../images.qrc"/>
</resources>
<connections>
<connection>
@ -263,11 +276,11 @@
<receiver>MetadataBulkDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel" >
<hint type="sourcelabel">
<x>252</x>
<y>382</y>
</hint>
<hint type="destinationlabel" >
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
@ -279,11 +292,11 @@
<receiver>MetadataBulkDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel" >
<hint type="sourcelabel">
<x>320</x>
<y>382</y>
</hint>
<hint type="destinationlabel" >
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
@ -295,11 +308,11 @@
<receiver>author_sort</receiver>
<slot>setDisabled(bool)</slot>
<hints>
<hint type="sourcelabel" >
<hint type="sourcelabel">
<x>240</x>
<y>95</y>
</hint>
<hint type="destinationlabel" >
<hint type="destinationlabel">
<x>240</x>
<y>113</y>
</hint>

View File

@ -43,8 +43,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>879</width>
<height>710</height>
<width>869</width>
<height>696</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
@ -87,7 +87,7 @@
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="title">
<widget class="EnLineEdit" name="title">
<property name="toolTip">
<string>Change the title of this book</string>
</property>
@ -142,7 +142,7 @@
<item row="2" column="1" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLineEdit" name="author_sort">
<widget class="EnLineEdit" name="author_sort">
<property name="toolTip">
<string>Specify how the author(s) of this book should be sorted. For example Charles Dickens should be sorted as Dickens, Charles.</string>
</property>
@ -225,7 +225,7 @@
<item row="5" column="1" colspan="2">
<layout class="QHBoxLayout" name="_2">
<item>
<widget class="QLineEdit" name="tags">
<widget class="EnLineEdit" name="tags">
<property name="toolTip">
<string>Tags categorize the book. This is particularly useful while searching. &lt;br&gt;&lt;br&gt;They can be any words or phrases, separated by commas.</string>
</property>
@ -269,7 +269,7 @@
<number>5</number>
</property>
<item>
<widget class="QComboBox" name="series">
<widget class="EnComboBox" name="series">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
@ -339,14 +339,14 @@
</widget>
</item>
<item row="4" column="1">
<widget class="QComboBox" name="publisher">
<widget class="EnComboBox" name="publisher">
<property name="editable">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="authors"/>
<widget class="EnLineEdit" name="authors"/>
</item>
<item row="7" column="1">
<widget class="QDoubleSpinBox" name="series_index">
@ -641,6 +641,16 @@
<extends>QLabel</extends>
<header>widgets.h</header>
</customwidget>
<customwidget>
<class>EnLineEdit</class>
<extends>QLineEdit</extends>
<header>widgets.h</header>
</customwidget>
<customwidget>
<class>EnComboBox</class>
<extends>QComboBox</extends>
<header>widgets.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>title</tabstop>

View File

@ -1,7 +1,8 @@
<ui version="4.0" >
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>TagEditor</class>
<widget class="QDialog" name="TagEditor" >
<property name="geometry" >
<widget class="QDialog" name="TagEditor">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
@ -9,33 +10,34 @@
<height>335</height>
</rect>
</property>
<property name="windowTitle" >
<property name="windowTitle">
<string>Tag Editor</string>
</property>
<property name="windowIcon" >
<iconset resource="../images.qrc" >:/images/chapters.svg</iconset>
<property name="windowIcon">
<iconset resource="../images.qrc">
<normaloff>:/images/chapters.svg</normaloff>:/images/chapters.svg</iconset>
</property>
<layout class="QGridLayout" >
<item row="0" column="0" >
<layout class="QVBoxLayout" >
<layout class="QGridLayout">
<item row="0" column="0">
<layout class="QVBoxLayout">
<item>
<layout class="QHBoxLayout" >
<layout class="QHBoxLayout">
<item>
<widget class="QLabel" name="label" >
<property name="text" >
<widget class="QLabel" name="label">
<property name="text">
<string>A&amp;vailable tags</string>
</property>
<property name="buddy" >
<property name="buddy">
<cstring>available_tags</cstring>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
@ -46,29 +48,30 @@
</layout>
</item>
<item>
<layout class="QHBoxLayout" >
<layout class="QHBoxLayout">
<item>
<widget class="QToolButton" name="delete_button" >
<property name="toolTip" >
<widget class="QToolButton" name="delete_button">
<property name="toolTip">
<string>Delete tag from database. This will unapply the tag from all books and then remove it from the database.</string>
</property>
<property name="text" >
<property name="text">
<string>...</string>
</property>
<property name="icon" >
<iconset resource="../images.qrc" >:/images/trash.svg</iconset>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/trash.svg</normaloff>:/images/trash.svg</iconset>
</property>
</widget>
</item>
<item>
<widget class="QListWidget" name="available_tags" >
<property name="alternatingRowColors" >
<widget class="QListWidget" name="available_tags">
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="selectionMode" >
<property name="selectionMode">
<enum>QAbstractItemView::MultiSelection</enum>
</property>
<property name="selectionBehavior" >
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
</property>
</widget>
@ -77,14 +80,14 @@
</item>
</layout>
</item>
<item row="0" column="1" >
<layout class="QVBoxLayout" >
<item row="0" column="1">
<layout class="QVBoxLayout">
<item>
<spacer>
<property name="orientation" >
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
@ -93,24 +96,25 @@
</spacer>
</item>
<item>
<widget class="QToolButton" name="apply_button" >
<property name="toolTip" >
<widget class="QToolButton" name="apply_button">
<property name="toolTip">
<string>Apply tag to current book</string>
</property>
<property name="text" >
<property name="text">
<string>...</string>
</property>
<property name="icon" >
<iconset resource="../images.qrc" >:/images/forward.svg</iconset>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/forward.svg</normaloff>:/images/forward.svg</iconset>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
@ -120,26 +124,26 @@
</item>
</layout>
</item>
<item row="0" column="2" >
<layout class="QVBoxLayout" >
<item row="0" column="2">
<layout class="QVBoxLayout">
<item>
<layout class="QHBoxLayout" >
<layout class="QHBoxLayout">
<item>
<widget class="QLabel" name="label_2" >
<property name="text" >
<widget class="QLabel" name="label_2">
<property name="text">
<string>A&amp;pplied tags</string>
</property>
<property name="buddy" >
<property name="buddy">
<cstring>applied_tags</cstring>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
@ -150,25 +154,25 @@
</layout>
</item>
<item>
<widget class="QListWidget" name="applied_tags" >
<property name="alternatingRowColors" >
<widget class="QListWidget" name="applied_tags">
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="selectionMode" >
<property name="selectionMode">
<enum>QAbstractItemView::MultiSelection</enum>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="3" >
<layout class="QVBoxLayout" >
<item row="0" column="3">
<layout class="QVBoxLayout">
<item>
<spacer>
<property name="orientation" >
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
@ -177,24 +181,25 @@
</spacer>
</item>
<item>
<widget class="QToolButton" name="unapply_button" >
<property name="toolTip" >
<widget class="QToolButton" name="unapply_button">
<property name="toolTip">
<string>Unapply (remove) tag from current book</string>
</property>
<property name="text" >
<property name="text">
<string>...</string>
</property>
<property name="icon" >
<iconset resource="../images.qrc" >:/images/list_remove.svg</iconset>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/list_remove.svg</normaloff>:/images/list_remove.svg</iconset>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
@ -204,14 +209,14 @@
</item>
</layout>
</item>
<item row="1" column="0" colspan="4" >
<layout class="QHBoxLayout" >
<item row="1" column="0" colspan="4">
<layout class="QHBoxLayout">
<item>
<spacer>
<property name="orientation" >
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
@ -220,41 +225,42 @@
</spacer>
</item>
<item>
<widget class="QLabel" name="label_3" >
<property name="text" >
<widget class="QLabel" name="label_3">
<property name="text">
<string>&amp;Add tag:</string>
</property>
<property name="buddy" >
<property name="buddy">
<cstring>add_tag_input</cstring>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="add_tag_input" >
<property name="toolTip" >
<widget class="EnLineEdit" name="add_tag_input">
<property name="toolTip">
<string>If the tag you want is not in the available list, you can add it here. Accepts a comma separated list of tags.</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="add_tag_button" >
<property name="toolTip" >
<widget class="QToolButton" name="add_tag_button">
<property name="toolTip">
<string>Add tag to available tags and apply it to current book</string>
</property>
<property name="text" >
<property name="text">
<string>...</string>
</property>
<property name="icon" >
<iconset resource="../images.qrc" >:/images/plus.svg</iconset>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/plus.svg</normaloff>:/images/plus.svg</iconset>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
@ -264,20 +270,27 @@
</item>
</layout>
</item>
<item row="2" column="0" colspan="4" >
<widget class="QDialogButtonBox" name="buttonBox" >
<property name="orientation" >
<item row="2" column="0" colspan="4">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons" >
<set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>EnLineEdit</class>
<extends>QLineEdit</extends>
<header>widgets.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="../images.qrc" />
<include location="../images.qrc"/>
</resources>
<connections>
<connection>
@ -286,11 +299,11 @@
<receiver>TagEditor</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel" >
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel" >
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
@ -302,11 +315,11 @@
<receiver>TagEditor</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel" >
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel" >
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>

View File

@ -1,7 +1,8 @@
<ui version="4.0" >
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Dialog</class>
<widget class="QDialog" name="Dialog" >
<property name="geometry" >
<widget class="QDialog" name="Dialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
@ -9,66 +10,66 @@
<height>640</height>
</rect>
</property>
<property name="windowTitle" >
<property name="windowTitle">
<string>Add custom news source</string>
</property>
<property name="windowIcon" >
<iconset resource="../images.qrc" >
<property name="windowIcon">
<iconset resource="../images.qrc">
<normaloff>:/images/user_profile.svg</normaloff>:/images/user_profile.svg</iconset>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4" >
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QScrollArea" name="scrollArea" >
<property name="frameShape" >
<widget class="QScrollArea" name="scrollArea">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="lineWidth" >
<property name="lineWidth">
<number>0</number>
</property>
<property name="widgetResizable" >
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents" >
<property name="geometry" >
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>730</width>
<height>600</height>
<width>720</width>
<height>586</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3" >
<property name="margin" >
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QWidget" native="1" name="central_widget" >
<property name="minimumSize" >
<widget class="QWidget" name="central_widget" native="true">
<property name="minimumSize">
<size>
<width>680</width>
<height>550</height>
</size>
</property>
<layout class="QHBoxLayout" name="horizontalLayout" >
<property name="margin" >
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QGroupBox" name="groupBox" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="Minimum" >
<widget class="QGroupBox" name="groupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title" >
<property name="title">
<string>Available user recipes</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2" >
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="BasicList" name="available_profiles" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Expanding" hsizetype="Minimum" >
<widget class="BasicList" name="available_profiles">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -76,56 +77,56 @@
</widget>
</item>
<item>
<widget class="QPushButton" name="add_profile_button" >
<property name="text" >
<widget class="QPushButton" name="add_profile_button">
<property name="text">
<string>Add/Update &amp;recipe</string>
</property>
<property name="icon" >
<iconset resource="../images.qrc" >
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/plus.svg</normaloff>:/images/plus.svg</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="remove_profile_button" >
<property name="text" >
<widget class="QPushButton" name="remove_profile_button">
<property name="text">
<string>&amp;Remove recipe</string>
</property>
<property name="icon" >
<iconset resource="../images.qrc" >
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/list_remove.svg</normaloff>:/images/list_remove.svg</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="share_button" >
<property name="text" >
<widget class="QPushButton" name="share_button">
<property name="text">
<string>&amp;Share recipe</string>
</property>
<property name="icon" >
<iconset resource="../images.qrc" >
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/forward.svg</normaloff>:/images/forward.svg</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="builtin_recipe_button" >
<property name="text" >
<widget class="QPushButton" name="builtin_recipe_button">
<property name="text">
<string>Customize &amp;builtin recipe</string>
</property>
<property name="icon" >
<iconset resource="../images.qrc" >
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/news.svg</normaloff>:/images/news.svg</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="load_button" >
<property name="text" >
<widget class="QPushButton" name="load_button">
<property name="text">
<string>&amp;Load recipe from file</string>
</property>
<property name="icon" >
<iconset resource="../images.qrc" >
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/chapters.svg</normaloff>:/images/chapters.svg</iconset>
</property>
</widget>
@ -134,59 +135,59 @@
</widget>
</item>
<item>
<widget class="QFrame" name="frame" >
<property name="frameShape" >
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow" >
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout" >
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QPushButton" name="toggle_mode_button" >
<property name="text" >
<widget class="QPushButton" name="toggle_mode_button">
<property name="text">
<string>Switch to Advanced mode</string>
</property>
</widget>
</item>
<item>
<widget class="QStackedWidget" name="stacks" >
<property name="currentIndex" >
<widget class="QStackedWidget" name="stacks">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="page" >
<layout class="QVBoxLayout" name="verticalLayout_5" >
<widget class="QWidget" name="page">
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<widget class="QLabel" name="label" >
<property name="text" >
<string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
<widget class="QLabel" name="label">
<property name="text">
<string>&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style>&lt;/head>&lt;body style=" font-family:'DejaVu Sans'; font-size:10pt; font-weight:400; font-style:normal;">
&lt;p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Create a basic news recipe, by adding RSS feeds to it. &lt;br />For most feeds, you will have to use the "Advanced mode" to further customize the fetch process.&lt;/p>&lt;/body>&lt;/html></string>
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'DejaVu Sans'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Create a basic news recipe, by adding RSS feeds to it. &lt;br /&gt;For most feeds, you will have to use the &quot;Advanced mode&quot; to further customize the fetch process.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="textFormat" >
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
<property name="wordWrap" >
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QGridLayout" >
<item row="0" column="0" >
<widget class="QLabel" name="label_2" >
<property name="text" >
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Recipe &amp;title:</string>
</property>
<property name="buddy" >
<property name="buddy">
<cstring>profile_title</cstring>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2" >
<widget class="QLineEdit" name="profile_title" >
<property name="font" >
<item row="0" column="1" colspan="2">
<widget class="EnLineEdit" name="profile_title">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
@ -194,57 +195,57 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item row="2" column="0" >
<widget class="QLabel" name="label_6" >
<property name="text" >
<item row="2" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>&amp;Oldest article:</string>
</property>
<property name="buddy" >
<property name="buddy">
<cstring>oldest_article</cstring>
</property>
</widget>
</item>
<item row="2" column="2" >
<widget class="QSpinBox" name="oldest_article" >
<property name="toolTip" >
<item row="2" column="2">
<widget class="QSpinBox" name="oldest_article">
<property name="toolTip">
<string>The oldest article to download</string>
</property>
<property name="suffix" >
<property name="suffix">
<string> days</string>
</property>
<property name="minimum" >
<property name="minimum">
<number>1</number>
</property>
<property name="maximum" >
<property name="maximum">
<number>365</number>
</property>
<property name="value" >
<property name="value">
<number>7</number>
</property>
</widget>
</item>
<item row="3" column="0" >
<widget class="QLabel" name="label_7" >
<property name="text" >
<item row="3" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>&amp;Max. number of articles per feed:</string>
</property>
<property name="buddy" >
<property name="buddy">
<cstring>max_articles</cstring>
</property>
</widget>
</item>
<item row="3" column="2" >
<widget class="QSpinBox" name="max_articles" >
<property name="toolTip" >
<item row="3" column="2">
<widget class="QSpinBox" name="max_articles">
<property name="toolTip">
<string>Maximum number of articles to download per feed.</string>
</property>
<property name="minimum" >
<property name="minimum">
<number>5</number>
</property>
<property name="maximum" >
<property name="maximum">
<number>100</number>
</property>
<property name="value" >
<property name="value">
<number>10</number>
</property>
</widget>
@ -252,64 +253,64 @@ p, li { white-space: pre-wrap; }
</layout>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
<widget class="QGroupBox" name="groupBox_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>100</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title" >
<property name="title">
<string>Feeds in recipe</string>
</property>
<layout class="QHBoxLayout" >
<layout class="QHBoxLayout">
<item>
<widget class="BasicList" name="added_feeds" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
<widget class="BasicList" name="added_feeds">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>100</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="selectionMode" >
<property name="selectionMode">
<enum>QAbstractItemView::MultiSelection</enum>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" >
<layout class="QVBoxLayout">
<item>
<widget class="QToolButton" name="up_button" >
<property name="text" >
<widget class="QToolButton" name="up_button">
<property name="text">
<string>...</string>
</property>
<property name="icon" >
<iconset resource="../images.qrc" >
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/arrow-up.svg</normaloff>:/images/arrow-up.svg</iconset>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="remove_feed_button" >
<property name="toolTip" >
<widget class="QToolButton" name="remove_feed_button">
<property name="toolTip">
<string>Remove feed from recipe</string>
</property>
<property name="text" >
<property name="text">
<string>...</string>
</property>
<property name="icon" >
<iconset resource="../images.qrc" >
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/list_remove.svg</normaloff>:/images/list_remove.svg</iconset>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="down_button" >
<property name="text" >
<widget class="QToolButton" name="down_button">
<property name="text">
<string>...</string>
</property>
<property name="icon" >
<iconset resource="../images.qrc" >
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/arrow-down.svg</normaloff>:/images/arrow-down.svg</iconset>
</property>
</widget>
@ -320,47 +321,47 @@ p, li { white-space: pre-wrap; }
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_3" >
<property name="title" >
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>Add feed to recipe</string>
</property>
<layout class="QGridLayout" >
<item row="0" column="0" >
<widget class="QLabel" name="label_4" >
<property name="text" >
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>&amp;Feed title:</string>
</property>
<property name="buddy" >
<property name="buddy">
<cstring>feed_title</cstring>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QLineEdit" name="feed_title" />
<item row="0" column="1">
<widget class="EnLineEdit" name="feed_title"/>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="label_5" >
<property name="text" >
<item row="1" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Feed &amp;URL:</string>
</property>
<property name="buddy" >
<property name="buddy">
<cstring>feed_url</cstring>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QLineEdit" name="feed_url" />
<item row="1" column="1">
<widget class="QLineEdit" name="feed_url"/>
</item>
<item row="2" column="0" colspan="2" >
<widget class="QPushButton" name="add_feed_button" >
<property name="toolTip" >
<item row="2" column="0" colspan="2">
<widget class="QPushButton" name="add_feed_button">
<property name="toolTip">
<string>Add feed to recipe</string>
</property>
<property name="text" >
<property name="text">
<string>&amp;Add feed</string>
</property>
<property name="icon" >
<iconset resource="../images.qrc" >
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/plus.svg</normaloff>:/images/plus.svg</iconset>
</property>
</widget>
@ -370,44 +371,44 @@ p, li { white-space: pre-wrap; }
</item>
</layout>
</widget>
<widget class="QWidget" name="page_2" >
<layout class="QVBoxLayout" >
<widget class="QWidget" name="page_2">
<layout class="QVBoxLayout">
<item>
<widget class="QLabel" name="label_8" >
<property name="text" >
<string>For help with writing advanced news recipes, please visit &lt;a href="http://__appname__.kovidgoyal.net/user_manual/news.html">User Recipes&lt;/a></string>
<widget class="QLabel" name="label_8">
<property name="text">
<string>For help with writing advanced news recipes, please visit &lt;a href=&quot;http://__appname__.kovidgoyal.net/user_manual/news.html&quot;&gt;User Recipes&lt;/a&gt;</string>
</property>
<property name="wordWrap" >
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="openExternalLinks" >
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_4" >
<property name="title" >
<widget class="QGroupBox" name="groupBox_4">
<property name="title">
<string>Recipe source code (python)</string>
</property>
<layout class="QVBoxLayout" >
<layout class="QVBoxLayout">
<item>
<widget class="QTextEdit" name="source_code" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
<widget class="QTextEdit" name="source_code">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>100</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font" >
<property name="font">
<font>
<family>DejaVu Sans Mono</family>
</font>
</property>
<property name="lineWrapMode" >
<property name="lineWrapMode">
<enum>QTextEdit::NoWrap</enum>
</property>
<property name="acceptRichText" >
<property name="acceptRichText">
<bool>false</bool>
</property>
</widget>
@ -430,11 +431,11 @@ p, li { white-space: pre-wrap; }
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox" >
<property name="orientation" >
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons" >
<property name="standardButtons">
<set>QDialogButtonBox::Close</set>
</property>
</widget>
@ -447,9 +448,14 @@ p, li { white-space: pre-wrap; }
<extends>QListWidget</extends>
<header>widgets.h</header>
</customwidget>
<customwidget>
<class>EnLineEdit</class>
<extends>QLineEdit</extends>
<header>widgets.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="../images.qrc" />
<include location="../images.qrc"/>
</resources>
<connections>
<connection>
@ -458,11 +464,11 @@ p, li { white-space: pre-wrap; }
<receiver>Dialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel" >
<hint type="sourcelabel">
<x>446</x>
<y>649</y>
</hint>
<hint type="destinationlabel" >
<hint type="destinationlabel">
<x>0</x>
<y>632</y>
</hint>
@ -474,11 +480,11 @@ p, li { white-space: pre-wrap; }
<receiver>Dialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel" >
<hint type="sourcelabel">
<x>175</x>
<y>643</y>
</hint>
<hint type="destinationlabel" >
<hint type="destinationlabel">
<x>176</x>
<y>636</y>
</hint>

View File

@ -10,7 +10,7 @@ from PyQt4.Qt import QListView, QIcon, QFont, QLabel, QListWidget, \
QPixmap, QMovie, QPalette, QTimer, QDialog, \
QAbstractListModel, QVariant, Qt, SIGNAL, \
QRegExp, QSettings, QSize, QModelIndex, \
QAbstractButton, QPainter
QAbstractButton, QPainter, QLineEdit, QComboBox
from calibre.gui2 import human_readable, NONE, TableView, \
qstring_to_unicode, error_dialog
@ -451,6 +451,48 @@ class BasicList(QListWidget):
yield self.item(i)
class LineEditECM(object):
'''
Extend the contenxt menu of a QLineEdit to include more actions.
'''
def contextMenuEvent(self, event):
menu = self.createStandardContextMenu()
menu.addSeparator()
action_title_case = menu.addAction('Title Case')
self.connect(action_title_case, SIGNAL('triggered()'), self.title_case)
menu.exec_(event.globalPos())
def title_case(self):
self.setText(qstring_to_unicode(self.text()).title())
class EnLineEdit(LineEditECM, QLineEdit):
'''
Enhanced QLineEdit.
Includes an extended content menu.
'''
pass
class EnComboBox(QComboBox):
'''
Enhanced QComboBox.
Includes an extended content menu.
'''
def __init__(self, *args):
QComboBox.__init__(self, *args)
self.setLineEdit(EnLineEdit(self))
class PythonHighlighter(QSyntaxHighlighter):