10 #include "adaptormodel.h"
13 #include "branchitem.h"
15 #include "imageitem.h"
16 #include "mapeditor.h"
18 #include "treemodel.h"
20 #include "vymmodelwrapper.h"
24 class FindResultModel;
36 typedef QMap<uint, QStringList> ItemList;
38 class VymModel : public TreeModel {
40 Q_CLASSINFO("D-Bus Interface", "org.insilmaril.vym.VymModel-h")
42 ////////////////////////////////////////////
43 // General housekeeping
44 ////////////////////////////////////////////
46 QString version; //!< version string saved in vym file
52 static uint idLast; //! the last used unique ID
54 VymModelWrapper *wrapper;
62 makeTmpDirectories(); //!< create temporary directories e.g. for history
63 QString tmpDirPath(); //!< Return path to temporary directory
65 MapEditor *getMapEditor();
66 uint getModelID(); //! Return unique ID of model
67 VymModelWrapper *getWrapper();
69 void setView(VymView *); //! Set vymView for resizing editors after load
74 bool isRepositionBlocked(); //!< While load or undo there is no need to
75 //!< update graphicsview
76 void updateActions(); //!< Update buttons in mainwindow
78 bool setData(const QModelIndex &index, const QVariant &value, int role) override;
80 ////////////////////////////////////////////
82 ////////////////////////////////////////////
84 bool zipped; // should map be zipped
85 static int mapNum; // unique number for model used in save/undo
86 FileType fileType; // type of file, e.g. vym, freemind...
87 QString fileName; // short name of file (for tab)
90 QString filePath; // path to file which will be saved
91 // /home/tux/example.vym
93 QString fileDir; // dir where file is saved
96 QString destPath; // path to .vym file (needed for vymlinks)
97 // /home/tux/example.vym
99 QString mapName; // fileName without ".vym"
102 QString tmpMapDirPath; // tmp directory with undo history
104 QTimer *autosaveTimer;
105 QTimer *fileChangedTimer;
106 QDateTime fileChangedTime;
109 void resetUsedFlags(); //! Before exports or saving, reset the flags
111 /*! This function saves all information of the map to disc.
112 saveToDir also calls the functions for all BranchObj and other objects in
113 the map. The structure of the map itself is returned as QString and passed
114 back to Main, where saveToDir is called initially
116 QString saveToDir(const QString &tmpdir, const QString &prefix,
117 FlagRowMaster::WriteMode flagMode, const QPointF &offset,
120 /*! Save all data in tree*/
122 saveTreeToDir(const QString &, const QString &, const QPointF &,
123 QList<Link *> &tmpLinks); // Save data recursivly to tempdir
125 /*! \brief Sets filepath, filename and mapname
127 If the filepath is "/home/tux/map.xml", then the filename will be set
128 to map.xml. The destname is needed for vymLinks, pointing to another map.
129 The destname holds the real name of the file, after it has been compressed,
133 /*! \brief Set File path
135 The destname is needed to construct the references between maps
137 void setFilePath(QString filepath, QString destname);
138 void setFilePath(QString); //!< Overloaded for convenience
139 QString getFilePath(); //!< Full path e.g. "/home/tux/map.xml"
140 QString getFileDir(); //!< e.g. "/home/tux"
141 QString getFileName(); //!< e.g. "map.xml"
142 QString getMapName(); //!< e.g. "map"
143 QString getDestPath(); //!< e.g. "/home/tux/map.vym"
145 bool parseVymText(const QString &s);
149 The data is read from file. Depending on LoadMode the current
150 selection gets replaced by data or the data is appended.
153 loadMap(QString, //!< Path
154 const LoadMode &lmode =
155 NewMap, //!< New map, replace or add to selection
156 const FileType &ftype = VymMap, //!< VymMap or FreeMind
157 const int &contentFilter =
158 0x0000, //!< For undo types of content can be filterd
159 int pos = -1 //!< Optionally tell position where to add data
163 /*! \brief Save the map to file */
164 File::ErrorCode save(const SaveMode &);
167 ImageItem* loadImage(BranchItem *dst = NULL, const QString &fn = "");
168 void saveImage(ImageItem *ii = NULL, QString fn = "");
171 void importDirInt(BranchItem *, QDir);
174 void importDir(const QString &);
178 bool removeVymLock();
182 bool renameMap(const QString &newPath); //! Rename map and change lockfile
183 void setReadOnly(bool b);
187 VymLock vymLock; //! Handle lockfiles and related information
188 bool readonly; //! if map is locked, it can be opened readonly
194 ////////////////////////////////////////////
195 // history (undo/redo)
196 ////////////////////////////////////////////
198 bool mapDefault; //!< Flag if map is untouched
199 bool mapChanged; //!< Flag if undo is possible
200 bool mapUnsaved; //!< Flag if map should be saved
202 QString histPath; //!< Path to history file
203 SimpleSettings undoSet; //!< undo/redo commands, saved in histPath
204 int stepsTotal; //!< total number of steps (undos+redos)
205 int curStep; //!< Current step in history (ring buffer)
206 int curClipboard; //!< number of history step, which is the current
208 int redosAvail; //!< Available number of redo steps
209 int undosAvail; //!< Available number of undo steps
210 bool repositionBlocked; //!< block while load or undo
211 bool saveStateBlocked; //!< block saving current state
213 void blockReposition(); //! Block reposition while bigger changes, e.g. an import
214 void unblockReposition(); //! Unblock reposition and do repositon
215 bool isDefault(); //!< true, if map is still the empty default map
216 void makeDefault(); //!< Reset changelog, declare this as default map
217 bool hasChanged(); //!< true, if something has changed and is not saved yet
218 void setChanged(); //!< called from TextEditor via LinkableMapObj
220 /*! \brief Get name of object
222 Returns heading of a branch or name of an object for use in comment
225 QString getObjectName(LinkableMapObj *);
226 QString getObjectName(TreeItem *);
228 void redo(); //!< Redo last action
229 bool isRedoAvailable(); //!< True, if redo is available
230 QString lastRedoSelection();
231 QString lastRedoCommand();
232 QVariant repeatLastCommand(); //!< Repeat last command on current selection
234 void undo(); //!< Undo last action
235 bool isUndoAvailable(); //!< True, if undo is available
236 void gotoHistoryStep(int); //!< Goto a specifig step in history
238 QString getHistoryPath(); //!< Path to directory containing the history
239 void resetHistory(); //!< Initialize history
241 /*! \brief Save the current changes in map
243 Two commands and selections are saved:
245 - undocommand and undoselection to undo the change
246 - redocommand and redoselection to redo the action after an undo
248 Additionally a comment is logged.
251 void saveState(const SaveMode &savemode, const QString &undoSelection,
252 const QString &undoCommand, const QString &redoSelection,
253 const QString &redoCommand, const QString &comment,
254 TreeItem *saveSelection, QString dataXML = "");
256 /*! Overloaded for convenience */
257 void saveStateChangingPart(TreeItem *undoSelection, TreeItem *redoSelection,
258 const QString &redoCommand,
259 const QString &comment);
261 /*! Overloaded for convenience */
262 void saveStateRemovingPart(TreeItem *redoSelection, const QString &comment);
264 /*! Overloaded for convenience */
265 void saveState(TreeItem *undoSelection, const QString &undoCommand,
266 TreeItem *redoSelection, const QString &redoCommand,
267 const QString &comment);
269 /*! Overloaded for convenience */
270 void saveState(const QString &undoSelection, const QString &undoCommand,
271 const QString &redoSelection, const QString &redoCommand,
272 const QString &comment);
274 /*! Overloaded for convenience */
275 void saveState(const QString &undoCommand, const QString &redoCommand,
276 const QString &comment);
278 /*! Save a change in string and merge
279 minor sequential changes */
280 void saveStateMinimal(TreeItem *undoSelection, const QString &undoCommand,
281 TreeItem *redoSelection, const QString &redoCommand,
282 const QString &comment);
284 /*! Save state before loading a map */
285 void saveStateBeforeLoad(LoadMode lmode, const QString &fname);
287 ////////////////////////////////////////////
289 ////////////////////////////////////////////
291 QGraphicsScene *getScene();
293 TreeItem *findBySelectString(QString s);
294 TreeItem *findID(const uint &i); // find MapObj by unique ID
295 TreeItem *findUuid(const QUuid &i); // find MapObj by unique ID
297 ////////////////////////////////////////////
299 ////////////////////////////////////////////
301 void setVersion(const QString &);
302 QString getVersion();
303 void setTitle(const QString &);
305 void setAuthor(const QString &);
307 void setComment(const QString &);
308 QString getComment();
313 void setSortFilter(const QString &);
314 QString getSortFilter();
319 void sortFilterChanged(QString); //!< Notify editors of new filter
322 void setHeading(const VymText &vt,
323 BranchItem *bi = NULL); //!< Set heading of item
324 void setHeadingPlainText(const QString &s,
325 BranchItem *bi = NULL); //!< Set heading of item
326 Heading getHeading(); //!< Get heading of item
328 const VymText &); //!< Signal emmited in NoteEditor via MainWindow
329 void setNote(const VymNote &vn); //!< Set note text
330 VymNote getNote(); //!< Get note text
331 bool hasRichTextNote(); //!< Check type of vymText used
332 void loadNote(const QString &fn); //!< Load note from file
333 void saveNote(const QString &fn); //!< Save note to file
336 BranchItem *findCurrent; // next object in find process
337 BranchItem *findPrevious; // next object in find process
338 bool EOFind; // true, if search failed
341 void findDuplicateURLs(); // find duplicate URLs, testing only so far
342 bool findAll(FindResultModel *, // Search all objects at once, also notes
343 QString s, Qt::CaseSensitivity cs = Qt::CaseInsensitive,
344 bool searchNotes = true);
350 void setURL(QString url, bool updateFromCloud = true, BranchItem *bi = nullptr);
351 QString getURL(); // returns URL of selection or ""
352 QStringList getURLs(bool ignoreScrolled = true); // returns URLs of subtree
354 void setFrameType(const FrameObj::FrameType &);
355 void setFrameType(const QString &);
356 void toggleFrameIncludeChildren();
357 void setFrameIncludeChildren(bool);
358 void setFramePenColor(const QColor &);
359 void setFrameBrushColor(const QColor &);
360 void setFramePadding(const int &);
361 void setFrameBorderWidth(const int &);
362 void setIncludeImagesVer(bool);
363 void setIncludeImagesHor(bool);
364 void setChildrenLayout(BranchItem::LayoutHint layoutHint);
365 void setHideLinkUnselected(bool);
367 /*! Should object be hidden in exports (clouded)? */
368 void setHideExport(bool, TreeItem *ti = NULL);
370 /*! Should object be hidden in exports (clouded)? */
371 void toggleHideExport();
373 /*! Toggle task for branch */
376 /*! Cycle through task states */
377 bool cycleTaskStatus(bool reverse = false);
379 /*! Set task to sleep for number of days or until a given date*/
380 bool setTaskSleep(const QString &s);
382 /*! Set manual delta for priority of task */
383 void setTaskPriorityDelta(const int &n, BranchItem *bi = nullptr);
385 /*! Get manual delta for priority of task */
386 int getTaskPriorityDelta();
388 /*! count tasks in this model */
391 /*! Update task priorities */
393 void updateTasksAlarm(bool force = false);
396 /*! Timer to check if tasks need to be awoken */
397 QTimer *taskAlarmTimer;
400 BranchItem *addTimestamp();
402 void copy(); //!< Copy to clipboard
403 void paste(); //!< Paste clipboard to branch and backup
404 void cut(); //!< Cut to clipboard (and copy)
406 bool moveUp(BranchItem *bi); //!< Move branch up without saving state
407 void moveUp(); //!< Move branch up with saving state
408 bool moveDown(BranchItem *bi); //!< Move branch down without saving state
409 void moveDown(); //!< Move branch down
410 void moveUpDiagonally(); //!< Move branch up diagonally: Branchs becomes child of branch above
411 void moveDownDiagonally(); //!< Move branch down diagonally: Branchs becomes sibling of parent
412 void detach(); //!< Detach branch and use as new mapcenter
413 void sortChildren(bool inverse = false); //!< Sort children lexically
415 // The create methods are used to quickly parse a XML file
416 BranchItem *createMapCenter(); //!< Create MapCenter
417 BranchItem *createBranch(BranchItem *dst); //!< Create Branch
418 ImageItem *createImage(BranchItem *dst); //!< Create image
422 Link *l); //!< Create XLink, will create MO automatically if needed
423 QColor getXLinkColor();
425 Qt::PenStyle getXLinkStyle();
426 QString getXLinkStyleBegin();
427 QString getXLinkStyleEnd();
429 AttributeItem *setAttribute();
430 AttributeItem *setAttribute(BranchItem *dst, AttributeItem *);
432 /*! \brief Add new mapcenter
434 Disclaimer: Still experimental, not fully supported yet.
436 BranchItem *addMapCenter(bool saveStateFlag = true);
437 BranchItem *addMapCenter(QPointF absPos);
439 /*! \brief Add new branch
441 Depending on num the new branch is created
443 -3 above selection as child of selections parent
444 -2 as child of selection
445 -1 below selection as child of selections parent
446 0..n insert at a specific position in selections parent
447 (needed for free relinking)
451 BranchItem *addNewBranchInt(BranchItem *dst,
452 int pos); // pos allows to add above/below
453 // selection, or as child at pos
458 // -3 insert in children of parent above selection
459 // -2 add branch to selection
460 // -1 insert in children of parent below selection
461 // 0..n insert in children of parent at pos
463 BranchItem *addNewBranch(BranchItem *bi = NULL, int pos = -2);
465 addNewBranchBefore(); //!< Insert branch between selection and its parent
466 /*! \brief Relink a branch to a new destination dst
467 Relinks branch to dst at branch position pos. There is no saveState
468 here, as for example moveUp or moving in MapEditor have
469 different needs to call saveState
470 Returns true if relinking was successful.
472 bool relinkBranch(BranchItem *branch, BranchItem *dst, int pos = -1,
473 bool updateSelection = false, QPointF orgPos = QPointF());
474 bool relinkImage(ImageItem *image, BranchItem *dst);
476 bool relinkTo(const QString &dest, int num, QPointF pos);
479 bool cleaningUpLinks; //!< True while cleaning up to avoid recursion
481 void cleanupItems(); //!< Delete orphaned Items
482 void deleteLater(uint); //!< Delete later with new beginRemoveRow
483 void deleteSelection(); //!< Delete selection
484 void deleteKeepChildren(
485 bool saveStateFlag = true); //!< remove branch, but keep children
487 void deleteChildren(); //!< keep branch, but remove children
489 TreeItem *deleteItem(
490 TreeItem *); //!< Delete item and return parent (if parent!= rootItem)
491 void deleteLink(Link *); //!< Remove Link and related LinkItems in TreeModel
492 void clearItem(TreeItem *ti); //!< Remove all children of TreeItem ti
493 bool scrollBranch(BranchItem *);
494 bool unscrollBranch(BranchItem *);
496 void unscrollChildren();
497 void setScaleFactor(qreal, ImageItem *ii = nullptr);
498 void growSelectionSize();
499 void shrinkSelectionSize();
500 void resetSelectionSize();
501 void emitExpandAll();
502 void emitExpandOneLevel();
503 void emitCollapseOneLevel();
504 void emitCollapseUnselected();
507 void expandOneLevel();
508 void collapseOneLevel();
509 void collapseUnselected();
513 ItemList getLinkedMaps();
514 ItemList getTargets();
517 Flag* findFlagByName(const QString &name);
519 void setFlagByName(const QString &name, bool useGroups = true);
520 void unsetFlagByName(const QString &name);
521 void toggleFlagByName(const QString &name, bool useGroups = true);
522 void toggleFlagByUid(const QUuid &uid, bool useGroups = true);
525 void colorBranch(QColor);
526 void colorSubtree(QColor, BranchItem *bi = NULL);
527 QColor getCurrentHeadingColor();
529 void note2URLs(); // get URLs from note
530 void editHeading2URL(); // copy heading to URL
531 void getJiraData(bool subtree = true); // get data from Jira
534 void updateJiraData(QJsonObject);
537 void setHeadingConfluencePageName(); // get page details from Confluence
538 void setVymLink(const QString &); // Set vymLink for selection
539 void deleteVymLink(); // delete link to another map
540 QString getVymLink(); // return path to map
541 QStringList getVymLinks(); // return paths in subtree
542 void followXLink(int);
544 void setXLinkColor(const QString &);
545 void setXLinkStyle(const QString &);
546 void setXLinkStyleBegin(const QString &);
547 void setXLinkStyleEnd(const QString &);
548 void setXLinkWidth(int);
550 ////////////////////////////////////////////
552 ////////////////////////////////////////////
554 /* \brief Runs the script */
555 QVariant execute(const QString &script);
557 ////////////////////////////////////////////
559 ////////////////////////////////////////////
561 TreeItem::HideTmpMode hidemode; // true while exporting to hide some stuff
564 /*! Set or unset temporary hiding of objects during export */
565 void setExportMode(bool);
567 /*! Save as image. Returns offset to upper left corner of image */
568 QPointF exportImage(QString fname = "", bool askForName = true,
569 QString format = "PNG");
571 /*! Save as PDF . Returns offset to upper left corner of image */
572 void exportPDF(QString fname = "", bool askForName = true);
574 /*! Save as SVG . Returns offset to upper left corner of image */
575 QPointF exportSVG(QString fname = "", bool askForName = true);
577 /*! Export as XML to directory */
578 void exportXML(QString fname = "", QString dir = "", bool useDialog = true);
580 /*! Export as A&O report text to file */
581 void exportAO(QString fname = "", bool askForName = true);
583 /*! Export as ASCII text to file */
584 void exportASCII(const QString &fname = "", bool listTasks = false,
585 bool askForName = true);
587 /*! Export as CSV text to file */
588 void exportCSV(const QString &fname = "", bool askForName = true);
590 /*! Export as Firefox bookmarks to JSON file */
591 void exportFirefoxBookmarks(const QString &fname = "", bool askForName = true);
593 /*! Export as HTML to directory */
594 void exportHTML(const QString &fname = "", const QString &dir = "",
595 bool useDialog = true);
597 /*! Export as HTML to Confluence*/
598 void exportConfluence(bool createPage = true, const QString &pageURL = "",
599 const QString &pageName = "",
600 bool useDialog = true);
602 /*! Export as OpenOfficeOrg presentation */
603 void exportImpress(const QString &, const QString &);
605 /*! Returns if Export in recently used format is possible*/
606 bool exportLastAvailable(QString &description, QString &command,
609 /*! Export in recently used format (saved in map)*/
612 /*! Export as LaTeX */
613 void exportLaTeX(const QString &fname = "", bool useDialog = true);
615 /*! Export as Markdown */
616 void exportMarkdown(const QString &fname = "", bool useDialog = true);
618 /*! Export as OrgMode input for emacs*/
619 void exportOrgMode(const QString &fname = "", bool useDialog = true);
621 ////////////////////////////////////////////
623 ////////////////////////////////////////////
625 void registerMapEditor(QWidget *);
627 void setMapZoomFactor(const double &);
628 void setMapRotationAngle(const double &);
629 void setMapAnimDuration(const int &d);
630 void setMapAnimCurve(const QEasingCurve &c);
631 bool centerOnID(const QString &id);
635 double rotationAngle;
637 QEasingCurve animCurve;
639 bool hasContextPos; //!< True, if we have a context pos
640 QPointF contextPos; //!< local position during context menu
642 void setContextPos(QPointF); //!< local position during context menu
643 void unsetContextPos(); //!< forget local position after context menu
645 void reposition(); //!< Call reposition for all MCOs
646 void setHideTmpMode(TreeItem::HideTmpMode mode);
648 void emitNoteChanged(TreeItem *ti);
649 void emitDataChanged(TreeItem *ti);
650 void emitUpdateQueries(); //!< tell MainWindow to update find results...
651 void emitUpdateLayout();
654 void updateQueries(VymModel *m);
656 void noteChanged(QModelIndex ix);
657 void newChildObject(QModelIndex ix);
660 MapEditor *mapEditor;
662 QColor defLinkColor; // default color for links
663 QPen defXLinkPen; // default pen for xlinks
664 QString defXLinkStyleBegin; // default style begin
665 QString defXLinkStyleEnd;
666 ; // default style end
667 LinkableMapObj::ColorHint linkcolorhint; // use heading color or own color
668 LinkableMapObj::Style linkstyle; // default style for links
672 bool setMapLinkStyle(const QString &); // Set style of link
673 LinkableMapObj::Style getMapLinkStyle(); // requested in LMO
674 void setMapDefLinkColor(QColor); // default color of links
675 void setMapLinkColorHintInt(); // color of links
676 void setMapLinkColorHint(LinkableMapObj::ColorHint); // color of links
677 void toggleMapLinkColorHint(); // after changing linkStyles
678 void selectMapBackgroundImage();
679 void setMapBackgroundImage(const QString &);
680 void selectMapBackgroundColor();
681 void setMapBackgroundColor(QColor);
682 QColor getMapBackgroundColor();
684 QFont getMapDefaultFont();
685 void setMapDefaultFont(const QFont &);
687 LinkableMapObj::ColorHint getMapLinkColorHint();
688 QColor getMapDefLinkColor();
689 void setMapDefXLinkPen(const QPen &p);
690 QPen getMapDefXLinkPen();
692 void setMapDefXLinkStyleBegin(const QString &s);
693 QString getMapDefXLinkStyleBegin();
694 void setMapDefXLinkStyleEnd(const QString &s);
695 QString getMapDefXLinkStyleEnd();
697 /*! Move absolutly to (x,y). */
698 void move(const double &x, const double &y);
700 /*! Move relativly to (x,y). */
701 void moveRel(const double &x, const double &y);
703 ////////////////////////////////////////////
704 // Animation **experimental**
705 ////////////////////////////////////////////
707 QTimer *animationTimer;
710 uint animationInterval;
711 int timerId; // animation timer
712 QList<MapObj *> animObjList; // list with animated objects
715 void animate(); //!< Called by timer to animate stuff
717 void startAnimation(BranchObj *bo, const QPointF &v);
718 void startAnimation(BranchObj *bo, const QPointF &start,
719 const QPointF &dest);
720 void stopAnimation(MapObj *mo);
721 void stopAllAnimation();
723 ////////////////////////////////////////////
725 ////////////////////////////////////////////
727 /*! \brief Networking states
729 In Network modus we want to switch of saveState, autosave, ...
732 Offline, //!< Offline
733 Client, //!< I am the client and connected to server
734 Server //!< I am the server
738 // Network connections **Experimental**
739 NetState netstate; // offline, client, server
740 QTcpServer *tcpServer; // Act as server in conference mode (experimental)
741 QList<QTcpSocket *> clientList; // List of connected clients
742 quint16 sendCounter; // Increased with every sent command
744 QTcpSocket *clientSocket; // socket of this client
745 QString server; // server address of this client
746 int port; // server port of this client
749 void sendSelection();
753 void connectToServer();
757 void sendData(const QString &s);
759 void displayNetworkError(QAbstractSocket::SocketError);
762 void downloadImage(const QUrl &url, BranchItem *bi = NULL);
764 ////////////////////////////////////////////
766 ////////////////////////////////////////////
768 TreeItem *latestAddedItem; // latest added object, reset on setChanged()
769 QUuid lastToggledUuid; // Latest toggled object
770 QList<uint> selectionHistory;
771 int currentSelection;
772 bool keepSelectionHistory; // If set, selection doesn't change history
775 void updateSelection(QItemSelection, QItemSelection); // update selection
778 void setSelectionModel(QItemSelectionModel *); // Set common selectionModel
779 QItemSelectionModel *getSelectionModel();
781 void setSelectionBlocked(bool);
782 bool isSelectionBlocked();
784 bool select(const QString &); //! Select by string
785 bool selectID(const QString &); //! select by unique ID (QUuid)
786 bool select(LinkableMapObj *lmo); //! Select by pointer to LMO
787 bool selectToggle(TreeItem *ti); //! Toggle select state
788 bool selectToggle(const QString &selectString); //! Overloaded function to toggle select state
789 bool select(TreeItem *ti); //! Select by pointer to TreeItem
790 bool select(const QModelIndex &index); //! Select by ModelIndex
792 void unselect(QItemSelection desel);
794 bool canSelectPrevious();
795 bool selectPrevious();
796 bool canSelectNext();
798 void resetSelectionHistory();
799 void appendSelectionToHistory();
800 void emitShowSelection(bool scaled = false); //!< Show selection in all views
803 void showSelection(bool scaled);
806 TreeItem *lastToggledItem();
807 bool selectFirstBranch();
808 bool selectFirstChildBranch();
809 bool selectLastBranch();
810 bool selectLastChildBranch();
811 bool selectLastSelectedBranch();
812 bool selectLastImage();
813 bool selectLatestAdded();
817 TreeItem::Type selectionType();
818 LinkableMapObj *getSelectedLMO();
819 BranchObj *getSelectedBranchObj();
820 BranchItem *getSelectedBranch();
821 QList<BranchItem *> getSelectedBranches();
822 ImageItem *getSelectedImage();
823 Task *getSelectedTask();
824 XLinkItem *getSelectedXLinkItem();
825 Link *getSelectedXLink();
826 AttributeItem *getSelectedAttribute();
827 TreeItem *getSelectedItem();
828 QList<TreeItem *> getSelectedItems();
829 QModelIndex getSelectedIndex();
830 QList<uint> getSelectedIDs();
831 QStringList getSelectedUUIDs();
832 bool isSelected(TreeItem *);
833 QString getSelectString();
834 QString getSelectString(LinkableMapObj *lmo);
835 QString getSelectString(TreeItem *item);
836 QString getSelectString(BranchItem *item);
837 QString getSelectString(const uint &i);
838 void setLatestAddedItem(TreeItem *ti);
839 TreeItem *getLatestAddedItem();
842 void selectionChanged(const QItemSelection &newsel,
843 const QItemSelection &oldsel);
846 void emitSelectionChanged(const QItemSelection &oldsel);
847 void emitSelectionChanged();
848 void selectMapLinkColor();
849 void selectMapSelectionColor();
852 QItemSelectionModel *selModel;
853 QString lastSelectString;
854 bool selectionBlocked; //! Used to block changes of selection while editing
858 void setSelectionPenColor(QColor);
859 QColor getSelectionPenColor();
860 void setSelectionPenWidth(qreal);
861 qreal getSelectionPenWidth();
862 void setSelectionBrushColor(QColor);
863 QColor getSelectionBrushColor();
865 ////////////////////////////////////////////
866 // Iterating and selecting branches
867 ////////////////////////////////////////////
869 bool initIterator(const QString &iname,
870 bool deepLevelsFirst = false); //! Named iterator
871 bool nextIterator(const QString &iname); //! Select next iterator
873 QHash<QString, QUuid> selIterCur;
874 QHash<QString, QUuid> selIterPrev;
875 QHash<QString, QUuid> selIterStart;
876 QHash<QString, bool> selIterActive;
878 ////////////////////////////////////////////
880 ////////////////////////////////////////////
882 SlideModel *getSlideModel();
884 SlideItem *addSlide();
885 void deleteSlide(SlideItem *si);
886 void deleteSlide(int n);
887 void relinkSlide(SlideItem *si, int pos);
888 bool moveSlideDown(int n = -1);
889 bool moveSlideUp(int n = -1);
890 SlideItem *findSlideID(uint id);
892 void updateSlideSelection(QItemSelection, QItemSelection);
895 SlideModel *slideModel;
896 bool blockSlideSelection;