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