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