annotate mainwindow.h @ 109:1721c580c10e

* Add a queueing mechanism for Hg actions, instead of refusing to start an action if something else is already happening. This is essential now that actions can be prompted by asynchronous events (e.g. filesystem watcher). * Make Revert behave sensibly
author Chris Cannam
date Fri, 26 Nov 2010 12:48:29 +0000
parents 8ae3b44c0073
children 4bd17f36d059
rev   line source
Chris@57 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@57 2
Chris@57 3 /*
Chris@57 4 EasyMercurial
Chris@57 5
Chris@98 6 Based on hgExplorer by Jari Korhonen
Chris@57 7 Copyright (c) 2010 Jari Korhonen
Chris@57 8 Copyright (c) 2010 Chris Cannam
Chris@57 9 Copyright (c) 2010 Queen Mary, University of London
Chris@57 10
Chris@57 11 This program is free software; you can redistribute it and/or
Chris@57 12 modify it under the terms of the GNU General Public License as
Chris@57 13 published by the Free Software Foundation; either version 2 of the
Chris@57 14 License, or (at your option) any later version. See the file
Chris@57 15 COPYING included with this distribution for more information.
Chris@57 16 */
jtkorhonen@0 17
jtkorhonen@0 18 #ifndef MAINWINDOW_H
jtkorhonen@0 19 #define MAINWINDOW_H
jtkorhonen@0 20
Chris@96 21 #include "hgtabwidget.h"
jtkorhonen@0 22 #include "hgrunner.h"
jtkorhonen@0 23 #include "common.h"
Chris@106 24 #include "changeset.h"
Chris@109 25 #include "hgaction.h"
jtkorhonen@0 26
Chris@50 27 #include <QMainWindow>
Chris@50 28 #include <QListWidget>
Chris@90 29 #include <QFileSystemWatcher>
Chris@50 30
jtkorhonen@0 31 QT_BEGIN_NAMESPACE
jtkorhonen@0 32 class QAction;
jtkorhonen@0 33 class QMenu;
jtkorhonen@0 34 QT_END_NAMESPACE
jtkorhonen@0 35
jtkorhonen@0 36 class MainWindow : public QMainWindow
jtkorhonen@0 37 {
jtkorhonen@0 38 Q_OBJECT
jtkorhonen@0 39
jtkorhonen@0 40 public:
jtkorhonen@0 41 MainWindow();
Chris@98 42 HgTabWidget *hgTabs;
jtkorhonen@0 43 void writeSettings();
jtkorhonen@0 44
jtkorhonen@0 45 //Paths to remote repo & workfolder
jtkorhonen@0 46 //Local repo is directory "./hg/" under work folder
jtkorhonen@0 47 QString remoteRepoPath;
jtkorhonen@0 48 QString workFolderPath;
Chris@106 49 QString currentBranch;
Chris@106 50 Changesets currentHeads;
Chris@108 51 Changesets currentParents;
jtkorhonen@0 52
jtkorhonen@0 53 protected:
jtkorhonen@0 54 void closeEvent(QCloseEvent *event);
jtkorhonen@0 55
jtkorhonen@0 56 public slots:
Chris@109 57 void hgQueryPaths();
jtkorhonen@0 58 void hgStat();
Chris@109 59 // void tabChanged(int currTab);
Chris@109 60 void commandCompleted(HgAction action, QString stdout);
Chris@109 61 void commandFailed(HgAction action, QString stdout);
Chris@95 62 void enableDisableActions();
jtkorhonen@0 63
jtkorhonen@0 64 private slots:
jtkorhonen@0 65 void about();
Chris@64 66 void settings();
Chris@69 67 void open();
Chris@64 68 void startupDialog();
Chris@94 69 void clearSelections();
Chris@64 70
jtkorhonen@0 71 void hgRemove();
jtkorhonen@0 72 void hgAdd();
jtkorhonen@0 73 void hgCommit();
jtkorhonen@0 74 void hgFileDiff();
jtkorhonen@0 75 void hgFolderDiff();
jtkorhonen@0 76 void hgChgSetDiff();
jtkorhonen@0 77 void hgUpdate();
jtkorhonen@0 78 void hgRevert();
jtkorhonen@0 79 void hgMerge();
jtkorhonen@33 80 void hgRetryMerge();
jtkorhonen@0 81 void hgCloneFromRemote();
jtkorhonen@0 82 void hgInit();
jtkorhonen@0 83 void hgIncoming();
jtkorhonen@0 84 void hgPush();
jtkorhonen@0 85 void hgPull();
jtkorhonen@0 86 void hgUpdateToRev();
jtkorhonen@0 87 void hgAnnotate();
jtkorhonen@0 88 void hgResolveList();
jtkorhonen@0 89 void hgResolveMark();
jtkorhonen@34 90 void hgTag();
jtkorhonen@11 91 void hgServe();
jtkorhonen@34 92 void hgIgnore();
jtkorhonen@0 93
Chris@90 94 void fsDirectoryChanged(QString);
Chris@90 95 void fsFileChanged(QString);
Chris@90 96
jtkorhonen@0 97 private:
Chris@109 98 void hgQueryBranch();
Chris@109 99 void hgQueryHeads();
Chris@109 100 void hgQueryParents();
jtkorhonen@0 101 void hgLog();
jtkorhonen@0 102 void createActions();
jtkorhonen@0 103 void connectActions();
jtkorhonen@0 104 void createMenus();
jtkorhonen@0 105 void createToolBars();
jtkorhonen@0 106 void createStatusBar();
jtkorhonen@0 107 void readSettings();
jtkorhonen@0 108 void splitChangeSets(QStringList *list, QString hgLogOutput);
jtkorhonen@2 109 void presentLongStdoutToUser(QString stdo);
Chris@95 110
jtkorhonen@28 111 QString listAllUpIpV4Addresses();
jtkorhonen@34 112 QString filterTag(QString tag);
jtkorhonen@0 113
Chris@64 114 QString getUserInfo() const;
Chris@64 115
Chris@79 116 bool openLocal(QString);
Chris@79 117 bool openRemote(QString, QString);
Chris@79 118 bool openInit(QString);
Chris@79 119
Chris@79 120 bool complainAboutFilePath(QString);
Chris@79 121 bool complainAboutUnknownFolder(QString);
Chris@84 122 bool complainAboutInitInRepo(QString);
Chris@84 123 bool complainAboutInitFile(QString);
Chris@84 124 bool complainAboutCloneToExisting(QString);
Chris@84 125 bool complainAboutCloneToFile(QString);
Chris@84 126 bool complainAboutCloneToExistingFolder(QString); //!!! not sure about this one
Chris@84 127
Chris@79 128 bool askToInitExisting(QString);
Chris@79 129 bool askToInitNew(QString);
Chris@79 130 bool askToOpenParentRepo(QString, QString);
Chris@84 131 bool askToOpenInsteadOfInit(QString);
Chris@79 132
Chris@90 133 void updateFileSystemWatcher();
Chris@90 134
Chris@64 135 bool firstStart;
Chris@64 136
jtkorhonen@0 137 //Actions enabled flags
jtkorhonen@0 138 bool remoteRepoActionsEnabled;
jtkorhonen@0 139 bool localRepoActionsEnabled;
jtkorhonen@0 140
jtkorhonen@0 141 //File menu actions
jtkorhonen@0 142 QAction *hgInitAct;
jtkorhonen@0 143 QAction *hgCloneFromRemoteAct;
Chris@69 144 QAction *openAct;
jtkorhonen@0 145 QAction *settingsAct;
jtkorhonen@0 146 QAction *exitAct;
jtkorhonen@0 147
jtkorhonen@33 148 //Repo actions
jtkorhonen@0 149 QAction *hgIncomingAct;
jtkorhonen@0 150 QAction *hgPushAct;
jtkorhonen@0 151 QAction *hgPullAct;
jtkorhonen@0 152 QAction *hgStatAct;
jtkorhonen@0 153 QAction *hgFileDiffAct;
jtkorhonen@0 154 QAction *hgFolderDiffAct;
jtkorhonen@0 155 QAction *hgChgSetDiffAct;
jtkorhonen@0 156 QAction *hgRevertAct;
jtkorhonen@0 157 QAction *hgAddAct;
jtkorhonen@0 158 QAction *hgRemoveAct;
jtkorhonen@0 159 QAction *hgUpdateAct;
jtkorhonen@0 160 QAction *hgCommitAct;
jtkorhonen@0 161 QAction *hgMergeAct;
jtkorhonen@33 162 QAction *hgRetryMergeAct;
jtkorhonen@0 163 QAction *hgUpdateToRevAct;
jtkorhonen@0 164 QAction *hgAnnotateAct;
jtkorhonen@0 165 QAction *hgResolveListAct;
jtkorhonen@0 166 QAction *hgResolveMarkAct;
jtkorhonen@34 167 QAction *hgTagAct;
jtkorhonen@34 168 QAction *hgIgnoreAct;
jtkorhonen@11 169 QAction *hgServeAct;
jtkorhonen@0 170
jtkorhonen@0 171 //Menus
jtkorhonen@0 172 QMenu *fileMenu;
jtkorhonen@0 173 QMenu *advancedMenu;
jtkorhonen@0 174 QMenu *helpMenu;
jtkorhonen@0 175
jtkorhonen@0 176 //Help menu actions
jtkorhonen@0 177 QAction *aboutAct;
jtkorhonen@0 178 QAction *aboutQtAct;
jtkorhonen@0 179
Chris@94 180 // Other actions
Chris@94 181 QAction *clearSelectionsAct;
Chris@94 182
jtkorhonen@0 183 QToolBar *fileToolBar;
jtkorhonen@0 184 QToolBar *repoToolBar;
jtkorhonen@0 185 QToolBar *workFolderToolBar;
jtkorhonen@0 186
Chris@109 187 HgRunner *runner;
jtkorhonen@0 188
Chris@90 189 QFileSystemWatcher *fsWatcher;
Chris@90 190
Chris@109 191 // int tabPage;
Chris@109 192 // unsigned char initialFileTypesBits;
jtkorhonen@33 193 bool justMerged;
jtkorhonen@0 194 };
jtkorhonen@0 195
jtkorhonen@0 196 #endif