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