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