27 #include <QAbstractItemModel>
28 #include <QAbstractItemDelegate>
33 #include <QAbstractButton>
35 #include <QItemSelectionModel>
36 #include <QTextDocument>
37 #include <QTextCharFormat>
38 #include <QStandardItemModel>
102 virtual QUrl url()
const = 0;
130 virtual uint compareUrlTo(
const QUrl& other, uint interestFlags = 0xFFFFFFFF)
const = 0;
156 virtual QVariantMap saveGuiState()
const = 0;
160 virtual bool restoreGuiState(
const QVariantMap& state) = 0;
181 void requestRestoreStyle(
const KLFStyle& style);
191 void moreCategorySuggestions(
const QStringList& categorylist);
201 virtual void updateResourceEngine() = 0;
202 virtual void updateResourceProp(
int propId) = 0;
203 virtual void updateResourceData(
const QString& subres,
int modifyType,
206 virtual void updateResourceDefaultSubResourceChanged(
const QString& newSubResource);
252 virtual void wantMoreCategorySuggestions();
276 virtual QString viewTypeTitle(
const QString& viewTypeIdent)
const = 0;
293 static QString defaultViewTypeIdentifier();
301 static QStringList allSupportedViewTypeIdentifiers();
398 virtual bool hasCreateWidget(
const QString& wtype)
const;
407 const Parameters& defaultparameters = Parameters());
424 virtual Parameters retrieveCreateParametersFromWidget(
const QString& wtype,
QWidget *widget);
428 virtual bool hasSaveToWidget(
const QString& wtype)
const;
465 IconViewList = LinearList,
466 CategoryTree = 0x0002,
467 DisplayTypeMask = 0x000f,
469 GroupSubCategories = 0x1000
478 ItemKindItemRole = Qt::UserRole+768,
483 FullCategoryPathItemRole
492 static inline int entryItemRole(
int propertyId) {
return (Qt::UserRole+788) + propertyId; }
500 virtual QUrl url()
const;
511 virtual void setFlavorFlags(uint flags, uint modify_mask = 0xffffffff);
512 virtual uint flavorFlags()
const;
513 inline uint
displayType()
const {
return flavorFlags() & DisplayTypeMask; }
516 virtual void prefetch(
const QModelIndexList& index)
const;
518 virtual Qt::ItemFlags flags(
const QModelIndex& index)
const;
521 int role = Qt::DisplayRole)
const;
522 virtual bool hasIndex(
int row,
int column,
533 virtual Qt::DropActions supportedDropActions()
const;
541 enum { DropWillAccept = 0x0001,
542 DropWillCategorize = 0x0002,
543 DropWillMove = 0x0004 };
546 virtual QImage dragImage(
const QModelIndexList& indexes);
548 virtual int entryColumnContentsPropertyId(
int column)
const;
549 virtual int columnForEntryPropertyId(
int entryPropertyId)
const;
571 virtual void redoSort();
574 virtual void sort(
int column, Qt::SortOrder order = Qt::AscendingOrder);
591 virtual void searchAbort();
597 virtual void completeRefresh();
608 unsigned int pFlavorFlags;
610 int pFetchBatchCount;
616 struct PersistentId {
619 QString categorylabel_fullpath;
622 friend QDebug&
operator<<(QDebug&,
const PersistentId&);
627 void startLayoutChange(
bool withQtLayoutChangedSignal =
true);
628 void endLayoutChange(
bool withQtLayoutChangedSignal =
true);
630 QModelIndexList pLytChgIndexes;
633 void updateCacheSetupModel();
639 bool dropCanInternal(
const QMimeData *data);
653 Q_PROPERTY(
QSize previewSize READ previewSize WRITE setPreviewSize) ;
708 enum { PTF_HighlightSearch = 0x0001,
709 PTF_HighlightSearchCurrent = 0x0002,
710 PTF_SelUnderline = 0x0004,
711 PTF_ForceRichTextRender = 0x0008,
712 PTF_FontLarge = 0x0010,
715 virtual void paintText(PaintPrivate *p,
const QString& text, uint flags = PTF_HighlightSearch)
const;
717 virtual bool indexHasSelectedDescendant(
const QModelIndex& parent)
const;
718 virtual bool selectionIntersectsIndexChildren(
const QItemSelection& selection,
721 virtual bool func_indexHasSelectedDescendant(
const QModelIndex& parent,
const QTime& timer,
722 int timeLimitMs)
const;
732 bool pAutoBackgroundItems;
733 QColor pAutoBackgroundColor;
739 : fmt(f), start(s), len(l) { }
741 bool operator<(
const ColorRegion& other)
const {
742 return start < other.start;
745 friend QDebug&
operator<<(QDebug&,
const ColorRegion&);
756 Q_PROPERTY(
bool autoBackgroundItems READ autoBackgroundItems WRITE setAutoBackgroundItems) ;
757 Q_PROPERTY(
QColor autoBackgroundColor READ autoBackgroundColor WRITE setAutoBackgroundColor) ;
759 Q_PROPERTY(QListView::Flow iconViewFlow READ iconViewFlow WRITE setIconViewFlow) ;
761 Q_PROPERTY(
QSize previewSize READ previewSize WRITE setPreviewSize) ;
764 enum ViewType { CategoryTreeView, ListTreeView, IconView };
769 virtual uint
compareUrlTo(
const QUrl& other, uint interestFlags = 0xFFFFFFFF)
const;
791 virtual QModelIndex currentVisibleIndex(
bool forward)
const;
796 QListView::Flow iconViewFlow()
const;
814 virtual void showColumns(
int propIdColumn,
bool show);
815 virtual void sortBy(
int propIdColumn, Qt::SortOrder sortorder);
820 virtual void slotSelectAll(
bool expandItems =
false);
821 virtual void slotRefresh();
822 virtual void slotRelayoutIcons();
832 void setIconViewFlow(QListView::Flow flow);
838 void updateDisplay();
843 virtual void expandRootNice();
862 virtual void slotSelectAll(
const QModelIndex& parent, uint selectFlags);
864 void slotViewItemClicked(
const QModelIndex& index);
865 void slotEntryDoubleClicked(
const QModelIndex& index);
867 void slotShowColumnSenderAction(
bool showCol);
870 void slotResourceModelReset();
873 void slotPreviewSizeFromActionSender();
874 void slotPreviewSizeActionsRefreshChecked();
882 bool pGroupSubCategories;
886 QMenu *pPreviewSizeMenu;
891 bool pEventFilterNoRecurse;
893 QModelIndexList selectedEntryIndexes()
const;
943 virtual QUrl url()
const;
949 virtual void updateReadyToOpenFromSender(
bool isready);
950 virtual void updateReadyToOpen();
953 virtual QUrl retrieveRawUrl()
const;
956 Ui::KLFLibOpenResourceDlg *pUi;
972 virtual Parameters getCreateParameters()
const;
984 virtual void updateReadyToCreateFromSender(
bool isready);
985 virtual void updateReadyToCreate();
988 Ui::KLFLibOpenResourceDlg *pUi;
1008 void slotResourcePropertyChanged(
int propId);
1009 void slotSubResourcePropertyChanged(
const QString& subResource,
int propId);
1010 void on_btnAdvanced_toggled(
bool on);
1013 void on_cbxSubResource_currentIndexChanged(
int newSubResItemIndex);
1015 void updateResourceProperties();
1016 void updateSubResourceProperties();
1017 void updateSubResources(
const QString& curSubResource =
QString());
1022 bool pSuppSubResProps;
1023 Ui::KLFLibResPropEditor *U;
1027 QString curSubResource()
const;
1038 void applyAndClose();
1039 void cancelAndClose();
1055 QString newSubResourceName()
const;
1056 QString newSubResourceTitle()
const;
1072 void on_txtTitle_textChanged(
const QString& text);
1073 void on_txtName_textChanged(
const QString& text);
1076 Ui::KLFLibNewSubResDlg *u;
1166 const Parameters& defaultparameters =
Parameters());
1182 static void addLocalFileType(
const LocalFileType& fileType);
hasIndex(int row, int column, const QModelIndex &parent=QModelIndex()
QDataStream & operator<<(QDataStream &stream, const KLFLatexSymbol &s)
#define KLF_DEBUG_DECLARE_REF_INSTANCE(expr)
virtual KLFLibResourceEngine * resource()
void setGroupSubCategories(bool yesOrNo)
virtual void setTheTreeView(QTreeView *theTreeView)
QColor autoBackgroundColor() const
const QStyleOptionViewItem * option
rowCount(const QModelIndex &parent=QModelIndex()
void setAutoBackgroundItems(bool on)
virtual QString viewTypeTitle(const QString &viewTypeIdent) const =0
Model for Item-Views displaying a library resource's contents.
index(int row, int column, const QModelIndex &parent=QModelIndex()
virtual bool canCreateLibView(const QString &, KLFLibResourceEngine *)
virtual void updateResourceEngine()=0
static int entryItemRole(int propertyId)
virtual KLFAbstractLibView * createLibView(const QString &viewTypeIdent, QWidget *parent, KLFLibResourceEngine *resourceEngine)=0
virtual bool searchFindNext(bool forward)=0
canFetchMore(const QModelIndex &parent)
qint32 entryId
An entry ID.
virtual QVariantMap saveGuiState() const =0
virtual void searchAbort()=0
static int entryPropIdForItemRole(int role)
createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index)
void setAutoBackgroundColor(const QColor &c)
virtual void setSelectionModel(QItemSelectionModel *sm)
virtual uint compareUrlTo(const QUrl &other, uint interestFlags=0xFFFFFFFF) const =0
Compare this resource view's URL to another URL.
dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
virtual void setAutoBackgroundItems(bool autoBgItems)
sort(int column, Qt::SortOrder order=Qt::AscendingOrder)
#define KLF_DEBUG_DECLARE_ASSIGNABLE_REF_INSTANCE()
virtual bool searchFind(const QString &queryString, bool forward)=0
number(long n, int base=10)
bool validResourceEngine() const
Returns TRUE if a non-NULL resource engine has been set.
virtual bool restoreGuiState(const QVariantMap &state)=0
KLFLibEngineFactory::Parameters Parameters
virtual QStringList viewTypeIdentifiers()
virtual void restoreWithStyle()
virtual ~KLFLibDefaultViewFactory()
virtual void setFetchBatchCount(int count)
updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index)
Contains general definitions to be used anywhere in the KLFLib* framework.
QSize previewSize() const
ViewType viewType() const
virtual void setAutoBackgroundColor(const QColor &autoBgColor)
virtual void updateResourceProp(int propId)=0
data(const QModelIndex &index, int role=Qt::DisplayRole)
A view widget to display a library resource's contents.
editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index)
mimeData(const QModelIndexList &indexes)
virtual void updateResourceData(const QString &subres, int modifyType, const QList< KLFLib::entryId > &entryIdList)=0
QSize previewSize() const
setEditorData(QWidget *editor, const QModelIndex &index)
parent(const QModelIndex &index)
paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index)
Dialog prompting user to choose a resource and a sub-resource to open.
void setPreviewSize(const QSize &size)
virtual QUrl url() const =0
Display Resource URL. NOT exactly like KLFLibResourceEngine::url() !
virtual KLFLibEntryList selectedEntries() const =0
void setPreviewSize(const QSize &psize)
virtual QModelIndex currentVisibleIndex() const
The first index that is currently visible in the current scrolling position.
virtual void setSearchString(const QString &s)
virtual KLFSearchable * searchable()
virtual void restoreLatexOnly()
bool autoBackgroundItems() const
Interface for guessing file schemes.
virtual void restore(uint restoreFlags=KLFLib::RestoreLatexAndStyle)=0
virtual bool autoBackgroundItems() const
KLF_EXPORT bool operator<(const KLFLatexSymbol &a, const KLFLatexSymbol &b)
static QList< KLFLibViewFactory * > allFactories()
virtual QStringList getCategorySuggestions()=0
virtual KLFLibEntrySorter * entrySorter()
The current KLFLibEntrySorter that sorts our items.
An entry (single formula) in the library.
bool groupSubCategories() const
virtual void setSearchIndex(const QModelIndex &index)
hasChildren(const QModelIndex &parent=QModelIndex()
virtual KLFSearchable * searchable()
virtual KLFLibResourceEngine * resourceEngine() const
columnCount(const QModelIndex &parent=QModelIndex()
fetchMore(const QModelIndex &parent)
sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index)
virtual ~KLFAbstractLibView()
virtual QList< KLFLib::entryId > selectedEntryIds() const =0
Utility class for sorting library entry items.
virtual QColor autoBackgroundColor() const
setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index)
An abstract resource engine.
virtual QList< QAction * > addContextMenuActions(const QPoint &pos)
virtual QStringList supportedTypes() const =0
virtual int fetchBatchCount() const
virtual bool selectEntries(const QList< KLFLib::entryId > &idList)=0