mainwindow.h
author insilmaril
Thu, 01 Oct 2009 11:28:50 +0000
changeset 798 d251c7b2de54
parent 795 6b0a5f4923d3
child 804 14f2b1b15242
permissions -rw-r--r--
Various fixes for relinking and selecting
     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 editMapInfo();
   145     void editMoveUp();	
   146     void editMoveDown();	
   147     void editDetach();	
   148 	void editSortChildren();
   149     void editToggleScroll();
   150     void editExpandAll();
   151     void editUnscrollChildren();
   152     void editAddAttribute();
   153     void editAddMapCenter();
   154     void editNewBranch();
   155     void editNewBranchBefore();
   156     void editNewBranchAbove();
   157     void editNewBranchBelow();
   158     void editImportAdd();
   159     void editImportReplace();
   160     void editSaveBranch();
   161     void editDeleteKeepChildren();
   162     void editDeleteChildren();
   163     void editDeleteSelection();
   164     void editLoadImage();
   165     void editSaveImage();
   166     void editFollowXLink (QAction *);
   167     void editEditXLink (QAction *);
   168 
   169     void formatSelectColor();
   170     void formatPickColor();
   171     void colorChanged(QColor);
   172     void formatColorBranch();
   173     void formatColorSubtree();
   174 	void formatLinkStyleLine();
   175 	void formatLinkStyleParabel();
   176 	void formatLinkStylePolyLine();
   177 	void formatLinkStylePolyParabel();
   178     void formatSelectBackColor();
   179     void formatSelectBackImage();
   180     void formatSelectLinkColor();
   181     void formatSelectSelectionColor();
   182     void formatToggleLinkColorHint();
   183 	void formatHideLinkUnselected();
   184 
   185     void viewZoomReset();
   186     void viewZoomIn();
   187     void viewZoomOut();
   188     void viewCenter();
   189 
   190 public slots:
   191 	void networkStartServer();
   192 	void networkConnect();
   193 	bool settingsPDF();
   194 	bool settingsURL();
   195 	void settingsMacroDir();
   196 	void settingsToggleDelKey();
   197 	void settingsUndoLevels();
   198 	void settingsAutosaveToggle();
   199 	void settingsAutosaveTime();
   200 	void settingsWriteBackupFileToggle();
   201 	void settingsToggleAnimation();
   202 
   203 	void windowToggleNoteEditor();
   204 	void windowToggleHistory();
   205 	void windowToggleProperty();
   206 	void updateHistory(SimpleSettings &);
   207 	void windowToggleAntiAlias();
   208 public:
   209 	bool isAliased();
   210 	bool hasSmoothPixmapTransform();
   211 public slots:
   212 	void windowToggleSmoothPixmap();
   213 	void updateNoteFlag();
   214 	void updateNoteEditor (QModelIndex index);
   215 	void changeSelection (VymModel *model,const QItemSelection &newSel, const QItemSelection &delSel);
   216 
   217 	void updateActions();
   218 	ModMode getModMode();
   219 	bool autoEditNewBranch();
   220 	bool autoSelectNewBranch();
   221 	void setScript(const QString &);
   222 	void runScript(const QString &);
   223 	void runScriptEverywhere (const QString &);
   224 
   225 private slots:
   226 	void windowNextEditor();
   227 	void windowPreviousEditor();
   228 	void windowShowNoteEditor();
   229 	void windowHideNoteEditor();
   230 
   231 	void standardFlagChanged();
   232 
   233     void testFunction1();
   234     void testFunction2();
   235     void testCommand();
   236 
   237     void helpDoc();
   238     void helpDemo();
   239     void helpAbout();
   240     void helpAboutQT();
   241 
   242 	void callMacro ();
   243 
   244 private:
   245 	QTabWidget *tabWidget;
   246 	FindWindow *findWindow;
   247 	QProcess *procBrowser;
   248 
   249 	QStringList imageTypes;
   250 
   251 	QList <VymView*> vymViews;		//! Keeps track of models and views related to a tab 
   252 	QString prevSelection;
   253 
   254 	HistoryWindow *historyWindow;
   255 
   256 	BranchPropertyWindow *branchPropertyWindow;
   257 	SimpleScriptEditor *scriptEditor;
   258 
   259 	QList <QAction*> actionListBranches;
   260 
   261 	QColor currentColor;
   262 
   263 	int xLinkMenuWidth;
   264 
   265 	QMenu *recentFilesMenu;
   266 	enum { MaxRecentFiles = 9 };
   267     QAction *recentFileActions[MaxRecentFiles];
   268 
   269     QAction *macroActions[12];
   270 	QStringList macro;
   271 
   272 	QAction* actionFileNewCopy;
   273 	QAction* actionFileSave;
   274 	QAction* actionFilePrint;
   275 	QAction* actionUndo;
   276 	QAction* actionRedo;
   277 	QAction *actionCopy;
   278 	QAction *actionCut;
   279 	QAction *actionPaste;
   280 	QAction *actionMoveUp;
   281 	QAction *actionMoveDown;
   282 	QAction *actionDetach;
   283 	QAction *actionSortChildren;
   284 	QAction *actionToggleScroll;
   285 	QAction *actionExpandAll;
   286 	QAction* actionOpenURL;
   287 	QAction* actionOpenURLTab;
   288 	QAction* actionOpenMultipleURLTabs;
   289 	QAction* actionURL;
   290 	QAction* actionLocalURL;
   291 	QAction* actionHeading2URL;
   292 	QAction* actionBugzilla2URL;
   293 	QAction* actionFATE2URL;
   294 	QAction *actionOpenVymLink;
   295 	QAction *actionOpenMultipleVymLinks;
   296 	QAction *actionVymLink;
   297 	QAction *actionDeleteVymLink;
   298 	QAction *actionToggleHideExport;
   299 	QAction *actionMapInfo;
   300 	QAction *actionHeading;
   301 	QAction *actionDelete;
   302 	QAction *actionAddAttribute;
   303 public:
   304 	QAction *actionAddMapCenter;
   305 
   306 private:	
   307 	QAction *actionAddBranch;
   308 	QAction *actionAddBranchBefore;
   309 	QAction *actionAddBranchAbove;
   310 	QAction *actionAddBranchBelow;
   311 	QAction *actionDeleteKeepChildren;
   312 	QAction *actionDeleteChildren;
   313 	QAction *actionImportAdd;
   314 	QAction *actionImportReplace;
   315 	QAction *actionSaveBranch;
   316 	QAction *actionLoadImage;
   317 
   318 	QAction* actionFormatColor;
   319 	QAction* actionFormatPickColor;
   320 	QAction* actionFormatColorBranch;
   321 	QAction* actionFormatColorSubtree;
   322 	QAction* actionFormatLinkColorHint;
   323 	QAction* actionFormatBackColor;
   324 	QAction* actionFormatBackImage;
   325 	QAction* actionFormatLinkColor;
   326 	QAction* actionFormatSelectionColor;
   327 
   328 	QActionGroup* actionGroupModModes;
   329 	QAction* actionModModeColor;
   330 	QAction* actionModModeXLink;
   331 	QAction* actionModModeCopy;
   332 
   333 	QActionGroup *actionGroupFormatFrameTypes;
   334 
   335 
   336 	QActionGroup *actionGroupFormatLinkStyles;
   337 	QAction *actionFormatLinkStyleLine;
   338 	QAction *actionFormatLinkStyleParabel;
   339 	QAction *actionFormatLinkStylePolyLine;
   340 	QAction *actionFormatLinkStylePolyParabel;
   341 	QAction *actionFormatHideLinkUnselected;
   342 
   343 	QAction *actionViewToggleNoteEditor;
   344 	QAction *actionViewToggleHistoryWindow;
   345 	QAction *actionViewTogglePropertyWindow;
   346 	QAction *actionViewToggleAntiAlias;
   347 	QAction *actionViewToggleSmoothPixmapTransform;
   348 	QAction* actionViewCenter;
   349 
   350 	QAction* actionSettingsAutoEditNewBranch;
   351 	QAction* actionSettingsAutoSelectNewBranch;
   352 	QAction* actionSettingsAutoSelectText;
   353 	QAction* actionSettingsUseDelKey;
   354 	QAction* actionSettingsUseFlagGroups;
   355 	QAction* actionSettingsUseHideExport;
   356 	QAction* actionSettingsAutosaveToggle;
   357 	QAction* actionSettingsAutosaveTime;
   358 	QAction* actionSettingsWriteBackupFile;
   359 	QAction* actionSettingsUseAnimation;
   360 };
   361 
   362 
   363 #endif
   364