mainwindow.h
author insilmaril
Fri, 13 Nov 2009 08:32:03 +0000
changeset 804 14f2b1b15242
parent 795 6b0a5f4923d3
child 807 f9f7922989d8
permissions -rw-r--r--
Several fixes, see tex/vym.changelog for details
     1 #ifndef MAINWINDOW_H 
     2 #define MAINWINDOW_H
     3 
     4 #include <QMainWindow>
     5 #include <QtDBus>
     6 
     7 
     8 #include "branchpropwindow.h"
     9 #include "extrainfodialog.h"
    10 #include "flag.h"
    11 #include "file.h"
    12 #include "findwindow.h"
    13 #include "historywindow.h"
    14 #include "mapeditor.h"
    15 #include "simplescripteditor.h"
    16 #include "texteditor.h"
    17 #include "vymview.h"
    18 
    19 
    20 class Main : public QMainWindow 
    21 {
    22     Q_OBJECT
    23 
    24 public:
    25 	/*! Modifier modes are used when CTRL together with a mouse button is pressed */
    26 	enum ModMode {
    27 		ModModeNone,	//!< Unused
    28 		ModModeColor,	//!< Pick color from object
    29 		ModModeCopy,	//!< Copy object
    30 		ModModeXLink	//!< Create a XLink (XLinkObj) from selected object
    31 		};
    32 
    33     Main(QWidget* parent=0, const char* name=0, Qt::WFlags f=0);
    34     ~Main();
    35 	void loadCmdLine();
    36 
    37 private:
    38 	QProgressBar *progressBar;
    39 	int progressMax;
    40 	int progressMin;
    41 public:	
    42 	void statusMessage (const QString &);
    43 	void setProgressMinimum (int min);
    44 	void setProgressMaximum (int max);
    45 	void setProgressValue (int v);
    46 	void removeProgressBar();
    47 
    48 public slots:
    49     void fileNew();
    50     void fileNewCopy();
    51 
    52 protected:
    53 	void closeEvent( QCloseEvent* );
    54 
    55 private:
    56     void setupFileActions();
    57     void setupEditActions();
    58     void setupFormatActions();
    59     void setupViewActions();
    60     void setupModeActions();
    61     void setupWindowActions();
    62     void setupFlag(Flag *flag, QToolBar *tb, const QString &name, const QString &tooltip);
    63     void setupFlagActions();
    64     void setupNetworkActions();
    65     void setupSettingsActions();
    66     void setupTestActions();
    67     void setupHelpActions();
    68     void setupContextMenus();
    69 	void setupRecentMapsMenu();
    70     void setupMacros();
    71 	void hideEvent (QHideEvent * );
    72 	void showEvent (QShowEvent * );
    73 	MapEditor* currentMapEditor() const;
    74 	VymModel* currentModel() const;
    75     
    76 private slots:
    77 	void editorChanged(QWidget*);
    78 
    79     ErrorCode fileLoad(QString ,const LoadMode &, const FileType & ftype=VymMap);
    80     void fileLoad(const LoadMode &);
    81     void fileLoad();
    82 	void fileLoadRecent();
    83 	void addRecentMap (const QString &);
    84     void fileSave(VymModel*, const SaveMode & );
    85     void fileSave();
    86 public slots:	
    87     void fileSave(VymModel*);	// autosave from MapEditor
    88 private slots:	
    89     void fileSaveAs(const SaveMode &);
    90     void fileSaveAs();
    91     void fileImportKDE3Bookmarks();
    92     void fileImportKDE4Bookmarks();
    93     void fileImportFirefoxBookmarks();
    94     void fileImportFreemind();
    95     void fileImportMM();
    96     void fileImportDir();
    97     void fileExportXML();
    98     void fileExportXHTML();
    99     void fileExportImage();
   100     void fileExportASCII();
   101     void fileExportCSV();
   102     void fileExportLaTeX();
   103     void fileExportKDE3Bookmarks();
   104     void fileExportKDE4Bookmarks();
   105     void fileExportTaskjuggler();
   106     void fileExportOOPresentation();
   107     void fileCloseMap();
   108     void filePrint();
   109     void fileExitVYM();
   110 
   111 public slots:
   112     void editUndo();	
   113     void editRedo();	
   114 	void gotoHistoryStep (int);
   115 private slots:	
   116     void editCopy();	
   117     void editPaste();	
   118     void editCut();	
   119     void editOpenFindWindow();
   120 	void editFind(QString);
   121 	void editFindChanged();
   122 private:
   123 	void openTabs(QStringList);
   124 public slots:
   125 	void editOpenURL();
   126 	void editOpenURLTab();
   127 private slots:
   128 	void editOpenMultipleURLTabs();
   129 	void editURL();
   130 	void editLocalURL();
   131 	void editHeading2URL();
   132 	void editBugzilla2URL();
   133 	void editFATE2URL();
   134 	void openVymLinks(const QStringList &);
   135 	void editVymLink();
   136 	void editOpenMultipleVymLinks();
   137 public slots:
   138     void editHeadingFinished(VymModel *m);
   139 //    void editHeading();
   140 	void editOpenVymLink();
   141 private slots:
   142 	void editDeleteVymLink();
   143 	void editToggleHideExport();
   144 	void editAddTimestamp();
   145 	void editMapInfo();
   146     void editMoveUp();	
   147     void editMoveDown();	
   148     void editDetach();	
   149 	void editSortChildren();
   150     void editToggleScroll();
   151     void editExpandAll();
   152     void editExpandOneLevel();
   153     void editCollapseOneLevel();
   154     void editUnscrollChildren();
   155     void editAddAttribute();
   156     void editAddMapCenter();
   157     void editNewBranch();
   158     void editNewBranchBefore();
   159     void editNewBranchAbove();
   160     void editNewBranchBelow();
   161     void editImportAdd();
   162     void editImportReplace();
   163     void editSaveBranch();
   164     void editDeleteKeepChildren();
   165     void editDeleteChildren();
   166     void editDeleteSelection();
   167     void editLoadImage();
   168     void editSaveImage();
   169     void editFollowXLink (QAction *);
   170     void editEditXLink (QAction *);
   171 
   172     void formatSelectColor();
   173     void formatPickColor();
   174     void colorChanged(QColor);
   175     void formatColorBranch();
   176     void formatColorSubtree();
   177 	void formatLinkStyleLine();
   178 	void formatLinkStyleParabel();
   179 	void formatLinkStylePolyLine();
   180 	void formatLinkStylePolyParabel();
   181     void formatSelectBackColor();
   182     void formatSelectBackImage();
   183     void formatSelectLinkColor();
   184     void formatSelectSelectionColor();
   185     void formatToggleLinkColorHint();
   186 	void formatHideLinkUnselected();
   187 
   188 public slots:
   189     void viewZoomReset();
   190     void viewZoomIn();
   191     void viewZoomOut();
   192     void viewCenter();
   193 
   194 public slots:
   195 	void networkStartServer();
   196 	void networkConnect();
   197 	bool settingsPDF();
   198 	bool settingsURL();
   199 	void settingsMacroDir();
   200 	void settingsToggleDelKey();
   201 	void settingsUndoLevels();
   202 	void settingsAutosaveToggle();
   203 	void settingsAutosaveTime();
   204 	void settingsWriteBackupFileToggle();
   205 	void settingsToggleAnimation();
   206 
   207 	void windowToggleNoteEditor();
   208 	void windowToggleHistory();
   209 	void windowToggleProperty();
   210 	void updateHistory(SimpleSettings &);
   211 	void windowToggleAntiAlias();
   212 public:
   213 	bool isAliased();
   214 	bool hasSmoothPixmapTransform();
   215 public slots:
   216 	void windowToggleSmoothPixmap();
   217 	void updateNoteFlag();
   218 	void updateNoteEditor (QModelIndex index);
   219 	void changeSelection (VymModel *model,const QItemSelection &newSel, const QItemSelection &delSel);
   220 
   221 	void updateActions();
   222 	ModMode getModMode();
   223 	bool autoEditNewBranch();
   224 	bool autoSelectNewBranch();
   225 	void setScript(const QString &);
   226 	void runScript(const QString &);
   227 	void runScriptEverywhere (const QString &);
   228 
   229 private slots:
   230 	void windowNextEditor();
   231 	void windowPreviousEditor();
   232 	void windowShowNoteEditor();
   233 	void windowHideNoteEditor();
   234 
   235 	void standardFlagChanged();
   236 
   237     void testFunction1();
   238     void testFunction2();
   239     void testCommand();
   240 
   241     void helpDoc();
   242     void helpDemo();
   243     void helpAbout();
   244     void helpAboutQT();
   245 
   246 	void callMacro ();
   247 
   248 private:
   249 	QTabWidget *tabWidget;
   250 	FindWindow *findWindow;
   251 	QProcess *procBrowser;		//FIXME-2 remove this...
   252 	qint64 *browserPID;
   253 
   254 	QStringList imageTypes;
   255 
   256 	QList <VymView*> vymViews;		//! Keeps track of models and views related to a tab 
   257 	QString prevSelection;
   258 
   259 	HistoryWindow *historyWindow;
   260 
   261 	BranchPropertyWindow *branchPropertyWindow;
   262 	SimpleScriptEditor *scriptEditor;
   263 
   264 	QList <QAction*> actionListBranches;
   265 
   266 	QColor currentColor;
   267 
   268 	int xLinkMenuWidth;
   269 
   270 	QMenu *recentFilesMenu;
   271 	enum { MaxRecentFiles = 9 };
   272     QAction *recentFileActions[MaxRecentFiles];
   273 
   274     QAction *macroActions[12];
   275 	QStringList macro;
   276 
   277 	QAction* actionFileNewCopy;
   278 	QAction* actionFileSave;
   279 	QAction* actionFilePrint;
   280 	QAction* actionUndo;
   281 	QAction* actionRedo;
   282 	QAction *actionCopy;
   283 	QAction *actionCut;
   284 	QAction *actionPaste;
   285 	QAction *actionMoveUp;
   286 	QAction *actionMoveDown;
   287 	QAction *actionDetach;
   288 	QAction *actionSortChildren;
   289 	QAction *actionToggleScroll;
   290 	QAction *actionExpandAll;
   291 	QAction *actionExpandOneLevel;
   292 	QAction *actionCollapseOneLevel;
   293 	QAction* actionOpenURL;
   294 	QAction* actionOpenURLTab;
   295 	QAction* actionOpenMultipleURLTabs;
   296 	QAction* actionURL;
   297 	QAction* actionLocalURL;
   298 	QAction* actionHeading2URL;
   299 	QAction* actionBugzilla2URL;
   300 	QAction* actionFATE2URL;
   301 	QAction *actionOpenVymLink;
   302 	QAction *actionOpenMultipleVymLinks;
   303 	QAction *actionVymLink;
   304 	QAction *actionDeleteVymLink;
   305 	QAction *actionAddTimestamp;
   306 	QAction *actionToggleHideExport;
   307 	QAction *actionMapInfo;
   308 	QAction *actionHeading;
   309 	QAction *actionDelete;
   310 	QAction *actionAddAttribute;
   311 public:
   312 	QAction *actionAddMapCenter;
   313 
   314 private:	
   315 	QAction *actionAddBranch;
   316 	QAction *actionAddBranchBefore;
   317 	QAction *actionAddBranchAbove;
   318 	QAction *actionAddBranchBelow;
   319 	QAction *actionDeleteKeepChildren;
   320 	QAction *actionDeleteChildren;
   321 	QAction *actionImportAdd;
   322 	QAction *actionImportReplace;
   323 	QAction *actionSaveBranch;
   324 	QAction *actionLoadImage;
   325 
   326 	QAction* actionFormatColor;
   327 	QAction* actionFormatPickColor;
   328 	QAction* actionFormatColorBranch;
   329 	QAction* actionFormatColorSubtree;
   330 	QAction* actionFormatLinkColorHint;
   331 	QAction* actionFormatBackColor;
   332 	QAction* actionFormatBackImage;
   333 	QAction* actionFormatLinkColor;
   334 	QAction* actionFormatSelectionColor;
   335 
   336 	QActionGroup* actionGroupModModes;
   337 	QAction* actionModModeColor;
   338 	QAction* actionModModeXLink;
   339 	QAction* actionModModeCopy;
   340 
   341 	QActionGroup *actionGroupFormatFrameTypes;
   342 
   343 
   344 	QActionGroup *actionGroupFormatLinkStyles;
   345 	QAction *actionFormatLinkStyleLine;
   346 	QAction *actionFormatLinkStyleParabel;
   347 	QAction *actionFormatLinkStylePolyLine;
   348 	QAction *actionFormatLinkStylePolyParabel;
   349 	QAction *actionFormatHideLinkUnselected;
   350 
   351 	QAction *actionViewToggleNoteEditor;
   352 	QAction *actionViewToggleHistoryWindow;
   353 	QAction *actionViewTogglePropertyWindow;
   354 	QAction *actionViewToggleAntiAlias;
   355 	QAction *actionViewToggleSmoothPixmapTransform;
   356 	QAction* actionViewCenter;
   357 
   358 	QAction* actionSettingsAutoEditNewBranch;
   359 	QAction* actionSettingsAutoSelectNewBranch;
   360 	QAction* actionSettingsAutoSelectText;
   361 	QAction* actionSettingsUseDelKey;
   362 	QAction* actionSettingsUseFlagGroups;
   363 	QAction* actionSettingsUseHideExport;
   364 	QAction* actionSettingsAutosaveToggle;
   365 	QAction* actionSettingsAutosaveTime;
   366 	QAction* actionSettingsWriteBackupFile;
   367 	QAction* actionSettingsUseAnimation;
   368 };
   369 
   370 
   371 #endif
   372