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